声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1930|回复: 0

[UDF专题] [转载]fluent udf

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

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

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

x
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提供的循环宏工具。
  1. <p>cell_t declares an integer data type used to identify cells.</p>
  2. <p>face_t declares an integer data type used to identify faces.</p>
  3. <p>Type Variable Meaning of the declaration</p>
  4. <p>Domain *d; d is a pointer to domain thread</p>
  5. <p>Thread *t; t is a pointer to thread</p>
  6. <p>cell_t c; c is cell thread variable</p>
  7. <p>face_t f; f is a face thread variable</p>
  8. <p>Node *node; node is a pointer to a node.</p>
  9. <p>Several frequently used loop macros:</p>
  10. <p>– Loop over all cell threads in domain d:</p>
  11. <p>thread_loop_c(ct,d) { }</p>
  12. <p>– Loop over face threads in domain d:</p>
  13. <p>thread_loop_f(ft,d) { }</p>
  14. <p>– Loop over all cells in a cell thread t:</p>
  15. <p>begin_c_loop(c, t)</p>
  16. <p>{...}</p>
  17. <p>end_c_loop (c,t)</p>
  18. <p>– Loop over faces in a face thread f_thread:</p>
  19. <p>begin_f_loop(f, f_thread)</p>
  20. <p>{ … }</p>
  21. <p>end_f_loop(f, f_thread)</p>
  22. <p>d: a domain pointer</p>
  23. <p>ct, t: a cell thread pointer</p>
  24. <p>ft,f_thread: a face thread pointer</p>
  25. <p>c: a cell thread variable</p>
  26. <p>f: a face thread variable</p>
  27. <p>Example – Parabolic Inlet Velocity Profile</p>
  28. <p>Example 2 – Custom Initialization</p>
  29. <p>DEFINE_ADJUST(name,domain); general purpose UDF called every iteration</p>
  30. <p>DEFINE_INIT(name,domain); UDF used to initialize field variables</p>
  31. <p>DEFINE_ON_DEMAND(name); an ‘execute-on-demand’ function</p>
  32. <p>DEFINE_RW_FILE(name,fp); customize reads/writes to case/data files</p>
  33. <p>DEFINE_PROFILE(name,thread,index); boundary profiles</p>
  34. <p>DEFINE_SOURCE(name,cell,thread,dS,index); equation source terms</p>
  35. <p>DEFINE_HEAT_FLUX(name,face,thread,c0,t0,cid,cir); heat flux</p>
  36. <p>DEFINE_PROPERTY(name,cell,thread); material properties</p>
  37. <p>DEFINE_DIFFUSIVITY(name,cell,thread,index); UDS and species diffusivities</p>
  38. <p>DEFINE_UDS_FLUX(name,face,thread,index); defines UDS flux terms</p>
  39. <p>DEFINE_UDS_UNSTEADY(name,cell,thread,index,apu,su); UDS transient terms</p>
  40. <p>DEFINE_SR_RATE(name,face,thread,r,mw,yi,rr); surface reaction rates</p>
  41. <p>DEFINE_VR_RATE(name,cell,thread,r,mw,yi,rr,rr_t); volumetric reaction
  42. rates</p>
  43. <p>DEFINE_SCAT_PHASE_FUNC(name,cell,face); scattering phase function for DOM</p>
  44. <p>DEFINE_DELTAT(name,domain); variable time step size for unsteady problems</p>
  45. <p>DEFINE_TURBULENT_VISCOSITY(name,cell,thread); calculates turbulent
  46. viscosity</p>
  47. <p>DEFINE_NOX_RATE(name,cell,thread,nox); NOx production and destruction
  48. rates</p>
  49. <p>C_NNODES(c,t); Returns nodes/cell</p>
  50. <p>C_NFACES(c,t); Returns faces/cell</p>
  51. <p>F_NNODES(f,t); Returns nodes/face</p>
  52. <p>C_CENTROID(x,c,t); Returns coordinates of cell centroid in array x[]</p>
  53. <p>F_CENTROID(x,f,t); Returns coordinates of face centroid in array x[]</p>
  54. <p>F_AREA(A,f,t); Returns area vector in array A[]</p>
  55. <p>C_VOLUME(c,t); Returns cell volume</p>
  56. <p>C_VOLUME_2D(c,t); Returns cell volume (axisymmetric domain)</p>
  57. <p>CURRENT_TIME real current flow time (in seconds)</p>
  58. <p>CURRENT_TIMESTEP real current physical time step size (in seconds)</p>
  59. <p>PREVIOUS_TIME real previous flow time (in seconds)</p>
  60. <p>PREVIOUS_2_TIME real flow time two steps back in time (in seconds)</p>
  61. <p>PREVIOUS_TIMESTEP real previous physical time step size (in seconds)</p>
  62. <p>N_TIME integer number of time steps</p>
  63. <p>N_ITER integer number of iterations</p>
  64. <p>C_R(c,t); Density</p>
  65. <p>C_P(c,t); Pressure</p>
  66. <p>C_U(c,t); U-velocity</p>
  67. <p>C_V(c,t); V-velocity</p>
  68. <p>C_W(c,t); W-velocity</p>
  69. <p>C_T(c,t); Temperature</p>
  70. <p>C H(c,t); Enthalpy</p>
  71. <p>C_K(c,t); Turbulent kinetic energy (k)</p>
  72. <p>C_D(c,t); Turbulent dissipation rate (ε)</p>
  73. <p>C_O(c,t); Specific dissipation of k (ω)</p>
  74. <p>C_YI(c,t,i); Species mass fraction</p>
  75. <p>C_UDSI(c,t,i); UDS scalars</p>
  76. <p>C_UDMI(c,t,i); UDM scalars</p>
  77. <p>C_DUDX(c,t); Velocity derivative</p>
  78. <p>C_DUDY(c,t); Velocity derivative</p>
  79. <p>C_DUDZ(c,t); Velocity derivative</p>
  80. <p>C_DVDX(c,t); Velocity derivative</p>
  81. <p>C_DVDY(c,t); Velocity derivative</p>
  82. <p>C_DVDZ(c,t); Velocity derivative</p>
  83. <p>C_DWDX(c,t); Velocity derivative</p>
  84. <p>C_DWDY(c,t); Velocity derivative</p>
  85. <p>C_DWDZ(c,t); Velocity derivative</p>
  86. <p>C_MU_L(c,t); Laminar viscosity</p>
  87. <p>C_MU_T(c,t); Turbulent viscosity</p>
  88. <p>C_MU_EFF(c,t); Effective viscosity</p>
  89. <p>C_K_L(c,t); Laminar thermal conductivity</p>
  90. <p>C_K_T(c,t); Turbulent thermal conductivity</p>
  91. <p>C_K_EFF(c,t); Effective thermal conductivity</p>
  92. <p>C_CP(c,t); Specific heat</p>
  93. <p>C_RGAS(c,t); Gas constant</p>
复制代码
转自:http://blog.sina.com.cn/s/blog_708637950101o79m.html

回复
分享到:

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-29 04:31 , Processed in 0.062884 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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