clock 发表于 2017-10-17 17:18:29

设置滑移网格,想要监测滑移面上某点的压力随时间变化的曲线

UDF程序如下:


#include"udf.h"
#include"mem.h"
DEFINE_EXECUTE_AT_END(pressure_end)
{
    Domain *d;
    cell_t c;
    real x;
    real point_x;
    real point_y;
    real point_z;
    FILE *result;
    real pressure;
    d = Get_Domain(1);
    Thread *t = Lookup_Thread(d,19); //ID=19,是我想监测的interface面
    result = fopen("F:\VAWT Simulation\try hard\fluent\Pressure_GET.txt","w");
   thread_loop_c(t,d)
   {
      begin_c_loop(c,t)
      {
             C_CENTROID(x,c,t);
            point_x=x;
            point_y=x;
            point_z=x;
            if(point_x==0.&&point_y==2.5&&point_z==-6)//interface面上的一点
               {
                  pressure = C_P(c,t);
               }
      }
      end_c_loop(c,t)
      }
   fprintf(result,"%12.8f%12.8f%12.8f\n",point_x,point_y,point_z);
   fprintf(result,"%12.8f\n", pressure);
   fclose(result);
}

错误显示:


Error: C:/Users/ADMINI~1/AppData/Local/Temp/Pressure_GET.c.14280.2.c: line 14: parse error.
Error: C:/Users/ADMINI~1/AppData/Local/Temp/Pressure_GET.c.14280.2.c: line 16: t: undeclared variable

line 14是:Thread *t = Lookup_Thread(d,19); //ID=19,是我想监测的interface面
line 16是:thread_loop_c(t,d)

不知道哪里有错诶?并且想问我编写的这个UDF能输出点上的压力随时间变化的曲线吗?谢谢大家了!!

clock 发表于 2017-10-17 17:28:46

请问,有哪位大神会的吗?

clock 发表于 2017-10-17 17:45:59

设置滑移网格,想要监测滑移面上某点的压力随时间变化的曲线

UDF程序如下:


#include"udf.h"
#include"mem.h"
DEFINE_EXECUTE_AT_END(pressure_end)
{
    Domain *d;
    cell_t c;
    real x;
    real point_x;
    real point_y;
    real point_z;
    FILE *result;
    real pressure;
    d = Get_Domain(1);
    Thread *t = Lookup_Thread(d,19); //ID=19,是我想监测的interface面
    result = fopen("F:\VAWT Simulation\try hard\fluent\Pressure_GET.txt","w");
   thread_loop_c(t,d)
   {
      begin_c_loop(c,t)
      {
             C_CENTROID(x,c,t);
            point_x=x;
            point_y=x;
            point_z=x;
            if(point_x==0.&&point_y==2.5&&point_z==-6)//interface面上的一点
               {
                  pressure = C_P(c,t);
               }
      }
      end_c_loop(c,t)
      }
   fprintf(result,"%12.8f%12.8f%12.8f\n",point_x,point_y,point_z);
   fprintf(result,"%12.8f\n", pressure);
   fclose(result);
}

错误显示:


Error: C:/Users/ADMINI~1/AppData/Local/Temp/Pressure_GET.c.14280.2.c: line 14: parse error.
Error: C:/Users/ADMINI~1/AppData/Local/Temp/Pressure_GET.c.14280.2.c: line 16: t: undeclared variable

line 14是:Thread *t = Lookup_Thread(d,19); //ID=19,是我想监测的interface面
line 16是:thread_loop_c(t,d)

不知道哪里有错诶?并且想问我编写的这个UDF能输出动网格上的点上的压力随时间变化的曲线吗?谢谢大家了!!

clock 发表于 2017-10-17 17:46:48

设置滑移网格,想要监测滑移面上某点的压力随时间变化的曲线

UDF程序如下:


#include"udf.h"
#include"mem.h"
DEFINE_EXECUTE_AT_END(pressure_end)
{
    Domain *d;
    cell_t c;
    real x;
    real point_x;
    real point_y;
    real point_z;
    FILE *result;
    real pressure;
    d = Get_Domain(1);
    Thread *t = Lookup_Thread(d,19); //ID=19,是我想监测的interface面
    result = fopen("F:\VAWT Simulation\try hard\fluent\Pressure_GET.txt","w");
   thread_loop_c(t,d)
   {
      begin_c_loop(c,t)
      {
             C_CENTROID(x,c,t);
            point_x=x;
            point_y=x;
            point_z=x;
            if(point_x==0.&&point_y==2.5&&point_z==-6)//interface面上的一点
               {
                  pressure = C_P(c,t);
               }
      }
      end_c_loop(c,t)
      }
   fprintf(result,"%12.8f%12.8f%12.8f\n",point_x,point_y,point_z);
   fprintf(result,"%12.8f\n", pressure);
   fclose(result);
}

错误显示:


Error: C:/Users/ADMINI~1/AppData/Local/Temp/Pressure_GET.c.14280.2.c: line 14: parse error.
Error: C:/Users/ADMINI~1/AppData/Local/Temp/Pressure_GET.c.14280.2.c: line 16: t: undeclared variable

line 14是:Thread *t = Lookup_Thread(d,19); //ID=19,是我想监测的interface面
line 16是:thread_loop_c(t,d)

不知道哪里有错诶?并且想问我编写的这个UDF能输出动网格上点上的压力随时间变化的曲线吗?谢谢大家了!!
页: [1]
查看完整版本: 设置滑移网格,想要监测滑移面上某点的压力随时间变化的曲线