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/)
-   -   gravity direction (https://www.cfd-online.com/Forums/fluent-udf/86696-gravity-direction.html)

metello March 30, 2011 11:48

gravity direction
 
Hello,

does anybody know if it's possible to change the direction of the gravity acceleration with a time dependent UDF?

Thanks!!

Amir March 30, 2011 16:10

Hi,
I've done it before with a proper journal file. I don't think that it can be done with UDF!

metello March 30, 2011 16:24

Thanky you for the reply,

I was thinking to use a journal file as well, but I tried write this UDF. Unfortunately it's wrong because "gravity" isn't the variable right name. Do you know which could be the proper one?


#include "udf.h"

#define PI 3.14159

DEFINE_ADJUST(gravity_change,d)
{

cell_t c;
Thread *t;
real gr[ND_ND];
real time=RP_Get_Real("flow-time");

if (time<0.25)

gr[0]=9.81*sin(PItime*4/0.25);

gr[1]=9.81*cos(PI/180*time*4/0.25);

gravity[0]=RP_Set_Real(gr[0]);
gravity[1]=RP_Set_Real(gr[1]);


}

Amir March 31, 2011 03:18

if you want to write a UDF, I have a suggestion. you can implicitly involve a gravitational effect by importing a source term in momentum equations, here it doesn't need to activate gravity effect in fluent instead write 2 UDFs for x and y momentum equations via DEFINE_SOURCE macro.

metello March 31, 2011 07:56

Great idea!
Could you be so kind to give me an example?

Amir March 31, 2011 09:12

Quote:

Originally Posted by metello (Post 301667)
Great idea!
Could you be so kind to give me an example?

of course,
your x and y momentum sources change with time. e.g. for rotating gravity it would be:
s_x=rho*g*cos(wt)
s_y=rho*g*sin(wt)

to implement a DEFINE_SOURCE UDF you can refer to UDF manual. I think it's clear.

metello March 31, 2011 11:02

I really don't know how to thank you!

But I have another question, I hope it will be the last!

Since my problem is multiphase, is it possible to read Rho or is it suppose to be a constant?

Amir March 31, 2011 11:09

I think, if you use C_R(c,t) as rho, FLUENT automatically account for that.

metello April 1, 2011 10:10

It works!

Thank you for all these aids Amir!


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