24小时热门版块排行榜    

查看: 2117  |  回复: 0

hustwing

银虫 (正式写手)

[求助] udf读取数据

#include "udf.h"   
#include "math.h"
real U_inf_variable[100];
real x[100];
real time;
int vel;
real cg_omega[2];
#define Nbpts 100
int i;
int counter=0;
FILE *fid;
FILE *fid2;
FILE *fid3;
DEFINE_EXECUTE_ON_LOADING(readfile,libname)
{
        fid=fopen("shuju.txt","r";
for (i=0;i<Nbpts;i++)
{
        fscanf(fid,"%le ",&U_inf_variable);
}
fclose(fid);
fid2=fopen("check_load_shuju.txt","w";
for (i=0;i<Nbpts;i++)
{
        fprintf(fid2,"%le %d\n",&U_inf_variable,counter);
}
fclose(fid2);
}
DEFINE_CG_MOTION(rotation,dt,cg_vel,cg_omega,time,dtime)
{
        if(time<3)
    cg_omega[2]=-0.024532;
    else if(time>3&&time<=10)
        cg_omega[2]=-0.01214;
}

DEFINE_PROFILE(power_3,thread,position)
{
face_t f;
time=CURRENT_TIME;
begin_f_loop(f,thread)
{
   F_PROFILE(f,thread,position)=U_inf_variable[counter];
}
end_f_loop(f,thread)
}
DEFINE_EXECUTE_AT_END(execute)
{
face_t f;
Domain*domain=Get_Domain(1);
Thread *tf1=Lookup_Thread(domain,126);
begin_f_loop(f,tf1)
{
F_CENTROID(x,f,tf1 );
vel= F_V(f,tf1);
fid3=fopen("vel.dat", "a+" ;
fprintf(fid3," %.6f\n",vel);
}
end_f_loop(f,thread)
fclose(fid3);
}
我想实现进口速度边界条件导入,经过一个时间步的迭代计算后,再从这个界面导出速度。。。请问大神我这个UDF为什么不能实现
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 hustwing 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 欢迎发来filecode的Mz6后的代码验证其规律 +29 医学老男孩 2026-08-13 61/3050 2026-08-15 20:41 by cqbnu
[基金申请] 有时候,自然基金真的不能太认真 (我的申报经验) +8 majunge000 2026-08-11 10/500 2026-08-15 18:55 by Equinoxhua
[基金申请] 哪位老哥知道今年的国自然具体哪一天放榜? +7 Ldrop2023 2026-08-13 7/350 2026-08-15 15:57 by mzhh2000
[基金申请] 关于Filecode分析方法 +10 majunge000 2026-08-10 13/650 2026-08-15 12:26 by hanpeng972
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 22/1100 2026-08-14 23:45 by Noways
[基金申请] 应该是93bebmhtak前后十一个字符比较关键 +23 Lanmanbaby 2026-08-09 37/1850 2026-08-14 13:40 by Equinoxhua
[硕博家园] 读博的好处 +4 lnee 2026-08-11 4/200 2026-08-14 10:20 by ahsoarli
[基金申请] FileCode能看出啥? +10 要乐观耀哥 2026-08-10 32/1600 2026-08-14 09:37 by 要乐观耀哥
[基金申请] 我的国基提前知道中了,可是同事的操作让我实在接受不了,怎么会有这样的人 +10 家与远方 2026-08-10 15/750 2026-08-14 02:08 by 绵羊哥哥
[基金申请] 静等基金结果 +8 gjjjzhong 2026-08-10 21/1050 2026-08-13 17:56 by 且听虎啸
[基金申请] 不应该看fileCode +7 且听虎啸 2026-08-12 9/450 2026-08-13 14:27 by flydreamws
[基金申请] Filecode 又变了,巨变 +3 WH3796 2026-08-12 4/200 2026-08-13 14:13 by 小木虫6752397
[基金申请] 分享一下我之前已中青C的计划书的filecode +4 布布和一二 2026-08-11 5/250 2026-08-13 12:56 by cratir
[基金申请] 结合人工智能,周易传统文化,filecode打分制来了,3分以上希望很大。 +3 Tide man 2026-08-12 4/200 2026-08-13 08:35 by ZJTJZ
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +11 Tide man 2026-08-11 11/550 2026-08-13 07:35 by 撸猫猫
[基金申请] 为什么网上很多人说本周 12号出结果 +6 瞬息宇宙 2026-08-10 7/350 2026-08-11 19:25 by Tide man
[基金申请] 确定了,国自然21号放榜 +6 布布和一二 2026-08-10 7/350 2026-08-10 19:15 by 2000zf36392
[基金申请] 国自然结果 +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
[基金申请] 据悉今年马上要出结果了 +7 瞬息宇宙 2026-08-10 8/400 2026-08-10 12:42 by Vivilian
[基金申请] 面上项目filecode邪修 +5 西山十月 2026-08-09 7/350 2026-08-10 07:32 by 仁砚薪传
信息提示
请填处理意见