|
[Sponsors] |
July 21, 2013, 13:54 |
UDF for radial expansion
|
#1 |
New Member
Join Date: Oct 2012
Posts: 7
Rep Power: 14 |
Hello all,
I have a simple 2D circle meshed with tetra elements. I want this circle to expand radially. For that purpose i have written the code below, using DEFINE_GRID_MOTION. This code gets face unit normal vectors on boundary, and tries each node to move through this unit vector of the face which it belongs to. However Fluent gives the error " Left handed faces detected! ". I dont know how to handle this problem. Any help would be kindly appreciated. /* Expansion-Contraction through face normal unit vector */ #include "udf.h" DEFINE_GRID_MOTION(radial-expansion, domain, dt, time, dtime) { Thread *tf = DT_THREAD(dt); face_t f; Node *v; real displ; real A[ND_ND]; /* face area normal vector */ real AMag; /* face area magnitude */ real NV_VEC(e); /* face unit normal vector */ int n; SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); displ=5*dtime; begin_f_loop(f, tf) { AMag=NV_MAG(A); NV_VS(e,=,A,/,AMag); /* face unit normal vector */ f_node_loop(f,tf,n) { v=F_NODE(f,tf,n); if (NODE_POS_NEED_UPDATE(v)) { NODE_POS_UPDATED(v); NV_V_VS(NODE_COORD(v),=, NODE_COORD(v), +, e, *, displ); } } |
|
July 21, 2013, 17:54 |
|
#2 |
New Member
Join Date: Oct 2012
Posts: 7
Rep Power: 14 |
Finally i have managed it, even with a 3D cylinder. I used position vector of each node, instead of face normal vector. I eliminate the z component of the position vector, in order to get uniform expansion (equal displacement for all nodes) for a 3-D cylinder (The central axis of the cylinder is z axis).
However, i still wonder how i could get a uniform expansion; if i would have, for example, an ellipsoid or a sphere. |
|
October 16, 2013, 10:14 |
|
#3 |
New Member
Vit Prokop
Join Date: Nov 2011
Posts: 5
Rep Power: 15 |
Hi, if it's help here is my code for normal expansion (respective fluctuation) of the surface in the Ansys Fluent. I used it for creation of the pressure waves and sound propagation excited by oscilating part.
Tested on the sphere, more complicated test will follow in next few days. Code:
/********************************************************************** NormalExpansionSurface.c UDF for specifying a transient expansion of the mesh, normal to its face ***********************************************************************/ #include "udf.h" DEFINE_GRID_MOTION(NormalExpansion3, domain, dt, time, dtime) { Thread *tf = DT_THREAD(dt); face_t f; Node *v; real displ; real NV_VEC(axis); real A[ND_ND]; /* face area normal vector */ real AMag; /* face area magnitude */ int n; SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); displ=-0.002388*cos(6280*(time+0.00025)); //grid displacement begin_f_loop(f, tf) { f_node_loop(f,tf,n) { F_AREA(A,f,tf); /*A is a vector, f face index, t thread index */ AMag=NV_MAG(A); /* Face normal vector */ A[0]=A[0]/AMag; /* X component of vector */ A[1]=A[1]/AMag; /* Y component of vector */ A[2]=A[2]/AMag; /* Z component of vector */ NV_D(axis, =, A[0], A[1], A[2]); v=F_NODE(f,tf,n); if (NODE_POS_NEED_UPDATE(v)) { NODE_POS_UPDATED(v); NV_V_VS(NODE_COORD(v), =, NODE_COORD(v), +, axis,*,displ); } } } end_f_loop(f,tf); } |
|
October 16, 2013, 11:59 |
|
#4 |
New Member
Join Date: Oct 2012
Posts: 7
Rep Power: 14 |
Hi kure87,
Thank you for your reply. Actually we have sought for almost-proper expansion of left ventricle of human heart. It is difficult to preserve the approximate shape of the LV after applying expansion operation. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |