CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

how to implement this kind of source term

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

Like Tree1Likes
  • 1 Post By keishawillstone

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 22, 2009, 09:47
Default how to implement this kind of source term
  #1
New Member
 
mihamina keisha
Join Date: May 2009
Location: india
Posts: 19
Rep Power: 16
keishawillstone is on a distinguished road
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.
keishawillstone is offline   Reply With Quote

Old   June 22, 2009, 19:43
Default
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
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
jaswi is offline   Reply With Quote

Old   June 23, 2009, 05:44
Default information
  #3
New Member
 
mihamina keisha
Join Date: May 2009
Location: india
Posts: 19
Rep Power: 16
keishawillstone is on a distinguished road
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
keishawillstone is offline   Reply With Quote

Old   June 23, 2009, 06:04
Default
  #4
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29
niklas will become famous soon enoughniklas will become famous soon enough
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.
niklas is offline   Reply With Quote

Old   June 24, 2009, 06:38
Default
  #5
New Member
 
mihamina keisha
Join Date: May 2009
Location: india
Posts: 19
Rep Power: 16
keishawillstone is on a distinguished road
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
keishawillstone is offline   Reply With Quote

Old   June 24, 2009, 08:01
Default
  #6
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
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
jaswi is offline   Reply With Quote

Old   June 25, 2009, 09:03
Default
  #7
New Member
 
mihamina keisha
Join Date: May 2009
Location: india
Posts: 19
Rep Power: 16
keishawillstone is on a distinguished road
Hi there,
Thank you so much it works well,the argument should be dimensionless!!!!
Kummi likes this.
keishawillstone is offline   Reply With Quote

Old   July 24, 2009, 13:51
Default
  #8
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 16
isabel is on a distinguished road
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
isabel is offline   Reply With Quote

Old   July 24, 2009, 14:14
Default
  #9
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Wernigerode, Sachsen-Anhalt, Germany
Posts: 281
Rep Power: 18
henrik is on a distinguished road
Isabel,

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

Henrik
henrik is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
UDF Scalar Code: HT 1 Greg Perkins FLUENT 8 October 20, 2000 12:40
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 13, 2000 23:03
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 11, 2000 03:43


All times are GMT -4. The time now is 13:50.