fluent UDF判断三维模型的网格是否为壁面网格



  • #define WALL_NUMBER1 4 /修改壁面的 ID,由壁面条件面板中读取/
    c_face_loop(cell, mixer, n)
    {
    fa = C_FACE(cell, mixer, n); //获取面指针
    tf = C_FACE_THREAD(cell, mixer, n); //获取该面所在thread的指针
    if (THREAD_ID(tf) == WALL_NUMBER1) //判断是否为贴近壁面的网格????三维网格应该怎么判断是否贴近壁面
    {
    if (C_VOF(cell, sec_th) == 1.) //如果充满液体,则蒸汽向液体质量传输为0
    mass_dot = 0.0; //质量源项为0
    else //不充满液体,则蒸汽进行凝结
    {
    C_CENTROID(cell_center, cell, mixer);
    F_CENTROID(face_center, fa, tf);
    NV_VV(a, = , cell_center, -, face_center);
    distance = NV_MAG(a);
    p_op = RP_Get_Real("operating-pressure";
    p = p_op + C_P(cell, first);
    cell_vapor_pressure = C_YI(cell, first, index_evap_primary) / vapor_molecular /(C_YI(cell, first, index_evap_primary) / vapor_molecular + (1 - C_YI(cell, first, index_evap_primary)) / air_molecular)p;
    wall_temper = F_T(fa, tf);
    wall_pressure = psat_vapor(wall_temper);
    wall_mass_fraction = wall_pressure
    vapor_molecular /(wall_pressurevapor_molecular + (standard_pressure - wall_pressure)air_molecular);
    diffusivity=standard_diffusivity
    standard_pressure/p
    pow(standard_temper/C_T(c,t),1.81);
    if (cell_vapor_pressure / p >= wall_pressure / standard_pressure)/发生冷凝/
    {
    area_density = 1 / (2 * distance);
    mass_transfer_coeff = C_YI(cell, first, index_evap_primary)C_R(cell,first)diffusivity / distance(C_YI(cell, first,index_evap_primary) - wall_mass_fraction) / (1 -wall_mass_fraction);
    mass_dot = -mass_transfer_coeff
    area_density;
    dS[eqn] = -C_YI(cell, first, index_evap_primary)*C_R(cell, first)diffusivity /distancearea_density;
    }
    }
    }
    }
    这段程序是水蒸气凝结的udf其中的一段,首先判断网格是不是壁面网格,然后判断网格内是否充满液体,如果是壁面网格且未充满液体,则通过压力来判断网格内水蒸气是否发生冷凝。
    想请教各位大神,该段程序是否存在什么明显的问题?模拟的是三维网格,程序中判断网格是否为壁面网格的语句是对的吗?


  • 版主 副教授

    判断壁面网格这里,可以用一个uds。设定壁面上该uds为1,其他区域为0。uds的流率、扩散、源什么的设为0。这样判断uds是不是1就知道是不是壁面了。



  • @bestucan 谢谢大佬提供新思路,像我程序中写的这样THREAD_ID(tf) == WALL_NUMBER1,进行判断网格所在thread的id和壁面的id一样来确定是否为贴近壁面网格是否可行?


Log in to reply
 


CFD中文网 | 东岳流体学术 | 东岳流体商业 | 吉ICP备20003622号-1