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

3D wall deformation with DEFINE_GRID_MOTION

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2022, 07:37
Default 3D wall deformation with DEFINE_GRID_MOTION
  #1
New Member
 
Rohan Sujeesh
Join Date: Jun 2022
Posts: 1
Rep Power: 0
robro1207 is on a distinguished road
Hi,
I'm trying to implement a wave deformation to a 3D cylinder. It's exactly the same as the DEFINE_GRID_MOTION example in the UDF manual, but in 3D. My UDF is giving me the negative cells found error. Any ideas about why my code isn't working?
My UDF:
/************************************************** *********************
udfexample.c
UDF for a node movement of a 2d rectangular pipe
************************************************** **********************/

#include "udf.h"

#define D 2e-6
#define l 630e-6
#define freq 1

DEFINE_GRID_MOTION(grid_both,domain,dt,time,dtime)
{
face_t f;
Thread *tf = DT_THREAD((Dynamic_Thread*)dt);
int n;
Node *v;
real radius;
real theta;
real x,y,z;



SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
/*Set flag to induce that a current's node position has been updated only once */
begin_f_loop (f,tf) /*Loop of faces*/
{
f_node_loop(f,tf,n) /*Loop of nodes on every face*/
{
v= F_NODE(f,tf,n);
if (NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
x = NODE_X(v);
y = NODE_Y(v);
z = NODE_Z(v);
radius = D/2.0*sin(x*M_PI/l*2)*sin(2*M_PI*freq*CURRENT_TIME);
theta = atan(NODE_Z(v)/NODE_Y(v));

NODE_Y(v) = radius * cos(theta);
NODE_Z(v) = radius * sin(theta);
if (NODE_Y(v) > (D/2.0))
{
NODE_Y(v)=D+y;
}
else
{
NODE_Y(v)=-y;
}
if (NODE_Z(v) > (D/2.0))
{
NODE_Z(v)=D+z;
}
else
{
NODE_Z(v)=-z;
}
Message("%lf %lf\n",x,y);

}
}
Update_Face_Metrics(f, tf);
}
end_f_loop(t,tf)
}

Last edited by robro1207; June 14, 2022 at 04:41.
robro1207 is offline   Reply With Quote

Old   June 14, 2022, 07:53
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
probably you have typo here
Code:
Thread *tf = DT_THREAD((Dynamic_Thread*)dt);
this is what you don't need (Dynamic_Thread*)

compile your code, read log.
didn't check for other problems
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Illegal cell label -1, fluent3DMeshToFoam BenGher OpenFOAM 7 October 10, 2023 01:02
Natural convection in a closed domain STILL NEEDING help! Yr0gErG FLUENT 4 December 2, 2019 01:04
Elastic wall deformation 1988 FLUENT 2 May 18, 2018 18:16
Enhanced Wall Treatment paduchev FLUENT 24 January 8, 2018 12:55
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27


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