double erf(double x)////erf(x) = the cumulation of { 2/sqrt(pi)*exp(-z*z) } from 0 to x; //error function
{ // 2/sqrt(pi) * { ∑[(-1)^n / n! * x^(2n+1)/(2n+1)] + x }
double res = x;
double factorial = 1; //n!
double x_pow = x;
int one = 1, n;
for( n=1; n<100; n++ ){
factorial *= n;
one *= -1;
x_pow *= x*x;
res += one / factorial * x_pow / ( 2*n+1 );
}
res *= 2 / sqrt(ERF_PI);
return res;
}
double norm_cdf(double y)//cumulation distribution function of standard normal distribution
{
real time = CURRENT_TIME;
y=(time-5.98023)/3.3487-3.3487/5.90205
return ( 1 + erf( y / sqrt(2) ) ) / 2;
}
DEFINE_PROFILE(unsteady_temperature, t, i)
{
real time = CURRENT_TIME;
real temperature;
face_t f;
导入fluent出现以下错误:
ers\user\Desktop\udf unsteady temperature w 1.c: line 27: parse error.
Error: C:\Users\user\Desktop\udf unsteady temperature w 1.c: line 38: y: undeclared variable