CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Multi-UDFs Initialisation error (https://www.cfd-online.com/Forums/fluent/88688-multi-udfs-initialisation-error.html)

Zhaohui Lu May 23, 2011 21:47

Multi-UDFs Initialisation error
 
:(Please have a look at my problem.Just so confused on this.hope someone could help me to figure it out. thanks in advance!

the UDFs is posted below:
#include <udf.h>
#define BMODULUS 2.2e9
#define rho_ref 1000.0
#define p_ref 101325
DEFINE_PROPERTY(superfluid_density, c, t)
{
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;
}

DEFINE_PROPERTY(sound_speed, c,t)
{
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 = (1.-dp/BMODULUS)*sqrt(BMODULUS/rho_ref);
return a;
}

DEFINE_PROFILE (unsteady_pressure, thread, position)
{
face_t f;
float a = 0.000470;
begin_f_loop(f, thread)
{
real t = RP_Get_Real("flow-time");
F_PROFILE(f, thread, position) = (1e+12)*t-(2e+15)*t*t-(6e+17)*t*t*t+10;
}
end_f_loop(f, thread)
}

the error displayed as:
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: ()

dmalcher May 24, 2011 08:17

Hi,

as I can see you copied big parts of your UDF out of the FLUENT UDF manual. Note that "RP_Get_Real ("operating-pressure")" is referring to a Scheme variable you have to define within the command line of FLUENT.
Alternatively, define "operating_pressure" as a constant or global variable in your UDF.

The same with "real t = RP_Get_Real("flow-time")". Use the solver macro CURRENT_TIME instead.

I hope that helps.

Regards
d

dmalcher May 24, 2011 09:01

so this is what I meant with declaring p_operating as a constant. In my case the reference pressure and the operating operating pressure have the same value, so dp = p, but I left it to make it clear.


#define BMODULUS 2.2e9 /* Pa*/
#define rho_ref 1000.0 /* kg/m³*/
#define p_ref 101325 /*Pa*/
#define p_operating 101325 /*Pa*/

DEFINE_PROPERTY(mod_density,c,t)
{
real rho_water;
real p, dp;

p = C_P(c,t) + p_operating;
dp = p - p_ref;
rho_water = rho_ref/(1.0-dp/BMODULUS);
return rho_water;
}

Zhaohui Lu May 25, 2011 02:47

Quote:

Originally Posted by dmalcher (Post 309013)
so this is what I meant with declaring p_operating as a constant. In my case the reference pressure and the operating operating pressure have the same value, so dp = p, but I left it to make it clear.


#define BMODULUS 2.2e9 /* Pa*/
#define rho_ref 1000.0 /* kg/m³*/
#define p_ref 101325 /*Pa*/
#define p_operating 101325 /*Pa*/

DEFINE_PROPERTY(mod_density,c,t)
{
real rho_water;
real p, dp;

p = C_P(c,t) + p_operating;
dp = p - p_ref;
rho_water = rho_ref/(1.0-dp/BMODULUS);
return rho_water;
}

Thanks dmalcher!
Just as you thought, I am really a begainer on Fluent.When face some problem, i usually try to find help from Fluent Doc first.I appreciate your kind help!
In order to conquer this with your assistance, maybe it would be better to show you some details about my case first .what i am simulating is the process of high pressure(transient) water ejecting into air using VoF Multiphase +turbulent model k-epsilon.
I made some modification in my UDF file posted below and the same error happened.hope you help me again on this! thanks a lot!

Regards
truly,
zhao


#include <udf.h>
#define BMODULUS 2.2e9 /* Pa*/
#define rho_ref 1000.0 /* kg/m?*/
#define p_ref 101325 /*Pa*/
#define p_operating 101325 /*Pa*/
DEFINE_PROPERTY(mod_density,c,t)
{
real rho_water;
real p, dp;
p = C_P(c,t) + p_operating;
dp = p - p_ref;
rho_water = rho_ref/(1.0-dp/BMODULUS);
return rho_water;
}
DEFINE_PROPERTY(sound_speed, c,t)
{
real a;
real p, dp;
p = C_P(c,t) + p_operating;
dp = p-p_ref;
a = (1.-dp/BMODULUS)*sqrt(BMODULUS/rho_ref);
return a;
}
DEFINE_PROFILE (unsteady_pressure, thread, position)
{
face_t f;
begin_f_loop(f, thread)
{
real t = CURRENT_TIME;
F_PROFILE(f, thread, position) = (1e12)*t-(2e15)*t*t-(6e17)*t*t*t+10;

}
end_f_loop(f, thread)
}

0906536m January 10, 2014 18:23

Hello,
I am having the same problem as you! Did you manage to correct it?
Thankyou


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