通过获取临近单元的C_UDSI和C_UDSI_G,运用插值方法求得。

#include "udf.h"
DEFINE_ON_DEMAND(test)
{
    face_t f;
    cell_t c0;
    Thread *tf,*t0;
    Domain*domain=Get_Domain(1);
    real NV_VEC(dist_vector);
    real f_centoid[ND_ND],c_centroid[ND_ND];
    real face_value,cell_value;
    thread_loop_f(tf, domain)/* loops over all face threads in a domain*/
    {
        if (THREAD_F_AXIS==THREAD_TYPE(tf)) /* if the thread is an axis thread*/
        {
            begin_f_loop(f, tf) /* loops over faces in a face thread */
            {
                F_CENTROID(f_centoid,f,tf); //centroid of a face
                c0=F_C0(f,tf);
                t0=THREAD_T0(tf);
                C_CENTROID(c_centroid,c0,t0); //centroid of the neighbour cell
                NV_DD(dist_vector,=,f_centoid[0],f_centoid[1],0,-,c_centroid[0],c_centroid[1],0);
                face_value=C_UDSI(c0,t0,0)+NV_DOT(C_UDSI_G(c0,t0,0),dist_vector); 
                cell_value=C_UDSI(c0,t0,0);
                Message0("x coord.=%g,face value=%g,cell value=%g\n",f_centoid[0],face_value,cell_value);
            }
            end_f_loop(f, f_thread)
        } 
    
    }
}
最后修改:2020 年 10 月 27 日
如果觉得我的文章对你有用,请随意赞赏