CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   CG Motion UDF Problem (http://www.cfd-online.com/Forums/fluent-udf/101978-cg-motion-udf-problem.html)

leoarmas May 18, 2012 11:30

CG Motion UDF Problem
 
Hello World!

I have been working in the past few days trying to understand UDFs but i think i've reached a dead end...

This is what i'm trying to do:

I'm just trying to simulate the flow around a body wich is moving up and down with a sinusoidal law of motion. To do this i have written my UDF just as is shown below:

#include "udf.h"

DEFINE_CG_MOTION(object_mov, dt, vel, omega, time, dtime)
{
real a, w, pi;

pi = 3.1415;

/* define motion variables */
a = 0.05; /* 0.05m movement amplitude */
w = 2 * pi * 2; /* 2Hz frequency */

/* define object movement law */
vel[0] = 0;
vel[1] = -a * w * sin(w*time);
vel[2] = 0;
}

I have no problem interpreting this UDF into Fluent. However, when defining the dynamic zone the following warning appears:

"Warning: incorrect cg motion UDF wing on zone 4 (assuming no motion)"

Do you have any clue why could this be? is my UDF correctly written?
Looking forward to your answer.
Thanks!

leoarmas June 1, 2012 11:42

Just to say that I have solved the problem: CG motion macro only works when compiled!!

Jessica.S June 2, 2012 01:21

Hi,
your missing a math header, try using these:

#include "udf.h"
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "dynamesh_tools.h"
#include "storage.h"

In addition, define an intermediate (i.e. "real v = 0") variable for the motion:

v = -a * w * sin(w*time);
vel[1] = v;

hopefully it will solve your problem...

hossein66 August 1, 2012 06:58

Quote:

Originally Posted by leoarmas (Post 364313)
Just to say that I have solved the problem: CG motion macro only works when compiled!!

How do you fix it? I have this problem but I can't fix it! Can you help me?

roham4peace April 10, 2015 02:59

udf for flapping motion in hover
 
I cant write udf code for flapping motion in hover, help me, im so confused

Jessica.S April 10, 2015 03:22

do it with solidworks flow simulation.

J

manahara October 9, 2015 01:55

Quote:

Originally Posted by hossein66 (Post 374796)
How do you fix it? I have this problem but I can't fix it! Can you help me?

Hi, Define CG Motion can only be compiled not interpreted. Please try compiling the UDF rather :)


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