|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
The following UDF, named adjust_fcn, specifies a user-defined scalar as a function of the gradient of another user-defined scalar, using DEFINE_ADJUST. The function is called once every iteration. It is executed as a compiled UDF in FLUENT.
/********************************************************************
UDF for defining user-defined scalars and their gradients
*********************************************************************/
#include "udf.h"
DEFINE_ADJUST(adjust_fcn, d)
{
Thread *t;
cell_t c;
real K_EL = 1.0;
/* Do nothing if gradient isn't allocated yet. */
if (! Data_Valid_P())
return;
thread_loop_c (t,d)
{
if (FLUID_THREAD_P(t))
{
begin_c_loop_all (c,t)
{
C_UDSI(c,t,1) +=
K_EL*NV_MAG2(C_UDSI_G(c,t,0))*C_VOLUME(c,t);
} /主要是这一步 不是很懂 他的这个C_UDSI(c,t,0) 和C_UDSI(c,t,1)都表示什么 我现在要求一个标量的梯度 是不是就和这个差不多 直接把我要表示的那个标量来代替C_UDSI(c,t,0) 和C_UDSI(c,t,1)就可以了是吗 /
end_c_loop_all (c,t)
}
}
} |
|