24小时热门版块排行榜    

查看: 478  |  回复: 0

yanboliu

金虫 (小有名气)

[求助] udf程序调试

各位前辈:
       大家好,我这里有一个程序,调试时显示以下信息:
Error: C:\Users\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
程序如下:
#include <udf.h>
#include <math.h>
#define ERF_PI 3.141592653589793
#define ERF_N 100


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;

begin_f_loop(f, t)
{
temperature = -4.6376+6.9448*exp(1.1742-time/5.90205)*(erf(y/sqrt(2))+1)/2;
F_PROFILE(f, t, i) = temperature;
}
end_f_loop(f, thread)

}


望各位前辈给我指点
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 yanboliu 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 303求调剂 +4 今夏不夏 2026-03-01 4/200 2026-03-01 14:46 by 嘟嘟小浣熊
[考研] 一志愿中南大学理学化学 +3 15779376950 2026-03-01 4/200 2026-03-01 14:27 by 15779376950
[考研] 284求调剂 +6 天下熯 2026-02-28 6/300 2026-03-01 14:19 by Ducount.Y
[考研] 0856材料求调剂 +3 麻辣鱿鱼 2026-02-28 3/150 2026-03-01 14:06 by yc258
[考研] 290求调剂 +8 材料专硕调剂; 2026-02-28 9/450 2026-03-01 12:46 by 闭眼看蓝天
[考研] 0856材料专业298分有科研经历 硕士研究生调剂自荐信 +6 zyf上岸 2026-03-01 6/300 2026-03-01 12:43 by liqiongjy
[考研] 321求调剂一志愿东北林业大学材料与化工英二数二 +3 虫虫虫虫虫7 2026-03-01 6/300 2026-03-01 11:50 by gaoxiaoniuma
[考研] 材料类求调剂 +8 wana_kiko 2026-02-28 8/400 2026-03-01 11:44 by 王伟要上岸啊
[考研] 317一志愿华南理工电气工程求调剂 +6 Soliloquy_Q 2026-02-28 11/550 2026-03-01 11:14 by 歌liekkas
[考研] 311求调剂 +9 南迦720 2026-02-28 10/500 2026-03-01 10:55 by sunny81
[考研] 0856求调剂285 +6 吕仔龙 2026-02-28 6/300 2026-03-01 10:03 by wang_dand
[硕博家园] 博士自荐 +6 科研狗111 2026-02-26 10/500 2026-03-01 10:02 by 科研狗111
[考研] 272求调剂 +4 田智友 2026-02-28 4/200 2026-03-01 06:43 by 刘兵
[考研] 304求调剂 +3 52hz~~ 2026-02-28 5/250 2026-03-01 00:00 by 52hz~~
[考研] 化工专硕348,一志愿985求调剂 +4 弗格个 2026-02-28 6/300 2026-02-28 22:00 by wang_dand
[考研] 292求调剂 +3 yhk_819 2026-02-28 3/150 2026-02-28 21:57 by gaoxiaoniuma
[考研] 264求调剂 +3 巴拉巴拉根556 2026-02-28 3/150 2026-02-28 21:31 by gaoxiaoniuma
[考研] 276求调剂 +3 路lyh123 2026-02-28 4/200 2026-02-28 19:45 by 路lyh123
[考研] 0856材料求调剂 +10 hyf hyf hyf 2026-02-28 11/550 2026-02-28 18:50 by 无际的草原
[考研] 304求调剂 +5 曼殊2266 2026-02-28 6/300 2026-02-28 12:44 by 迷糊CCPs
信息提示
请填处理意见