|
[Sponsors] |
June 13, 2022, 07:37 |
3D wall deformation with DEFINE_GRID_MOTION
|
#1 |
New Member
Rohan Sujeesh
Join Date: Jun 2022
Posts: 1
Rep Power: 0 |
Hi,
I'm trying to implement a wave deformation to a 3D cylinder. It's exactly the same as the DEFINE_GRID_MOTION example in the UDF manual, but in 3D. My UDF is giving me the negative cells found error. Any ideas about why my code isn't working? My UDF: /************************************************** ********************* udfexample.c UDF for a node movement of a 2d rectangular pipe ************************************************** **********************/ #include "udf.h" #define D 2e-6 #define l 630e-6 #define freq 1 DEFINE_GRID_MOTION(grid_both,domain,dt,time,dtime) { face_t f; Thread *tf = DT_THREAD((Dynamic_Thread*)dt); int n; Node *v; real radius; real theta; real x,y,z; SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); /*Set flag to induce that a current's node position has been updated only once */ begin_f_loop (f,tf) /*Loop of faces*/ { f_node_loop(f,tf,n) /*Loop of nodes on every face*/ { v= F_NODE(f,tf,n); if (NODE_POS_NEED_UPDATE(v)) { NODE_POS_UPDATED(v); x = NODE_X(v); y = NODE_Y(v); z = NODE_Z(v); radius = D/2.0*sin(x*M_PI/l*2)*sin(2*M_PI*freq*CURRENT_TIME); theta = atan(NODE_Z(v)/NODE_Y(v)); NODE_Y(v) = radius * cos(theta); NODE_Z(v) = radius * sin(theta); if (NODE_Y(v) > (D/2.0)) { NODE_Y(v)=D+y; } else { NODE_Y(v)=-y; } if (NODE_Z(v) > (D/2.0)) { NODE_Z(v)=D+z; } else { NODE_Z(v)=-z; } Message("%lf %lf\n",x,y); } } Update_Face_Metrics(f, tf); } end_f_loop(t,tf) } Last edited by robro1207; June 14, 2022 at 04:41. |
|
June 14, 2022, 07:53 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
probably you have typo here
Code:
Thread *tf = DT_THREAD((Dynamic_Thread*)dt); compile your code, read log. didn't check for other problems
__________________
best regards ****************************** press LIKE if this message was helpful |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Illegal cell label -1, fluent3DMeshToFoam | BenGher | OpenFOAM | 7 | October 10, 2023 01:02 |
Natural convection in a closed domain STILL NEEDING help! | Yr0gErG | FLUENT | 4 | December 2, 2019 01:04 |
Elastic wall deformation | 1988 | FLUENT | 2 | May 18, 2018 18:16 |
Enhanced Wall Treatment | paduchev | FLUENT | 24 | January 8, 2018 12:55 |
Multiphase flow - incorrect velocity on inlet | Mike_Tom | CFX | 6 | September 29, 2016 02:27 |