24小时热门版块排行榜    

查看: 2026  |  回复: 9

15800971578

新虫 (初入文坛)

[求助] Fluent编译问题 已有1人参与

下面这段程序编译的时候老是出错,哪位大神能帮忙提点一下?

#include"udf.h"
int ID_out=18;
real avg_temp=289.15;
real NV_VEC(A);
real sum_T_A=0.0;
real sum_A=0.0;
Thead *thread_out;
face_t f;
Domain *domain;
DEFINE_ADJUST(adjust,d)
{
domain=Get_Domain(1);
thread_out=Lookup_Thread(domain,ID_out);
begin_f_loop(f,thread_out)
{
   F_AREA(A,f,thread_out);
   sum_A+=NV_MAG(A);
   sum_T_A+=NV_MAG(A)*F_T(f,thread_out);
}
   end_f_loop(f,thread_out)
  avg_temp=sum_T_A/sum_A;
}
DEFINE_PROFILE(inlet_T,t,i)
{
    begin_f_loop(f,t)
    {
  F_PROFILE(f,t,i) = avg_temp;
     }
   end_f_loop(f,t)
}



Fluent报错:
..\..\src\temperature.c(7) : error C2143: 语法错误 : 缺少“{”(在“*”的前面)
..\..\src\temperature.c(13) : warning C4133: “=”: 从“Thread *”到“int *”的类型不兼容
..\..\src\temperature.c(14) : error C2223: “->nelements”的左侧必须指向结构/联合
..\..\src\temperature.c(16) : error C2223: “->storage”的左侧必须指向结构/联合
..\..\src\temperature.c(16) : error C2223: “->storage”的左侧必须指向结构/联合
..\..\src\temperature.c(16) : error C2223: “->storage”的左侧必须指向结构/联合
..\..\src\temperature.c(18) : error C2223: “->storage”的左侧必须指向结构/联合
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

MoonLee777

新虫 (正式写手)

d就是参数为何你还要定义

发自小木虫IOS客户端
2楼2018-07-28 18:29:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

MoonLee777

新虫 (正式写手)

3楼2018-07-28 18:30:04
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

tang985

新虫 (著名写手)

仔细点呀,第七排那是Thread不是Thead,错误算很明显的了

发自小木虫Android客户端
4楼2018-08-02 00:28:32
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

tang985

新虫 (著名写手)

引用回帖:
2楼: Originally posted by MoonLee777 at 2018-07-28 18:29:38
d就是参数为何你还要定义

domain是需要定义的,和int定义整形一个道理

发自小木虫Android客户端
5楼2018-08-02 00:30:23
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

MoonLee777

新虫 (正式写手)

adjust本身穿的参数就是d为何要定义,直接用就行了

发自小木虫IOS客户端
6楼2018-08-02 12:30:21
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

liukan12

银虫 (小有名气)

【答案】应助回帖

★ ★ ★ ★ ★ ★
15800971578: 金币+5, ★★★很有帮助 2018-08-08 16:54:27
小红豆: 金币+1, 违规存档, 违规留联系方式 2018-12-12 09:18:37
#include"udf.h"
#define id_out 18

real avg_temp = 289.15;
real avg_temp_all = 289.15;
define_adjust(adjust, d)
{

#if !rp_host
        thread *thread_out;   //定义thread指针
        face_t f=0;
        real nv_vec(a);
        real sum_t_a = 0.0;
        real sum_a = 0.0;

        thread_out = lookup_thread(d, id_out);

#endif

#if !parallel /*注意18.0以后需要在t0模式下测试*/
        begin_f_loop(f, thread_out)
        {
                f_area(a, f, thread_out);
                sum_a += nv_mag(a);
                sum_t_a += nv_mag(a)*f_t(f, thread_out);
        }
        end_f_loop(f, thread_out)
                avg_temp = sum_t_a / sum_a;
                message("the avg temp is %g,", avg_temp);
#endif

#if rp_node
                real sum_a_all=0.;
                real sum_t_a_all=0.;
                real avg_temp_all=0.;
        begin_c_loop_int(c, t)
        {
                f_area(a, f, thread_out);
                sum_a += nv_mag(a);
                sum_t_a += nv_mag(a)*f_t(f, thread_out);
        }
        end_c_loop_int(c, t)
                avg_temp = sum_t_a / sum_a;
        message("the avg temp  is %g in cpu %d. \n", avg_temp, myid);
        sum_a_all = prf_grsum1(sum_a)
        sum_t_a_all = prf_grsum1(sum_t_a);
        avg_temp_all = sum_t_a_all / sum_a_all;
        message0("the avg temp in all thread is %g,", avg_temp_all);
#endif // rp_node

}


define_profile(inlet_t, t, i)
{
        face_t f = 0;
        begin_f_loop(f, t)
        {
#if parallel
                f_profile(f, t, i) = avg_temp;
#else
                f_profile(f, t, i) = avg_temp_all;
#endif
        }
        end_f_loop(f, t)
}

针对你的意思 写了一个比较完全的包括简单并行的版本 未用到tui交换确定寻找域 未严格调试
ANSYSFluent流体仿真研究人员。
7楼2018-08-04 16:08:29
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

15800971578

新虫 (初入文坛)

引用回帖:
4楼: Originally posted by tang985 at 2018-08-02 00:28:32
仔细点呀,第七排那是Thread不是Thead,错误算很明显的了

当时检查了很久都没发现,后来终于看到了,改掉了已经,但是改掉之后,程序不报错了,入口却没有温度赋值
8楼2018-08-08 16:51:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

15800971578

新虫 (初入文坛)

引用回帖:
7楼: Originally posted by liukan12 at 2018-08-04 16:08:29
#include"udf.h"
#define ID_out 18

real avg_temp = 289.15;
real avg_temp_all = 289.15;
DEFINE_ADJUST(adjust, d)
{

#if !RP_HOST
        Thread *thread_out;   //定义Thread指针
        fa ...

谢谢大神,666
9楼2018-08-08 16:52:48
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

liukan12

银虫 (小有名气)

内容已删除
ANSYSFluent流体仿真研究人员。
10楼2018-08-08 18:11:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 15800971578 的主题更新
信息提示
请填处理意见