CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

UDF for radial expansion

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 21, 2013, 12:54
Default UDF for radial expansion
  #1
New Member
 
Join Date: Oct 2012
Posts: 6
Rep Power: 5
kenan is on a distinguished road
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);
}
}
kenan is offline   Reply With Quote

Old   July 21, 2013, 16:54
Default
  #2
New Member
 
Join Date: Oct 2012
Posts: 6
Rep Power: 5
kenan is on a distinguished road
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.
kenan is offline   Reply With Quote

Old   October 16, 2013, 09:14
Default
  #3
New Member
 
Vit Prokop
Join Date: Nov 2011
Posts: 5
Rep Power: 6
kure87 is on a distinguished road
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);
}
kure87 is offline   Reply With Quote

Old   October 16, 2013, 10:59
Default
  #4
New Member
 
Join Date: Oct 2012
Posts: 6
Rep Power: 5
kenan is on a distinguished road
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.
kenan is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
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


All times are GMT -4. The time now is 06:51.