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

What does "false" mean in this IOobject?

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

Like Tree2Likes
  • 1 Post By TobM
  • 1 Post By floquation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 30, 2016, 10:49
Default What does "false" mean in this IOobject?
  #1
New Member
 
Adkar
Join Date: Apr 2015
Posts: 18
Rep Power: 11
adkar is on a distinguished road
Could someone please tell me what "false" means in IOobject?
This is found in so many places inside OpenFOAM.
The following is an example piece of code.

Thank you in advance.

***************************************
location: /src/thermophysicalModels/radiationModels/radiationModel/viewFactor/viewFactor.C
***************************************
Foam::tmp<Foam::volScalarField> Foam::radiation::viewFactor::Rp() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"Rp",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar
(
"zero",
dimMass/pow3(dimTime)/dimLength/pow4(dimTemperature),
0.0
)
)
);
}
*******************************
adkar is offline   Reply With Quote

Old   May 3, 2016, 08:29
Default
  #2
Member
 
Join Date: Sep 2014
Location: Germany
Posts: 88
Rep Power: 11
TobM is on a distinguished road
In: http://foam.sourceforge.net/docs/cpp/a01169.html
you see, that "false" says, that the field Rp is not a registered object. For default it is set to true.
adkar likes this.
TobM is offline   Reply With Quote

Old   May 3, 2016, 09:02
Default
  #3
New Member
 
Adkar
Join Date: Apr 2015
Posts: 18
Rep Power: 11
adkar is on a distinguished road
Firstly,thank you so much for taking your time and answering my question.

I am pretty new to OpenFOAM. But I think the above 'false' is cpp syntax.
I will do my homework in searching what registered object means

This might be wrong but, does the above "false" mean that when Rp() is called inside another class (radiationModel.C) there will not be any values sent inside the function Rp() since it is declared as "false" ?
Ru() is defined in in ViewFactors.C (the above piece of code) and called in another file called radiationModel.C


http://openfoam.com/documentation/cp...ml/a02143.html

Thank you once again.
adkar is offline   Reply With Quote

Old   May 3, 2016, 10:58
Default
  #4
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
floquation will become famous soon enough
You can compare it with local and global variables.

In principle every variable is local: it lives within the scope it was defined.

However, OpenFOAM holds a database of IOobjects. From the mesh-variable you can get any of the IOobjects stored inside that database.
Therefore, those stored IOobjects are in essence global variables: As long as you have access to a reference to the mesh instance, you can access all of those stored IOobjects.

In your code snippet it means that the only reference to the IOobject is the return value of the Rp()-function.
If it was set to true, there would be another reference to that IOobject inside OpenFOAM's "global IOobject variables" database.
adkar likes this.
floquation is offline   Reply With Quote

Old   August 5, 2016, 11:32
Default
  #5
New Member
 
Mathi
Join Date: Dec 2014
Posts: 11
Rep Power: 11
fluidmobil is on a distinguished road
thanks so far,

can someone explain the meaning of the last three lines before the closing parenthesis in the following code snippet?

Code:
lambda_
    (
        IOobject
        (
            "lambdaTemp"
            U.time().timeName(),
            U_.db()
        ),
        U_.mesh(),
        dimensionedScalar("lambdaTemp", dimensionSet(1, 1, -3, -1, 0),0),
        calculatedFvPatchScalarField::typeName
    ),
so what means U_.mesh(), dimensionedScalar and calculatedFvPatchScalarField::typeName

is a file "lambdaTemp" created somewhere?

thanks in advance

Mathi
fluidmobil is offline   Reply With Quote

Old   August 6, 2016, 17:19
Default
  #6
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
Quote:
Originally Posted by fluidmobil View Post
thanks so far,

can someone explain the meaning of the last three lines before the closing parenthesis in the following code snippet?

Code:
lambda_
    (
        IOobject
        (
            "lambdaTemp"
            U.time().timeName(),
            U_.db()
        ),
        U_.mesh(),
        dimensionedScalar("lambdaTemp", dimensionSet(1, 1, -3, -1, 0),0),
        calculatedFvPatchScalarField::typeName
    ),
so what means U_.mesh(), dimensionedScalar and calculatedFvPatchScalarField::typeName

is a file "lambdaTemp" created somewhere?

thanks in advance

Mathi
The type of your object lambda_ is volScalarField which is essentially:
Code:
//--- volFieldsFwd.H ---
typedef GeometricField<scalar, fvPatchField, volMesh> volScalarField;
Now look at the constructor of GeometricField:
Code:
//--- GeometricField.c ---
//- Constructor given IOobject, mesh, dimensioned<Type> and patch type.
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
    const IOobject& io,
    const Mesh& mesh,
    const dimensioned<Type>& dt,
    const word& patchFieldType
)
:
    Internal(io, mesh, dt, false),
    timeIndex_(this->time().timeIndex()),
    field0Ptr_(NULL),
    fieldPrevIterPtr_(NULL),
    boundaryField_(mesh.boundary(), *this, patchFieldType)
{
    if (debug)
    {
        InfoInFunction << "Creating temporary" << endl << this->info() << endl;
    }

    boundaryField_ == dt.value();

    readIfPresent();
}
The last 3 parameters unknown to you are:
U_.mesh() - a reference to mesh (as a set of finite volumes with boundaries) your field is defind on;
dimensionedScalar("lambdaTemp", dimensionSet(1, 1, -3, -1, 0),0) - a scalar zero value to initialize your field;
calculatedFvPatchScalarField::typeName - a type (expressed as a string) of boundary patches
Zeppo 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
Read a vector list with IFstream and create IOobject from it Sylv OpenFOAM Programming & Development 1 October 9, 2017 15:25
Creating a new field from terms of the turbulence model HaZe OpenFOAM Programming & Development 15 November 24, 2014 13:51
reconstructParMesh not working with an axisymetric case francesco OpenFOAM Bugs 4 May 8, 2009 05:49
IOobject and IOfield in OpenFoam xiao OpenFOAM Running, Solving & CFD 0 April 2, 2008 21:56
Saving patch motion as an IOobject jaswi OpenFOAM Running, Solving & CFD 1 June 26, 2007 13:07


All times are GMT -4. The time now is 06:24.