minoz 发表于 2016-4-8 09:49

[转载]fluent udf

The cell zones and face zones of a model (in the finite-volume scheme) are accessed in UDFs as Thread data types.
udf中,模型的单元和表面区域以thread数据格式存储。
In order to access data in a thread (zone),we need to provide the correct thread pointer, and use FLUENT provided looping macros to access each member (cell or face) in that thread.
要访问thread中的数据,需要提供正确的指针,使用fluent提供的循环宏工具。
<p>cell_t declares an integer data type used to identify cells.</p>
<p>face_t declares an integer data type used to identify faces.</p>
<p>Type Variable Meaning of the declaration</p>
<p>Domain *d; d is a pointer to domain thread</p>
<p>Thread *t; t is a pointer to thread</p>
<p>cell_t c; c is cell thread variable</p>
<p>face_t f; f is a face thread variable</p>
<p>Node *node; node is a pointer to a node.</p>
<p>Several frequently used loop macros:</p>
<p>– Loop over all cell threads in domain d:</p>
<p>thread_loop_c(ct,d) { }</p>
<p>– Loop over face threads in domain d:</p>
<p>thread_loop_f(ft,d) { }</p>
<p>– Loop over all cells in a cell thread t:</p>
<p>begin_c_loop(c, t)</p>
<p>{...}</p>
<p>end_c_loop (c,t)</p>
<p>– Loop over faces in a face thread f_thread:</p>
<p>begin_f_loop(f, f_thread)</p>
<p>{ … }</p>
<p>end_f_loop(f, f_thread)</p>
<p>d: a domain pointer</p>
<p>ct, t: a cell thread pointer</p>
<p>ft,f_thread: a face thread pointer</p>
<p>c: a cell thread variable</p>
<p>f: a face thread variable</p>
<p>Example – Parabolic Inlet Velocity Profile</p>
<p>Example 2 – Custom Initialization</p>
<p>DEFINE_ADJUST(name,domain); general purpose UDF called every iteration</p>
<p>DEFINE_INIT(name,domain); UDF used to initialize field variables</p>
<p>DEFINE_ON_DEMAND(name); an ‘execute-on-demand’ function</p>
<p>DEFINE_RW_FILE(name,fp); customize reads/writes to case/data files</p>
<p>DEFINE_PROFILE(name,thread,index); boundary profiles</p>
<p>DEFINE_SOURCE(name,cell,thread,dS,index); equation source terms</p>
<p>DEFINE_HEAT_FLUX(name,face,thread,c0,t0,cid,cir); heat flux</p>
<p>DEFINE_PROPERTY(name,cell,thread); material properties</p>
<p>DEFINE_DIFFUSIVITY(name,cell,thread,index); UDS and species diffusivities</p>
<p>DEFINE_UDS_FLUX(name,face,thread,index); defines UDS flux terms</p>
<p>DEFINE_UDS_UNSTEADY(name,cell,thread,index,apu,su); UDS transient terms</p>
<p>DEFINE_SR_RATE(name,face,thread,r,mw,yi,rr); surface reaction rates</p>
<p>DEFINE_VR_RATE(name,cell,thread,r,mw,yi,rr,rr_t); volumetric reaction
rates</p>
<p>DEFINE_SCAT_PHASE_FUNC(name,cell,face); scattering phase function for DOM</p>
<p>DEFINE_DELTAT(name,domain); variable time step size for unsteady problems</p>
<p>DEFINE_TURBULENT_VISCOSITY(name,cell,thread); calculates turbulent
viscosity</p>
<p>DEFINE_NOX_RATE(name,cell,thread,nox); NOx production and destruction
rates</p>
<p>C_NNODES(c,t); Returns nodes/cell</p>
<p>C_NFACES(c,t); Returns faces/cell</p>
<p>F_NNODES(f,t); Returns nodes/face</p>
<p>C_CENTROID(x,c,t); Returns coordinates of cell centroid in array x[]</p>
<p>F_CENTROID(x,f,t); Returns coordinates of face centroid in array x[]</p>
<p>F_AREA(A,f,t); Returns area vector in array A[]</p>
<p>C_VOLUME(c,t); Returns cell volume</p>
<p>C_VOLUME_2D(c,t); Returns cell volume (axisymmetric domain)</p>
<p>CURRENT_TIME real current flow time (in seconds)</p>
<p>CURRENT_TIMESTEP real current physical time step size (in seconds)</p>
<p>PREVIOUS_TIME real previous flow time (in seconds)</p>
<p>PREVIOUS_2_TIME real flow time two steps back in time (in seconds)</p>
<p>PREVIOUS_TIMESTEP real previous physical time step size (in seconds)</p>
<p>N_TIME integer number of time steps</p>
<p>N_ITER integer number of iterations</p>
<p>C_R(c,t); Density</p>
<p>C_P(c,t); Pressure</p>
<p>C_U(c,t); U-velocity</p>
<p>C_V(c,t); V-velocity</p>
<p>C_W(c,t); W-velocity</p>
<p>C_T(c,t); Temperature</p>
<p>C H(c,t); Enthalpy</p>
<p>C_K(c,t); Turbulent kinetic energy (k)</p>
<p>C_D(c,t); Turbulent dissipation rate (ε)</p>
<p>C_O(c,t); Specific dissipation of k (ω)</p>
<p>C_YI(c,t,i); Species mass fraction</p>
<p>C_UDSI(c,t,i); UDS scalars</p>
<p>C_UDMI(c,t,i); UDM scalars</p>
<p>C_DUDX(c,t); Velocity derivative</p>
<p>C_DUDY(c,t); Velocity derivative</p>
<p>C_DUDZ(c,t); Velocity derivative</p>
<p>C_DVDX(c,t); Velocity derivative</p>
<p>C_DVDY(c,t); Velocity derivative</p>
<p>C_DVDZ(c,t); Velocity derivative</p>
<p>C_DWDX(c,t); Velocity derivative</p>
<p>C_DWDY(c,t); Velocity derivative</p>
<p>C_DWDZ(c,t); Velocity derivative</p>
<p>C_MU_L(c,t); Laminar viscosity</p>
<p>C_MU_T(c,t); Turbulent viscosity</p>
<p>C_MU_EFF(c,t); Effective viscosity</p>
<p>C_K_L(c,t); Laminar thermal conductivity</p>
<p>C_K_T(c,t); Turbulent thermal conductivity</p>
<p>C_K_EFF(c,t); Effective thermal conductivity</p>
<p>C_CP(c,t); Specific heat</p>
<p>C_RGAS(c,t); Gas constant</p>转自:http://blog.sina.com.cn/s/blog_708637950101o79m.html

页: [1]
查看完整版本: [转载]fluent udf