Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. Fluent
  3. 多孔介质-UDF讨论

多孔介质-UDF讨论

已定时 已固定 已锁定 已移动 Fluent
2 帖子 2 发布者 2.8k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • W 离线
    W 离线
    wangzhixiong08
    写于 最后由 李东岳 编辑
    #1
    /************************************************** **********************/ /* Porous Media Source Code */ /* */ /* By Greg Perkins */ /* CANCES, Australian Technology Park */ /* Ph: 02 9318 0004, Fax: 02 9319 2328 */ /* Email: perkinsg@cances.atp.com.au */ /* */ /* Started: 10-11-99 */ /* */ /* Revised: 22-11-99 */ /************************************************** **********************/
    
    /* ---- These routines implement a porous media model (same as standard
    
    Fluent model) that can vary spatially and temporily.
    
    To use in Fluent compile and link source library as described
    
    in the Fluent UDF manual. Then use the udf in the source terms
    
    for momentum equations */
    
    #include "udf.h" #include "sg.h"
    
    /* ---- use a user defined scalar to track material properties of the domain */ enum { PERM, N_REQUIRED_UDS };
    
    /* --- misc defines */ #define PERM_EXP_VOID 35.0 #define PERM_EXP_MATERIAL -20.0 #define PERM_ADJ_FALSE 0 #define PERM_ADJ_TRUE 1 #define UDS_PERM(alpha) log10(alpha) /* --- permeability function for scalar-0 */ #define WEIGHT 1.0e20 /* --- weighting co-eff in linearized eqn */ #define WEIGHT2 1.0e20 #define INLET_VELOCITY 10.0 /* --- inlet velocity in m/s */
    
    /* ---- define criteria for various possible configurations */ #define MAT_CHANNEL(x,y,z) ((y<=0.25) || (y>=0.75)) #define MAT_STEP(x,y,z) ( ((x<=1.0)&&(y<=0.5)) || ((x>1.0)&&(y<=0.25)) ) #define MAT_ONECHANNEL(x,y,z) (y<=0.5) #define MAT_CHANNEL2(x,y,z) ( ((x<=1.0)&&(y<=0.5)) || ((x>1.0)&&(y<=0.25)) || (y>=0.95) )
    
    /* ------------------------------------------------------------------------
    
    Material Properties
    
    This routine returns the local properties of the material (alpha,C2) for
    
    a given location in the domain (x,y,z).
    
    ------------------------------------------------------------------------ */ void Material_Properties(real x, real y, real z, real *alpha, real *C2) {
    
    /* --- use this routine to return the permeability, alpha and the
    
    co-efficient C2, for each location x,y,z in the domain. No
    
    Modifications needed for 2D. For time dependent porous media
    
    use the RP_Get_Real("flow time") function to find out t (secs) */
    
    if MAT_STEP(x,y,z)
    
    {
    
    *alpha = pow(10.0,PERM_EXP_MATERIAL);
    
    *C2 = 0.0;
    
    }
    
    else
    
    {
    
    *alpha = pow(10.0,PERM_EXP_VOID);
    
    *C2 = 0.0;
    
    } }
    
    /* ------------------------------------------------------------------------
    
    X_Momentum_Source
    
    This routine returns the source term for the X-momentum term for each
    
    control volume in the domain. The local properties are obtained by
    
    calling Material_Properties
    
    ------------------------------------------------------------------------ */ DEFINE_SOURCE(SRCE_Xmom,cell,thread,dS,eqn) {
    
    real x[ND_ND];
    
    real alpha, C2, constant1, constant2, Ux, source;
    
    /* --- determine x,y,z co-ordinates of cell */
    
    C_CENTROID(x,cell,thread);
    
    /* --- determine local properties */
    
    Material_Properties(x[0], x[1], x[2], &alpha, &C2);
    
    /* --- determine constants 1,2 */
    
    constant1 = C_MU_L(cell,thread)/alpha;
    
    constant2 = 0.5 * C_R(cell,thread) * C2;
    
    /* --- determine x-velocity */
    
    Ux = C_U(cell,thread);
    
    source = -(constant1*Ux + constant2 * fabs(Ux) * Ux);
    
    dS[eqn] = -(constant1 + 2 * constant2 * fabs(Ux)); /* XXX CHECK */
    
    return source; }
    
    /* ------------------------------------------------------------------------
    
    Y_Momentum_Source
    
    This routine returns the source term for the Y-momentum term for each
    
    control volume in the domain. The local properties are obtained by
    
    calling Material_Properties
    
    ------------------------------------------------------------------------ */ DEFINE_SOURCE(SRCE_Ymom, cell, thread, dS, eqn) {
    
    real x[ND_ND];
    
    real alpha, C2, constant1, constant2, Uy, source;
    
    /* --- determine x,y,z co-ordinates of cell */
    
    C_CENTROID(x,cell,thread);
    
    /* --- determine local properties */
    
    Material_Properties(x[0], x[1], x[2], &alpha, &C2);
    
    /* --- determine constants 1,2 */
    
    constant1 = C_MU_L(cell,thread)/alpha;
    
    constant2 = 0.5 * C_R(cell,thread) * C2;
    
    /* --- determine y-velocity */
    
    Uy = C_V(cell,thread);
    
    source = -(constant1*Uy + constant2 * fabs(Uy) * Uy);
    
    dS[eqn] = -(constant1 + 2 * constant2 * fabs(Uy)); /* XXX CHECK */
    
    return source; }
    
    /* ------------------------------------------------------------------------
    
    Z_Momentum_Source
    
    This routine returns the source term for the Z-momentum term for each
    
    control volume in the domain. The local properties are obtained by
    
    calling Material_Properties
    
    ------------------------------------------------------------------------ */ DEFINE_SOURCE(SRCE_Zmom, cell, thread, dS, eqn) {
    
    real x[ND_ND];
    
    real alpha, C2, constant1, constant2, Uz, source;
    
    /* --- determine x,y,z co-ordinates of cell */
    
    C_CENTROID(x,cell,thread);
    
    /* --- determine local properties */
    
    Material_Properties(x[0], x[1], x[2], &alpha, &C2);
    
    /* --- determine constants 1,2 */
    
    constant1 = C_MU_L(cell,thread)/alpha;
    
    constant2 = 0.5 * C_R(cell,thread) * C2;
    
    /* --- determine z-velocity */
    
    Uz = C_W(cell,thread);
    
    source = -(constant1*Uz + constant2 * fabs(Uz) * Uz);
    
    dS[eqn] = -(constant1 + 2 * constant2 * fabs(Uz)); /* XXX CHECK */
    
    return source; }
    
    1 条回复 最后回复
  • L 离线
    L 离线
    l.j刘侃
    写于 最后由 编辑
    #2

    注意格式还有先调试一下吧 这个问题其实最难的是最后的各个方向上的分量处理
    而如果是平面各向同性的话 难点在于处理最后源项中针对的方向长度问题
    注意源项的单位 你好像并没有关心

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]