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

Heterogeneous Reaction UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2017, 23:35
Default Heterogeneous Reaction UDF
  #1
New Member
 
Abdulla
Join Date: Jan 2016
Posts: 5
Rep Power: 10
i3abdulla is on a distinguished road
Hi,

I'm looking for help to find the source of error in my UDF (code below)

So when I interpret the c code into Fluent 18.2, I get an error message saying:

cpp -I"C:\PROGRA~1\ANSYSS~1\\\Desktop\\CFD Model\\Hetrogenous_UDF.c: line 13: parse error.
Error: C:\\Users\\a.alshehhi\\Desktop\\CFD Model\\Hetrogenous_UDF.c: line 20: subthread: undeclared variable

I tried to solve it but unfortunately I couldn't, I wish if someone can help me.

Regards,


- - - - - - Start of Code -------

#include "udf.h"

DEFINE_HET_RXN_RATE(rxratedecomp,c,t,r,mw,yi,rr,rr _t)

{
Domain *d = Get_Domain(1);

const real R=8.3145;
real T, P, A0, EA, mole_frac, rho, vol_frac;
real conc [2];
const int POROUS_ID=12 , LIQ_PHASE_ID=1;
const enum {gas_phase, liquid_phase}
const enum {h2o2_w, h2o_w}
const enum {air, o2_g, h2o_g}

// phase thread pointer to the liquid phase
Thread *subthread = THREAD_SUB_THREAD(t, LIQ_PHASE_ID);

//volume fraction of the liquid phase
vol_frac=C_VOF(c,subthread);

// if the liquid is in the porous zone
if (Lookup_Thread(d, POROUS_ID) == t )
{

//pre-exponential factor for catalytic decomposition
A0=2.6*pow(10,4);

// activation energy for catalytic decomposition
EA=52.5*pow(10,3);
}

else{

//pre-exponental factor for catalytic decomposition
A0=1.0*pow(10,5.8);

// activation energy for thermal decomposition
EA=71.0*pow(10,3);
}

// temperature of the liquid phase
T=C_T(c,subthread);

// dens i ty of the liquid phase
rho=C_R(c,subthread);

//mole fraction of HP
mole_frac=yi[liquid_phase][h2o2_w]/mw[liquid_phase][h2o2_w];

// concentration of HP given by ideal gas law (kmol/m3)
conc[h2o2_w]=mole_frac*rho;

// reaction rate kmol /(m3, s )
*rr = 0.02*A0*exp(-EA/(R*T))*conc[h2o2_w]*vol_frac;
}
i3abdulla is offline   Reply With Quote

Old   December 10, 2017, 02:58
Default
  #2
New Member
 
Abdulla
Join Date: Jan 2016
Posts: 5
Rep Power: 10
i3abdulla is on a distinguished road
Is there anyone have an answer?
i3abdulla is offline   Reply With Quote

Old   December 13, 2017, 01:38
Default
  #3
New Member
 
Abdulla
Join Date: Jan 2016
Posts: 5
Rep Power: 10
i3abdulla is on a distinguished road
I hope if someone can help me
i3abdulla is offline   Reply With Quote

Reply

Tags
fluent, udf


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
write code UDF Fluent solve kinetic reaction rate equation palm oil zirkov FLUENT 0 February 13, 2017 10:16
udf for reaction hane Fluent UDF and Scheme Programming 0 April 12, 2014 03:43
UDF macros for surface reaction borhan_sd@yahoo.com Fluent UDF and Scheme Programming 0 June 6, 2013 08:57
question about udf for "particle surface reaction rate" lili Fluent UDF and Scheme Programming 0 January 9, 2013 03:37
UDF : Chemical Reaction in Catalytic Converter adhimac FLUENT 1 March 27, 2001 14:04


All times are GMT -4. The time now is 02:50.