I was able set UDF for my dynamic mesh using following UDF. It works in serial mode.
Now problem is that I want to speed up my solution, so parallelization is needed. I have gone through the user manual but I was not able to grasp fully what need to be done. If you help point out whats need to be change to convert this for parallel use, I would be grateful. Thank you!
#include "udf.h"
DEFINE_GRID_MOTION(diaphragm,domain,dt,time,dtime) {
real amp,dy0,omega; amp=0.0005; /*amplitude of the oscillatory motion 5mm*/ omega=942; /*oscillations frequency*/
#if !RP_HOST int n; Thread *tf = DT_THREAD(dt); face_t f; Node *v;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); begin_f_loop(f,tf) { f_node_loop(f,tf,n) { v=F_NODE(f,tf,n);
if (NODE_POS_NEED_UPDATE (v)) { NODE_POS_UPDATED(v); dy0=amp*sin(omega*time); /*the displacement of the bottom wall in the Y direction*/ NODE_Y(v)=NODE_Y(v)+dy0; } } } end_f_loop(f,tf); #endif }