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/)
-   -   problem of udf with material property (https://www.cfd-online.com/Forums/fluent-udf/132469-problem-udf-material-property.html)

france April 1, 2014 07:53

problem of udf with material property
 
hello everyone,Recently I come up with some problems in my master project.I write a udf for my simulation model.The udf main use to define density and viscosity.At the same time,I run the model in parallel way.When I set well all the parameters and initialization,the fluent software will automatic close. And sometimes it can successfully initialization ,but run to the first step the fluent software close.The error information almost can't see.So I don't know what the problem with my project.I guess that it must be the property udf have some problems.
Here I paste my udf .Hope someone can help me. Thanks very much in advance.
#include "udf.h"
#define BMODULUS 1.1e9
#define rho_ref 870.0
#define p_ref 101325.0
DEFINE_PROPERTY(superfluid_density,c,t)
{
#if !RP_HOST
real rho;
real p, dp;
real p_operating;
p_operating = RP_Get_Real("operating-pressure");
p = C_P(c,t)+p_operating;
dp = p-p_ref;
rho = rho_ref/(1.0-dp/BMODULUS);
return rho;
#endif
}
DEFINE_PROPERTY(sound_speed,c,t)
{
#if !RP_HOST
real a;
real p,dp,p_operating;
p_operating = RP_Get_Real ("operating-pressure");
p = C_P(c,t)+p_operating;
dp = p-p_ref;
a = sqrt((BMODULUS-dp)/rho_ref);
return a;
#endif
}

#define f1 5.1e-9
#define f2 2.3e-8
#define f3 -1.16
DEFINE_PROPERTY(viscosity,c,t)
{
#if !RP_HOST
real tt,p,kv,p_operating;
p_operating = RP_Get_Real ("operating-pressure");
tt=C_T(c,t);
p=C_P(c,t)+p_operating;
kv=0.0457*exp(6.58*pow(1+f1*p,f2)*pow((tt-138)/265,f3)-1);
return kv;
#endif
}

upeksa April 4, 2014 06:51

I think that your problem is that you use the function "pow" but you don't include "math.h"

If still don't work:

żDo other UDF work in you computer?

In that case, I would change your formulation of "operating-pressure", I guess it comes from a scheme code and maybe that is what is not working.

Yot can try something like:

#define p_operating RP_Get_Real("operating-pressure")

at the begining of the code instead.

Cheers

yuanmengyuan1989 May 27, 2014 08:08

have your problems been solved?
 
my UDF are similar with yours. but i met the Initialization error.

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: ()
do you know the reason ?


All times are GMT -4. The time now is 21:38.