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

UDF question

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2006, 14:08
Default UDF question
  #1
Ryan
Guest
 
Posts: n/a
Hello All -

I am trying to simply define the diffusivity properties of 5 different species for two different zones. I have decided using if loops is the most efficient. Everything appears to be in order, and the UDF hooks to fluent just fine, but when I attempt to begin iterating, I get "Floating Point Error: invalid number." I am not sure if fluent is even recognizing the coefficients I am putting in. Please Help!!! Cheers

#include "udf.h" DEFINE_DIFFUSIVITY(protondiff,c,t,i) {

real D; int zone_ID = THREAD_ID(t);

if (i == 1){

if (zone_ID==2)

{D = 2.03e-15;}

if (zone_ID==3)

{D =2.03e-15;} return D;}

if (i == 2){

if (zone_ID==2)

{D = 8.91e-10;}

if (zone_ID==3)

{D = 9.90e-10;} return D;}

if (i == 3){

if (zone_ID==2)

{D = 1.9285e-11;}

if (zone_ID==3)

{D = 2.03e-11;} return D;}

if (i == 4){

if (zone_ID==2)

{D = 4.275e-11;}

if (zone_ID==3)

{D = 4.5e-11;} return D;}

if (i == 5){

if (zone_ID==2)

{D =2e-15;}

if (zone_ID==3)

{D = 2e-15;} return D;} }

  Reply With Quote

Old   June 30, 2006, 16:16
Default Re: UDF question
  #2
Aidan
Guest
 
Posts: n/a
try this:

#include "udf.h" DEFINE_DIFFUSIVITY(protondiff,c,t,i) {

real D=0.0; int zone_ID = THREAD_ID(t);

if (i == 1){

if (zone_ID==2)

{D = 2.03e-15;}

if (zone_ID==3)

{D =2.03e-15;} return D;}

else if (i == 2){

if (zone_ID==2)

{D = 8.91e-10;}

if (zone_ID==3)

{D = 9.90e-10;} return D;}

else if (i == 3){

if (zone_ID==2)

{D = 1.9285e-11;}

if (zone_ID==3)

{D = 2.03e-11;} return D;}

else if (i == 4){

if (zone_ID==2)

{D = 4.275e-11;}

if (zone_ID==3)

{D = 4.5e-11;} return D;}

else if (i == 5){

if (zone_ID==2)

{D =2e-15;}

else if (zone_ID==3)

{D = 2e-15;} return D;}

else { return D; }}
  Reply With Quote

Old   July 5, 2006, 15:54
Default Re: UDF question
  #3
Ryan
Guest
 
Posts: n/a
That worked great, thanks! The numbers for species were from 0-4 though. Cheers, Ryan
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A simple UDF question Pirooz Darabi FLUENT 0 October 31, 2007 16:22
Yet another UDF question. Bee FLUENT 0 October 9, 2006 04:46
Basic question: UDF for wall heat flux Carl FLUENT 1 August 5, 2006 20:01
Question about UDF summer FLUENT 1 July 18, 2006 11:13
A question about the dynamic mesh UDF Tango FLUENT 1 November 27, 2003 03:56


All times are GMT -4. The time now is 07:27.