声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2068|回复: 0

[UDF专题] UDF输出数据 【转】

[复制链接]
发表于 2016-4-8 09:51 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
在fluent计算一个非稳态的情况,需要对一个面的压力值进行按时间步长的输出。在udf中有一个输出宏,但却是每一步都输出,我不想输出那么多,请问应如何编写程序?或者用什么宏?
  1. <p>static int last_ts=-1;</p>
  2. <p>DEFINE_ADJUST(name,d)</p>
  3. <p>{</p>
  4. <p>int int_time, curr_ts;</p>
  5. <p>curr_ts=RP_Get_Integer("time-step");</p>
  6. <p>if (last_ts!=curr_ts)</p>
  7. <p>{</p>
  8. <p>last_ts=curr_ts;</p>
  9. <p>current_time=RP_Get_Real("flow-time");</p>
  10. <p>int_time=(int)(current_time);</p>
  11. <p>if (int_time % 300==0)</p>
  12. <p>{</p>
  13. <p>fprintf(fp, "%f %e \n", current_time, your_pressure);</p>
  14. <p>}</p>
  15. <p>}</p>
  16. <p>}</p>
复制代码
转自:http://blog.sina.com.cn/s/blog_708637950101n1ob.html

回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-4-29 10:03 , Processed in 0.104118 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表