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

UDF to access only one phase in mixture domain

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 4, 2020, 05:11
Default UDF to access only one phase in mixture domain
  #1
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 210
Rep Power: 16
arunraj is on a distinguished road
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)
}
arunraj is offline   Reply With Quote

Old   July 5, 2020, 22:18
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
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
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply


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



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