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

Check if energy is enabled from inside udf

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   March 30, 2010, 07:25
Default Check if energy is enabled from inside udf
  #1
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 647
Rep Power: 11
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 30, 2010, 23:21
Default
  #2
Senior Member
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 106
Rep Power: 7
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, 02:38
Default
  #3
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 647
Rep Power: 11
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, 04:02
Default
  #4
Senior Member
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 106
Rep Power: 7
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, 04:56
Default
  #5
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 647
Rep Power: 11
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 08:45.
dmoroian is offline   Reply With Quote

Old   April 12, 2010, 08:20
Default
  #6
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 647
Rep Power: 11
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 08:46.
dmoroian is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
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 16: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 06:34
Why FVM for high-Re flows? Zhong Lei Main CFD Forum 23 May 14, 1999 13:22


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