找回密码
 注册
查看: 2061|回复: 2

高手帮忙看一下 这个程序有点看不懂 万分感谢

[复制链接]
发表于 2009-4-24 16:41:15 | 显示全部楼层 |阅读模式

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

您需要 登录 才可以下载或查看,没有账号?注册

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)
       }
    }
}
发表于 2009-4-24 17:03:10 | 显示全部楼层

有点难

是否学习计算流体力学一定要很会编写程序?
发表于 2009-12-10 20:34:11 | 显示全部楼层
好像是求一个标量梯度的平方和
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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