CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF of saturation temperature (https://www.cfd-online.com/Forums/fluent-udf/236732-udf-saturation-temperature.html)

stanlee8 June 13, 2021 03:36

UDF of saturation temperature
 
Hi there,

I am trying to simulate condensation in the building environment, using the evaporation-condensation model in Fluent.
Mixture multiphase model was used, with the primary phase as water liquid and a mixture of water vapour and air as a secondary phase.
I understand I need a UDF to describe the relationship between saturation temperature and water vapour pressure.
The UDF I used is listed below:
#include "udf.h"

DEFINE_PROPERTY(saturation_temp,c,t)
{
real sat_t;
real vapor_p;
real static_p = C_P(c,t);
real operating_p = RP_Get_Real ("operating-pressure");
vapor_p = static_p + operating_p; // absolute pressure = static pressure + operating pressure
sat_t = (1723.6425/(8.05573-((double)log10((double)vapor_p/133.322)))-233.08)+273.15; // Pressure in Pa to mmHg (Yaws)
return sat_t;
}


A transient model is used and the results diverged after 5 iterations.
The error is shown as below:
Experiencing convergence difficulties - temporarily relaxing and trying again...

Experiencing convergence difficulties - temporarily relaxing and trying again...

Experiencing convergence difficulties - temporarily relaxing and trying again...

Experiencing convergence difficulties - temporarily relaxing and trying again...
Stabilizing pres



sure coupled to enhance linear solver robustness.
Stabilizing pressure coupled using GMRES to enhance linear solver robustness.

Experiencing convergence difficulties - temporarily relaxing and trying again...

Divergence detected in AMG solver: pressure coupled Stabilizing phase-2-species-0 to enhance linear solver robustness.
Stabilizing phase-2-species-0 using GMRES to enhance linear solver robustness.
Stabilizing temperature to enhance linear solver robustness.
Stabilizing temperature using GMRES to enhance linear solver robustness.
temperature limited to 1.000000e+00 in 751264 cells on zone 10 in domain 1
temperature limited to 5.000000e+03 in 399712 cells on zone 10 in domain 1

Divergence detected in AMG solver: pressure coupled
Divergence detected in AMG solver: pressure coupled
Divergence detected in AMG solver: pressure coupled
Error at host: floating point exception
Error at Node 0: floating point exception
Error at Node 1: floating point exception
Error at Node 2: floating point exception
Error at Node 3: floating point exception

===============Message from the Cortex Process================================

Compute processes interrupted. Processing can be resumed.

================================================== ============================
Interrupting client...
Done.
Registering Udf, ("H:\rail humid_files\dp4\FLU\Fluent\sattemp1.txt")

Calculation complete.

It is really killing me, somebody please help me!!!

Thank you so much.

pakk June 13, 2021 03:48

Does the same happen if you vaatwanden the relevant line to

Code:

sat_t = 300;

stanlee8 June 13, 2021 07:41

Hi Pakk,

I am not sure if I have got you right, but I have tried the follows code:

#include "udf.h"

DEFINE_PROPERTY(saturation_temp,c,t)
{
return (real)373.1545154;
}

which works well.

stanlee8 June 13, 2021 08:07

Hi Pakk,

yes, I just replaced
Quote:

sat_t = (1723.6425/(8.05573-((double)log10((double)vapor_p/133.322)))-233.08)+273.15;
with
Quote:

sat_t = 300;
and it works fine.

pakk June 13, 2021 14:00

OK, then the problem is in that equation.

Is the pressure in your simulation within the range where that equation is valid?

stanlee8 June 15, 2021 00:22

Hi Pakk,

Yes, I guess so.
May I ask what static_p = C_P(c,t) represent?
Cuz I copy the code from somewhere else and not quite familiar with it.

stanlee8 June 15, 2021 00:30

If C_P(c,t) is the static pressure of the mixture, then I think the above UDF is wrong.
Cuz the saturation temperature is a function of partial vapour pressure but not the static pressure of the mixture, am I right?

pakk June 16, 2021 05:01

The UDF implements a certain equation from physics. You have to say which equation should be implemented.

If you tell Fluent to use the wrong equation, then you will get the wrong results.

I can not tell you if the equation is wrong: you are the one who is doing the simulation, you are the one who decided that a certain equation should be used. So you are the one who should know how the equation should look like.

stanlee8 June 27, 2021 08:12

HI Pakk,

Thanks, I think I have already solved it!


All times are GMT -4. The time now is 18:28.