fluent VOF initialization patch instead of UDF define_INIT

copyright (C) 2011-2017 iesensor.com

Recently, I am doing VOF simulation on Fluent 6.3, But I can not init the mass-fraction in define_INIT()

————————–reply from fluent tech support———————

the Patching option in the GUI panel of Fluent which is more easier and straight forward compared to UDF Hook.(init hook)

—————-this is how this been done:—————–

25.14.2 Patching Values in Selected Cells

In the patching option, you can locate the region through

ADAPT > REGION > select Quad (Inside)

> define x & y values > Click on "Mark" on the panel,

Caution"!!!: do NOT click "Adapt", it will change mesh.


Now in the solution intialization, you can patch the region with the defined VOF value to the region.

Select “Register to patch” , NOT fluid in “Zone to patch”(global zone)


Please refer to the link below for more details on Patching,

If the value is not uniform, you can use the Custom Field function to calculate the initial value, usually, only the coordination info is needed




C_VOF(cell,cell_thread) may never be able to be set a value!



—————————–my example UDF , it does NOT work ————————–

/* domain pointer that is passed by INIT function is mixture domain */




//Domain *d= Get_Domain(3);

//Thread *t=Lookup_Thread(d,6);

//Thread *mix_th=THREAD_SUPER_THREAD(t)


int phase_domain_index;

cell_t cell;

Thread *cell_thread;

Domain *subdomain;

real xc[ND_ND];

real vof = 1.0;

//real x,y; /* the coord */

/* loop over all subdomains (phases) in the superdomain (mixture) */

sub_domain_loop(subdomain, d, phase_domain_index)


/* loop if secondary phase */

if (DOMAIN_ID(subdomain) == 3)

/* loop over all cell threads in the secondary phase domain */

thread_loop_c (cell_thread,subdomain)


/* loop over all cells in secondary phase cell threads */

begin_c_loop_all (cell,cell_thread)



if( (xc[0] >0.0 && xc[0]<0.0178 ) && (xc[1]>0.0 && xc[1]<0.0275) )


C_VOF(cell,cell_thread)=vof; // VOF mass fraction, if species is used,C_YI()






BSD documentation licensed Free for non-commercial usage only
Author: Qingfeng XIA copyright (C) 2011-2013 http://www.iesensor.com
please keep the original link in your reference. http://www.iesensor.com/blog/2011/01/28/fluent-vof-initialization-patch-instead-of-udf-define_init/
This entry was posted in Uncategorized. Bookmark the permalink.