CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF Fluent binary diffusivity (stefan Maxwell) (https://www.cfd-online.com/Forums/fluent-udf/92596-udf-fluent-binary-diffusivity-stefan-maxwell.html)

natantyt September 19, 2011 11:42

UDF Fluent binary diffusivity (stefan Maxwell)
 
Hi

Below is my code for a binary diffusivity for a gas mixture, modified from a code that exist on Ansys costumer portal. It seems that fluent does not recognize my code at all. The code compiled and loaded perfectly. But whatever I put as a value for the binary diffusivity whether a typical chapman formula or a number, the result is shown as 1#QNBe+00!


#include"udf.h"
#define NUM_SPECIES 6
#define catalyst 2
VkH2 = 7.07;
VkCO = 18.9;
VkCO2 = 26.9;
VkC3H8 = 64;
VkH2O = 12.7;
VkN2 = 17.9;

real Vk[6]={7.07,18.9,26.9,64,12.7,17.9};
real MW[6]={2,28,44,44,18,28};
real d_m[7][7];
real diff;
real divide;
Material *m;
int a,b,alpha;
alpha=0;
int j1, j2, k, n, flag,i;




DEFINE_DIFFUSIVITY(binary_diff,c,t,i)
{


real Temp = C_T(c,t);
real Pressure = 10e5+C_P(c,t);


/* Dij matrix*/

for (a=0;a<NUM_SPECIES; ++a)
{
for (b=0;b<NUM_SPECIES;++b)
{

d_m[a][b]=pow(10,-5);
}
}
/* n = # of species, n-1 # of equations */
m=THREAD_MATERIAL(t);
flag = 0;
k = NUM_SPECIES-1;
while(flag==0)
{
divide = (i+1-k)%(n-1);
if(divide==0.0)
{
j2=k;
flag=1;
}
else
k=k-1;
}

j1=((i+1-j2)/(n-1));
diff=d_m[j1][j2];
return diff;

}

Anybody has any idea? Thank You Very Much!


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