CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Convergence problems - UDF (https://www.cfd-online.com/Forums/fluent/236228-convergence-problems-udf.html)

tomasfreitasrocha May 20, 2021 05:24

Convergence problems - UDF
 
Hello everyone,

I am trying to implement a real-gas model for a CO2 ejector. My properties are interpolated from lookup tables, and this is working well for thermal conductivity, specific heat and viscosity. As for density, the simulation converges when I use an ideal-gas model; however, when I switch to my UDF, the simulation does not converge. Even if I write a UDF for density that replicates the ideal gas model, I have problems.

I would appreciate any help.

Thank you.

AlexanderZ May 20, 2021 18:44

well, if you have problems with UDF, you should show it, at least
show the error log as well, show compilation log

tomasfreitasrocha May 21, 2021 04:39

Yes, of course.

Here it is:

#include "udf.h"
#include "mem.h"
#include "external.h"

DEFINE_PROPERTY(property_density,c,t)
{
float density;

density = C_P(c,t)/(69.29*C_T(c,t));

return density;
}

The molecular weight of my fluid is 120 kg/kmol.

When I use this UDF, I get negative pressure values.

pakk May 22, 2021 04:16

C_P is gauge pressure, you have to add the reference pressure.

tomasfreitasrocha May 22, 2021 05:09

Thank you for your reply.

I have set my operating pressure at 0. Also, I get no compilation or loading errors! All the other UDFs work.

pakk May 22, 2021 09:56

If you initialize it at e.g. 5 Pa, 300 K, don't iterate, and plot density, does it make sense?

(I don't know what is causing your problem, but this might give some information to help solve the problem.)

tomasfreitasrocha May 22, 2021 10:07

Yes it does! Which adds to my confusion...


All times are GMT -4. The time now is 05:22.