CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Warning message C4133 while compiling

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 2, 2017, 12:44
Default Warning message C4133 while compiling
  #1
New Member
 
Stefan Holl
Join Date: Sep 2017
Posts: 1
Rep Power: 0
Arminius is on a distinguished road
Hi!

I've got the following udf code for a udrgm

#include "udf.h"
#include "stdio.h"
#include "ctype.h"
#include "stdarg.h"
#define MW 28.966 /* molec. wt. for single gas (kg/kmol) */
#define rgas (UNIVERSAL_GAS_CONSTANT/MW)
#define b 0.001265 /* covolume term for single gas (m^3/kg) */
/* b = R * T_crit / ( 8 * p_crit ) */
#define CC1_cold 1048.71
#define CC2_cold -0.383871
#define CC3_cold 0.945559e-3
#define CC4_cold -0.548647e-6
#define CC5_cold 0.0790677e-9
#define CC1_hot 873.949
#define CC2_hot 0.384069
#define CC3_hot -0.140147e-3
#define CC4_hot 0.0245553e-6
#define CC5_hot -1.63649e-12
/* Reference State: */
#define P_DAT 101325.0 /*Referencepressure*/
#define T_DAT 288.15 /*Referencetemp*/
static int (*usersMessage)(char *,...);
static void (*usersError)(char *,...);
static double cp_datum_ref;
/************************************************** *******************/
/* Thermodynamic functions: */
/************************************************** *******************/
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_error */
/*--------------------------------------------------------------------*/
DEFINE_ON_DEMAND(I_do_nothing)
{
/* this is a dummy function to allow us */
/* to use the compiled UDFs utility */
}
void ANEOS_error(int err, char *f, char *msg)
{
if (err)
usersError("ANEOS_error (%d) from function: %s\n%s\n",err,f,msg);
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_Setup */
/* Compute some constants */
/*--------------------------------------------------------------------*/
void ANEOS_setup(Domain *domain, cxboolean vapor_phase, char *filename,
int (*messagefunc)(char *format, ...),
void (*errorfunc)(char *format, ...))
{
cp_datum_ref = CC1_cold*log(T_DAT) + T_DAT*(CC2_cold
+ T_DAT*(0.5*CC3_cold+ T_DAT*(0.333333*CC4_cold +
0.25*CC5_cold*T_DAT)));

usersMessage = messagefunc;
usersError = errorfunc;
usersMessage("\nLoading Real-Ideal Library: %s\n", filename);
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_density */
/* Returns density given T and press */
/*--------------------------------------------------------------------*/
double ANEOS_density(cxboolean vapor_phase, double Temp, double press, double yi[])
{
double rho = 1. / ( (rgas*Temp/press) + b );
return rho; /* (kg/m^3) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_H_ideal_gas */
/* Returns ideal gas specific enthalpy for a given T */
/*--------------------------------------------------------------------*/
double ANEOS_H_ideal_gas(double Temp)
{
double Ho = 0.0;
if (Temp<=1000)
Ho = Temp*(CC1_cold + Temp*(0.5*CC2_cold
+ Temp*(0.333333*CC3_cold+ Temp*(0.25*CC4_cold
+ Temp*0.2*CC5_cold))));
if (Temp>1000)
Ho = Temp*(CC1_hot + Temp*(0.5*CC2_hot+ Temp*(0.333333*CC3_hot
+ Temp*(0.25*CC4_hot + Temp*0.2*CC5_hot))));
return Ho;
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_cp_ideal */
/* Returns specific heat at a given T, assuming ideal gas */
/*--------------------------------------------------------------------*/
double ANEOS_cp_ideal(double Temp)
{
double cpo = 0.0;
if (Temp<=1000)
cpo = CC1_cold + Temp*(CC2_cold + Temp*(CC3_cold
+ Temp*(CC4_cold + Temp * CC5_cold)));
if (Temp>1000)
cpo = CC1_hot + Temp*(CC2_hot + Temp*(CC3_hot
+ Temp*(CC4_hot + Temp * CC5_hot)));
return cpo; /* (J/kg-K) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_specific_heat */
/* Returns specific heat at a given T */
/*--------------------------------------------------------------------*/
double ANEOS_specific_heat(double Temp, double rho, double P, double yi[])
{
double cp, ANEOS_cp_ideal(Temp);
cp = ANEOS_cp_ideal(Temp);
return cp; /* (J/Kg-K) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_enthalpy */
/* Returns specific enthalpy given T and rho */
/*--------------------------------------------------------------------*/
double ANEOS_enthalpy(double Temp, double rho, double P, double yi[])
{
double delta_h,press,v,h, ANEOS_H_ideal_gas(Temp);
v = 1.0 / rho;
press = rgas * Temp / (v - b);
delta_h = press*b;
h = ANEOS_H_ideal_gas(Temp)+delta_h;
return h; /* (J/Kg) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_entropy */
/* Returns entropy given T and rho */
/*--------------------------------------------------------------------*/
ANEOS_entropy(double Temp, double rho, double P, double yi[])
{
double delta_s,v,vo,s;
double cp_integral = 0.0;
if (Temp<=1000)
cp_integral = CC1_cold*log(Temp) + Temp*(CC2_cold
+ Temp*(0.5*CC3_cold+ Temp*(0.333333*CC4_cold
+ 0.25*CC5_cold*Temp)))- cp_datum_ref;
if (Temp>1000)
cp_integral = CC1_hot*log(Temp) + Temp*(CC2_hot
+ Temp*(0.5*CC3_hot+ Temp*(0.333333*CC4_hot
+ 0.25*CC5_hot*Temp)))- cp_datum_ref;
v = 1.0 / rho;
vo = rgas*Temp/P_DAT;
delta_s = rgas*log((v-b)/vo);
s = delta_s + cp_integral; /* (J/kg) */
return s;
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_mw */
/* Returns molecular weight */
/*--------------------------------------------------------------------*/
double ANEOS_mw(double yi[])
{
return MW; /* (Kg/Kmol) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_speed_of_sound */
/* Returns s.o.s given T and rho */
/*--------------------------------------------------------------------*/
double ANEOS_speed_of_sound(double Temp, double rho, double P, double yi[])
{
double cp = ANEOS_specific_heat(Temp, rho, P, yi);
double v = 1./rho;
double c = (v/(v-b))*sqrt(cp*rgas*Temp/(cp-rgas));
return c; /* (m/s) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_viscosity */
/* Viscosity via 3-coefficient Sutherland Law */
/*--------------------------------------------------------------------*/
double ANEOS_viscosity(double Temp, double rho, double P, double yi[])
{
double mu = 0.0;
double mu_Sutherland = 1.7894e-05;
double T_Sutherland = 273.11;
double S_Sutherland = 110.56;
mu = mu_Sutherland * ( pow( (Temp/T_Sutherland),1.5) )
* (T_Sutherland + S_Sutherland) / (Temp + S_Sutherland);
return mu; /* (Kg/m-s) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_thermal_conductivity */
/* Euckun formula */
/*--------------------------------------------------------------------*/
double ANEOS_thermal_conductivity(double Temp, double rho, double P, double yi[])
{
double cp,mu,k;
cp = ANEOS_specific_heat(Temp, rho, P, yi);
mu = ANEOS_viscosity(Temp, rho, P, yi);
k = (cp+1.25*rgas)*mu;
return k; /* (W/m-K) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_rho_t */
/* Returns derivative of rho wrt. T at constant p */
/*--------------------------------------------------------------------*/
double ANEOS_rho_t(double Temp, double rho, double P, double yi[])
{
double press,v,rho_t;
v = 1.0 / rho;
press = rgas*Temp/(v - b);
rho_t = -rgas/(press*v*v);
return rho_t; /* (Kg/m^3-K) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_rho_p */
/* Returns derivative of rho wrt. p at constant T */
/*--------------------------------------------------------------------*/
double ANEOS_rho_p(double Temp, double rho, double P, double yi[])
{
double press,v,rho_p;
v = 1.0 / rho;
press = rgas*Temp/(v - b);
rho_p = rgas*Temp/(press*press*v*v);
return rho_p; /* (Kg/m^3-Pa) */
}
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_enthalpy_t */
/* Returns derivative of h wrt. T at constant p, which */
/* equals cp */
/*--------------------------------------------------------------------*/
double ANEOS_enthalpy_t(double Temp, double rho, double P, double yi[])
{
double cp;
cp = ANEOS_specific_heat(Temp, rho, P, yi);
return cp;
/*--------------------------------------------------------------------*/
/* FUNCTION: ANEOS_enthalpy_p */
/* returns derivative of h wrt. p at constant T; */
/*--------------------------------------------------------------------*/
}
double ANEOS_enthalpy_p(double Temp, double rho, double P, double yi[])
{
return b;
}
/************************************************** ********************/
/* Actual UDF hook (macro) into the User Defined Real Gas Model: */
/************************************************** ********************/
/*--------------------------------------------------------------------*/
/* Export real gas functions to the solver: */
/*--------------------------------------------------------------------*/
UDF_EXPORT RGAS_Functions RealGasFunctionList=
{
ANEOS_setup, /* initialize */
ANEOS_density, /* density */
ANEOS_enthalpy, /* enthalpy */
ANEOS_entropy, /* entropy */
ANEOS_specific_heat, /* specific_heat */
ANEOS_mw, /* molecular_weight */
ANEOS_speed_of_sound, /* speed_of_sound */
ANEOS_viscosity, /* viscosity */
ANEOS_thermal_conductivity, /* thermal_conductivity */
ANEOS_rho_t, /* drho/dT |const p */
ANEOS_rho_p, /* drho/dp |const T */
ANEOS_enthalpy_t, /* dh/dT |const p */
ANEOS_enthalpy_p, /* dh/dp |const T */
};

Does anybody know, how I can get rid of the warning message:
warning C4133: "Initialization": Incompatible types - from "int (*)(double,double,double,double *)" to "double (*)(double,double,double,double *)" ??

Thanks in advance!

Arminius is offline   Reply With Quote

Reply

Tags
udf - warning c4133

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 06:42
is internalField(U) equivalent to zeroGradient? immortality OpenFOAM Running, Solving & CFD 7 March 29, 2013 02:27
1.5-dev GCC-4.5.1 linnemann OpenFOAM 22 November 3, 2010 04:09
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 22:58
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 07:59


All times are GMT -4. The time now is 16:52.