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

SR_RATE not getting compiled

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 18, 2013, 11:35
Default SR_RATE not getting compiled
  #1
New Member
 
Andhra Pradesh
Join Date: Jan 2013
Posts: 13
Rep Power: 13
vismayie is on a distinguished road
The following is the surface reaction rate that i want to input to the simulation
#include "udf.h"
#define R 8.314
#define p 101325
#define pi 3.14159


DEFINE_SR_RATE(my_rate,f,t,r,mw,yi,rr)
{
Thread *t0 = t -> t0;
cell_t c0=F_C0(f,t);


real co = yi[0];
real h2o = yi[1];
real co2 = yi[2];
real h2 = yi[3];
real n2 = yi[4];
real ar = yi[5];

real rho_w = 1.0, T_w, sd=2.49045e-5;
real xco = 1.0, xh2o = 1.0, xco2 = 1.0, xh2 = 1.0, xn2 = 1.0;

real pco, ph2o, pco2, ph2, pn2, thetapt=1.0;
real k1, k2,k3,k4,k5,k6,k7,k8,k9, k10,k11,k12, k13,k14,k15,k16,k17,k18,K1eq,K2eq,K3eq,K4eq,K5eq,K 6eq,K7eq,K8eq;
real ratedecomp,rateform, rate;


T_w = F_T(f,t);
rho_w = C_R(c0,t0)*C_T(c0,t0)/T_w;

h2o *= rho_w/mw[1];
co2 *= rho_w/mw[2];
co *= rho_w/mw[0];
h2 *= rho_w/mw[3];
n2 *= rho_w/mw[4];
ar *= rho_w/mw[5];



xn2 = n2/(n2+h2+co2+co+h2o+ar);
xh2 = h2/(n2+h2+co2+co+h2o+ar);
xco2 = co2/(n2+h2+co2+co+h2o+ar);
xco = co/(n2+h2+co2+co+h2o+ar);
xh2o = h2o/(n2+h2+co2+co+h2o+ar);


pn2 = xn2*p;
ph2 = xh2*p;
ph2o = xh2o*p;
pco = xco*p;
pco2 = xco2*p;


k1 = (0.129/(R*T_w))*(sqrt((R*T_w)/(2*pi*mw[3])))*(pow((T_w/300),0.858));
k2 = (7.95*1e12*sd)*(pow((T_w/300),-0.001))*exp(((-21.76 + (2.56*(T_w/300)))*4185.8)/(R*T_w));
k3 = (9.36*1e12*sd)*(pow((T_w/300),-0.118))*exp(((-17.404 - (0.38*(T_w/300)))*4185.8)/(R*T_w));
k4 = (9.99*1e12*sd)*(pow((T_w/300),-1.049))*exp(((-13.836 + (0.92*(T_w/300)))*4185.8)/(R*T_w));
k5 = (0.108/(R*T_w))*(sqrt((R*T_w)/(2*pi*mw[1])))*(pow((T_w/300),1.162));
k6 = (2.03*1e12*sd)*(pow((T_w/300),1.372))*exp(((-11.5225 + (5*T_w))*4185.8)/(R*T_w));
k7 = (1.0/(R*T_w))*(sqrt((R*T_w)/(2*pi*mw[0])))*(pow((T_w/300),0.000));
k8 = (5.66*1e15*sd)*(pow((T_w/300),-0.5))*exp(((-28.6 + (4*T_w))*4185.8)/(R*T_w));
k9 = (0.195/(R*T_w))*(sqrt((R*T_w)/(2*pi*mw[2])))*(pow((T_w/300),0.250));
k10 = (2.63*1e12*sd)*(pow((T_w/300),-0.250))*exp(((4.8- (0.004*T_w))*4185.8)/(R*T_w));
k11 = (8.03*1e08*sd)*(pow((T_w/300),-0.531))*exp(((-9.36 + (0.28*(T_w/300)))*4185.8)/(R*T_w));
k12 = (1.25*1e09*sd)*(pow((T_w/300),0.531))*exp(((-10.021 + (0.38*(T_w/300)))*4185.8)/(R*T_w));
k13 = (8.43*1e08*sd)*(pow((T_w/300),0.024))*exp(((-9.01 - (0.00782*(T_w/300)))*4185.8)/(R*T_w));
k14 = (1.19*1e09*sd)*(pow((T_w/300),-0.024))*exp(((-10.46 + (0.67*(T_w/300)))*4185.8)/(R*T_w));
k15 = (1.06*1e11*sd)*(pow((T_w/300),0.549))*exp(((-1.1 + (0.036*(T_w/300)))*4185.8)/(R*T_w));
k16 = (9.45*1e10*sd)*(pow((T_w/300),-0.549))*exp(((-2.22 + (0.62*(T_w/300)))*4185.8)/(R*T_w));
k17 = (1.1*1e11*sd)*(pow((T_w/300),0.492))*exp(((-17.394 - (0.00136*(T_w/300)))*4185.8)/(R*T_w));
k18 = (9.07*1e10*sd)*(pow((T_w/300),-0.492))*exp(((-12.43 + (0.62*(T_w/300)))*4185.8)/(R*T_w));


K1eq = k1/k2;
K2eq = k3/k4;
K3eq = k5/k6;
K4eq = k7/k8;
K5eq = k10/k9;
K6eq = k11/k12;
K7eq = k14/k13;
K8eq = k15/k16;


thetapt=(1/(1+(K3eq*ph2o)+sqrt((ph2/K1eq))+(pco2/K5eq)+(K2eq*K3eq*ph2o*(sqrt((K1eq/ph2))))+(K4eq*pco2)+(((K5eq*K2eq*K3eq*ph2o*pco2)/K8eq)*(sqrt((ph2/K1eq))))));
rateform = (pow(thetapt,2))*(k17*K4eq*K3eq*pco2*ph2o);


if (STREQ(r->name, "reaction-1"))
{
*rr = 471*(rateform)/1000;
C_UDMI(c0,t0,0) = *rr;
}

}

Firstly could someone please go through this and comment if my code is correct or not? I compiled no errors in code.
After compiling i hooked it and used one used defined memory
But after performing iterations the outlet composition is same as inlet composition. essentially the simulation is not identifying the UDF.
Another doubt that i have is should i compile the udf first or define everything else and then compile it and hook it?
if needed i can share the simulation file with you.

Thanking you,
V.Vismayie
vismayie is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interepreted Vs. Compiled UDFs Antonis Fluent UDF and Scheme Programming 10 March 22, 2018 12:15
Odd error when using OpenFOAM compiled with --march=native JLight OpenFOAM Running, Solving & CFD 0 October 16, 2012 00:36
Using compiled UDF:s in different Fluent versions S H FLUENT 1 September 12, 2007 04:40
how to compile compiled UDF? AVINASH FLUENT 3 January 19, 2007 05:04
DEFINE_CG_MOTION Interpreted or Compiled? Aussie Shane FLUENT 0 April 20, 2006 05:50


All times are GMT -4. The time now is 14:39.