CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF Radiation model for combustion (http://www.cfd-online.com/Forums/fluent-udf/66883-udf-radiation-model-combustion.html)

shshiva17 July 27, 2009 14:25

UDF Radiation model for combustion
 
Hi,,,This is siva kumar from IIT MADRAS....while am interpret my udf the error is showing like.....
Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()
this error is coming in my fluent model when i interpret the source code as shown in below....fuel is methane
#include "udf.h"
DEFINE_SOURCE(energy,c,t,ds,eqn)
{
/*FILE *fp;*/
real source,tep,sigma,Pamb,tamb;
real MW[18];
real Xh2o,Xco,Xco2,Xch4,ph2o,pco,pco2,pch4;
real MWmix,sum=0;
real kapa,absh2o,absco,absco2,absch4;
real a0,a1,a2,a3,a4,a5;
real b0,b1,b2,b3,b4,b5;
real c0,c1,c2,c3,c4;
real d0,d1,d2,d3,d4;
int i;
/*fp=fopen("properties.txt","w");*/
tep=C_T(c,t);
MW[0]=1;
MW[1]=32;
MW[2]=17;
MW[3]=16;
MW[4]=2;
MW[5]=18;
MW[6]=33;
MW[7]=28;
MW[8]=44;
MW[9]=16;
MW[10]=15;
MW[11]=14;
MW[12]=30;
MW[13]=29;
MW[14]=31;
MW[15]=34;
MW[16]=13;
MW[17]=28;
sigma=0.000000056697;
Pamb=1.0;
tamb=298.0;
a0=18.741;
a1=-121.310;
a2=273.500;
a3=-194.05;
a4=56.31;
a5=-5.8169;
b0=-0.23093;
b1=1.12393;
b2=9.4153;
b3=-2.99880;
b4=0.51382;
b5=-.000018684;
c0=6.6334;
c1=-0.0035686;
c2=0.000000016682;
c3=0.00000000025611;
c4=-0.000000000000026558;
if(tep<=750)
{
d0=4.7869;
d1=-0.06953;
d2=0.000295775;
d3=-0.000000425732;
d4=0.000000000202894;
}
else
if(tep>750)
{
d0=10.09;
d1=-0.01183;
d2=0.0000047753;
d3=-0.000000000587209;
d4=-0.000000000000025334;
}
for(i=0;i<18;i++)
{
sum=sum+C_YI(c,t,i)/MW[i];
}
MWmix=1/sum;
Xh2o=C_YI(c,t,5)*MWmix/18;
Xco=C_YI(c,t,7)*MWmix/28;
Xco2=C_YI(c,t,8)*MWmix/44;
Xch4=C_YI(c,t,9)*MWmix/16;
ph2o=Xh2o*Pamb;
pco=Xco*Pamb;
pco2=Xco2*Pamb;
pch4=Xch4*Pamb;
absch4=c0+(c1*tep)+(c2*pow(tep,2))+(c3*pow(tep,3)) +(c4*pow(tep,4)
);
absco2=a0+(a1*(1000/tep))+(a2*pow(1000/tep,2))+(a3*pow(1000/tep,3
))+(a4*pow(1000/tep,4))+(a5*pow(1000/tep,5));
absco=d0+(d1*tep)+(d2*pow(tep,2))+(d3*pow(tep,3))+ (d4*pow(tep,4))
;
absh2o=b0+(b1*(1000/tep))+(b2*pow(1000/tep,2))+(b3*pow(1000/tep,3
))+(b4*pow(1000/tep,4))+(b5*pow(1000/tep,5));
kapa=(absch4*pch4)+(absco*pco)+(absco2*pco2)+(absh 2o*ph2o);
source=-(4*sigma*kapa*(pow(tep,4)-pow(tamb,4)));
/*fprintf(fp,"%f%f%f\n",tep,source,MWmix);*/
ds[eqn]=0;
return source;
}

why the error is coming i don't know please help me??????

Micael July 29, 2009 10:44

Hello Siva,

Notice the space into your variable:
kapa=(absch4*pch4)+(absco*pco)+(absco2*pco2)+(absh 2o*ph2o);

Delete that space and it should be ok:
kapa=(absch4*pch4)+(absco*pco)+(absco2*pco2)+(absh2o*ph2o);

Have a good day.

MicaŽl

shshiva17 July 29, 2009 10:59

Thank u very much MicaŽl
 
i willl try that.....thank u very much for ur reply...keep in touch with me,,,,,

shshiva17 July 29, 2009 12:28

hey MicaŽl
 
i have tried but it is not working man,,,,,???

Micael July 29, 2009 18:34

Sorry, I had not tried the UDF, only saw this space and reported it. Now I can see too that there is another problem, more difficult to find.

That is not clear to me, but the problem seems to come from C_YI(c,t,i). Using only a Species Transport model, I can successfully use your UDF. Which model do you use?

Someone reported problem using C_YI(c,t,i) with a pdf combustion model:
http://university.fluent.com/forum/v...814ae1a27f690d

Hope this can helps.

MicaŽl

shshiva17 July 30, 2009 01:59

MicaŽl
 
hi,,,,miceal,,,am using species transport model .......how can it be solved...?
see miceal am not using pdf combustion model am using only species transport model......???

Micael July 30, 2009 10:19

Here is what I did:
I enabled Species Transport. I choose "mixture-template" in the Mixture Material drop-down list. In the Materials panel, I added arbitrary fluid materials in that mixture up to 18. Finally, I hooked the UDF in the boundaries panel, adding energy source in the fluid zone. I did few iterations without bug. Do you use it that way?

If you have less then 18 species defined in your mixture there is a bug here in your code:
for(i=0;i<18;i++)
{
sum=sum+C_YI(c,t,i)/MW[i];
}

You can easily see how many species you have:
Define -> Models -> Species -> Transport & Reaction
Just look at the right of "Number of Volumetric Species"

shshiva17 July 30, 2009 10:49

u have run that file...
did get running the fluent with out error....but mine is error is coming again,,,???

Micael July 30, 2009 11:33

You have defined 18 species in your mixture?
If yes, then I don't know what is the problem.

shshiva17 July 30, 2009 12:03

miceal..
 
hi miceal my problem is 2 step methane combustion....total products are 6 how can i give 18 products ,,,,
i think we need to change the udf into 6 species,,,,,,isn't it???

Micael July 30, 2009 12:58

Did your write this UDF yourself? What it does? What is "MW"?

I thought you have 18 species because of this:
for(i=0;i<18;i++)
{
sum=sum+C_YI(c,t,i)/MW[i];
}
i in C_YI(c,t,i) is species index (integer)

What this loop intend to do?

Since you have 6 species, now it is clear to me that the problem is there.;)

Don't give up.


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