UDF about boiling phenomenon
Hi. everyone.
I’m studying boiling phenomenon and carrying out the vof simulation on bubble growth when boiling. A boundary between liquid and vapor is not clear. So I assumed that 0< volume fraction <0.5 : water 0.5< volume fraction <1 : vapor DEFINE_INIT(my_init_function, domain) { Thread *t; Thread **pt; Thread **st; cell_t c; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE); Domain *sDomain = DOMAIN_SUB_DOMAIN(domain,S_PHASE); real xc[ND_ND], vof1, vof2; mp_thread_loop_c (t,domain,pt) if (FLUID_THREAD_P(t)) { Thread *tp = pt[P_PHASE]; begin_c_loop (c,t) { C_CENTROID(xc,c,t); vof1=C_VOF(c,tp); if ( 0.5 < vof1 ) C_VOF(c,tp) = 1; } end_c_loop (c,t) } mp_thread_loop_c (t,domain,st) if (FLUID_THREAD_P(t)) { Thread *sp = st[P_PHASE]; begin_c_loop (c,t) { C_CENTROID(xc,c,t); vof2=C_VOF(c,sp); if ( 0.5 < vof2 ) C_VOF(c,sp) = 0; } end_c_loop (c,t) } } and I wrote UDF. but It didn’t operate. Would you please do me a favor? Please give me reply anytime you feel free. Thank you! |
Does it fail when you compile it? Or when you interpret it? Or when you load it? Or when you run it?
What are P_PHASE and S_PHASE? Does the program know what to do with it? (You calculate xc, but never do anything with it. That will not cause any problem, but you could remove it, to make the code smaller.) |
I arppreciate reply to my question.
I succeed UDF compile. however when operating simulation, Error: Divergence detected in AMG solver: pressure correction. P_PHASE and S_PHASE is first phase(vapor) and second phase(liquid). To use C_CENTROID, I defined xc[ND_ND]. |
Quote:
Quote:
Quote:
I can more or less see what your UDF does. But I don't know what you want it to do. What do you want your UDF to do? (Be as exact as possible, for example "VOF calculations" or "separate water from vapor" is not detailed enough.) |
I want to change VOF valvue to separate water from vapor.
0<VOF<0.5 : VOF=0 0.5<VOF<1 : VOF=1 |
And then? Continue the calculation? Make pictures? Calculate the volume occupied by water?
|
yes. I make picture of vapor bubble growth using calculated vapor volume fraction. and calcuate heat transfer rate and haet flux.
|
Two questions:
- Why do you need the VOF to be either 0 or 1? If the values in the simulation are in between, you can still make pictures, and do these calculations. - Why do you continue the simulation after making these values 0 or 1? Fluent will get really confused by this, as you noticed. |
As the boundary between water and vapor is not claer, I think a boundary using volume fraction value may be simplied. However, I agree your opinion 2. I think fluent is comfused, so errors happen. Do you have any ideas?
|
My opinion: don't change the VOF...
If you really want to have a strict distinction between vapor and liquid, add a user defined memory (UDM) and store the value there. So instead of Code:
C_VOF(c,tp) = 1; Code:
C_UDMI(c,tp,0) = 1; In that way, you don't change the VOF, so Fluent will not get confused, and you can make the same plots by plotting UDM0. |
All times are GMT -4. The time now is 12:32. |