云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > fluent UDF第五章 使用宏存取FLUENT解算器变量

fluent UDF第五章 使用宏存取FLUENT解算器变量

  • 62 次阅读
  • 3 次下载
  • 2025/5/23 2:37:22

你可以在你的宏中加入下标_G来得到梯度矢量和它的分量,例如: C_T_G(c,t); /* 返回单元格的温度梯度矢量. */

注意只有当已经求解出包含这个变量的方程时才能得到梯度变量。例如如果你定义了一个关于能量的原程序,那么你的UDF可以读写单元格的温度梯度(使用C_ T _G)

但是你却不能读写X方向的速度分量(使用C_ U _G)。而且,如果你建立了一个由使用者确定的方式转移方程,那么你就不能得到一部分的梯度了。这是因为求解器不断的移走它不需要的数据。你可以使用下面的方法来阻止存储器释放记忆:发出文本命令save/set/expert ,然后对计算机提出的“是否阻止暂时的求解器记忆释放”这一提问回答“是”。按照这种做法就可以保留所有的梯度数据,但是这种计算需要更多的内存。

You can access a component of a gradient vector by specifying it as an argument in the gradient vector call (0 for the x component; 1 for y; and 2 for z). For example, C_T_G(c,t)[0]; /* returns the x-component of the cell temperature */ /* gradient vector */

returns the x component of the temperature gradient vector. Note that in Table 5.2.1, the gradient and component macros are shown only for temperature but can be extended to all of the variables except pressure. You must use C DP to access the cell pressure gradient vector and components, as shown in Table 5.2.1.

在调用梯度矢量时把某一分量作为参数,这样就可以得到梯度分量了,(参数0代表X方向的分量,1代表Y方向的分量,2代表Z方向的分量)例如: C_T_G(c,t)[0]; /* 返回温度梯度X方向的分量 */

注意在表5.2.1中虽然只列出了温度梯度和其分量求解的宏,但是却可以扩展到除了压力以外的所有变量中去,对于压力你只能按照表5.2.1中的方法使用C_DP来得到压力梯度和其分量。

Accessing Reconstruction Gradient (RG) Vectors and Components

In the same way as the gradient, you can add the RG su_x to your macro to access the reconstruction gradient (RG) vector and components of a variable quantity. By specify- ing the appropriate integer (0 for the x component; 1 for y; and 2 for z) as an argument, you can obtain the desired vector component. Reconstruction gradients are typically used when you want to implement your own interpolation scheme. Reconstruction gra- dient and component macros are shown only for temperature in Table 5.2.1, but can be extended to all of the variables. Note that RG variables, like gradient variables, are available only when the equation for that variable is being solved.

读写改造过的梯度矢量和其分量

和梯度一样的方式,你可以通过加RG的下标在你的宏中来得到梯度向量和其分量。通过使用恰当的整数作为参数来获得想要的矢量分量。(参数0代表X方向

的分量,1代表Y方向的分量,2代表Z方向的分量)当你完成你自己的插补计划时可以使用改造过的梯度。改造过的温度梯度和其分量在表5.2.1中列出了,但是可以推广到所有的变量。注意改造过的梯度矢量和梯度矢量一样都只有在梯度方程被求解出来时才可以得到。

Accessing Previous Time Steps

The M1 suffix can be generally applied to the macros in Table 5.2.1 to allow access to the value of the variable at the previous time step (i.e., t - _t). These data may be useful in unsteady simulations. For example,

C_T_M1(c,t); /* returns value of cell temperature at previous time step*/ returns the value of the cell temperature at the previous time step.

The M2 suffix can be generally applied to the macros in Table 5.2.1 to allow access to the value of the variable at the time step before the previous one (i.e., t - 2_t). These data may be useful in unsteady simulations. Previous time step macros are shown only for temperature in Table 5.2.1, but can be extended to all of the variables.

读写前一步长下的时间

在表5.2.1里的宏中加入下标_M1就可以得到前一次步长时间下(t-⊿t)的变量的值。得到的这些数据可以在不稳定的模拟中使用。例如: C_T_M1(c,t); /*返回前一步时间下的单元格温度的值 */

若在表5.2.1里宏的后面加上下标M2就可以得到前两次步长下的时间(t-2⊿t)。这些数据可用与不稳定的模拟计算中。在表5.2.1中仅列出了温度的前一次步长的求法,但是可以扩展到其它的变量中去。

5.2.2 Macros for Accessing Derivatives

The macros listed in Table 5.2.2 can be used to access velocity derivative variables. Table 5.2.2: Derivative Macros in mem.h 5.2.2读写导数的宏

在表5.2.2中列出来的宏可以用于读写由速度导数。

表5.2.2

名称(参数) 参数类型 返回值 C DUDX(c,t) C DUDY(c,t) C DUDZ(c,t) C DVDX(c,t) C DVDY(c,t) C DVDZ(c,t) C DWDX(c,t) C DWDY(c,t) C DWDZ(c,t)

cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t velocity derivative velocity derivative velocity derivative velocity derivative velocity derivative velocity derivative velocity derivative velocity derivative velocity derivative

5.2.3 Macros for Accessing Material Properties

The macros listed in Table 5.2.3 can be used to access material property variables.

5.2.3存取材料性质的宏

在表5.2.3中列出的宏可以用于存取材料的性质。

表5.2.3在mem.h中存取材料性质的宏 名称(参数) 参数类型 返回值 C_FMEAN(c,t) C_FMEAN2(c,t) C_FVAR(c,t) C_FVAR2(c,t) C_PREMIXC(c,t)

C_LAM FLAME SPEED(c,t) C_CRITICAL STRAIN RATE(c,t)

C_ POLLUT(c,t,i)

C_R(c,t) C_MU L(c,t) C_MU T(c,t) C_MU EFF(c,t) C_K_L(c,t) C_K_T(c,t) C_K_ EFF(c,t) C_CP(c,t) C_RGAS(c,t) C_DIFF L(c,t,i,j) C_DIFF EFF(c,t,i) C_ABS COEFF(c,t) C_SCAT COEFF(c,t) C_NUT(c,t)

cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t

cell t c, Thread *t, int i

cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t, int i, int j

cell t c, Thread *t, int i cell t c, Thread *t cell t c, Thread *t cell t c, Thread *t 第一次混合分数的平均值 第一次混合分数的平均值 第一次混合分数变量 第二次混合分数变量 反应过程变量 层流焰速度 临界应变速度

第i个污染物质的质量分数 密度 层流速度 湍流速度 有效粘度 热传导系数

湍流热传导系数 有效热传导系数 确定的热量 气体常数

层流物质的扩散率

物质的有效扩散率 吸附系数 扩散系数

湍流速度for Spalart-Allmaras

5.2.4 Macros for Accessing User-Defined Scalars and Memory

The macros listed in Table 5.2.4 can be used to access user-defined scalars and memory for cells.

Table 5.2.4: User-Defined Scalar and Memory Macros for Cells in mem.h Name(Arguments) Argument Types Returns C _UDSI(c,t,i) cell t c, Thread *t, int i user-defined scalar (cell)

C_UDSI M(c,t,i) C_UDSI_DIFF(c,t,i) C_UDMI(c,t,i)

cell t c, Thread *t, int i cell t c, Thread *t, int i cell t c, Thread *t, int i user-defined scalar previous time step (cell) user-defined scalar di_usivity (cell)

user-defined memory (cell)

5.2.4用户定义的标量和存储器的宏的读写

在表5.2.4中列出的宏可以为单元格读写用户定义的标量和存储器。

表5.2.4在mem.h文件中的可以为单元格读写用户定义的标量和存储器的宏

名称(参数) 参数类型 返回值

用户定义的标量(单元格) C _UDSI(c,t,i) cell t c, Thread *t, int i

前一次步长下用户定义的标量 C_UDSI M(c,t,i) cell t c, Thread *t, int i

(单元格)

用户定义的标量的分散率 C_UDSI_DIFF(c,t,i) cell t c, Thread *t, int i

(单元格)

用户定义的存储器(单元格) C_UDMI(c,t,i) cell t c, Thread *t, int i

5.2.5 Reynolds Stress Model Macros

The macros listed in Table 5.2.5 can be used to access variables for the Reynolds stress turbulence model. Name(Arguments) Argument Types Returns C RUU(c,t) cell t c, Thread *t uu Reynolds stress C RVV(c,t) cell t c, Thread *t vv Reynolds stress C RWW(c,t) cell t c, Thread *t ww Reynolds stress C RUV(c,t) cell t c, Thread *t uv Reynolds stress C RVW(c,t) cell t c, Thread *t vw Reynolds stress C RUW(c,t) cell t c, Thread *t uw Reynolds stress

5.2.5雷诺兹压力模型宏

在表5.2.5中列出了可以给雷诺兹压力模型读写变量的宏

表5.2.2在metric.h中的RSM宏

名字(参数) 参数类型 返回值

uu 雷诺兹压力 C RUU(c,t) cell t c, Thread *t

vv 雷诺兹压力 C RVV(c,t) cell t c, Thread *t

ww 雷诺兹压力 C RWW(c,t) cell t c, Thread *t

uv雷诺兹压力s C RUV(c,t) cell t c, Thread *t

vw 雷诺兹压力 C RVW(c,t) cell t c, Thread *t

uw 雷诺兹压力 C RUW(c,t) cell t c, Thread *t

5.3 Face Macros

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

你可以在你的宏中加入下标_G来得到梯度矢量和它的分量,例如: C_T_G(c,t); /* 返回单元格的温度梯度矢量. */ 注意只有当已经求解出包含这个变量的方程时才能得到梯度变量。例如如果你定义了一个关于能量的原程序,那么你的UDF可以读写单元格的温度梯度(使用C_ T _G) 但是你却不能读写X方向的速度分量(使用C_ U _G)。而且,如果你建立了一个由使用者确定的方式转移方程,那么你就不能得到一部分的梯度了。这是因为求解器不断的移走它不需要的数据。你可以使用下面的方法来阻止存储器释放记忆:发出文本命令save/set/expert ,然后对计算机提出的“是否阻止暂时的求解器记忆释放”这一提问回答“是”。按照这种做法就可以保留所有的梯度数据,但是这种计算需要更多的内存。 You can access a compon

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com