# Problem in UDF for dynamic mesh

 Register Blogs Members List Search Today's Posts Mark Forums Read

December 16, 2020, 05:58
Problem in UDF for dynamic mesh
#1
Member

Dnyanesh Mirikar
Join Date: Jul 2019
Posts: 35
Rep Power: 7
Hello everyone,

I'm trying to simulate synthetic jet, where bottom wall oscillates according to the displacement equation.

X=a*s*sin(2*pi*f*t)

I have created an UDF, which gets compiled but when I start solution it shows error before first iteration. (screenshot is attached below).

UDF I have created is as following

#include "udf.h"

DEFINE_GRID_MOTION(diaphragm, domain, dt, time, dtime)
{
int n;
Node *node;
face_t f;

real a, rad, r, rc, s, p, freq, A;

real xc[ND_ND];

a = 0.0002;

rc = 0.0225;

s = (1-(r/rc));

p = 3.1425;

freq = 150;

begin_f_loop (f, t)
{
f_node_loop (f, t, n);
{
node = F_NODE (f, t, n);

A = a*s*sin(2*p*freq*time);

NODE_Y (node) = A;
}
}
end_f_loop (f, t)
}

Please guide me what I'm doing wrong. I'm new to dynamic mesh settings. Thank you for your help.
Attached Images
 error-dyn.jpg (75.8 KB, 5 views)

 December 17, 2020, 23:32 Parallelization of UDF #2 Member   Dnyanesh Mirikar Join Date: Jul 2019 Posts: 35 Rep Power: 7 I was able set UDF for my dynamic mesh Here is the UDF. 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 }

 Tags dynamic mesh, grid motion, oscillation, synthetic jet, udf