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

How can I twist a surface with UDF?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 21, 2010, 11:21
Default How can I twist a surface with UDF? -solved-
  #1
Senior Member
 
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 7
enry is on a distinguished road
Hi all,
I have to twist a surface through mesh-motion. How can I do that? How should I write the UDF? Please help me...
Thanks in advace!

Last edited by enry; July 21, 2010 at 16:57.
enry is offline   Reply With Quote

Old   July 21, 2010, 16:57
Default
  #2
Senior Member
 
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 7
enry is on a distinguished road
I solved the problem, with define_grid_motion.
If somebody is interested, here is the UDF.




#include"udf.h"
DEFINE_GRID_MOTION(twist,domain,dt,time,dtime)
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;

real NV_VEC(axis);
real delta,xaxis,yaxis,teta,xn,yn,dx,dy,H;
int n;


H = 0.1; /*z-dimension of the model*/
teta = 10*3.14/180; /*rotation angle*/


begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
/* update node if the current node has not been previously
visited when looping through previous faces */
if ( NODE_POS_NEED_UPDATE (v))
{
/* indicate that node position has been update
so that it's not updated more than once */
NODE_POS_UPDATED(v);
xn = cos(teta)*NODE_X(v)-sin(teta)*NODE_Y(v);
yn = sin(teta)*NODE_X(v)+cos(teta)*NODE_Y(v);
dx = xn-NODE_X(v);
dy = yn-NODE_Y(v);
xaxis = dx/sqrt(pow(dx,2) + pow(dy,2));
yaxis = dy/sqrt(pow(dx,2) + pow(dy,2));
NV_D(axis, =, xaxis,yaxis, 0.0);
delta = sqrt(pow(dx,2) + pow(dy,2))*NODE_Z(v)/H;
NV_V_VS(NODE_COORD(v), =, NODE_COORD(v), +, axis,*,delta);


}
}
}
end_f_loop(f,tf);
}

Last edited by enry; July 21, 2010 at 17:21.
enry is offline   Reply With Quote

Old   September 16, 2010, 13:40
Default
  #3
New Member
 
Taher
Join Date: Jun 2009
Posts: 1
Rep Power: 0
Taher is on a distinguished road
Hey guys.. I need to move a 2D airfoil through certain angle of attack.. now if I dont want to use CG_Motion.. do you think I can do it through GRID_MOTION.. Like may be threading all the nodes across surface and moving them all..
Taher 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
need help regarding error in surface rxn UDF Ashish Jain FLUENT 0 May 16, 2005 10:43
need help regarding surface reaction UDF Ashish Jain FLUENT 0 May 11, 2005 14:31
solid edge problem....can you help? cindy Main CFD Forum 3 April 5, 2004 13:43
Patran Volume Meshing Deb CFX 19 April 17, 2003 10:56
free convection heat transfer from a heated horizontal surface through a liquid to a thin cooled fin Kaushik FLUENT 1 May 8, 2000 06:47


All times are GMT -4. The time now is 09:39.