STYLE: update code style for regionFaModels, optionsList

This commit is contained in:
Mark Olesen
2022-09-16 11:32:11 +02:00
parent a8057c4bc6
commit c59dc00623
26 changed files with 270 additions and 356 deletions

View File

@ -79,21 +79,6 @@ void Foam::fa::optionList::checkApplied() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fa::optionList::optionList
(
const fvPatch& p,
const dictionary& dict
)
:
PtrList<fa::option>(),
mesh_(p.boundaryMesh().mesh()),
patch_(p),
checkTimeIndex_(mesh_.time().startTimeIndex() + 2)
{
reset(optionsDict(dict));
}
Foam::fa::optionList::optionList(const fvPatch& p) Foam::fa::optionList::optionList(const fvPatch& p)
: :
PtrList<fa::option>(), PtrList<fa::option>(),
@ -103,6 +88,14 @@ Foam::fa::optionList::optionList(const fvPatch& p)
{} {}
Foam::fa::optionList::optionList(const fvPatch& p, const dictionary& dict)
:
Foam::fa::optionList(p)
{
reset(optionsDict(dict));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fa::optionList::reset(const dictionary& dict) void Foam::fa::optionList::reset(const dictionary& dict)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -81,16 +81,6 @@ void Foam::fv::optionList::checkApplied() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::optionList::optionList(const fvMesh& mesh, const dictionary& dict)
:
PtrList<fv::option>(),
mesh_(mesh),
checkTimeIndex_(mesh_.time().startTimeIndex() + 2)
{
reset(optionsDict(dict));
}
Foam::fv::optionList::optionList(const fvMesh& mesh) Foam::fv::optionList::optionList(const fvMesh& mesh)
: :
PtrList<fv::option>(), PtrList<fv::option>(),
@ -99,6 +89,14 @@ Foam::fv::optionList::optionList(const fvMesh& mesh)
{} {}
Foam::fv::optionList::optionList(const fvMesh& mesh, const dictionary& dict)
:
Foam::fv::optionList(mesh)
{
reset(optionsDict(dict));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::optionList::reset(const dictionary& dict) void Foam::fv::optionList::reset(const dictionary& dict)

View File

@ -214,7 +214,7 @@ KirchhoffShell::KirchhoffShell
), ),
w00_ w00_
( (
IOobject IOobject
( (
"w00_" + regionName_, "w00_" + regionName_,
primaryMesh().time().timeName(), primaryMesh().time().timeName(),
@ -227,7 +227,7 @@ KirchhoffShell::KirchhoffShell
), ),
laplaceW0_ laplaceW0_
( (
IOobject IOobject
( (
"laplaceW0_" + regionName_, "laplaceW0_" + regionName_,
primaryMesh().time().timeName(), primaryMesh().time().timeName(),
@ -240,7 +240,7 @@ KirchhoffShell::KirchhoffShell
), ),
laplace2W0_ laplace2W0_
( (
IOobject IOobject
( (
"laplace2W0_" + regionName_, "laplace2W0_" + regionName_,
primaryMesh().time().timeName(), primaryMesh().time().timeName(),

View File

@ -61,8 +61,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef KirchhoffShell_H #ifndef Foam_regionModels_KirchhoffShell_H
#define KirchhoffShell_H #define Foam_regionModels_KirchhoffShell_H
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "vibrationShellModel.H" #include "vibrationShellModel.H"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "velocityFilmShellFvPatchVectorField.H" #include "velocityFilmShellFvPatchVectorField.H"
#include "dictionaryContent.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -42,13 +43,13 @@ velocityFilmShellFvPatchVectorField::velocityFilmShellFvPatchVectorField
) )
: :
mixedFvPatchField<vector>(p, iF), mixedFvPatchField<vector>(p, iF),
baffle_(), baffle_(nullptr),
dict_(dictionary::null), dict_(),
curTimeIndex_(-1), curTimeIndex_(-1),
zeroWallVelocity_(true) zeroWallVelocity_(true)
{ {
refValue() = 0; refValue() = Zero;
refGrad() = 0; refGrad() = Zero;
valueFraction() = 1; valueFraction() = 1;
} }
@ -68,7 +69,7 @@ velocityFilmShellFvPatchVectorField::velocityFilmShellFvPatchVectorField
iF, iF,
mapper mapper
), ),
baffle_(), baffle_(nullptr),
dict_(ptf.dict_), dict_(ptf.dict_),
curTimeIndex_(-1), curTimeIndex_(-1),
zeroWallVelocity_(true) zeroWallVelocity_(true)
@ -84,14 +85,25 @@ velocityFilmShellFvPatchVectorField::velocityFilmShellFvPatchVectorField
: :
mixedFvPatchField<vector>(p, iF), mixedFvPatchField<vector>(p, iF),
baffle_(nullptr), baffle_(nullptr),
dict_(dict), dict_
(
// Copy dictionary, but without "heavy" data chunks
dictionaryContent::copyDict
(
dict,
wordRes(), // allow
wordRes // deny
({
"type", // redundant
"value", "refValue", "refGradient", "valueFraction"
})
)
),
curTimeIndex_(-1), curTimeIndex_(-1),
zeroWallVelocity_(dict.getOrDefault<bool>("zeroWallVelocity", true)) zeroWallVelocity_(dict.getOrDefault<bool>("zeroWallVelocity", true))
{ {
fvPatchVectorField::operator=(vectorField("value", dict, p.size())); fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
typedef regionModels::areaSurfaceFilmModels::liquidFilmBase baffle;
if (dict.found("refValue")) if (dict.found("refValue"))
{ {
// Full restart // Full restart
@ -103,13 +115,13 @@ velocityFilmShellFvPatchVectorField::velocityFilmShellFvPatchVectorField
{ {
// Start from user entered data. Assume fixedValue. // Start from user entered data. Assume fixedValue.
refValue() = *this; refValue() = *this;
refGrad() = vector::zero; refGrad() = Zero;
valueFraction() = 1; valueFraction() = 1;
} }
if (!baffle_) if (!baffle_)
{ {
baffle_.reset(baffle::New(p, dict).ptr()); baffle_.reset(baffleType::New(p, dict_));
} }
} }
@ -121,7 +133,7 @@ velocityFilmShellFvPatchVectorField::velocityFilmShellFvPatchVectorField
) )
: :
mixedFvPatchField<vector>(ptf, iF), mixedFvPatchField<vector>(ptf, iF),
baffle_(), baffle_(nullptr),
dict_(ptf.dict_), dict_(ptf.dict_),
curTimeIndex_(-1), curTimeIndex_(-1),
zeroWallVelocity_(true) zeroWallVelocity_(true)
@ -172,13 +184,6 @@ void velocityFilmShellFvPatchVectorField::updateCoeffs()
void velocityFilmShellFvPatchVectorField::write(Ostream& os) const void velocityFilmShellFvPatchVectorField::write(Ostream& os) const
{ {
mixedFvPatchField<vector>::write(os); mixedFvPatchField<vector>::write(os);
// Remove value and type already written by mixedFvPatchField
dict_.remove("value");
dict_.remove("type");
dict_.remove("refValue");
dict_.remove("refGradient");
dict_.remove("valueFraction");
dict_.write(os, false); dict_.write(os, false);
} }

View File

@ -127,10 +127,16 @@ class velocityFilmShellFvPatchVectorField
: :
public mixedFvPatchField<vector> public mixedFvPatchField<vector>
{ {
// Typedefs
//- The finite-area region model
typedef regionModels::areaSurfaceFilmModels::liquidFilmBase baffleType;
// Private Data // Private Data
//- Thermal baffle //- The liquid film
autoPtr<regionModels::areaSurfaceFilmModels::liquidFilmBase> baffle_; autoPtr<baffleType> baffle_;
//- Dictionary //- Dictionary
mutable dictionary dict_; mutable dictionary dict_;

View File

@ -45,7 +45,7 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
) )
: :
fixedValueFvPatchField<scalar>(p, iF), fixedValueFvPatchField<scalar>(p, iF),
baffle_(), baffle_(nullptr),
dict_() dict_()
{} {}
@ -65,7 +65,7 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
iF, iF,
mapper mapper
), ),
baffle_(), baffle_(nullptr),
dict_(ptf.dict_) dict_(ptf.dict_)
{} {}
@ -78,7 +78,7 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
) )
: :
fixedValueFvPatchField<scalar>(p, iF, dict), fixedValueFvPatchField<scalar>(p, iF, dict),
baffle_(), baffle_(nullptr),
dict_ dict_
( (
// Copy dictionary, but without "heavy" data chunks // Copy dictionary, but without "heavy" data chunks
@ -94,11 +94,9 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
) )
) )
{ {
typedef regionModels::thermalShellModel baffle;
if (!baffle_) if (!baffle_)
{ {
baffle_.reset(baffle::New(p, dict).ptr()); baffle_.reset(baffleType::New(p, dict_));
} }
} }
@ -110,7 +108,7 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
) )
: :
fixedValueFvPatchField<scalar>(ptf, iF), fixedValueFvPatchField<scalar>(ptf, iF),
baffle_(), baffle_(nullptr),
dict_(ptf.dict_) dict_(ptf.dict_)
{} {}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -68,8 +68,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef thermalShellFvPatchScalarField_H #ifndef Foam_thermalShellFvPatchScalarField_H
#define thermalShellFvPatchScalarField_H #define Foam_thermalShellFvPatchScalarField_H
#include "autoPtr.H" #include "autoPtr.H"
#include "thermalShellModel.H" #include "thermalShellModel.H"
@ -90,10 +90,16 @@ class thermalShellFvPatchScalarField
: :
public fixedValueFvPatchField<scalar> public fixedValueFvPatchField<scalar>
{ {
// Typedefs
//- The finite-area region model
typedef regionModels::thermalShellModel baffleType;
// Private Data // Private Data
//- Thermal baffle //- The thermal baffle
autoPtr<regionModels::thermalShellModel> baffle_; autoPtr<baffleType> baffle_;
//- Dictionary //- Dictionary
dictionary dict_; dictionary dict_;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,8 +26,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vibrationShellFvPatchScalarField.H" #include "vibrationShellFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "dictionaryContent.H" #include "dictionaryContent.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,11 +43,11 @@ vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
) )
: :
mixedFvPatchField<scalar>(p, iF), mixedFvPatchField<scalar>(p, iF),
baffle_(), baffle_(nullptr),
dict_() dict_()
{ {
refValue() = 0; refValue() = Zero;
refGrad() = 0; refGrad() = Zero;
valueFraction() = 1; valueFraction() = 1;
} }
@ -67,7 +67,7 @@ vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
iF, iF,
mapper mapper
), ),
baffle_(), baffle_(nullptr),
dict_(ptf.dict_) dict_(ptf.dict_)
{} {}
@ -80,7 +80,7 @@ vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
) )
: :
mixedFvPatchField<scalar>(p, iF), mixedFvPatchField<scalar>(p, iF),
baffle_(), baffle_(nullptr),
dict_ dict_
( (
// Copy dictionary, but without "heavy" data chunks // Copy dictionary, but without "heavy" data chunks
@ -109,13 +109,13 @@ vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
{ {
// Start from user entered data. Assume fixedValue. // Start from user entered data. Assume fixedValue.
refValue() = *this; refValue() = *this;
refGrad() = 0; refGrad() = Zero;
valueFraction() = 1; valueFraction() = 1;
} }
if (!baffle_) if (!baffle_)
{ {
baffle_.reset(regionModels::vibrationShellModel::New(p, dict).ptr()); baffle_.reset(baffleType::New(p, dict_));
} }
} }
@ -127,7 +127,7 @@ vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
) )
: :
mixedFvPatchField<scalar>(ptf, iF), mixedFvPatchField<scalar>(ptf, iF),
baffle_(), baffle_(nullptr),
dict_(ptf.dict_) dict_(ptf.dict_)
{} {}

View File

@ -79,10 +79,16 @@ class vibrationShellFvPatchScalarField
: :
public mixedFvPatchField<scalar> public mixedFvPatchField<scalar>
{ {
// Typedefs
//- The finite-area region model
typedef regionModels::vibrationShellModel baffleType;
// Private Data // Private Data
//- Thermal baffle //- The vibration shell
autoPtr<regionModels::vibrationShellModel> baffle_; autoPtr<baffleType> baffle_;
//- Dictionary //- Dictionary
dictionary dict_; dictionary dict_;

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef liquidFilmBase_H #ifndef Foam_liquidFilmBase_H
#define liquidFilmBase_H #define Foam_liquidFilmBase_H
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -111,7 +111,7 @@ protected:
//- Film pressure //- Film pressure
areaScalarField pf_; areaScalarField pf_;
//- Primary region pressure //- Primary region pressure
areaScalarField ppf_; areaScalarField ppf_;
//- Film momentum flux //- Film momentum flux
@ -289,7 +289,7 @@ public:
// Thermo variables // Thermo variables
//- Access const reference mu //- Access const reference mu
virtual const areaScalarField& mu() const = 0; virtual const areaScalarField& mu() const = 0;
//- Access const reference rho //- Access const reference rho

View File

@ -51,7 +51,7 @@ void liquidFilmModel::correctThermoFields()
{ {
scalarField X(thermo_.size(), 1); scalarField X(thermo_.size(), 1);
forAll (rho_, faceI) forAll(rho_, faceI)
{ {
rho_[faceI] = thermo_.rho(pRef_, Tf_[faceI], X); rho_[faceI] = thermo_.rho(pRef_, Tf_[faceI], X);
mu_[faceI] = thermo_.mu(pRef_, Tf_[faceI], X); mu_[faceI] = thermo_.mu(pRef_, Tf_[faceI], X);
@ -59,7 +59,7 @@ void liquidFilmModel::correctThermoFields()
Cp_[faceI] = thermo_.Cp(pRef_, Tf_[faceI], X); Cp_[faceI] = thermo_.Cp(pRef_, Tf_[faceI], X);
} }
forAll (regionMesh().boundary(), patchI) forAll(regionMesh().boundary(), patchI)
{ {
const scalarField& patchTf = Tf_.boundaryFieldRef()[patchI]; const scalarField& patchTf = Tf_.boundaryFieldRef()[patchI];

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,7 +37,9 @@ namespace areaSurfaceFilmModels
template<class FilmType> template<class FilmType>
const FilmType& filmSubModelBase::filmType() const const FilmType& filmSubModelBase::filmType() const
{ {
if (!isA<FilmType>(filmModel_)) const auto* filmPtr = isA<FilmType>(filmModel_);
if (!filmPtr)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Model " << this->modelType() << " requested film type " << "Model " << this->modelType() << " requested film type "
@ -45,7 +47,7 @@ const FilmType& filmSubModelBase::filmType() const
<< abort(FatalError); << abort(FatalError);
} }
return refCast<const FilmType>(filmModel_); return *filmPtr;
} }

View File

@ -145,8 +145,7 @@ Foam::regionModels::regionFaModel::regionFaModel
coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")), coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")),
outputPropertiesPtr_(nullptr), outputPropertiesPtr_(nullptr),
vsmPtr_(nullptr), vsmPtr_(nullptr),
patchID_(patch.index()), regionName_(dict.get<word>("region"))
regionName_(dict.lookup("region"))
{ {
constructMeshObjects(); constructMeshObjects();
initialise(); initialise();
@ -201,4 +200,5 @@ Foam::scalar Foam::regionModels::regionFaModel::CourantNumber() const
return 0; return 0;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -64,8 +64,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef regionFaModel_H #ifndef Foam_regionFaModel_H
#define regionFaModel_H #define Foam_regionFaModel_H
#include "volMesh.H" #include "volMesh.H"
#include "IOdictionary.H" #include "IOdictionary.H"
@ -79,7 +79,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace regionModels namespace regionModels
{ {
@ -134,16 +133,9 @@ protected:
//- Dictionary of output properties //- Dictionary of output properties
autoPtr<IOdictionary> outputPropertiesPtr_; autoPtr<IOdictionary> outputPropertiesPtr_;
//-Volume-to surface mapping //- Volume/surface mapping
autoPtr<volSurfaceMapping> vsmPtr_; autoPtr<volSurfaceMapping> vsmPtr_;
// Addressing
//- Patch IDs on the primary region coupled to this region
label patchID_;
//- Region name //- Region name
word regionName_; word regionName_;
@ -182,73 +174,76 @@ public:
// Member Functions // Member Functions
// Access // Access
//- Return the reference to the primary mesh database //- Return the reference to the primary mesh database
inline const fvMesh& primaryMesh() const; const fvMesh& primaryMesh() const noexcept { return primaryMesh_; }
//- Return the reference to the time database //- Return the reference to the time database
inline const Time& time() const; const Time& time() const noexcept { return time_; }
//- Return the active flag //- Return the active flag
inline const Switch& active() const; Switch active() const noexcept { return active_; }
//- Return the information flag //- Return the information flag
inline const Switch& infoOutput() const; Switch infoOutput() const noexcept { return infoOutput_; }
//- Return the model name //- Return the model name
inline const word& modelName() const; const word& modelName() const noexcept { return modelName_; }
//- Return the region mesh database //- Return the region mesh database
inline const faMesh& regionMesh() const; inline const faMesh& regionMesh() const;
//- Return the region mesh database for manipulation //- Return the region mesh database for manipulation
inline faMesh& regionMesh(); inline faMesh& regionMesh();
//- Return the model coefficients dictionary //- Return the model coefficients dictionary
inline const dictionary& coeffs() const; const dictionary& coeffs() const noexcept { return coeffs_; }
//- Return const access to the output properties dictionary //- Return const access to the output properties dictionary
inline const IOdictionary& outputProperties() const; inline const IOdictionary& outputProperties() const;
//- Return output properties dictionary //- Return output properties dictionary
inline IOdictionary& outputProperties(); inline IOdictionary& outputProperties();
//- Return the solution dictionary //- Return the solution dictionary
inline const dictionary& solution() const; inline const dictionary& solution() const;
//- Return patch ID
inline label patchID() const;
// Help Functions // Addressing
//- Return mapping between surface and volume fields //- The patch ID on the primary region coupled to this region
const volSurfaceMapping& vsm() const; label patchID() const { return patch_.index(); }
// Evolution // Helper Functions
//- Main driver routing to evolve the region - calls other evolves //- Return mapping between surface and volume fields
virtual void evolve(); const volSurfaceMapping& vsm() const;
//- Pre-evolve region
virtual void preEvolveRegion();
//- Evolve the region
virtual void evolveRegion();
//- Post-evolve region
virtual void postEvolveRegion();
//- Courant number of the region
virtual scalar CourantNumber() const;
// IO // Evolution
//- Provide some feedback //- Main driver routing to evolve the region - calls other evolves
virtual void info() = 0; virtual void evolve();
//- Pre-evolve region
virtual void preEvolveRegion();
//- Evolve the region
virtual void evolveRegion();
//- Post-evolve region
virtual void postEvolveRegion();
//- Courant number of the region
virtual scalar CourantNumber() const;
// IO
//- Provide some feedback
virtual void info() = 0;
}; };

View File

@ -29,40 +29,9 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::fvMesh&
Foam::regionModels::regionFaModel::primaryMesh() const
{
return primaryMesh_;
}
inline const Foam::Time& Foam::regionModels::regionFaModel::time() const
{
return time_;
}
inline const Foam::Switch& Foam::regionModels::regionFaModel::active() const
{
return active_;
}
inline const Foam::Switch& Foam::regionModels::regionFaModel::infoOutput() const
{
return infoOutput_;
}
inline const Foam::word& Foam::regionModels::regionFaModel::modelName() const
{
return modelName_;
}
inline const Foam::faMesh& Foam::regionModels::regionFaModel::regionMesh() const inline const Foam::faMesh& Foam::regionModels::regionFaModel::regionMesh() const
{ {
const auto* regionPtr = time_.findObject<faMesh>(regionName_); auto* regionPtr = time_.getObjectPtr<faMesh>(regionName_);
if (regionPtr) if (regionPtr)
{ {
@ -96,11 +65,6 @@ inline Foam::faMesh& Foam::regionModels::regionFaModel::regionMesh()
} }
inline const Foam::dictionary& Foam::regionModels::regionFaModel::coeffs() const
{
return coeffs_;
}
inline const Foam::IOdictionary& inline const Foam::IOdictionary&
Foam::regionModels::regionFaModel::outputProperties() const Foam::regionModels::regionFaModel::outputProperties() const
{ {
@ -135,10 +99,4 @@ Foam::regionModels::regionFaModel::solution() const
} }
inline Foam::label Foam::regionModels::regionFaModel::patchID() const
{
return patchID_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -75,11 +75,11 @@ tmp<areaScalarField> thermalShell::qr()
dimensionedScalar(dimPower/dimArea, Zero) dimensionedScalar(dimPower/dimArea, Zero)
); );
if (qrName_ != "none") if (!qrName_.empty() && qrName_ != "none")
{ {
auto& aqr = taqr.ref(); auto& aqr = taqr.ref();
const auto qr = primaryMesh().lookupObject<volScalarField>(qrName_); const auto& qr = primaryMesh().lookupObject<volScalarField>(qrName_);
const volScalarField::Boundary& vqr = qr.boundaryField(); const volScalarField::Boundary& vqr = qr.boundaryField();

View File

@ -71,8 +71,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef thermalShell_H #ifndef Foam_regionModels_thermalShell_H
#define thermalShell_H #define Foam_regionModels_thermalShell_H
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "thermalShellModel.H" #include "thermalShellModel.H"

View File

@ -65,8 +65,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef thermalShellModel_H #ifndef Foam_regionModels_thermalShellModel_H
#define thermalShellModel_H #define Foam_regionModels_thermalShellModel_H
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -103,7 +103,7 @@ protected:
//- Shell temperature //- Shell temperature
areaScalarField T_; areaScalarField T_;
//- Pointer to faOptions //- Reference to faOptions
Foam::fa::options& faOptions_; Foam::fa::options& faOptions_;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -49,12 +49,13 @@ autoPtr<thermalShellModel> thermalShellModel::New
if (!ctorPtr) if (!ctorPtr)
{ {
FatalErrorInFunction FatalIOErrorInLookup
<< "Unknown thermalShellModel type " (
<< modelType << nl << nl dict,
<< "Valid thermalShellModel types :" << nl "thermalShellModel",
<< dictionaryConstructorTablePtr_->sortedToc() modelType,
<< exit(FatalError); *dictionaryConstructorTablePtr_
) << exit(FatalIOError);
} }
return autoPtr<thermalShellModel>(ctorPtr(modelType, p, dict)); return autoPtr<thermalShellModel>(ctorPtr(modelType, p, dict));

View File

@ -68,8 +68,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef thermalShellModel_H #ifndef Foam_regionModels_vibrationShellModel_H
#define thermalShellModel_H #define Foam_regionModels_vibrationShellModel_H
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "autoPtr.H" #include "autoPtr.H"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,12 +48,13 @@ autoPtr<vibrationShellModel> vibrationShellModel::New
if (!ctorPtr) if (!ctorPtr)
{ {
FatalErrorInFunction FatalIOErrorInLookup
<< "Unknown vibrationShellModel type " (
<< modelType << nl << nl dict,
<< "Valid vibrationShellModel types :" << nl "vibrationShellModel",
<< dictionaryConstructorTablePtr_->sortedToc() modelType,
<< exit(FatalError); *dictionaryConstructorTablePtr_
) << exit(FatalIOError);
} }
return autoPtr<vibrationShellModel>(ctorPtr(modelType, p, dict)); return autoPtr<vibrationShellModel>(ctorPtr(modelType, p, dict));

View File

@ -62,7 +62,6 @@ class regionModel
: :
public IOdictionary public IOdictionary
{ {
private: private:
// Private Member Functions // Private Member Functions
@ -132,7 +131,7 @@ protected:
interRegionAMI_; interRegionAMI_;
// Protected member functions // Protected Member Functions
//- Read control parameters from dictionary //- Read control parameters from dictionary
virtual bool read(); virtual bool read();
@ -187,65 +186,64 @@ public:
// Member Functions // Member Functions
// Access // Access
//- Return the reference to the primary mesh database //- Return the reference to the primary mesh database
inline const fvMesh& primaryMesh() const; const fvMesh& primaryMesh() const noexcept { return primaryMesh_; }
//- Return the reference to the time database //- Return the reference to the time database
inline const Time& time() const; const Time& time() const noexcept { return time_; }
//- Return the active flag //- Return the active flag
inline Switch active() const; Switch active() const noexcept { return active_; }
//- Return the information flag //- Return the information flag
inline Switch infoOutput() const; Switch infoOutput() const noexcept { return infoOutput_; }
//- Return the model name //- Return the model name
inline const word& modelName() const; const word& modelName() const noexcept { return modelName_; }
//- Return the region mesh database //- Return the region mesh database
inline const fvMesh& regionMesh() const; inline const fvMesh& regionMesh() const;
//- Return the region mesh database for manipulation //- Return the region mesh database for manipulation
inline fvMesh& regionMesh(); inline fvMesh& regionMesh();
//- Return the model coefficients dictionary //- Return the model coefficients dictionary
inline const dictionary& coeffs() const; const dictionary& coeffs() const noexcept { return coeffs_; }
//- Return the solution dictionary //- Return the solution dictionary
inline const dictionary& solution() const; inline const dictionary& solution() const;
//- Return const access to the output properties dictionary //- Return const access to the output properties dictionary
inline const IOdictionary& outputProperties() const; inline const IOdictionary& outputProperties() const;
//- Return output properties dictionary //- Return output properties dictionary
inline IOdictionary& outputProperties(); inline IOdictionary& outputProperties();
// Addressing
//- Return true if patchi on the local region is a coupled // Addressing
// patch to the primary region
inline bool isCoupledPatch(const label regionPatchi) const;
//- Return true if patchi on the primary region is a coupled //- List of patch IDs on the primary region coupled to this region
// patch to the local region inline const labelList& primaryPatchIDs() const noexcept;
inline bool isRegionPatch(const label primaryPatchi) const;
//- Return the list of patch IDs on the primary region coupled //- List of patch IDs internally coupled with the primary region
// to this region inline const labelList& intCoupledPatchIDs() const noexcept;
inline const labelList& primaryPatchIDs() const;
//- Return the list of patch IDs internally coupled with the //- True if patchi on the local region is a coupled
// primary region //- patch to the primary region
inline const labelList& intCoupledPatchIDs() const; inline bool isCoupledPatch(const label regionPatchi) const;
//- Return region ID corresponding to primaryPatchID //- True if patchi on the primary region is a coupled
inline label regionPatchID(const label primaryPatchID) const; //- patch to the local region
inline bool isRegionPatch(const label primaryPatchi) const;
//- Return region ID corresponding to primaryPatch ID
inline label regionPatchID(const label primaryPatchi) const;
// Helper // Helper Functions
//- Return the coupled patch ID paired with coupled patch //- Return the coupled patch ID paired with coupled patch
// regionPatchi // regionPatchi
@ -322,25 +320,25 @@ public:
) const; ) const;
// Evolution // Evolution
//- Main driver routing to evolve the region - calls other evolves //- Main driver routing to evolve the region - calls other evolves
virtual void evolve(); virtual void evolve();
//- Pre-evolve region //- Pre-evolve region
virtual void preEvolveRegion(); virtual void preEvolveRegion();
//- Evolve the region //- Evolve the region
virtual void evolveRegion(); virtual void evolveRegion();
//- Post-evolve region //- Post-evolve region
virtual void postEvolveRegion(); virtual void postEvolveRegion();
// I-O // I-O
//- Provide some feedback //- Provide some feedback
virtual void info(); virtual void info();
}; };

View File

@ -30,37 +30,6 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::fvMesh&
Foam::regionModels::regionModel::primaryMesh() const
{
return primaryMesh_;
}
inline const Foam::Time& Foam::regionModels::regionModel::time() const
{
return time_;
}
inline Foam::Switch Foam::regionModels::regionModel::active() const
{
return active_;
}
inline Foam::Switch Foam::regionModels::regionModel::infoOutput() const
{
return infoOutput_;
}
inline const Foam::word& Foam::regionModels::regionModel::modelName() const
{
return modelName_;
}
inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const
{ {
const fvMesh* regionPtr = time_.getObjectPtr<fvMesh>(regionName_); const fvMesh* regionPtr = time_.getObjectPtr<fvMesh>(regionName_);
@ -89,12 +58,6 @@ inline Foam::fvMesh& Foam::regionModels::regionModel::regionMesh()
} }
inline const Foam::dictionary& Foam::regionModels::regionModel::coeffs() const
{
return coeffs_;
}
inline const Foam::dictionary& inline const Foam::dictionary&
Foam::regionModels::regionModel::solution() const Foam::regionModels::regionModel::solution() const
{ {
@ -130,20 +93,26 @@ Foam::regionModels::regionModel::outputProperties()
} }
inline const Foam::labelList&
Foam::regionModels::regionModel::primaryPatchIDs() const noexcept
{
return primaryPatchIDs_;
}
inline const Foam::labelList&
Foam::regionModels::regionModel::intCoupledPatchIDs() const noexcept
{
return intCoupledPatchIDs_;
}
inline bool Foam::regionModels::regionModel::isCoupledPatch inline bool Foam::regionModels::regionModel::isCoupledPatch
( (
const label regionPatchi const label regionPatchi
) const ) const
{ {
forAll(intCoupledPatchIDs_, i) return intCoupledPatchIDs_.found(regionPatchi);
{
if (intCoupledPatchIDs_[i] == regionPatchi)
{
return true;
}
}
return false;
} }
@ -152,46 +121,18 @@ inline bool Foam::regionModels::regionModel::isRegionPatch
const label primaryPatchi const label primaryPatchi
) const ) const
{ {
forAll(primaryPatchIDs_, i) return primaryPatchIDs_.found(primaryPatchi);
{
if (primaryPatchIDs_[i] == primaryPatchi)
{
return true;
}
}
return false;
}
inline const Foam::labelList&
Foam::regionModels::regionModel::primaryPatchIDs() const
{
return primaryPatchIDs_;
}
inline const Foam::labelList&
Foam::regionModels::regionModel::intCoupledPatchIDs() const
{
return intCoupledPatchIDs_;
} }
inline Foam::label Foam::regionModels::regionModel::regionPatchID inline Foam::label Foam::regionModels::regionModel::regionPatchID
( (
const label primaryPatchID const label primaryPatchi
) const ) const
{ {
forAll(primaryPatchIDs_, i) const label i = primaryPatchIDs_.find(primaryPatchi);
{
if (primaryPatchIDs_[i] == primaryPatchID)
{
return intCoupledPatchIDs_[i];
}
}
return -1; return (i >= 0 ? intCoupledPatchIDs_[i] : -1);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd Copyright (C) 2020-2022 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -49,7 +49,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
turbulentTemperatureRadCoupledMixedFvPatchScalarField(p, iF), turbulentTemperatureRadCoupledMixedFvPatchScalarField(p, iF),
owner_(false), owner_(false),
internal_(true), internal_(true),
baffle_(), baffle_(nullptr),
dict_(), dict_(),
extrudeMeshPtr_() extrudeMeshPtr_()
{} {}
@ -72,7 +72,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
), ),
owner_(ptf.owner_), owner_(ptf.owner_),
internal_(ptf.internal_), internal_(ptf.internal_),
baffle_(), baffle_(nullptr),
dict_(ptf.dict_), dict_(ptf.dict_),
extrudeMeshPtr_() extrudeMeshPtr_()
{} {}
@ -88,15 +88,13 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
turbulentTemperatureRadCoupledMixedFvPatchScalarField(p, iF, dict), turbulentTemperatureRadCoupledMixedFvPatchScalarField(p, iF, dict),
owner_(false), owner_(false),
internal_(true), internal_(true),
baffle_(), baffle_(nullptr),
dict_(dict), dict_(dict),
extrudeMeshPtr_() extrudeMeshPtr_()
{ {
const fvMesh& thisMesh = patch().boundaryMesh().mesh(); const fvMesh& thisMesh = patch().boundaryMesh().mesh();
typedef regionModels::thermalBaffleModels::thermalBaffleModel baffle;
word regionName("none"); word regionName("none");
dict_.readIfPresent("region", regionName); dict_.readIfPresent("region", regionName);
@ -115,7 +113,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
createPatchMesh(); createPatchMesh();
} }
baffle_.reset(baffle::New(thisMesh, dict).ptr()); baffle_.reset(baffleType::New(thisMesh, dict));
owner_ = true; owner_ = true;
baffle_->rename(baffleName); baffle_->rename(baffleName);
} }
@ -131,7 +129,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
turbulentTemperatureRadCoupledMixedFvPatchScalarField(ptf, iF), turbulentTemperatureRadCoupledMixedFvPatchScalarField(ptf, iF),
owner_(ptf.owner_), owner_(ptf.owner_),
internal_(ptf.internal_), internal_(ptf.internal_),
baffle_(), baffle_(nullptr),
dict_(ptf.dict_), dict_(ptf.dict_),
extrudeMeshPtr_() extrudeMeshPtr_()
{} {}

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd Copyright (C) 2020-2022 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -229,7 +229,15 @@ class thermalBaffleFvPatchScalarField
: :
public turbulentTemperatureRadCoupledMixedFvPatchScalarField public turbulentTemperatureRadCoupledMixedFvPatchScalarField
{ {
// Private data // Typedefs
//- The baffle region model
typedef
regionModels::thermalBaffleModels::thermalBaffleModel
baffleType;
// Private Data
//- Enumeration of patch IDs //- Enumeration of patch IDs
enum patchID enum patchID
@ -246,7 +254,7 @@ class thermalBaffleFvPatchScalarField
bool internal_; bool internal_;
//- Thermal baffle //- Thermal baffle
autoPtr<regionModels::thermalBaffleModels::thermalBaffleModel> baffle_; autoPtr<baffleType> baffle_;
//- Dictionary //- Dictionary
dictionary dict_; dictionary dict_;
@ -255,7 +263,7 @@ class thermalBaffleFvPatchScalarField
autoPtr<extrudePatchMesh> extrudeMeshPtr_; autoPtr<extrudePatchMesh> extrudeMeshPtr_;
// Private member functions // Private Member Functions
//- Extrude mesh //- Extrude mesh
void createPatchMesh(); void createPatchMesh();
@ -323,7 +331,7 @@ public:
} }
// Member functions // Member Functions
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();