|
[Sponsors] |
August 15, 2011, 09:36 |
UDF carbon conversion
|
#1 |
Member
Theodoros Papadopoulos
Join Date: Mar 2011
Posts: 36
Rep Power: 15 |
Hi, I wrote a UDF to calculate more accurately the carbon conversion. When I apply the UDF for each reaction separately it works perfect, but when I enable all the 4 simultaneously then it works wrong. Can someone explain me why this happen?
Thank you very much in advance for your help #include "udf.h" #define A1 113.12 /*pre-exponential factor for reaction-1*/ #define A2 1.92e5 /*pre-exponential factor for reaction-2*/ #define A3 4.18e4 /*pre-exponential factor for reaction-3*/ #define A4 0.004 /*pre-exponential factor for reaction-4*/ #define E1 1.3e8 /*activation energy for reaction-1*/ #define E2 2.71e8 /*activation energy for reaction-2*/ #define E3 2.52e8 /*activation energy for reaction-3*/ #define E4 1.69e9 /*activation energy for reaction-4*/ #define n1 0.68 /*reaction order for reaction-1*/ #define n2 0.54 /*reaction order for reaction-2*/ #define n3 0.64 /*reaction order for reaction-3*/ #define n4 1 /*reaction order for reaction-4*/ #define D1 9.69e-10 /*bulk diffusion coefficient for reaction-1*/ #define D2 7.67e-10 /*bulk diffusion coefficient for reaction-2*/ #define D3 1.23e-09 /*bulk diffusion coefficient for reaction-3*/ #define D4 3.56e-09 /*bulk diffusion coefficient for reaction-4*/ #define Mc 12 /*Molecular weight of carbon, kg/kmol*/ #define M1 32 /*Molecular weight of o2, kg/kmol*/ #define M2 44 /*Molecular weight of co2, kg/kmol*/ #define M3 18 /*Molecular weight of h2o, kg/kmol*/ #define M4 2 /*Molecular weight of h2, kg/kmol*/ #define v1 0.5 /*stoichiometric coefficient for reaction-1*/ #define v2 1 /*stoichiometric coefficient for reaction-2*/ #define v3 1 /*stoichiometric coefficient for reaction-3*/ #define v4 2 /*stoichiometric coefficient for reaction-4*/ #define At0 2.5e5 /*initial specific surface area of char particle, m^2/kg*/ #define strucpara 0.12 /*particle structure parameter*/ #define density 1100 /*particle true density, kg/m^3*/ #define f 0.7 /*surface roughness factor*/ #define tolerance 1e-4 real r1_pressure(real r1_psi, real r1_ruser[], int r1_iuser[], cxboolean r1_buser[], char *r1_cuser) { return (r1_psi-r1_ruser[0]+3/(r1_ruser[19]*pow(r1_psi,(n1-1)/2))*(1/(tanh(r1_ruser[19]*pow(r1_psi,(n1-1)/2)))-1/(r1_ruser[19]*pow(r1_psi,(n1-1)/2)))*r1_ruser[1]*pow(r1_psi,n1)*r1_ruser[2]/r1_ruser[8]/r1_ruser[20]); } real r2_pressure(real r2_psi, real r2_ruser[], int r2_iuser[], cxboolean r2_buser[], char *r2_cuser) { return (r2_psi-r2_ruser[0]+3/(r2_ruser[19]*pow(r2_psi,(n2-1)/2))*(1/(tanh(r2_ruser[19]*pow(r2_psi,(n2-1)/2)))-1/(r2_ruser[19]*pow(r2_psi,(n2-1)/2)))*r2_ruser[1]*pow(r2_psi,n2)*r2_ruser[2]/r2_ruser[8]/r2_ruser[20]); } real r3_pressure(real r3_psi, real r3_ruser[], int r3_iuser[], cxboolean r3_buser[], char *r3_cuser) { return (r3_psi-r3_ruser[0]+3/(r3_ruser[19]*pow(r3_psi,(n3-1)/2))*(1/(tanh(r3_ruser[19]*pow(r3_psi,(n3-1)/2)))-1/(r3_ruser[19]*pow(r3_psi,(n3-1)/2)))*r3_ruser[1]*pow(r3_psi,n3)*r3_ruser[2]/r3_ruser[8]/r3_ruser[20]); } real r4_pressure(real r4_psi, real r4_ruser[], int r4_iuser[], cxboolean r4_buser[], char *r4_cuser) { return (r4_psi-r4_ruser[0]+3/(r4_ruser[19]*pow(r4_psi,(n4-1)/2))*(1/(tanh(r4_ruser[19]*pow(r4_psi,(n4-1)/2)))-1/(r4_ruser[19]*pow(r4_psi,(n4-1)/2)))*r4_ruser[1]*pow(r4_psi,n4)*r4_ruser[2]/r4_ruser[8]/r4_ruser[20]); } and then using the define_pr_rate 4 times for the 4 reactions Last edited by papteo; August 15, 2011 at 09:56. Reason: more details now |
|
August 18, 2011, 08:32 |
|
#2 |
Member
Theodoros Papadopoulos
Join Date: Mar 2011
Posts: 36
Rep Power: 15 |
can someone help me pls
|
|
Tags |
carbon conversion problem |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
plotting carbon conversion | Ekiguy | FLUENT | 0 | May 28, 2011 01:57 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |