CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   DEFINE_SOURCE boil tutorial (https://www.cfd-online.com/Forums/fluent/44007-define_source-boil-tutorial.html)

emanuele March 5, 2007 12:57

DEFINE_SOURCE boil tutorial
 
hello. I have interpreted in Fluent this UDF ( i have founded it in boil tutorial )

#include "udf.h" #include "sg_mphase.h" #define T_SAT 373 define LAT_HT 1.e3 DEFINE_SOURCE(liq_src, cell, pri_th, dS, eqn) { Thread *mix_th, *sec_th; real m_dot_l; mix_th = THREAD_SUPER_THREAD(pri_th); sec_th = THREAD_SUB_THREAD(mix_th, 1);

if(C_T(cell, mix_th)>=T_SAT) {

m_dot_l = -0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)* fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;

dS[eqn] = -0.1*C_R(cell, pri_th)* fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;

}

else {

m_dot_l = 0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)* fabs(T_SAT-C_T(cell,mix_th))/T_SAT;

dS[eqn] = 0.;

}

return m_dot_l;}

DEFINE_SOURCE(vap_src, cell, sec_th, dS, eqn)

{ Thread * mix_th, *pri_th; real m_dot_v;

mix_th = THREAD_SUPER_THREAD(sec_th); pri_th = THREAD_SUB_THREAD(mix_th, 0);

if(C_T(cell, mix_th)>=T_SAT){ m_dot_v = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)* fabs(C_T(cell, mix_th) - T_SAT)/T_SAT; dS[eqn] = 0.; }

else {

m_dot_v = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)* fabs(T_SAT-C_T(cell,mix_th))/T_SAT;

dS[eqn] = -0.1*C_R(cell, sec_th)* fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;

return m_dot_v;

}

DEFINE_SOURCE(enrg_src, cell, mix_th, dS, eqn) {

Thread *pri_th, *sec_th;

real m_dot;

pri_th = THREAD_SUB_THREAD(mix_th, 0);

sec_th = THREAD_SUB_THREAD(mix_th, 1);

if(C_T(cell, mix_th)>=T_SAT){

m_dot = -0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;

dS[eqn] = -0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)/T_SAT;

}

else {

m_dot = 0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(T_SAT-C_T(cell,mix_th))/T_SAT;

dS[eqn] = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)/T_SAT;}

return LAT_HT*m_dot; }

Because i'm only interested in evaporating process ( when temperature reachs Tsat, T >Tsat )and not when T<Tsat, have i to delete the else condition ( T<Tsat )into the three precedents define_source ? Or what can i do?


emanuele March 5, 2007 13:01

Re: DEFINE_SOURCE boil tutorial
 
I'm sorry. I'll repeat.

Because i'm only interested in evaporating process ( when temperature reachs Tsat, T >Tsat )and not when T < Tsat, have i to delete the else condition ( T<Tsat )in the precedents define_source udf? Or what can i do?

thanks


emanuele March 6, 2007 04:42

Re: DEFINE_SOURCE boil tutorial
 
the problem is that if T < Tsat the model seems doesn't works and isn't stable, while if i patch an initial temperature of 374 ( > Tsat) it works. I'm only interesting in evaporating process and not in consendating, but in my model at the beginning of simulation temperature is < Tsat. How can i modify the udf?

mohsen soleimani March 11, 2007 00:45

velocity profile
 
Hi, I am trying to model the fully develop velocity profile with fluent , can yu help me in this field?could you please send for me a udf profile that describe the velocity profile?


Bak_Flow March 13, 2007 15:08

Re: DEFINE_SOURCE boil tutorial
 
Dear Emanuele,

I have used this basic 2 phase mass transfer udf but had similar stability problems. It will depend on the case as to what you have to do to make it work but here are some suggestions that I found useful:

1. Always run your case transient (first order if you don't care about accurate time history) as in the tutorial. You can play with time steps and iterations per time step but if all you are interested in is the steady state then just a few iterations per time step are probably all you need.

2. The model has a constant ie 0.1 in: m_dot=0.1*Phi_primary*Density_primary Although this worked for the tutorial case, i found the model a lot more stable if you make this smaller. You can either start off smaller and converge to a solution and "load it up"...sometimes called load stepping or parameter continuuation.

3. The accuracy of your results should be investigated in light of 2 given the physical phenomena you are trying to simulate. The issue is whether the evaporation is limited by mass transfer or if the ability to transfer heat to cell limits the process. You could look at this as the above rate implied a given evaporation rate in a cell. Can the flow or heat transfer keep up to this rate? Does this match the experiment?

Let us know how it works out.

Best Regards,

Bak_Flow

emanuele March 13, 2007 19:38

Re: DEFINE_SOURCE boil tutorial
 
hello, thanks for your reply!! Now i have resolved my convergence problem but i have noticed that the evaporation is too fast in comparison to the real case. I have full evaporation of water after only two second. What can i do to make the evaporation slower? can i change something in UDF ? i have put 0,001 instead of 0,1 as relax costant but i haven't noticed many differences in evaporation time. Thanks for your help. emanuele

Bak_Flow March 14, 2007 09:56

Re: DEFINE_SOURCE boil tutorial
 
Hi,

what did you do to solve the convergence problems? Did any of the suggestions help?

It looks like you will need a more complicated model for evaporation/boiling. You may have to look at a mass transfer limited case. There you need something like Kl*A(C-C_bulk) Kl-mass transfer coefficient A-area for mass transfer C-equilbrium concentration...say from Henry's law C_buld-concentration in the bulk

.....or something like that??? Have you contacted fluent for ideas on this?

Regards,

Bak_Flow

emanuele March 14, 2007 10:38

Re: DEFINE_SOURCE boil tutorial
 
Hello! To improve convergence I have drastically reduced time step and also some under relaxed factor. I have alreay contacted Fluent for ideas on my model.. but they told me that they can't give indications on as to write UDF function. I would like to know if some changes in UDF can increase evaporation time but i really don't know what kind of changes i have to do. Thanks for help Emanuele



All times are GMT -4. The time now is 23:34.