求助:Fluent中导入UDF

浏览:1951 回答:2

#include "udf.h"

#include "math.h"

FILE *result;

DEFINE_EXECUTE_AT_END(pressure_end)

{

    result=fopen("Pressure_GET.txt","a");

    Domain *d

    d=Get_Domain(1);

    Thread *t;

    cell_t c;

    real pressure;

    real A[ND_ND];

    real point_x;

    real point_y;

    real point_z;

    real Y=2.5;

    real R=6.;

    int curr_ts;

    curr_ts=N_TIME;

    thread_loop_c(t,d)

     {

           if(curr_ts>=720)

           {

               real X=(-1.)*R *sin(2.*curr_ts);

               real Z=(-1.)*R *cos(2.*curr_ts);

           begin_c_loop(c,t)

            {

                C_CENTROID(A,c,t);

                point_x=A[0];

                point_y=A[1];

                point_z=A[2];

            if(fabs(point_x-X)<=0.0001&&fabs(point_y-Y)<=0.0001&&fabs(point_z-Z)<=0.0001)

            {

                pressure=C_P(c,t);

                fprintf(result,"坐标:%12.8f%12.8f%12.8f,时间步数:%f\n", point_x,point_y,point_z,curr_ts);

                fprintf(result,"%12.8f\n", pressure);

            }

            }

            end_c_loop(c,t)

            }

        }

        fclose(result);

}


导入Fluent中时,出现错误:

F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c:2: math.h: No such file or directory

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 7: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 9: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 10: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 11: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 12: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 13: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 14: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 15: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 16: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 17: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 18: parse error.

Error: F:\\VAWT Simulation\\try hard\\fluent\\Pressure_GET2.c: line 19: curr_ts: undeclared variable

它提示错误的是这几行:

  #include "math.h"

   Domain *d

    d=Get_Domain(1);

    Thread *t;

    cell_t c;

    real pressure;

    real A[ND_ND];

    real point_x;

    real point_y;

    real point_z;

    real Y=2.5;

    real R=6.;

    int curr_ts;

    curr_ts=N_TIME;

全是定义行出错,这是因为什么原因啊?一直卡在这儿两天了,求助大神们!!

邀请回答 我来回答

全部回答

(1)
默认 最新
路修在戈壁滩上
已解决
2017年10月19日
评论 1 点赞

没解决?试试专家一对一服务

换一批