# how to implement this kind of source term

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

 June 22, 2009, 10:47 how to implement this kind of source term #1 New Member   mihamina keisha Join Date: May 2009 Location: india Posts: 19 Rep Power: 15 hi there, I'm implementing a source term in my model and I'm stuck,here it is: volScalarField rpyro = kncell*wncell*rho*exp(Encell/(R*Ts)); and here what it says when I run it: "Argument of transcendental function not dimensionless" I don't know but it clearly says in the guide that to implement exponantial function we need to type exp(term),I defined the dimension for each term but I don't know what' wrong with it. I've checked out the trans() function and I know it but the point is that I didn't even use it. Can somebody out there tell me how to work this out please? Thanks in advance.

 June 22, 2009, 20:43 #2 Senior Member   Join Date: Mar 2009 Posts: 248 Rep Power: 16 Hi keishawillstone (sorry could not find your real name) I am not sure if this will help but just try this way: volScalarField rpyro = kncell*wncell*rho*Foam::exp(Encell/(R*Ts)); If that does not help then please try a more descriptive post as in this case it is not clear what are Encell, R and T. Are they volScalarFields or just scalars . BR Jaswi

 June 23, 2009, 06:44 information #3 New Member   mihamina keisha Join Date: May 2009 Location: india Posts: 19 Rep Power: 15 Hi Jaswi, I want to thank you first for answering me.By the way,about the precision, kncell is a scalar wncell is a scalar Encell is also a scalar R is constant used in the perfect gas law(scalar) Ts is the temperature(volScalarField) But I will try it and keep you aware of the result BR, Keisha

June 23, 2009, 07:04
#4
Super Moderator

Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 694
Rep Power: 27
Quote:
 Argument of transcendental function not dimensionless
If Ts is temperature and the others are just scalars it will have the dimension 1/K.

make the scalars dimensionedScalars instead and make sure the argument
to exp is dimensionless.

 June 24, 2009, 07:38 #5 New Member   mihamina keisha Join Date: May 2009 Location: india Posts: 19 Rep Power: 15 Hi there, What really puzzles me is that I landed on the analytical cylinder code in potentielFoam and it uses cos() and sin() though these laters are considered as transcendental function and the code didn't even included any specific header but just 'fvCFD.H'. Thank you for the information I will try it and keep you inform BR Keisha

 June 24, 2009, 09:01 #6 Senior Member   Join Date: Mar 2009 Posts: 248 Rep Power: 16 Hi There Yes you are right but please look into the fvCFD.H and you will realize that it is the mother of all headers. take a look 00001 #ifndef fvCFD_H 00002 #define fvCFD_H 00003 00004 #include "parRun.H" 00005 00006 #include "Time.H" 00007 #include "fvMesh.H" 00008 #include "fvc.H" 00009 #include "fvMatrices.H" 00010 #include "fvm.H" 00011 #include "linear.H" 00012 #include "calculatedFvPatchFields.H" 00013 #include "fixedValueFvPatchFields.H" 00014 #include "adjustPhi.H" 00015 #include "findRefCell.H" 00016 #include "mathematicalConstants.H" 00017 00018 #include "OSspecific.H" 00019 #include "argList.H" 00020 #include "timeSelector.H" 00021 00022 #ifndef namespaceFoam 00023 #define namespaceFoam 00024 using namespace Foam; 00025 #endif 00026 00027 #endif it lives at src/finiteVolume/cfdTools/general/include/fvCFD.H BR Jaswi

 June 25, 2009, 10:03 #7 New Member   mihamina keisha Join Date: May 2009 Location: india Posts: 19 Rep Power: 15 Hi there, Thank you so much it works well,the argument should be dimensionless!!!! Kummi likes this.

 July 24, 2009, 14:51 #8 Senior Member   isabel Join Date: Apr 2009 Location: Spain Posts: 171 Rep Power: 15 Sorry for disturb you. Do you know how to correct my error? My code is: forAll(levelSet,gI) { if (levelSet[gI] > 0.0002 ) H[gI] = 1; else { if (levelSet[gI] < 0.0002 ) H[gI] = 0; else H[gI] = sin(levelSet[gI]); } } And when I compile, I have this error in the line " H[gI] = sin(levelSet[gI]) " : levelSetEqn.H:91: error: call of overloaded ‘sin(double&)’ is ambiguous

 July 24, 2009, 15:14 #9 Senior Member   Henrik Rusche Join Date: Mar 2009 Location: Göttingen, Niedersachsen, Germany Posts: 280 Rep Power: 16 Isabel, Please do not post the same question all over the place. Henrik