CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   how to implement this kind of source term (http://www.cfd-online.com/Forums/openfoam-programming-development/65647-how-implement-kind-source-term.html)

keishawillstone June 22, 2009 09:47

how to implement this kind of source term
 
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.

jaswi June 22, 2009 19:43

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

keishawillstone June 23, 2009 05:44

information
 
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

niklas June 23, 2009 06:04

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.

keishawillstone June 24, 2009 06:38

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

jaswi June 24, 2009 08:01

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

keishawillstone June 25, 2009 09:03

Hi there,
Thank you so much it works well,the argument should be dimensionless!!!!

isabel July 24, 2009 13:51

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

henrik July 24, 2009 14:14

Isabel,

Please do not post the same question all over the place.

Henrik


All times are GMT -4. The time now is 17:08.