没必要用UDF的,按照下面的 *** 作即可:主要是一个写profile,再在新的case中读取,就ok
1Write a data profile at the outlet of the old case
In this step, you will write a file containing selected
ow solution information on
specied surfaces Later, you will use this information as inlet boundary conditions
when the boiling model is enabled
File>Write>Profile
(a) Select Define New Profile in the Options group box
(b) Select outlet from the Surfaces selection list
(c) Select Velocity Magnitude, Turbulence Kinetic Energy (k), and Turbulent Dissipation
Rate (Epsilon) and so on from the Values selection list
(d) Click Write to open the Select File panel
(e) Enter liquid-outletprof for File Name and click OK
This writes a profile file to the working folder The profile file contains the solution
information that was requested in the Write Profile panel This information
is used to supply inlet information in the boiling calculation
(f) Close the Write Profile panel
2For a new case, Read the newly created profile into memory
After creating a profile, you need to read it into memory for the profile variables to be
available as boundary conditions
File>Read >Profile
FLUENT displays the progress of reading the profile, in the console
高手帮我也看一下,我抄的教程上的程序,编译也出现语法错误,求指教!
#include "udfh"
static real viscosity_0;
DEFINE_INIT(melt_setup, domain)
{
/ if memory for the particle variable titles has not been
allocated yet, do it now /
if (NULLP(user_particle_vars)) Init_User_Particle_Vars();
/ now set the name and label /
strcpy(user_particle_vars[0]name,"melting-index");
strcpy(user_particle_vars[0]label,"Melting Index");
}
/ update the user scalar variables /
DEFINE_DPM_SCALAR_UPDATE(melting_index, cell, thread, initialize, p)
{
cphase_state_t c = &(p->cphase);
if (initialize)
{
/ this is the initialization call, set:
p->user[0] contains the melting index, initialize to 0
viscosity_0 contains the viscosity at the start of a time step/
p->user[0] = 0;
viscosity_0 = c->mu;
}
else
{
/ use a trapezoidal rule to integrate the melting index /
p->user[0] += P_DT(p) 5 (1/viscosity_0 + 1/c->mu);
/ save current fluid viscosity for start of next step /
viscosity_0 = c->mu;
}
}
/ write melting index when sorting particles at surfaces /
DEFINE_DPM_OUTPUT(melting_output, header, fp, p, thread, plane)
{
char name[100];
if (header)
{
if (NNULLP(thread))
cxprintf(fp,"(%s %d)\n",thread->head->dpm_summarysort_file_name,11);
else
cxprintf(fp,"(%s %d)\n",plane->sort_file_name,11);
cxprintf(fp,"(%10s %10s %10s %10s %10s %10s %10s"
" %10s %10s %10s %10s %s)\n",
"X","Y","Z","U","V","W","diameter","T","mass-flow",
"time","melt-index","name");
}
else
{
sprintf(name,"%s:%d",p->injection->name,p->part_id);
cxprintf(fp,
"((%106g %106g %106g %106g %106g %106g "
"%106g %106g %106g %106g %106g) %s)\n",
p->statepos[0], p->statepos[1], p->statepos[2],
p->stateV[0], p->stateV[1], p->stateV[2],
p->statediam, p->statetemp, p->flow_rate, p->statetime,
p->user[0], name);
}
}
begin_f_loop(f, thread) , end_f_loop(f, thread)是一个循环语句
F_PROFILE(f, thread, position)=。。。。。相应公式的值,并返回给你要定的温度或者压力
以上就是关于Fluent高手求教,UDF编写程序,提取一个流场出口个各个参数,然后加载在另一个流场作为入口条件全部的内容,包括:Fluent高手求教,UDF编写程序,提取一个流场出口个各个参数,然后加载在另一个流场作为入口条件、FLUENT中udf的程序编译为什么总是出现parse error、fluent中udf程序中profile宏里面语句不明白等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)