CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Compilation error for SR_RATE (https://www.cfd-online.com/Forums/fluent-udf/112659-compilation-error-sr_rate.html)

vismayie February 2, 2013 04:57

Compilation error for SR_RATE
 
the following is my UDF :

#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 nh3 = yi[0]; /* mass fraction of nh3 at the wall*/
real n2 = yi[1];
real h2 = yi[2];
real ar = yi[3]; /* mass fraction of ar at the wall */

real rho_w = 1.0, T_w, sd=2.075e-5;
real xn2 = 1.0, xh2 = 1.0, xnh3 = 1.0;

real pn2, ph2, pnh3,thetapt=1,thetanh2=1;
real k1, k2,k3,k4,k5,k6,k7,k8,k9, k10,k11,k12, k13,k14,k15,k16,k17,k18,K1eq,K2eq,K3eq,K8eq,K9eq;
real ratedecomp,rateform, rate;

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

n2 *= rho_w/mw[1]; /* converting of mass fractions into molar concentrations */
h2 *= rho_w/mw[2];
nh3 *= rho_w/mw[0];
ar *= rho_w/mw[3];



xn2 = n2/(n2+h2+nh3+ar);
xh2 = h2/(n2+h2+nh3+ar);
xnh3 = nh3/(n2+h2+nh3+ar);


pn2 = xn2*p;
ph2 = xh2*p;
pnh3 = xnh3*p;



k1 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[2])));
k2 = (1e13*sd)*exp(-6*4185.8/(R*T_w));
k3 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[2])))*exp(-3*4185.8/(R*T_w));
k4 = (1e13*sd)*exp(-21*4185.8/(R*T_w));
k5 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[1])))*exp(-21*4185.8/(R*T_w));
k6 = (1e13*sd)*exp(-27*4185.8/(R*T_w));
k7 = (1e11*sd)*exp(-26*4185.8/(R*T_w));
k8 = (1e11*sd)*exp(-7*4185.8/(R*T_w));
k9 = (1e11*sd)*exp(-36*4185.8/(R*T_w));
k10 = (1e11*sd)*exp(-5*4185.8/(R*T_w));
k11 = (1e11*sd)*exp(-12*4185.8/(R*T_w));
k12 = (1e11*sd)*exp(-21*4185.8/(R*T_w));
k13 = (1e11*sd)*exp(-5*4185.8/(R*T_w));
k14 = (1e11*sd)*exp(-21*4185.8/(R*T_w));
k15 = (1e13*sd)*exp(-5*4185.8/(R*T_w));
k16 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[0])))*exp(-7*4185.8/(R*T_w));
k17 = (1e13*sd)*exp(-14*4185.8/(R*T_w));
k18 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[0])));


K1eq = k1*ph2/k2;
K2eq = k3*ph2/k4;
K3eq = k5*pn2/k6;
K8eq = k15/(k16*pnh3);
K9eq = k17/(k18*pnh3);


thetapt=1/(1+K1eq+sqrt(K2eq)+sqrt(K3eq)+1/K9eq);
thetanh2=thetapt/(K8eq*sqrt(K2eq));

ratedecomp=0.5*k12*thetanh2*thetapt;

rateform=0.5*k11*pow(thetapt,2)*sqrt(K2eq*K3eq)*(( k7*K1eq)+(k9*sqrt(K2eq))+k12/(K8eq*sqrt(K2eq)))/(k10+(k11+k8)*sqrt(K2eq));


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


}


when I try to interpret this it says line 9 : structure not implemented .
When I compile this, while building it shows no error and the following appears on the console window :


1 file(s) copied.
(system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\win64\2ddp\makefile")
1 file(s) copied.
(chdir "libudf")()
(chdir "win64\2ddp")()

Done.

After this when i press the load button i get the following on the console window:
"c:/users/arun/desktop/directory"

Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified.

Error Object: ()


Could anyone please help me with this as soon as possible. This is a part of my Btech project and i have a review soon so need to fix this problem at the earliest...

Thanking you,
Vismayie

epc1 February 2, 2013 08:25

Quote:

Originally Posted by vismayie (Post 405593)
the following is my UDF :

#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 nh3 = yi[0]; /* mass fraction of nh3 at the wall*/
real n2 = yi[1];
real h2 = yi[2];
real ar = yi[3]; /* mass fraction of ar at the wall */

real rho_w = 1.0, T_w, sd=2.075e-5;
real xn2 = 1.0, xh2 = 1.0, xnh3 = 1.0;

real pn2, ph2, pnh3,thetapt=1,thetanh2=1;
real k1, k2,k3,k4,k5,k6,k7,k8,k9, k10,k11,k12, k13,k14,k15,k16,k17,k18,K1eq,K2eq,K3eq,K8eq,K9eq;
real ratedecomp,rateform, rate;

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

n2 *= rho_w/mw[1]; /* converting of mass fractions into molar concentrations */
h2 *= rho_w/mw[2];
nh3 *= rho_w/mw[0];
ar *= rho_w/mw[3];



xn2 = n2/(n2+h2+nh3+ar);
xh2 = h2/(n2+h2+nh3+ar);
xnh3 = nh3/(n2+h2+nh3+ar);


pn2 = xn2*p;
ph2 = xh2*p;
pnh3 = xnh3*p;



k1 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[2])));
k2 = (1e13*sd)*exp(-6*4185.8/(R*T_w));
k3 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[2])))*exp(-3*4185.8/(R*T_w));
k4 = (1e13*sd)*exp(-21*4185.8/(R*T_w));
k5 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[1])))*exp(-21*4185.8/(R*T_w));
k6 = (1e13*sd)*exp(-27*4185.8/(R*T_w));
k7 = (1e11*sd)*exp(-26*4185.8/(R*T_w));
k8 = (1e11*sd)*exp(-7*4185.8/(R*T_w));
k9 = (1e11*sd)*exp(-36*4185.8/(R*T_w));
k10 = (1e11*sd)*exp(-5*4185.8/(R*T_w));
k11 = (1e11*sd)*exp(-12*4185.8/(R*T_w));
k12 = (1e11*sd)*exp(-21*4185.8/(R*T_w));
k13 = (1e11*sd)*exp(-5*4185.8/(R*T_w));
k14 = (1e11*sd)*exp(-21*4185.8/(R*T_w));
k15 = (1e13*sd)*exp(-5*4185.8/(R*T_w));
k16 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[0])))*exp(-7*4185.8/(R*T_w));
k17 = (1e13*sd)*exp(-14*4185.8/(R*T_w));
k18 = 0.5*(sqrt(1000/(R*T_w*2*pi*mw[0])));


K1eq = k1*ph2/k2;
K2eq = k3*ph2/k4;
K3eq = k5*pn2/k6;
K8eq = k15/(k16*pnh3);
K9eq = k17/(k18*pnh3);


thetapt=1/(1+K1eq+sqrt(K2eq)+sqrt(K3eq)+1/K9eq);
thetanh2=thetapt/(K8eq*sqrt(K2eq));

ratedecomp=0.5*k12*thetanh2*thetapt;

rateform=0.5*k11*pow(thetapt,2)*sqrt(K2eq*K3eq)*(( k7*K1eq)+(k9*sqrt(K2eq))+k12/(K8eq*sqrt(K2eq)))/(k10+(k11+k8)*sqrt(K2eq));


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


}


when I try to interpret this it says line 9 : structure not implemented .
When I compile this, while building it shows no error and the following appears on the console window :


1 file(s) copied.
(system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\win64\2ddp\makefile")
1 file(s) copied.
(chdir "libudf")()
(chdir "win64\2ddp")()

Done.

After this when i press the load button i get the following on the console window:
"c:/users/arun/desktop/directory"

Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified.

Error Object: ()


Could anyone please help me with this as soon as possible. This is a part of my Btech project and i have a review soon so need to fix this problem at the earliest...

Thanking you,
Vismayie

Do you have the case file in the same location as the udf file?

Did you open fluent via the SDK command prompt?

vismayie February 2, 2013 12:15

Hi,


I have both the case file and the udf in the same directory .
I am not aware of the SDK command prompt . How are we supposed to use it ?
Can you suggest some reading material to fix this error.

Thank you

Vismayie

epc1 February 2, 2013 12:53

Quote:

Originally Posted by vismayie (Post 405650)
Hi,


I have both the case file and the udf in the same directory .
I am not aware of the SDK command prompt . How are we supposed to use it ?
Can you suggest some reading material to fix this error.

Thank you

Vismayie

I think you are using flurent 6.3 64 bit. If you are have a look at this:

https://dl.dropbox.com/u/63453669/20...ing%20SDKx.pdf

vismayie February 3, 2013 02:31

I am trying to download the files you have asked me to. I am very new to this software and i dont understand the head and tail of it

Thank you
Vismayie

vismayie February 4, 2013 04:31

Hey,
I dont have microsoft visual studio installed in my computer at all. So which version should i download ?

Thanking you,

Vismayie

vismayie February 4, 2013 04:35

I have microsoft visual C++ 2005 so should i uninstall it before going any further

msaeedsadeghi February 5, 2013 00:19

Quote:

Originally Posted by vismayie (Post 405860)
I have microsoft visual C++ 2005 so should i uninstall it before going any further

It's better to install visual studio 2005 if your windows is 32Bit.

timjm February 22, 2013 10:40

Were you able to get your UDF working?

I am working on a similar type of setup now, i.e. many reactions at a surface, and am having a bit of trouble myself.

1. Did you need a return function?
2. Is it possible to define all of the reactions you need in a single UDF?


All times are GMT -4. The time now is 21:36.