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

How to define movement/deformation relative to a rigid body motion in Fluent by udf?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By eagle_001

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 23, 2019, 12:07
Default How to define movement/deformation relative to a rigid body motion in Fluent by udf?
  #1
New Member
 
Ouyang
Join Date: Jun 2018
Posts: 6
Rep Power: 8
eagle_001 is on a distinguished road
Hello, everyone!

In the external flow field, my model can be divided into two parts, namely, Part A and Part B. The motion of Part A is defined in global coordinate, while the motion of Part B is defined relative to Part A.

Firstly, I treat both of the two parts as rigid body, and use two DEFINE_CG_MOTION macros in udf to define their motions. And define Part A first in the Dynamic Mesh Zone dialogue, then define Part B, enable the relative motion and specify the Relative Zone as Part A. These steps are described in the Uers guide. I succeeded in doing this.

After that, I treat the Part B as flexible body, and use CG_MOTION and GRID_MOTION to define the motion of Part A and Part B, respectively. In the GRID_MOTION, NODE_X(v) and NODE_Y(v) macros are used to specify the relative deformation. But when I define Part B's motion in the Dynamic Mesh Zone dialogue, I find there is no Part A can be selected in the Relative Zone box.

In the Uers guide, I found a piece of description as follow: you must specify the movement/deformation in you UDF using NODE_COORD_NEST rather than specify the final coordinates.
I search the NODE_COORD_NEST macro in the UDF manual, only one place is found and no example is shown.

So if anyone has ever defined momvement/deformation relative to a rigid body motion and could give me any help?
Thanks a million!
eagle_001 is offline   Reply With Quote

Old   May 23, 2019, 22:21
Default
  #2
New Member
 
Ouyang
Join Date: Jun 2018
Posts: 6
Rep Power: 8
eagle_001 is on a distinguished road
Hello, everyone! Thanks to Kremella, who gave me an answer in the student community.
Now, I like to share this with you.

Your code might look something like this:

begin_f_loop(f,tf)

{

f_node_loop(f,tf,n)

{

v = F_NODE(f,tf,n);

dy = …;

NV_D(NODE_COORD_NEST(v), = ,0.0,dy,0.0)

}

}

end_f_loop(f,tf);
1985788414 likes this.
eagle_001 is offline   Reply With Quote

Old   May 10, 2022, 23:46
Default Simulation help
  #3
New Member
 
central province
Join Date: Oct 2020
Posts: 9
Rep Power: 6
Krasa is on a distinguished road
I am also working with something like this can you please help me to solve my problem.
Krasa is offline   Reply With Quote

Old   May 11, 2022, 02:19
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
show your code, compilation log, describe problems
__________________
best regards


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

Old   May 12, 2022, 01:07
Default
  #5
New Member
 
central province
Join Date: Oct 2020
Posts: 9
Rep Power: 6
Krasa is on a distinguished road
Thank you so much Sir. I have written my problem below.

sir, I have a heat sink with two thin fins (0.25 mm thickness) and a substate. the heat sink is placed inside the air domain (As shown in the figure).

I want to get the flapping motion of fins (in the transverse direction(y-direction)) while the whole heat sink is vibrating in the transverse direction (y-direction). which means I need to give flapping + vibration (translation) to the fins. and only vibration(translation) to subsrate.

So I used DEFINE CG MOTION for the rigid body motion of the substate. and DEFINE GRID MOTION for the flapping of the fins.I have given substrate as Rigid Body and fins as User Define in the dynamic mesh settings.

In the first part of the UDF, I have defined the vibration motion of the substrate. and the second part flapping motion of the fins.

however, the substrate is moving with sinusoidal motion fin is only flapping in the motion. it does not move with the sinusoidal motion of the substrate.

I think because I have given the flapping motion to the fins according to origin not relative to the substrate.

Now I am trying to write the UDF which has a sinusoidal motion for the substrate and a flapping motion for fins with respect to the relative motion of the substrate.

Can you please guide me on this? Thank you.

height of the substrate is 5 mm so I gave to fins to deform after 0.005 m

my current UDF

#include "udf.h"

DEFINE_CG_MOTION(substrate, dt, vel, omega, time, dtime)
{
Real theta
real f;
real Amp;
real vec;

theta=2*3.141592654*f;
f=50;
Amp=0.003;

vec = amp * theta * cos(theta * time);

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);

vel[0]=0.0;
vel[1]=vec;
vel[2]=0.0;
Message ("time = %f, vel[1] = %f\n", time, vel[1]);
}

DEFINE_GRID_MOTION(fins,main, dt, time, dtime)
{
Thread *tf = DT_THREAD (dt);
face_t f;
Node *v;
real NV_VEC (velocity), NV_VEC (axis);
real NV_VEC (origin), NV_VEC (rvec);
real velc;
real freq;
real amp;
real w;
int n;

/* set deforming flag on adjacent cell zone */

SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf));
freq=50;
amp=0.003;
w=2*3.141592654*freq;

velc = amp * w * cos(w * time);

NV_S (velocity, =, 0.0);
NV_D (axis, =, 0.0,0.0, 1.0);
NV_D (origin, =, 0.0, 0.0, 0.0);/*center of gravity for my fin1*/

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.005
and that the current node has not been previously
visited when looping through previous faces */

if (NODE_Z (v) > 0.005 && 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);
velocity[1] = velc * pow (NODE_Z (v)/0.026, 2);

NV_V_VS (rvec, =, NODE_COORD (v), +, velocity, *, dtime);
NV_V (NODE_COORD (v), =, rvec);
}
}
}
end_f_loop (f, tf);
}
Krasa is offline   Reply With Quote

Old   May 12, 2022, 06:16
Default
  #6
New Member
 
central province
Join Date: Oct 2020
Posts: 9
Rep Power: 6
Krasa is on a distinguished road
please help me with this problem
Krasa is offline   Reply With Quote

Old   May 17, 2022, 04:41
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
what kind of problem do you have with this code? it seems to be correct
however, I didn't compile it
__________________
best regards


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

Reply

Tags
define_cg_motion, define_grid_motion, udf


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
6-DoF Rigid Body Motion jumpa72 OpenFOAM Running, Solving & CFD 6 March 1, 2024 03:38
UDF Define grid motion and Remeshing dynamic mesh nguyenhoa Fluent UDF and Scheme Programming 6 July 20, 2023 03:41
Problem with rigid body motion ghost82 EnSight 11 March 12, 2015 10:22
Dynamic Mesh Modeling - Six Degree Rigid Body Motion bluewings OpenFOAM Running, Solving & CFD 0 February 12, 2013 21:08
fluent probelm"mesh motion udf" bestrcsekhar Main CFD Forum 0 November 2, 2008 02:38


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