CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   adjusting gravity using UDFs (http://www.cfd-online.com/Forums/fluent/29719-adjusting-gravity-using-udfs.html)

chriss May 5, 2002 21:08

adjusting gravity using UDFs
 
I need to adjust gravity every time step. Using Scheme this is straight forward but I can find how to do it using UDFs.

Any ideas.


Henrik Widell May 6, 2002 02:31

Re: adjusting gravity using UDFs
 
The M_gravity[ND_ND] array in models.h holds the gravity vector, so you can change gravity by changing the values in this array. I need no "include models.h" statement, I think, since this header file seems to be included through udf.h - but I might be mistaken on this.

ND_ND is 2 for a 2D case and 3 for a 3D case...

Regards,

Henrik

chriss May 6, 2002 23:07

Re: adjusting gravity using UDFs
 
Great.

Will that work with interpreted UDF's? I tried referencing M_gravity[0] with and without #include "models.h" and the preprocessor complained.

Thanks.

Henrik Widell May 7, 2002 02:01

Re: adjusting gravity using UDFs
 
What version are you using? In FLUENT 6 M_gravity is in models.h, but in FLUENT 5 it is in flow.h - both should be included if you have included udf.h though.

Will it work in interpreted UDFs? To be honest, I don't know - I gave up using the interpreted UDFs long ago, because of all the limitations and bugs. A C compiler isn't that expensive...and it saves me a lot of grief.

Henrik

Greg Perkins May 8, 2002 08:09

Re: adjusting gravity using UDFs
 
If that doesn't work, you can always add the gravity as a source term = pg to the momentum equations using your own udf. I haven't done this but I can't see why it wouldn't work.

Of course, modifying the internal gravity vector is a bit better if its possible for your interpreted udfs.

I too think compiled udfs are the way to go - interpreted stuff is generally more of a hassle. Also, I've found a unix/linux platform better than a Windows platform.

Greg


All times are GMT -4. The time now is 15:21.