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/)
-   -   UDF to modify gravity vector ? (http://www.cfd-online.com/Forums/fluent-udf/96379-udf-modify-gravity-vector.html)

jpo January 20, 2012 14:21

UDF to modify gravity vector ?
 
Hello,

would anyone know how to write a UDF that modifies the definition of the gravity vector? Specifically, the magnitude of the gravity with altitude

Thank you

ComputerGuy January 20, 2012 14:41

Interesting problem. You might use a DEFINE_SOURCE macro for the x, y, or z momentum equations and specify whatever functional form of gravity you wanted. You can modify gravity (global) with the M_gravity[ND_ND] function, but it sounds like you want (effectively) cell-by-cell control.

Unchecked!
Code:

#include "udf.h"

DEFINE_SOURCE(grav_source,c,t,dS,eqn)
{
real mygrav=9.81; /*constant here, but could be some function of height.*/
real source;
source = mygrav*C_R(c,t); /*rho g */
return source;
}

ComputerGuy


Quote:

Originally Posted by jpo (Post 340364)
Hello,

would anyone know how to write a UDF that modifies the definition of the gravity vector? Specifically, the magnitude of the gravity with altitude

Thank you


jpo January 20, 2012 15:15

Thank you ComputerGuy, I appreciate your answer

jpo January 24, 2012 09:10

One clarification -

when you say "real mygrav=9.81;"
along what axis is this applied?

Thanks


All times are GMT -4. The time now is 08:03.