|
[Sponsors] |
June 17, 2016, 21:02 |
UDF for initial liquid-vapor interface
|
#1 |
New Member
Join Date: Jun 2016
Posts: 17
Rep Power: 10 |
Hi all.
I want to write a UDF code to define a hemisphere interface of a water droplet and vapor phase in surroundings for simulating evaporation. I am a beginner user of UDF. My guessing is that I should use DEFINE_INIT macro. I followed one example in UDf manual, but I am not sure about using loop over cells or faces. I also don't know how to define the boundary. should I use C_vof to define volume fraction for each phase? |
|
June 18, 2016, 08:22 |
|
#2 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
To define the boundary, use DEFINE_PROFILE macro. |
||
June 20, 2016, 15:10 |
|
#3 | |
New Member
Join Date: Jun 2016
Posts: 17
Rep Power: 10 |
Quote:
For defining a hemisphere shape of the initial interphase between liquid and vapor, I am using the code below. Does it seem correct? I could not compile it successfully though. Apparently something is wrong with it. #include "udf.h" /* domain pointer that is passed by INIT function is mixture domain */ DEFINE_INIT(my_init_function, mixture_domain) { int phase_domain_index; cell_t cell; Thread *cell_thread; Domain *subdomain; real xc[ND_ND]; /* loop over all subdomains (phases) in the superdomain (mixture) */ sub_domain_loop(subdomain, mixture_domain, 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) { C_CENTROID(xc,cell,cell_thread); if ((sqrt(ND_SUM(pow(xc[0],2.),pow(xc[1]-3,2.),pow(xc[2],2.)))<1.25 && xc[1]>3 ) ) /* 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) } } } |
||
June 23, 2016, 10:17 |
|
#4 |
Member
Rajukiran Antham
Join Date: Dec 2012
Location: Sweden
Posts: 41
Rep Power: 14 |
Initialization can also be done using GUI in fluent
Adapt->Region->Sphere There you can mark the region and later initialize VOF value using Solution initialization-> Patch |
|
June 24, 2016, 16:49 |
|
#5 | |
New Member
Join Date: Jun 2016
Posts: 17
Rep Power: 10 |
Quote:
Thank you so much for your help. I used the patch function and it seems that it is working properly. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF | acasas | CFD Freelancers | 1 | January 23, 2015 08:26 |
parse error while interpreting udf | Kristin | Fluent UDF and Scheme Programming | 3 | March 15, 2012 07:43 |
RGP file for liquid air | eis | CFX | 0 | April 22, 2010 11:34 |
Evaporation UDF | MN | FLUENT | 0 | December 8, 2003 21:37 |
DEFINE_DPM_OUTPUT macro UDF HELP | Puneet | FLUENT | 3 | November 28, 2003 11:55 |