|
[Sponsors] |
February 10, 2014, 15:02 |
Errors in defining a source term
|
#1 |
New Member
Michigan
Join Date: Jan 2013
Posts: 10
Rep Power: 12 |
Hi all,
I'm having some trouble with a source term. I used the species transport and reaction model but since the model contains polymers, I don't know the accurate standard state enthalpy. So I set the standard state enthalpy to 0 and specified a reaction source term as follows: /*UDF for energy source term of the reactions*/ #include "udf.h" #define Aw 1385.; #define Ew 3.266e+4; #define AOH 1.7348; #define EOH 4.04e+4; #define Rg 8.314; #define cw0 776.74; #define coh0 3032.56; #define cn0 4581.40; #define delhyd 7.075e+4; #define delwat 8.6e+4; DEFINE_SOURCE(energy_source1,c,t,dS,eqn) { int j; int k; real convoh; real convw; real q; real n; real source; Material *m = THREAD_MATERIAL(t); char *name = "oh"; char *name1 = "h2o<l>"; j = mixture_specie_index(m,name); k = mixture_specie_index(m,name1); convoh=(0.424-C_YI(c,t,j))/0.424;/*the comversion of oh*/ convw=(0.0127-C_YI(c,t,k))/0.0127;/*the comversion of h2o<l>*/ q=AOH*exp(-EOH/Rg/C_T(c,t))*coh0*(1.-convoh)*(cn0-2.*cw0*convw-coh0*convoh);/*The coh0*dXoh/dt*/ n=Aw*exp(-Ew/Rg/C_T(c,t))*cw0*(1.-convw);/*The cw0*dXw/dt*/ source = delhyd*q+delwat*n;/*The cw0*dXw/dt*delwater+coh0*dXoh/dt*delhyd*/ dS[eqn]=0; return source; } And I'm getting the errors when building the libudf: ..\..\src\energy_source1.c(30) : error C2143: syntax error : missing ')' before ';' ..\..\src\energy_source1.c(30) : error C2100: illegal indirection ..\..\src\energy_source1.c(30) : error C2143: syntax error : missing ';' before '/' ..\..\src\energy_source1.c(30) : error C2143: syntax error : missing ';' before '/' ..\..\src\energy_source1.c(30) : error C2100: illegal indirection ..\..\src\energy_source1.c(30) : error C2143: syntax error : missing ')' before ';' ..\..\src\energy_source1.c(30) : warning C4552: '*' : operator has no effect; expected operator with side-effect ..\..\src\energy_source1.c(30) : error C2100: illegal indirection ..\..\src\energy_source1.c(30) : warning C4552: '-' : operator has no effect; expected operator with side-effect ..\..\src\energy_source1.c(30) : error C2100: illegal indirection ..\..\src\energy_source1.c(30) : error C2143: syntax error : missing ';' before ')' ..\..\src\energy_source1.c(31) : error C2143: syntax error : missing ')' before ';' ..\..\src\energy_source1.c(31) : error C2100: illegal indirection ..\..\src\energy_source1.c(31) : error C2143: syntax error : missing ';' before '/' ..\..\src\energy_source1.c(31) : error C2143: syntax error : missing ';' before '/' ..\..\src\energy_source1.c(31) : error C2100: illegal indirection ..\..\src\energy_source1.c(32) : error C2100: illegal indirection ..\..\src\energy_source1.c(32) : warning C4552: '+' : operator has no effect; expected operator with side-effect ..\..\src\energy_source1.c(32) : error C2100: illegal indirection Can anyone help me?? |
|
February 10, 2014, 15:19 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
The #defines that you start with are wrong.
Instead of Code:
#define Aw 1385.; Code:
#define Aw 1385. The (pre-)compiler will replace things literally. So when you wrote Code:
q=AOH*exp(... Code:
q=1.7348;*exp(... |
|
February 10, 2014, 20:56 |
|
#3 |
New Member
Michigan
Join Date: Jan 2013
Posts: 10
Rep Power: 12 |
Thank you so much for your reply pakk
|
|
Tags |
compiling, source term, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Micro Scale Pore, icoFoam | gooya_kabir | OpenFOAM Running, Solving & CFD | 2 | November 2, 2013 14:58 |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 16:33 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 05:03 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |
UDFs for Scalar Eqn - Fluid/Solid HT | Greg Perkins | FLUENT | 0 | October 11, 2000 04:43 |