CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF fails to model 9.81m/s^2 gravity

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 24, 2012, 18:44
Default UDF fails to model 9.81m/s^2 gravity
  #1
jpo
Member
 
Join Date: Apr 2009
Posts: 94
Rep Power: 17
jpo is on a distinguished road
Hello,

I tried to add a z-momentum source term to model constant gravity of 9.81 m/s^2. The UDF is below.
Gravity in operating conditions panel was turned off.

Then I removed the UDF and turned gravity on in operating conditions panel and set "operating density" to 0.


The UDF failed to model 9.81m/s^2 gravity. Would anyone know why?


UDF file>>>>>>
#include "udf.h"
DEFINE_SOURCE(gravity_source,c,t,dS,eqn)
{
/* VAR */
double xc[ND_ND];
double gravity;
double source;


/* BEGIN */
C_CENTROID(xc,c,t);
gravity = 9.81;
source = gravity*C_R(c,t); /*rho g */
return source;
}
jpo is offline   Reply With Quote

Old   January 24, 2012, 19:06
Default
  #2
Senior Member
 
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16
ComputerGuy is on a distinguished road
JPO,

First: think about posting udf-related questions in the UDF forum (http://www.cfd-online.com/Forums/fluent-udf/)

Next: how is it failing? What are the error messages?

ComputerGuy

Quote:
Originally Posted by jpo View Post
Hello,

I tried to add a z-momentum source term to model constant gravity of 9.81 m/s^2. The UDF is below.
Gravity in operating conditions panel was turned off.

Then I removed the UDF and turned gravity on in operating conditions panel and set "operating density" to 0.


The UDF failed to model 9.81m/s^2 gravity. Would anyone know why?


UDF file>>>>>>
#include "udf.h"
DEFINE_SOURCE(gravity_source,c,t,dS,eqn)
{
/* VAR */
double xc[ND_ND];
double gravity;
double source;


/* BEGIN */
C_CENTROID(xc,c,t);
gravity = 9.81;
source = gravity*C_R(c,t); /*rho g */
return source;
}
ComputerGuy is offline   Reply With Quote

Old   January 24, 2012, 19:15
Default
  #3
jpo
Member
 
Join Date: Apr 2009
Posts: 94
Rep Power: 17
jpo is on a distinguished road
ComputerGuy, Thank you for suggesting the UDF forum. I was not aware of it.

How it fails? - Residuals oscillate and do not converge... The same case without UDF (gravity is defined in the oper. conditions panel) converges well.
jpo is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use of k-epsilon and k-omega Models Jade M Main CFD Forum 40 January 27, 2023 08:18
UDF for defining granular viscosity in mixture model priyanka.asp Fluent UDF and Scheme Programming 7 May 19, 2019 19:16
How to access only one phase in multiphase model by UDF wersoe Fluent UDF and Scheme Programming 1 January 4, 2017 08:11
udf: volume fraction gradient in eulerian model jwwang FLUENT 22 April 15, 2015 07:27
UDF: how to know domain number in the model? mssound FLUENT 0 May 17, 2010 16:00


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