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

deadly need help

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 10, 2003, 09:49
Default deadly need help
  #1
vculiu
Guest
 
Posts: n/a
I have struggled for surface reaction UDF for one week, I even can not get the sample UDF in manual right. Please take a look and give me a help! Your time and kindness are greatly appreciate. The code is from 4-44 to 4-46 UDF manual.

The error is 'THREAD_STORE: undefined variable" in line of

" *rr=reaction_rate(F_C0(f,fthread), F_C0_THREAD(f,fthread),mw,yi); "

Thanks.

include "udf.h"

/* ARRHENIUS CONSTANTS */ #define PRE_EXP 1e+15 #define ACTIVE 1e+08 #define BETA 0.0

real arrhenius_rate(real temp) {

real trate =PRE_EXP*pow(temp,BETA)*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp)) ; return trate ; }

/* 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];

real tcrate = arrhenius_rate( C_T(c,cthread)) *pow(concenHF,HF_EXP) ; return tcrate; }

DEFINE_SR_RATE(arrhenius,f,fthread,r,mw,yi,rr) {

*rr = reaction_rate(F_C0(f,fthread), F_C0_THREAD(f,fthread),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

Old   November 10, 2003, 10:23
Default Re: deadly need help
  #2
cp
Guest
 
Posts: n/a
Please let us know, what error message you are getting?

Chendhil.
  Reply With Quote

Old   November 10, 2003, 10:53
Default Re: deadly need help
  #3
vculiu
Guest
 
Posts: n/a
The error is 'THREAD_STORE: undefined variable" in line of

" *rr=reaction_rate(F_C0(f,fthread), F_C0_THREAD(f,fthread),mw,yi); "

Thanks!
  Reply With Quote

Old   November 11, 2003, 11:07
Default Re: deadly need help
  #4
cp
Guest
 
Posts: n/a
I am sorry I have not come across this type of error before.

Chendhil.
  Reply With Quote

Old   November 11, 2003, 18:40
Default Re: deadly need help
  #5
jason
Guest
 
Posts: n/a
Solved the problem by using Compiled UDF rather than intepreted UDF.
  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



All times are GMT -4. The time now is 10:29.