c语言error c2275,udf compiled之后出现error c2275等问题

该博客详细介绍了如何在Fluent求解器中编写用户定义函数(UDF)来计算并输出湍动能耗散率。代码示例展示了UDF的实现,包括获取细胞压力、坐标值,并将结果写入文本文件和Fluent控制台。这个过程对于理解和调试CFD模拟中的湍流模型至关重要。
摘要由CSDN通过智能技术生成

CODE:

/********************************************************************

UDF for integrating turbulent dissipation and printing it to

console window at the end of the current iteration or time step

*********************************************************************/

#include "udf.h"

#include "math.h"

#include "mem.h"

#include "global.h"

FILE *fp;

FILE *fp1;

DEFINE_EXECUTE_AT_END(pressure)

{

Domain *d;

d=Get_Domain(1);

fp=fopen("dp_body.txt","a");

real FC[ND_ND];

real x_body1,y_body1,p_body1;

cell_t c;

Thread *ft=Lookup_Thread(d,9);

Thread *ft1=Lookup_Thread(d,10);

thread_loop_c(ft,d)

{

//loop over all cells//

begin_c_loop(c,ft)

{

C_P(c,ft);//get the pressure//

C_CENTROID(FC,c,ft);

// 输出x坐标和压力值

x_body1=FC[0];

y_body1=FC[1];

p_body1=C_P(c,ft);

}

end_c_loop(c,ft)

}

}

fprintf(fp,"  x= %-8.5f   y= %-8.5f  dp=%-12.5f\n ",x_body1,y_body1,dp); //输入到文本里。

Message(" x= %-8.5f dp=%-12.5f\n ",x_body1,dp); //直接输出到fluent运行界面

fclose(fp);

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值