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 * * * * * * * * * * * * * * //
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)
:
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 * * * * * * * * * * * * * //
void Foam::fa::optionList::reset(const dictionary& dict)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -81,16 +81,6 @@ void Foam::fv::optionList::checkApplied() const
// * * * * * * * * * * * * * * * * 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)
:
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 * * * * * * * * * * * * * //
void Foam::fv::optionList::reset(const dictionary& dict)

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF),
baffle_(),
baffle_(nullptr),
dict_()
{}
@ -65,7 +65,7 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
iF,
mapper
),
baffle_(),
baffle_(nullptr),
dict_(ptf.dict_)
{}
@ -78,7 +78,7 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF, dict),
baffle_(),
baffle_(nullptr),
dict_
(
// Copy dictionary, but without "heavy" data chunks
@ -94,11 +94,9 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
)
)
{
typedef regionModels::thermalShellModel 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),
baffle_(),
baffle_(nullptr),
dict_(ptf.dict_)
{}

View File

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

View File

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

View File

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

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef liquidFilmBase_H
#define liquidFilmBase_H
#ifndef Foam_liquidFilmBase_H
#define Foam_liquidFilmBase_H
#include "runTimeSelectionTables.H"
#include "autoPtr.H"

View File

@ -51,7 +51,7 @@ void liquidFilmModel::correctThermoFields()
{
scalarField X(thermo_.size(), 1);
forAll (rho_, faceI)
forAll(rho_, faceI)
{
rho_[faceI] = thermo_.rho(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);
}
forAll (regionMesh().boundary(), patchI)
forAll(regionMesh().boundary(), patchI)
{
const scalarField& patchTf = Tf_.boundaryFieldRef()[patchI];

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -64,8 +64,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef regionFaModel_H
#define regionFaModel_H
#ifndef Foam_regionFaModel_H
#define Foam_regionFaModel_H
#include "volMesh.H"
#include "IOdictionary.H"
@ -79,7 +79,6 @@ SourceFiles
namespace Foam
{
namespace regionModels
{
@ -134,16 +133,9 @@ protected:
//- Dictionary of output properties
autoPtr<IOdictionary> outputPropertiesPtr_;
//-Volume-to surface mapping
//- Volume/surface mapping
autoPtr<volSurfaceMapping> vsmPtr_;
// Addressing
//- Patch IDs on the primary region coupled to this region
label patchID_;
//- Region name
word regionName_;
@ -185,19 +177,19 @@ public:
// Access
//- 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
inline const Time& time() const;
const Time& time() const noexcept { return time_; }
//- Return the active flag
inline const Switch& active() const;
Switch active() const noexcept { return active_; }
//- Return the information flag
inline const Switch& infoOutput() const;
Switch infoOutput() const noexcept { return infoOutput_; }
//- Return the model name
inline const word& modelName() const;
const word& modelName() const noexcept { return modelName_; }
//- Return the region mesh database
inline const faMesh& regionMesh() const;
@ -206,7 +198,7 @@ public:
inline faMesh& regionMesh();
//- 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
inline const IOdictionary& outputProperties() const;
@ -217,11 +209,14 @@ public:
//- Return the solution dictionary
inline const dictionary& solution() const;
//- Return patch ID
inline label patchID() const;
// Addressing
//- The patch ID on the primary region coupled to this region
label patchID() const { return patch_.index(); }
// Help Functions
// Helper Functions
//- Return mapping between surface and volume fields
const volSurfaceMapping& vsm() const;

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
{
const auto* regionPtr = time_.findObject<faMesh>(regionName_);
auto* regionPtr = time_.getObjectPtr<faMesh>(regionName_);
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&
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)
);
if (qrName_ != "none")
if (!qrName_.empty() && qrName_ != "none")
{
auto& aqr = taqr.ref();
const auto qr = primaryMesh().lookupObject<volScalarField>(qrName_);
const auto& qr = primaryMesh().lookupObject<volScalarField>(qrName_);
const volScalarField::Boundary& vqr = qr.boundaryField();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,7 +62,6 @@ class regionModel
:
public IOdictionary
{
private:
// Private Member Functions
@ -132,7 +131,7 @@ protected:
interRegionAMI_;
// Protected member functions
// Protected Member Functions
//- Read control parameters from dictionary
virtual bool read();
@ -190,19 +189,19 @@ public:
// Access
//- 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
inline const Time& time() const;
const Time& time() const noexcept { return time_; }
//- Return the active flag
inline Switch active() const;
Switch active() const noexcept { return active_; }
//- Return the information flag
inline Switch infoOutput() const;
Switch infoOutput() const noexcept { return infoOutput_; }
//- Return the model name
inline const word& modelName() const;
const word& modelName() const noexcept { return modelName_; }
//- Return the region mesh database
inline const fvMesh& regionMesh() const;
@ -211,7 +210,7 @@ public:
inline fvMesh& regionMesh();
//- Return the model coefficients dictionary
inline const dictionary& coeffs() const;
const dictionary& coeffs() const noexcept { return coeffs_; }
//- Return the solution dictionary
inline const dictionary& solution() const;
@ -223,29 +222,28 @@ public:
inline IOdictionary& outputProperties();
// Addressing
//- Return true if patchi on the local region is a coupled
// patch to the primary region
//- List of patch IDs on the primary region coupled to this region
inline const labelList& primaryPatchIDs() const noexcept;
//- List of patch IDs internally coupled with the primary region
inline const labelList& intCoupledPatchIDs() const noexcept;
//- True if patchi on the local region is a coupled
//- patch to the primary region
inline bool isCoupledPatch(const label regionPatchi) const;
//- Return true if patchi on the primary region is a coupled
// patch to the local region
//- True if patchi on the primary region is a coupled
//- patch to the local region
inline bool isRegionPatch(const label primaryPatchi) const;
//- Return the list of patch IDs on the primary region coupled
// to this region
inline const labelList& primaryPatchIDs() const;
//- Return the list of patch IDs internally coupled with the
// primary region
inline const labelList& intCoupledPatchIDs() const;
//- Return region ID corresponding to primaryPatchID
inline label regionPatchID(const label primaryPatchID) 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
// regionPatchi

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
{
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&
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
(
const label regionPatchi
) const
{
forAll(intCoupledPatchIDs_, i)
{
if (intCoupledPatchIDs_[i] == regionPatchi)
{
return true;
}
}
return false;
return intCoupledPatchIDs_.found(regionPatchi);
}
@ -152,46 +121,18 @@ inline bool Foam::regionModels::regionModel::isRegionPatch
const label primaryPatchi
) const
{
forAll(primaryPatchIDs_, i)
{
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_;
return primaryPatchIDs_.found(primaryPatchi);
}
inline Foam::label Foam::regionModels::regionModel::regionPatchID
(
const label primaryPatchID
const label primaryPatchi
) const
{
forAll(primaryPatchIDs_, i)
{
if (primaryPatchIDs_[i] == primaryPatchID)
{
return intCoupledPatchIDs_[i];
}
}
const label i = primaryPatchIDs_.find(primaryPatchi);
return -1;
return (i >= 0 ? intCoupledPatchIDs_[i] : -1);
}

View File

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

View File

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