|
[Sponsors] |
Problems to use: DOMAIN_RES, DOMAIN_RES_SCALE and DOMAIN_EQN_LABEL |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 21, 2018, 10:51 |
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 |
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));
}
}
...
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 |
|
August 22, 2018, 03:04 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
August 22, 2018, 03:08 |
|
#3 |
Senior Member
|
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); } } } |
|
August 22, 2018, 03:25 |
many thanks
|
#4 |
New Member
DS
Join Date: May 2016
Posts: 28
Rep Power: 10 |
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 |
|
Tags |
domain_res udf |
|
|
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 |