找回密码
 注册
查看: 2562|回复: 0

multiphase eulerian model 里第一项附加 uds 对流项的 udf

[复制链接]
发表于 2009-4-28 10:48:46 | 显示全部楼层 |阅读模式

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

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

x
欧拉两相流模型,其中第一相 附加一个UDS方程, 默认选择时对流项不会出现越界问题,但是如果自己编写udf会出现越界问题,如入口给定1,但计算一段时间后会超出1。
以下是我的udf,如果有人能解决可以给一定的钱,具体站内联系。

#include "udf.h"
DEFINE_UDS_FLUX(cd, face, thread_g, i)
{
    cell_t  c0,  c1 = -1;
    Thread  *tg0,  *tg1 = NULL;
   
    real NV_VEC(A), flux = 0.0;
       
  real flux0 = 0.0, flux1 = 0.0, NV_VEC(psi_vec0), NV_VEC(psi_vec1);
       
    real rho_g0, vof_g0, vof_g1;
       
       
    real NV_VEC(dx0),  NV_VEC(dx1), fe, vof;       
       
  c0 = F_C0(face, thread_g);
  tg0 = F_C0_THREAD(face, thread_g);
    F_AREA(A, face, thread_g);
       
       
        if (BOUNDARY_FACE_THREAD_P(thread_g))
    {
                if (NNULLP(THREAD_STORAGE(thread_g, SV_DENSITY)))
                {
                        rho_g0 = F_R(face, thread_g);
                }
                else
                {
                        rho_g0 = C_R(c0, tg0);
                }
               
                NV_DS(psi_vec0, =, F_U(face, thread_g), F_V(face, thread_g), F_W(face, thread_g), *, rho_g0);
                flux = NV_DOT(psi_vec0, A) * F_VOF(face, thread_g);
        }
        else
    {
                c1 = F_C1(face, thread_g);
                tg1 = F_C1_THREAD(face, thread_g);
               
                vof_g0 = C_VOF(c0, tg0);
                vof_g1 = C_VOF(c1, tg1);
               
               
                NV_DS(psi_vec0, =, C_U(c0, tg0), C_V(c0, tg0), C_W(c0, tg0), *, C_R(c0, tg0));
                NV_DS(psi_vec1, =, C_U(c1, tg1), C_V(c1, tg1), C_W(c1, tg1), *, C_R(c1, tg1));
               
                flux0 = NV_DOT(psi_vec0, A) * vof_g0;
                flux1 = NV_DOT(psi_vec1, A) * vof_g1;

                flux = 0.5 * (flux0 + flux1);


        }
        return flux ;
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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