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

UDFs error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 7, 2005, 23:09
Default UDFs error
  #1
Shuailin
Guest
 
Posts: n/a
Hello. I'am studying UDFs. And now I need to set a surface reaction. The reactants flow through a hollow pipe with diameter of 1mm, and the reaction takes place on the wall. First I'd like to understand the program about surface reaction(SR)in the fluent UDFs help document. I copied the program code into the VC++, and saved it as exampleSR.cpp file. When I compiled in the fluent, an error appeared: "line 9: function returning float returns double" The code is "real arrhenius_rate(real temp) { return PRE_EXP*pow(temp,BETA)*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp)); }" I tried to change "real" into double, then another error "THREAD_STORE: undeclared variable" appeared. The corresponding code is "DEFINE_SR_RATE(arrhenius,f,fthread,r,mw,yi,rr ) { *rr = reaction_rate(F_C0(f,fthread),F_C0_THREAD(f,fthrea d),mw,yi); }" There is not the variable of THREAD_STORE. How to solve the problem?

The whole program code is the follow: /************************************************** *****************/ /* UDF for specifying a custom surface reaction rate * /************************************************** *****************/ #include "udf.h" /* ARRHENIUS CONSTANTS */ #define PRE_EXP 1e+15 #define ACTIVE 1e+08 #define BETA 0.0 real arrhenius_rate(real temp) { return PRE_EXP*pow(temp,BETA)*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp)); } /* Species numbers. Must match order in Fluent panel */ #define HF 0 #define WF6 1 #define H2O 2 #define NUM_SPECS 3 /* Reaction Exponents */ #define HF_EXP 2.0 #define WF6_EXP 0.0 #define H2O_EXP 0.0 #define MW_H2 2.0 #define STOIC_H2 3.0 /* Reaction Rate Routine that is used in both UDFs */ real reaction_rate(cell_t c, Thread *cthread,real mw[],real yi[]) { real concenHF = C_R(c, cthread)*yi[HF]/mw[HF]; return arrhenius_rate(C_T(c, cthread))*pow(concenHF,HF_EXP); }

DEFINE_SR_RATE(arrhenius,f,fthread,r,mw,yi,rr) { *rr = reaction_rate(F_C0(f,fthread),F_C0_THREAD(f,fthrea d),mw,yi); } real contact_area(cell_t c, Thread *t, int s_id, int *n) { int i = 0; real area = 0.0, A[ND_ND]; *n = 0; c_face_loop(c,t,i) { if(THREAD_ID(C_FACE_THREAD(c,t,i)) == s_id) { (*n)++; F_AREA(A, C_FACE(c,t,i), C_FACE_THREAD(c,t,i)); area += NV_MAG(A); } } return area; }

  Reply With Quote

Reply


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
checking the system setup and Qt version vivek070176 OpenFOAM Installation 22 June 1, 2010 13:34
compile errors of boundary condition "expDirectionMixed" liying02ts OpenFOAM Bugs 2 February 1, 2010 21:11
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50
user defined function cfduser CFX 0 April 29, 2006 11:58


All times are GMT -4. The time now is 03:24.