CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   dynamic mesh 2D UDF (https://www.cfd-online.com/Forums/fluent/156912-dynamic-mesh-2d-udf.html)

touyet July 15, 2015 06:38

dynamic mesh 2D UDF
 
HI everyone
I have a question to ask yours
recently I'm trying to make dynamic mesh in 2D and 3D
I want do like below
(https://www.youtube.com/watch?v=YbDSbXmgKBo)

but there is problem on UDF.
How can I write UDF ( with CG_motion or Grid motion ) to making dynamic mesh in that video??
need your help.

ctw987 April 18, 2017 19:30

hello touyet! Do you like filters?

vasava April 19, 2017 08:40

You can use DEFINE_CG_MOTION macro as shown in following example. You will have to made additional setup dynamic mesh. See Step-7 for this tutorial. You may find some hints.

Code:

#include "udf.h"

#define  omega      1.0          /* rotational speed, rad/sec        */
#define  R          0.109        /* radius of the arc, meters        */

DEFINE_CG_MOTION(butterfly_flex_UDF, dt, cg_vel, cg_omega, time, dtime)
{
  cg_vel[0] = 0.0;
  cg_vel[1] = 0.0;
  cg_vel[2] = 0.0;

  cg_omega[0] = 0.0;
  cg_omega[1] = 0.0;
  cg_omega[2] = omega;
}


D.M April 19, 2017 09:00

Hi,
the UDF you are trying to write is pretty simple, if the only velocity vector for your object is in the direction of the X axis, and the velocity magnitude is constant (0.1m/s) (your object doesn't have acceleration or drag on it), the UDF will be like below:

DEFINE_CG_MOTION(motion_disk, dt, vel, omega, time, dtime)
{
real flow_time = CURRENT_TIME;
Thread *t;
face_t f;
real x[ND_ND];
NV_S(vel, =, 0);
NV_S(omega, =, 0);
t = DT_THREAD(dt);

if (flow_time <= 0.111)
vel[0] = 0.1;
else
vel[0] = 0;

}
in the above code, i want the object to be stopped from moving any further at the time 0.111sec, you can change this time depending on the time you want your object to be stopped at. one more thing, "vel[0]" is the magnitude of the object's velocity in the X direction. if you want to add acceleration in your UDF, you just have to change the line "vel[0] = 0.1;" like:"vel[0] = -0.2 * flow_time + 0.1" .
for hooking this UDF in fluent see the help of the product.

for more accurate results i highly recommend you to use quad meshses instead of tri and use layering with sliding mesh methods. however if you are not familiar with these two methods, feel free and use smoothing-remeshing methods.

nehir May 12, 2017 08:22

I try to solve a flow past a oscillating cylinder between paralel wall. I would like to make cylinder goes up and down. But I cannot prepare udf file for cylinder motion. Can you help me? Cylinder has sinusolidal motion on y axıs direction. there is no motion on x axis. CAn you help me?


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