
[Sponsors] 
March 30, 2011, 11:48 
gravity direction

#1 
New Member
Pietro Romanazzi
Join Date: Mar 2011
Posts: 5
Rep Power: 5 
Hello,
does anybody know if it's possible to change the direction of the gravity acceleration with a time dependent UDF? Thanks!! 

March 30, 2011, 16:24 

#3 
New Member
Pietro Romanazzi
Join Date: Mar 2011
Posts: 5
Rep Power: 5 
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("flowtime"); 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]); } Last edited by metello; March 31, 2011 at 07:57. 

March 31, 2011, 03:18 

#4 
Senior Member

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.


March 31, 2011, 07:56 

#5 
New Member
Pietro Romanazzi
Join Date: Mar 2011
Posts: 5
Rep Power: 5 
Great idea!
Could you be so kind to give me an example? 

March 31, 2011, 09:12 

#6 
Senior Member

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. 

March 31, 2011, 11:02 

#7 
New Member
Pietro Romanazzi
Join Date: Mar 2011
Posts: 5
Rep Power: 5 
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? 

April 1, 2011, 10:10 

#9 
New Member
Pietro Romanazzi
Join Date: Mar 2011
Posts: 5
Rep Power: 5 
It works!
Thank you for all these aids Amir! 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
MRFInterFoam: Trouble with direction of gravity / Continuity error cannot be removed  bengt  OpenFOAM Running, Solving & CFD  2  May 28, 2010 14:45 
how to consider gravity in CFX  shrimp  CFX  4  September 8, 2008 20:41 
changing gravity vector direction using UDF  Nico  FLUENT  0  September 7, 2006 12:00 
Gravity component and inlet velocity  Vidya  FLUENT  8  July 31, 2006 08:28 
Help: gravity in CFX  Dejun Jing  CFX  2  July 22, 2002 08:58 