定义初始条件的udf

#include "udf.h"
DEFINE_INIT(domainInititial, d)
{
 cell_t c;
 Thread *t;
 real xc[ND_ND];
 real x;
 real y;
 thread_loop_c(t, d)
 {
  begin_c_loop_all(c, t)
  {
   C_CENTROID(xc, c, t);
   x = xc[0];
   y = xc[1];
   if (pow(x - 0.05, 2) / (0.03*0.03) + pow(y - 0.03, 2) / pow(0.015, 2) < 1)
   {
    C_T(c, t) = 500;
   }
   else
   {
    C_T(c, t) = 300;
   }
  }
  end_c_loop_all(c,t)
 }
}

猜你喜欢

转载自blog.csdn.net/MouGang/article/details/83115448