CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   DEFINE_MASS_TRANSFER evaporation (https://www.cfd-online.com/Forums/fluent/43928-define_mass_transfer-evaporation.html)

emanuele February 27, 2007 12:15

DEFINE_MASS_TRANSFER evaporation
 
hello, I have to simulate the mass transfer due to evaporation in Fluent and i should do it with DEFINE_MASS_TRANSFER udf. I have a plain surface with water on the top and a flow of hot air is passing over the water. Some amount of water is evaporated and converted in water vapor in air phase. I use VOF model to model water and air phase ( air phase is a mixture of water vapor and air ). Do someone has an example of DEFINE_MASS_TRANSFER udf, based on saturation temperature, to model transfer of water in water phase to water vapor in air phase ? ( i have to use it in phase interaction panel )

Please help me Thanks


emanuele February 28, 2007 11:22

Re: DEFINE_MASS_TRANSFER evaporation
 
i have written this UDF ( i have found it in UDF manual )

/* UDF to define a simple mass transfer based on Saturation

Temperature. The "from" phase is the gas and the "to" phase is the

liquid phase */

#include "udf.h"

DEFINE_MASS_TRANSFER(liq_gas_source,cell,thread,fr om_index, from_species_index, to_index, to_species_index) {

real m_lg;

real T_SAT = 373.15;

Thread *gas = THREAD_SUB_THREAD(thread, from_index);

Thread *liq = THREAD_SUB_THREAD(thread, to_index);

m_lg = 0.;

if (C_T(cell, liq) >= T_SAT)

{

m_lg = -0.1*C_VOF(cell,liq)*C_R(cell,liq)*

fabs(C_T(cell,liq)-T_SAT)/T_SAT;

}

if ((m_lg == 0. ) && (C_T(cell, gas) <= T_SAT))

{

m_lg = 0.1*C_VOF(cell,gas)*C_R(cell,gas)*

fabs(T_SAT-C_T(cell,gas))/T_SAT;

}

return (m_lg); }

When i interpret it in Fluent, it works. So i define a mass transfer mechanism in phase interaction panel between phase 2 (water liquid) and phase 1, species h20. When i start my unsteady simulation fluent send message:

Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: ()

What kind of error is this ?

Please help me, thanks


Sujith February 28, 2007 11:48

Re: DEFINE_MASS_TRANSFER evaporation
 
the udf is accessing some memory which is not allocated. for example you are accessing the value of velocity at mixture thread, where velocity is defined for phase thread...

You may debug ur udf by commenting or printing a message and find out the problematic area...

emanuele February 28, 2007 12:12

Re: DEFINE_MASS_TRANSFER evaporation
 
But i have interpreted udf in fluent and fluent doesn't send any error message. I'm very confused, what is wrong ?

Sujith February 28, 2007 14:41

Re: DEFINE_MASS_TRANSFER evaporation
 
interpretor will work; it just checks whether the code is correct in wrt c standards. But fluent may not digest some part and it gives you the error message.

JIE February 28, 2007 23:59

Re: DEFINE_MASS_TRANSFER evaporation
 
You'd better to use compile mode instead of interpretor

emanuele March 1, 2007 10:28

Re: DEFINE_MASS_TRANSFER evaporation
 
Thanks for the reply. I couldnt understand the UDF example for mass transfer. In the following UDF it says that the mass transfer takes place gas to liquid and the magnitude is negative.

if(C_T(Cell,liq)>= T_SAT)

{

m_lg = -0.1*C_VOF(cell,liq)*C_R(cell,liq)*fabs(C_T(cell,li q)-T_SAT)/T_SAT;

}

if ((m_lg == 0.)&& (C_T(cell, gas) <= T_SAT))

{

I'm interested only in mass transfer from liquid to gas. Can I remove the negative sign and change the mass transfer direction from liq to gas? Or have i to delete the second if condition but not removing negative sign ? thanks for help

Sujith March 2, 2007 12:36

Re: DEFINE_MASS_TRANSFER evaporation
 
the value of m_lg will be passed to the Phase interactions panel; there u can see how is the mass transfer defined, from where to where. If the value is -ve then mass transfer will take place in the opp. direction to that defined in the phase interactions panel.

emanuele March 4, 2007 12:06

Re: DEFINE_MASS_TRANSFER evaporation
 
thanks a lot! In phase interaction panel i define one mass transfer mechanism FROM water liquid TO water vapor defining this udf DEFINE_MASS_TRANSFER :

#include "udf.h"

DEFINE_MASS_TRANSFER(liq_gas_source,cell,thread,fr om_index, from_species_index, to_index, to_species_index) {

real m_lg;

real T_SAT = 373.15;

Thread *gas = THREAD_SUB_THREAD(thread, from_index);

Thread *liq = THREAD_SUB_THREAD(thread, to_index);

m_lg = 0.;

if (C_T(cell, liq) >= T_SAT)

{

m_lg = 0.1*C_VOF(cell,liq)*C_R(cell,liq)*

fabs(C_T(cell,liq)-T_SAT)/T_SAT;

}

if ((m_lg == 0. ) && (C_T(cell, gas) <= T_SAT))

{

m_lg = 0;

}

return (m_lg); } It should be correct? I use mixture mode, k-eps RNG; the problem is that it's very difficult to reach convergence, i have to use time step size of 1e-06. I have also tried to decrease under relaxed factor and change pressure velocity coupling and discretization but i don't know exactly what to do to improve convergence. Because the return value of m_lg in UDF is kg/m3/second have i to wait the solution for first second to begin to see water phase fraction decreasing ?


chhanwal October 26, 2009 02:20

I think we have to rewrite whole programme in different manner if we need mass transfer from liquid to gas phase

jpinho November 24, 2009 06:49

Hello there!!!

Can anyone explain me the use of the following equation:

m_lg = 0.1*C_VOF(cell,liq)*C_R(cell,liq)*

fabs(C_T(cell,liq)-T_SAT)/T_SAT;

What is the ideia of the factor 0.1? And how can be this equation phisically intrepertated?

Thanks
Jorge

dokeun January 19, 2011 21:54

you can find that coefficient in theory guide
 
Coefficient 0.1 is default value commented in theory guide.
Just what i'm wondering is whether the mass-transfer equ represented in this thread is applicable to VOF.
And I think there should be energy transfer between phases during evaporation.

Quote:

Originally Posted by jpinho (Post 237478)
Hello there!!!

Can anyone explain me the use of the following equation:

m_lg = 0.1*C_VOF(cell,liq)*C_R(cell,liq)*

fabs(C_T(cell,liq)-T_SAT)/T_SAT;

What is the ideia of the factor 0.1? And how can be this equation phisically intrepertated?

Thanks
Jorge


Nikolopoulos January 21, 2011 12:16

dokeun is right!

You should incorporate with heat sources the effect on energy equation for sure!
You can do it by storing the rate of the mass tranfer in a C_UDMI (user defined memory).

One question: If you put
return 0;
in the end does it still report an error?
If no, some value goes to infinity

dokeun January 23, 2011 22:51

Hello Nikolopoulos
I didn't figure out your question exactly. this is your experience or expectation.
But if this is your hypotheses.
If you mean "return 0;" is there is no mass transfer between the phases on a cell then there shouldn't be source term(mass&energy) due to phase change.
The reason you mentioned about going infinity of some value may be, in my guess, because you assumed that restored mass source for one cell (in a C_UDMI) is not changed during iteration. but the value keeps change during the iteration and if there is no mass transfer(mass source term is zero) by evaporation then energy source for the cell at that time is zero.

Good luck to you and me
Quote:

Originally Posted by Nikolopoulos (Post 291600)
One question: If you put
return 0;
in the end does it still report an error?
If no, some value goes to infinity


Nikolopoulos January 24, 2011 02:39

If i understand correctly, your code compiles, and runs a few iterations.

If you make a test and return zero from this UDF and you don't have any fluent crash downs the problem would probably be a division by zero or something like that. As good policy you should put an upper and lower bound for your variable that is returned.

If it stills crashes down, it means that either the model is not well developed in Fluent or there is a violating statement in your UDF.


Another idea is to check in your code if C_VOF(cell,liq) is greater than 10^-6. If "yes" proceed with your calculations and if "NO" then return zero.


All times are GMT -4. The time now is 10:40.