CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Problems to use: DOMAIN_RES, DOMAIN_RES_SCALE and DOMAIN_EQN_LABEL

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 21, 2018, 10:51
Default Problems to use: DOMAIN_RES, DOMAIN_RES_SCALE and DOMAIN_EQN_LABEL
  #1
New Member
 
DS
Join Date: May 2016
Posts: 28
Rep Power: 10
denis.sanga@hotmail.it is on a distinguished road
Goodmorning,
I'm trying to write an UDF able to read the residual values with the simple extract of code found online:
HTML Code:
...
for (nw=0; nw<MAX_EQNS; ++nw)
{
if (strlen(DOMAIN_EQN_LABEL(domain,nw))>0)
{
Message0("eq %s: %g\n", DOMAIN_EQN_LABEL(domain,nw), DOMAIN_RES(domain,nw)/DOMAIN_RES_SCALE(domain,nw));
}
}
...
When I compare the results printed in the log file from fluent and the residuals printed by udf there are many mistakes: in particular seems that the position "nw" of the residual label in the DOMAIN_EQN_LABEL(domain,nw) list is not the same of the corresponding residual number in the DOMAIN_RES(domain,nw)/DOMAIN_RES_SCALE(domain,nw) list.

For a simple case I obtain something like this:
nw=0 --> DOMAIN_EQN_LABEL=continuity; DOMAIN_RES=correspond to continuity as expected
nw=1 --> DOMAIN_EQN_LABEL=nothing; DOMAIN_RES=correspond to x_velocity
nw=2 --> DOMAIN_EQN_LABEL=x-velocity; DOMAIN_RES=correspond to y_velocity
nw=3 --> DOMAIN_EQN_LABEL=y-velocity;DOMAIN_RES=correspond to z_velocity
nw=4 --> DOMAIN_EQN_LABEL=z-velocity; DOMAIN_RES=correspond to k
nw=5 --> DOMAIN_EQN_LABEL=energy; DOMAIN_RES=correspond to omega
nw=6 --> DOMAIN_EQN_LABEL=nothing; DOMAIN_RES=correspond to energy
...
nw=8 --> DOMAIN_EQN_LABEL=k; DOMAIN_RES=-nan
nw=12 --> DOMAIN_EQN_LABEL=omega; DOMAIN_RES=inf


Can someone help me to understand how to read the correct residual number associated with the correct quantity?

Thank you very very much
Best regards
DS
denis.sanga@hotmail.it is offline   Reply With Quote

Old   August 22, 2018, 03:04
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I don't know the reason of such behavior of these macros.
But what I can suggest is:
you have both names of equations that you are interested in and you have names of residuals which are under other nw pointer.
So you may make a loop through the list of residual names and check whether the name is equal to the name you expected, or not.
So you will create our own order in the list, which corresponds to equation list.

hope, my idea is clear
best regards
AlexanderZ is offline   Reply With Quote

Old   August 22, 2018, 03:08
Default
  #3
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
The index for the residuals is continuous whereas the index for the labels is not. You have to use the mapping to get the correct index for labels. The code below is for your reference.
Code:
DEFINE_ADJUST(res_list,domain)
{
    int eqn, cmpt, nw;
    real scaled_res;

    Message("Residuals for iteration %g\n",count2[nres-1]);
    for (eqn = 0; eqn < DOMAIN_NUMEQN(domain); ++eqn) {
        nw = DOMAIN_EQNS(domain, eqn);
        if(strlen(DOMAIN_EQN_LABEL(domain,nw))>0)
        {
            Message("[%d] %s equation:", nw, DOMAIN_EQN_LABEL(domain,nw));
            scaled_res = DOMAIN_RES(domain,eqn)/DOMAIN_RES_SCALE(domain,eqn);
            Message("%g\n", scaled_res);
        }
    }
}
blackmask is offline   Reply With Quote

Old   August 22, 2018, 03:25
Default many thanks
  #4
New Member
 
DS
Join Date: May 2016
Posts: 28
Rep Power: 10
denis.sanga@hotmail.it is on a distinguished road
Thank you all very very much. I just tried with a simple case the blackmask suggestions and works. I will try with more complex cases.

Thank you all really much
DS
denis.sanga@hotmail.it is offline   Reply With Quote

Reply

Tags
domain_res udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] Problems with coedge curves and surfaces tommymoose ANSYS Meshing & Geometry 6 December 1, 2020 12:12
[mesh manipulation] Problems with rotational cyclic boundaries TReviol OpenFOAM Meshing & Mesh Conversion 8 July 11, 2014 04:45
[ICEM] Flow channel meshing problems StefanG ANSYS Meshing & Geometry 19 May 15, 2012 07:44
Two-phase air water flow problems by activating Wall Lubrication Force challenger85 CFX 5 November 5, 2009 06:44
Help required to solve Hydraulic related problems aero CFX 0 October 30, 2006 12:00


All times are GMT -4. The time now is 11:08.