#include "udf.h"
DEFINE_GRID_MOTION(moving_arc, domain, dt, time, dtime)
{
*Thread *tf = DT_THREAD (dt)*/;
face_t f;
Node *node_p;
real alpha, theta, x, ymag, yfull, y;
int n;
SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf));
alpha = omega * CURRENT_TIME;
theta = 2.0 * alpha + 3.0 * M_PI / 2.0;
begin_f_loop (f, tf)
{
f_node_loop (f, tf, n)
{
node_p = F_NODE (f, tf, n);
if (NODE_POS_NEED_UPDATE (node_p))
{
NODE_POS_UPDATED (node_p);
x = NODE_X (node_p);
ymag = sqrt (R*R - x*x) + 0.03;
yfull = ymag - 0.1;
y = - 0.1 + yfull * sin(theta);
NODE_Y (node_p) = y;
}
}
}
end_f_loop (f, tf);
}
这个怎样转变为interprete 方式的udf |