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

 July 21, 2013, 12:54 UDF for radial expansion #1 New Member   Join Date: Oct 2012 Posts: 7 Rep Power: 6 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, 16:54 #2 New Member   Join Date: Oct 2012 Posts: 7 Rep Power: 6 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, 09:14 #3 New Member   Vit Prokop Join Date: Nov 2011 Posts: 5 Rep Power: 7 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, 10:59 #4 New Member   Join Date: Oct 2012 Posts: 7 Rep Power: 6 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.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Qureshi FLUENT 7 March 23, 2017 08:37 pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12 shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14 Luc SEMINEL FLUENT 0 November 25, 2002 05:03 Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01

All times are GMT -4. The time now is 13:11.