CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Calculations and Dimensions

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 6, 2014, 09:04
Default Calculations and Dimensions
  #1
Senior Member
 
Join Date: Jan 2012
Posts: 159
Rep Power: 4
maybee is on a distinguished road
Hi,

I am working with the multiphaseEulerFoam and I recognized that sometimes fields are initialized like

Code:
volScalarField p
    (
        IOobject
        (
            "p",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
without getting dimensions. On the other hand some fields are initialized like

Code:
volVectorField U
    (
        IOobject
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedVector("U", dimVelocity, vector::zero)
    );
Should I initialize fields generally with a dimensioned type especially when using them for calculations or should I initialize fields without any dimension type (-> are they dimless then?) ?
maybee is offline   Reply With Quote

Old   March 6, 2014, 09:23
Default
  #2
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Mol, Belgium
Posts: 294
Rep Power: 13
Lieven will become famous soon enough
Hi Maybee,

The clue is in the way the field is read:

In case of your 'p'-example, the p-field must be read (IOobject::MUST_READ). Initial value of the field and also the dimensions are read from the field in the time folder "runTime.timeName()".

In case of the velocity field U. You specify IOobject::NO_READ meaning that OF will not search for an input file in the time folder but that the field is initialized by the dimensions vector (which automatically defines the dimensions).

There is an other option possible: READ_IF_PRESENT which basically combines the two previous ones. (in fact also a fourth, MUST_READ_IF_MODIFIED, but this is less relevant in the present context).

Hope this clarifies things...

Cheers,

L
Lieven is offline   Reply With Quote

Old   March 6, 2014, 13:09
Default
  #3
Senior Member
 
Join Date: Jan 2012
Posts: 159
Rep Power: 4
maybee is on a distinguished road
Thx. got it now.
maybee is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
transient calculations! lelia CD-adapco 9 April 14, 2008 09:33
How to choose a BL dimensions..? Cyril FLUENT 11 September 21, 2007 09:42
Including gravity in calculations!!! gilberto CFX 26 October 15, 2001 21:55


All times are GMT -4. The time now is 21:46.