|
[Sponsors] |
April 30, 2016, 10:49 |
What does "false" mean in this IOobject?
|
#1 |
New Member
Adkar
Join Date: Apr 2015
Posts: 18
Rep Power: 11 |
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 ) ) ); } ******************************* |
|
May 3, 2016, 08:29 |
|
#2 |
Member
Join Date: Sep 2014
Location: Germany
Posts: 88
Rep Power: 11 |
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. |
|
May 3, 2016, 09:02 |
|
#3 |
New Member
Adkar
Join Date: Apr 2015
Posts: 18
Rep Power: 11 |
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. |
|
May 3, 2016, 10:58 |
|
#4 |
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20 |
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. |
|
August 5, 2016, 11:32 |
|
#5 |
New Member
Mathi
Join Date: Dec 2014
Posts: 11
Rep Power: 11 |
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 ), is a file "lambdaTemp" created somewhere? thanks in advance Mathi |
|
August 6, 2016, 17:19 |
|
#6 | |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
Quote:
Code:
//--- volFieldsFwd.H --- typedef GeometricField<scalar, fvPatchField, volMesh> volScalarField; 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(); } 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 |
||
|
|
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 |