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

Reaction Rate in UDF

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 5, 2007, 06:17
Default Reaction Rate in UDF
  #1
mahdi
Guest
 
Posts: n/a
hello all I try to write a code for a raction rate to use as UDF, but when I iterate it in fluent I see the following Error.

Error: divergence detected in AMG solver: species-0 Error Object: ()

I change the URF to arrive the minimum but this error dont disappear.

Can anyone help me?

Thanks in advance

The code is:

#include "udf.h" #include "math.h"

#define A1 4.225e15 #define A2 1.955e06 #define A3 1.02e015

#define ACH4 6.65e-4 #define AH2O 1.77e05 #define ACO 8.23e-5 #define AH2 6.12e-9

#define E1 -240.1 #define E2 67.130

#define dHCH4 -38.28 #define dHH2O 88.680 #define dHCO -70.65 #define dHH2 -82.90

#define dH1 224.0 #define dH2 -37.3 #define dH3 187.5

#define R 0.008314 DEFINE_VR_RATE(Reaction_Rate,c,t,r,mole_weight,spe cies_mf,Rate,rr_t) {

real T = C_T(c, t); real Pb = C_P(c, t); real yCH4 = species_mf[0]; real yH2O = species_mf[1]; real yCO = species_mf[2]; real yH2 = species_mf[3]; real yCO2 = species_mf[4];

double P,PCH4,PH2O,PCO,PH2,PCO2,k1,k2,KCH4,KH2O,KCO,KH2,K 1,K2,DEN,Rate1,Rate2;

P = Pb / 101325; //Conversion of paskal to bar; PCH4 = yCH4 * P; PH2O = yH2O * P; PCO = yCO * P; PH2 = yH2 * P; PCO2 = yCO2 * P;

k1 = A1 * exp (-E1/R/T); k2 = A2 * exp (-E2/R/T);

KCH4=ACH4 * exp (-dHCH4/R/T); KH2O=AH2O * exp (-dHH2O/R/T); KCO =ACO * exp (-dHCO/R/T); KH2 =AH2 * exp (-dHH2/R/T);

K1 = exp (-22819.024/T+7.951*(log(T))-0.004354*T+0.00000036067*(pow(T,2))+(4850/(pow(T,2)))-24.78); K2 = exp (5870.4418/T+1.86*(log(T))-0.00027*T-58200/(pow(T,2))-18.00628);

if (FLUID_THREAD_P(t) && THREAD_VAR(t).fluid.porous) {

DEN=1+KCO*PCO+KH2*PH2+KCH4*PCH4+(KH2O*PH2O/PH2);

Rate1=(k1/(pow(PH2,2.5))*(PCH4*PH2O-((pow(PH2,3))*PCO/K1))/(pow(DEN,2)));

Rate2=(k2/(PH2)*(PCO*PH2O-(PH2*PCO2/K2))/(pow(DEN,2)));

*Rate = Rate1 - Rate2; } else

*Rate = 0;

*rr_t = *R1CO; }
  Reply With Quote

Old   August 7, 2007, 05:27
Default Re: Reaction Rate in UDF
  #2
cg
Guest
 
Posts: n/a
This chemistry looks stiff. Try using the DEFINE_NET_REACTION rate with the Stiff Chemistry Laminar solver.
  Reply With Quote

Old   August 7, 2007, 08:31
Default Re: Reaction Rate in UDF
  #3
mahdi
Guest
 
Posts: n/a
Hi cg very Thanks

But when I use it have some another error from my code. The rete is nonlinear and I use "DEFINE_VR_RATE". Could you help me please, becouse I dont use "DEFINE_NET_REACTION" yet in a code.

The reaction I use is nonlinear.

Thanks in advance
  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
UDF molar rate of creation/destruction of species Michal Fluent UDF and Scheme Programming 1 January 18, 2013 07:26
UDF example for multi reaction in phases error3361 Fluent UDF and Scheme Programming 0 March 4, 2011 15:49
Segmentation fault in running alternateSteadyReactingFoam,why? NewKid OpenFOAM 18 January 20, 2011 16:55
Reaction Rate in UDF mahdi FLUENT 0 August 5, 2007 06:20
Reaction Rate Dhruv CD-adapco 1 October 1, 2005 10:34


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