CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Compilation error for SR_RATE

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

Reply
 
LinkBack Thread Tools Display Modes
Old   February 2, 2013, 05:57
Default Compilation error for SR_RATE
  #1
New Member
 
Andhra Pradesh
Join Date: Jan 2013
Posts: 13
Rep Power: 4
vismayie is on a distinguished road
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
vismayie is offline   Reply With Quote

Old   February 2, 2013, 09:25
Default
  #2
New Member
 
Ernesto
Join Date: Dec 2011
Posts: 18
Rep Power: 5
epc1 is on a distinguished road
Quote:
Originally Posted by vismayie View Post
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?
epc1 is offline   Reply With Quote

Old   February 2, 2013, 13:15
Default
  #3
New Member
 
Andhra Pradesh
Join Date: Jan 2013
Posts: 13
Rep Power: 4
vismayie is on a distinguished road
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
vismayie is offline   Reply With Quote

Old   February 2, 2013, 13:53
Default
  #4
New Member
 
Ernesto
Join Date: Dec 2011
Posts: 18
Rep Power: 5
epc1 is on a distinguished road
Quote:
Originally Posted by vismayie View Post
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
epc1 is offline   Reply With Quote

Old   February 3, 2013, 03:31
Default
  #5
New Member
 
Andhra Pradesh
Join Date: Jan 2013
Posts: 13
Rep Power: 4
vismayie is on a distinguished road
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 is offline   Reply With Quote

Old   February 4, 2013, 05:31
Default
  #6
New Member
 
Andhra Pradesh
Join Date: Jan 2013
Posts: 13
Rep Power: 4
vismayie is on a distinguished road
Hey,
I dont have microsoft visual studio installed in my computer at all. So which version should i download ?

Thanking you,

Vismayie
vismayie is offline   Reply With Quote

Old   February 4, 2013, 05:35
Default
  #7
New Member
 
Andhra Pradesh
Join Date: Jan 2013
Posts: 13
Rep Power: 4
vismayie is on a distinguished road
I have microsoft visual C++ 2005 so should i uninstall it before going any further
vismayie is offline   Reply With Quote

Old   February 5, 2013, 01:19
Default
  #8
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
Quote:
Originally Posted by vismayie View Post
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.
msaeedsadeghi is offline   Reply With Quote

Old   February 22, 2013, 11:40
Default
  #9
New Member
 
Tim Maguire
Join Date: Sep 2009
Posts: 19
Rep Power: 7
timjm is on a distinguished road
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?
timjm is offline   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
Compilation error for OpenFOAM-ext on Ubantu 10.04 32 bit Sargam05 OpenFOAM Installation 13 March 22, 2014 06:21
swak4Foam compilation for OF-2.0.0 camoesas OpenFOAM Installation 19 December 10, 2012 14:24
Compilation Error (V 1.7.1; Icc 12.1.0, OpenMPI 1.4.3) floydfan OpenFOAM Installation 7 December 20, 2011 06:56
errors during compilation and installation of OpenFOAM-1.7.x on Ubuntu 10.04 ftec OpenFOAM Installation 7 February 23, 2011 07:07
Compilation Error.... Arnab CD-adapco 4 September 12, 2004 15:54


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