CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF to access only one phase in mixture domain (https://www.cfd-online.com/Forums/fluent-udf/228519-udf-access-only-one-phase-mixture-domain.html)

arunraj July 4, 2020 04:11

UDF to access only one phase in mixture domain
 
Hello everyone,

I would like to access only one phase in the mixture domain. I have written the UDF. However, I do not know if my code is right? Could someone clarify?

Can anyone explain what the following code is doing? I have attached only a part of code that I am interested in.

Thread *t,
Thread **pt;
Thread **st;
Domain *d, *pd, *sd;

DEFINE_SOURCE ---------
{
mp_thread_loop_c (t, d, st)
if (FLUID_THREAD_P(t))
{
Thread *sp = st[phase_ID];
begin_c_loop (c, t)
{
if(C_T(c, t)>tsat)
{
source = C_VOF(c, sp)*fabs(C_T(c, t)*1000;
dS[eqn] = 0.0;
}
else if(C_T(c, t)<=tsat)
{
source = -C_VOF(c, sp)*fabs(C_T(c, t)*1000;
dS[eqn] = 0.0;
}
else
{
source = 0.0;
dS[eqn] = 0.0;
}
}
end_c_loop (c, t)
}

AlexanderZ July 5, 2020 21:18

you've cut code too much to get full explanation

define_source is a macro to apply source to any zone. It already has cell/thread loop.

mp_thread_loop_c is macro which loops through all cell threads (at the mixture level) within the mixture domain and provides the pointers of the phase-level (cell) threads associated with each mixture-level thread.

so using mp_thread_loop_c in define_source is not a good idea from my point of view (but I've never tested it). To avoid it you may use define_adjust or analog macros and save calculated source to UDMIs

C_VOF(c, sp) is concentration of certain phase in the cell

Read Ansys FLuent Customization manual


All times are GMT -4. The time now is 15:16.