how to implement this kind of source term
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.
(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 .
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
make the scalars dimensionedScalars instead and make sure the argument
to exp is dimensionless.
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
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
00004 #include "parRun.H"
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"
00018 #include "OSspecific.H"
00019 #include "argList.H"
00020 #include "timeSelector.H"
00022 #ifndef namespaceFoam
00023 #define namespaceFoam
00024 using namespace Foam;
it lives at
Thank you so much it works well,the argument should be dimensionless!!!!
Sorry for disturb you. Do you know how to correct my error?
My code is:
if (levelSet[gI] > 0.0002 )
H[gI] = 1;
if (levelSet[gI] < 0.0002 )
H[gI] = 0;
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
Please do not post the same question all over the place.
|All times are GMT -4. The time now is 05:32.|