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

Check if energy is enabled from inside udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2010, 08:25
Default Check if energy is enabled from inside udf
  #1
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
I wrote a udf which reads the temperature field using macro C_T(c,t). However, if the energy equation is not enabled the udf generates a SEGMENTATION FAULT.
Is it possible to check from within the udf if there is a temperature field?

Dragos
dmoroian is offline   Reply With Quote

Old   March 31, 2010, 00:21
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by dmoroian View Post
I wrote a udf which reads the temperature field using macro C_T(c,t). However, if the energy equation is not enabled the udf generates a SEGMENTATION FAULT.
Is it possible to check from within the udf if there is a temperature field?

Dragos
#include "udf.h"
DEFINE_ON_DEMAND(test_temp_field)
{
Domain *domain;
Thread *c_thread;
domain=Get_Domain(1);
thread_loop_c(c_thread, domain) /*loops over all cell threads in domain*/
{

if(NNULLP(THREAD_STORAGE(c_thread,SV_T)))
Message0("Temp. field exists\n");
else
Message0("Temp. field doesn't exist\n");

}
gearboy is offline   Reply With Quote

Old   March 31, 2010, 03:38
Default
  #3
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Thanks Ji,
Do you have a similar check for species?

Dragos
dmoroian is offline   Reply With Quote

Old   March 31, 2010, 05:02
Default
  #4
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by dmoroian View Post
Thanks Ji,
Do you have a similar check for species?

Dragos
Use the following for species transport model.
if(NNULLP(THREAD_STORAGE(c_thread,SV_Y_I(i))))

i is the number of your specified species.
gearboy is offline   Reply With Quote

Old   March 31, 2010, 05:56
Default
  #5
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
SV_Y_I is not working (sintax error), instead I think SV_Y_0 should be used and then check for particular SV_Y_I(i)

Last edited by dmoroian; April 12, 2010 at 09:45.
dmoroian is offline   Reply With Quote

Old   April 12, 2010, 09:20
Default
  #6
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Quote:
Originally Posted by dmoroian View Post
SV_Y_I is not working (sintax error), instead I think SV_Y_0 should be used and then check for particular SV_Y_I(i)
The above test gives false positives, the following check seems to work well (12.0.16):
Code:
if(!rp_spe)
   Error("Species transport is disabled!\n");
if(2 > n_spe)
   Error("Not enough species, minim 3, current %d.\n",n_spe);

Last edited by dmoroian; April 12, 2010 at 09:46.
dmoroian 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
How to make a UDF to repeat itself ??? magnounibo Fluent UDF and Scheme Programming 5 July 26, 2011 17:15
Modelling the Heat flow inside the curing oven Marios Vlad CFX 1 February 6, 2008 08:11
Energy dissipation and Drag coefficient Freeman Main CFD Forum 10 January 27, 2006 08:42
Species Mass Fraction inside UDF using PDF? Daniel Schneider FLUENT 0 September 20, 2000 07:34
Why FVM for high-Re flows? Zhong Lei Main CFD Forum 23 May 14, 1999 14:22


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