CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to define movement/deformation relative to a rigid body motion in Fluent by udf? (https://www.cfd-online.com/Forums/fluent-udf/217768-how-define-movement-deformation-relative-rigid-body-motion-fluent-udf.html)

eagle_001 May 23, 2019 11:07

How to define movement/deformation relative to a rigid body motion in Fluent by udf?
 
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 May 23, 2019 21:21

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);

Krasa May 10, 2022 22:46

Simulation help
 
I am also working with something like this can you please help me to solve my problem.

AlexanderZ May 11, 2022 01:19

show your code, compilation log, describe problems

Krasa May 12, 2022 00:07

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 May 12, 2022 05:16

please help me with this problem

AlexanderZ May 17, 2022 03:41

what kind of problem do you have with this code? it seems to be correct
however, I didn't compile it


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