VOF Patch
I would like to model a cosine wave of liquid water with air on top in a tank using the VOF model. However I do not want to create the "wave" in Gambit and thus have a uniform 2D quadrilateral mesh. Attached is a UDF that should patch two volume fractions, i.e. below a height of 10 mm patch C_VOF=1 and above 10 mm patch C_VOF=0. This is just a test case and later on I'll replace it with a cosine wave. When I run the UDF and connect it to a Function Hook I get an error when trying to initialize it. Any suggestions?
/************************************************** *************** UDF for initializing phase volume fraction ************************************************** ****************/ #include "udf.h" /* domain pointer that is passed by INIT function is mixture domain */ DEFINE_INIT(my_init_function, d) { cell_t cell; Thread *cell_thread; real xc[ND_ND]; /* loop over all cell threads in the domain */ thread_loop_c (cell_thread, d) { /* loop over all cells */ begin_c_loop_all (cell,cell_thread) { C_CENTROID(xc,cell,cell_thread); if (xc[1] < 10.) /* set volume fraction to 1 for centroid */ C_VOF(cell,cell_thread) = 1.; else /* otherwise initialize to zero */ C_VOF(cell,cell_thread) = 0.; } end_c_loop_all (cell,cell_thread) } } |
All times are GMT -4. The time now is 17:25. |