CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

DEFINE_CG_MOTION vs DEFINE_GRID_MOTION

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 28, 2012, 11:01
Default DEFINE_CG_MOTION vs DEFINE_GRID_MOTION
  #1
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 414
Rep Power: 11
cfd seeker is on a distinguished road
I am trying to simulate the flapping motion of simple wing using a UDF. I came across two types of UDF's for the said purpose. I would like to know the difference between the two types and which one is better if we want to simulate flapping/pitching/twisting/rolling motion of the wing. Thanks in advance

Regards
cfd seeker is offline   Reply With Quote

Old   September 7, 2012, 11:54
Default
  #2
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 414
Rep Power: 11
cfd seeker is on a distinguished road
Hi guys I am back with my UDF I want to simulate flapping motion of wing. The wing goes up from the mean position, comes back to the mean position and completes the half cycle in opposite direction. Here instead of going up, it again goes down and keep on flapping between mean position and downward direction which ofcourse is wrong. I am not able to figure out the mistake in the UDF. Kindly I need the help to correct it. Thanks in advance

#include "udf.h"
DEFINE_GRID_MOTION(s1020, domain, dt, time, dtime)
{
Thread *tf = DT_THREAD (dt);
face_t f;
Node *v;
real NV_VEC(omega), NV_VEC(axis), NV_VEC(dp);
real NV_VEC(origin), NV_VEC(rvec);
real sign, terma, PI;
int n;
/* set deforming flag on adjacent cell zone */
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
terma = 26.178*time;
sign = -1 * sin (26.178 * time);
Message (" terma = %10.7f\n",terma);
Message (" time = %10.5f, sign = %10.5f \n", time, sign);
PI = 3.141592654;
/* if ( terma>PI )
{
sign = -sign;
}
*/
NV_S(omega, =, 0.0);
NV_D(axis, =, 1.0, 0.0, 0.0);
NV_D(origin, =, 0.5, 0.0, 0.0);
Message (" axis = %10.5f, origin = %10.5f \n", axis, origin);
begin_f_loop(f, tf)
{
f_node_loop(f, tf, n)
{
v = F_NODE(f, tf, n);
/* update node if z position is greater than 0.02 and that the current node */
/* has not been previously visited when looping through previous faces */
if (NODE_Z(v) > 0.02 && NODE_POS_NEED_UPDATE (v))
{
/* indicate that node position has been update so taht it's not */
/* updated more than once */
NODE_POS_UPDATED(v);
omega [0] = sign * pow (NODE_Z(v)/4, 0.5);
NV_VV(rvec, =, NODE_COORD(v), -, origin);
NV_CROSS(dp, omega, rvec);
NV_S(dp, *=, dtime);
if ( terma>(2.*PI) )
NV_V(NODE_COORD(v), -=, dp);
else
NV_V(NODE_COORD(v), +=, dp);
}
}
}
end_f_loop(f, tf);
}
cfd seeker is offline   Reply With Quote

Old   September 7, 2012, 11:55
Default
  #3
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 414
Rep Power: 11
cfd seeker is on a distinguished road
I am attaching the txt file of UDF in case anybody wants to open it in C
Attached Files
File Type: txt s1020.txt (1.8 KB, 8 views)
cfd seeker 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



All times are GMT -4. The time now is 01:04.