thermalBaffleModel: Simplification

Removed unused run-time selection mechanism for the baffle model.
Removed two layers of unnecessary base class (thermalBaffleModel and
regionModel1D). Simplified the handling of thickness and made apply
regarduess of dimensionality. Made thickness data a dimensioned field,
so that mesh changes get applied to it automatically. Replaced ad-hoc
baffle thickness calculation with a "proper" parallel-aware wave-based
method.
This commit is contained in:
Will Bainbridge
2022-08-12 09:42:25 +01:00
parent ac0eea9610
commit a9dc5e1934
35 changed files with 653 additions and 2989 deletions

View File

@ -250,7 +250,6 @@ patchToPatch/rays/raysPatchToPatch.C
mappedPatches/mappedPolyPatch/mappedPatchBase.C mappedPatches/mappedPolyPatch/mappedPatchBase.C
mappedPatches/mappedPolyPatch/mappedPolyPatch.C mappedPatches/mappedPolyPatch/mappedPolyPatch.C
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
mappedPatches/mappedPointPatch/mappedPointPatch.C mappedPatches/mappedPointPatch/mappedPointPatch.C
mappedPatches/mappedPointPatch/mappedWallPointPatch.C mappedPatches/mappedPointPatch/mappedWallPointPatch.C

View File

@ -1,174 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mappedVariableThicknessWallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(mappedVariableThicknessWallPolyPatch, 0);
addToRunTimeSelectionTable
(
polyPatch,
mappedVariableThicknessWallPolyPatch,
word
);
addToRunTimeSelectionTable
(
polyPatch,
mappedVariableThicknessWallPolyPatch,
dictionary
);
}
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
)
:
mappedWallPolyPatch(name, size, start, index, bm, patchType),
thickness_(size)
{}
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const mappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
)
:
mappedWallPolyPatch(name, size, start, index, bm, typeName),
thickness_(size)
{}
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const mappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
)
:
mappedWallPolyPatch(name, size, start, index, bm, typeName),
thickness_(size)
{}
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
)
:
mappedWallPolyPatch(name, dict, index, bm, patchType),
thickness_(scalarField("thickness", dict, this->size()))
{}
Foam::mappedVariableThicknessWallPolyPatch::
mappedVariableThicknessWallPolyPatch
(
const mappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm
)
:
mappedWallPolyPatch(pp, bm),
thickness_(pp.thickness_)
{}
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
(
const mappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
)
:
mappedWallPolyPatch(pp, bm, index, newSize, newStart),
thickness_(newSize)
{}
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
(
const mappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
)
:
mappedWallPolyPatch(pp, bm, index, mapAddressing, newStart),
thickness_(pp.size())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::mappedVariableThicknessWallPolyPatch::
~mappedVariableThicknessWallPolyPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mappedVariableThicknessWallPolyPatch::
write(Foam::Ostream& os) const
{
writeEntry(os, "thickness", thickness_);
}
// ************************************************************************* //

View File

@ -1,238 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::mappedVariableThicknessWallPolyPatch
Description
Foam::mappedVariableThicknessWallPolyPatch
SourceFiles
mappedVariableThicknessWallPolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef mappedVariableThicknessWallPolyPatch_H
#define mappedVariableThicknessWallPolyPatch_H
#include "wallPolyPatch.H"
#include "mappedWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class mappedVariableThicknessWallPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class mappedVariableThicknessWallPolyPatch
:
public mappedWallPolyPatch
{
// Private Data
//- Thickness
scalarList thickness_;
public:
//- Runtime type information
TypeName("mappedWallVariableThickness");
// Constructors
//- Construct from components
mappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
);
//- Construct from components
mappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const mappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
);
//- Construct from components. Uniform offset.
mappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const mappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
mappedVariableThicknessWallPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
);
//- Construct as copy, resetting the boundary mesh
mappedVariableThicknessWallPolyPatch
(
const mappedVariableThicknessWallPolyPatch&,
const polyBoundaryMesh&
);
//- Construct given the original patch and resetting the
// face list and boundary mesh information
mappedVariableThicknessWallPolyPatch
(
const mappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
);
//- Construct given the original patch and a map
mappedVariableThicknessWallPolyPatch
(
const mappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>
(
new mappedVariableThicknessWallPolyPatch(*this, bm)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new mappedVariableThicknessWallPolyPatch
(
*this,
bm,
index,
newSize,
newStart
)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new mappedVariableThicknessWallPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
//- Destructor
virtual ~mappedVariableThicknessWallPolyPatch();
// Member Functions
//- Return non const thickness
scalarList& thickness()
{
return thickness_;
}
//- Return const thickness
const scalarList& thickness() const
{
return thickness_;
}
//- Write the polyPatch data as a dictionary
void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -4,6 +4,6 @@ makeType=${1:-libso}
wclean $makeType regionModel wclean $makeType regionModel
wclean $makeType surfaceFilmModels wclean $makeType surfaceFilmModels
wclean $makeType thermalBaffleModels wclean $makeType thermalBaffle
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -6,6 +6,6 @@ cd ${0%/*} || exit 1 # Run from this directory
wmake $targetType regionModel wmake $targetType regionModel
wmake $targetType surfaceFilmModels wmake $targetType surfaceFilmModels
wmake $targetType thermalBaffleModels wmake $targetType thermalBaffle
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,13 +1,4 @@
# Region models
regionModel/regionModel.C regionModel/regionModel.C
singleLayerRegion/singleLayerRegion.C singleLayerRegion/singleLayerRegion.C
regionModel1D/regionModel1D.C
# Boundary conditions
derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch.C
regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C
regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C
regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C
LIB = $(FOAM_LIBBIN)/libregionModels LIB = $(FOAM_LIBBIN)/libregionModels

View File

@ -1,64 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mappedVariableThicknessWallFvPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "regionModel1D.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(mappedVariableThicknessWallFvPatch, 0);
addToRunTimeSelectionTable
(
fvPatch,
mappedVariableThicknessWallFvPatch,
polyPatch
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mappedVariableThicknessWallFvPatch::
makeDeltaCoeffs(scalarField& dc) const
{
const mappedVariableThicknessWallPolyPatch& pp =
refCast<const mappedVariableThicknessWallPolyPatch>(patch());
typedef regionModels::regionModel1D modelType;
const modelType& region1D =
patch().boundaryMesh().mesh().time().lookupObject<modelType>
(
"thermalBaffleProperties"
);
dc = 2.0/(pp.thickness()/region1D.nLayers());
}
// ************************************************************************* //

View File

@ -1,93 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::mappedVariableThicknessWallFvPatch
Description
Take thickness field and number of layers and returns deltaCoeffs
as 2.0/thickness/nLayers.
To be used with 1D thermo baffle.
SourceFiles
mappedVariableThicknessWallFvPatch.C
\*---------------------------------------------------------------------------*/
#ifndef mappedVariableThicknessWallFvPatch_H
#define mappedVariableThicknessWallFvPatch_H
#include "wallFvPatch.H"
#include "mappedVariableThicknessWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class mappedVariableThicknessWallFvPatch Declaration
\*---------------------------------------------------------------------------*/
class mappedVariableThicknessWallFvPatch
:
public wallFvPatch
{
protected:
// Protected Member Functions
//- Read neighbour cell distances from dictionary
void makeDeltaCoeffs(scalarField& dc) const;
public:
//- Runtime type information
TypeName(mappedVariableThicknessWallPolyPatch::typeName_());
// Constructors
//- Construct from components
mappedVariableThicknessWallFvPatch
(
const polyPatch& patch,
const fvBoundaryMesh& bm
)
:
wallFvPatch(patch, bm)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -267,8 +267,7 @@ Foam::regionModels::regionModel::regionModel
outputPropertiesPtr_(nullptr), outputPropertiesPtr_(nullptr),
primaryPatchIDs_(), primaryPatchIDs_(),
intCoupledPatchIDs_(), intCoupledPatchIDs_(),
regionName_("none"), regionName_("none")
functions_(*this)
{} {}
@ -300,8 +299,7 @@ Foam::regionModels::regionModel::regionModel
outputPropertiesPtr_(nullptr), outputPropertiesPtr_(nullptr),
primaryPatchIDs_(), primaryPatchIDs_(),
intCoupledPatchIDs_(), intCoupledPatchIDs_(),
regionName_(lookup("regionName")), regionName_(lookup("regionName"))
functions_(*this, subOrEmptyDict("functions"))
{ {
constructMeshObjects(); constructMeshObjects();
initialise(); initialise();
@ -344,8 +342,7 @@ Foam::regionModels::regionModel::regionModel
outputPropertiesPtr_(nullptr), outputPropertiesPtr_(nullptr),
primaryPatchIDs_(), primaryPatchIDs_(),
intCoupledPatchIDs_(), intCoupledPatchIDs_(),
regionName_(dict.lookup("regionName")), regionName_(dict.lookup("regionName"))
functions_(*this, subOrEmptyDict("functions"))
{ {
constructMeshObjects(); constructMeshObjects();
initialise(); initialise();
@ -398,9 +395,7 @@ void Foam::regionModels::regionModel::evolve()
void Foam::regionModels::regionModel::preEvolveRegion() void Foam::regionModels::regionModel::preEvolveRegion()
{ {}
functions_.preEvolveRegion();
}
void Foam::regionModels::regionModel::evolveRegion() void Foam::regionModels::regionModel::evolveRegion()
@ -408,9 +403,7 @@ void Foam::regionModels::regionModel::evolveRegion()
void Foam::regionModels::regionModel::postEvolveRegion() void Foam::regionModels::regionModel::postEvolveRegion()
{ {}
functions_.postEvolveRegion();
}
void Foam::regionModels::regionModel::info() void Foam::regionModels::regionModel::info()

View File

@ -39,13 +39,11 @@ SourceFiles
#include "fvMesh.H" #include "fvMesh.H"
#include "timeIOdictionary.H" #include "timeIOdictionary.H"
#include "regionModelFunctionObjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
namespace regionModels namespace regionModels
{ {
@ -110,9 +108,6 @@ protected:
//- Region name //- Region name
word regionName_; word regionName_;
//- Region model function objects
regionModelFunctionObjectList functions_;
// Protected member functions // Protected member functions

View File

@ -1,352 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "regionModel1D.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
defineTypeNameAndDebug(regionModel1D, 0);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::regionModels::regionModel1D::constructMeshObjects()
{
nMagSfPtr_.reset
(
new surfaceScalarField
(
IOobject
(
"nMagSf",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
regionMesh(),
dimensionedScalar(dimArea, 0)
)
);
}
void Foam::regionModels::regionModel1D::initialise()
{
DebugInFunction << endl;
// Calculate boundaryFaceFaces and boundaryFaceCells
DynamicList<label> faceIDs;
DynamicList<label> cellIDs;
label localPyrolysisFacei = 0;
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
forAll(intCoupledPatchIDs_, i)
{
const label patchi = intCoupledPatchIDs_[i];
const polyPatch& ppCoupled = rbm[patchi];
forAll(ppCoupled, localFacei)
{
label facei = ppCoupled.start() + localFacei;
label celli = -1;
label nFaces = 0;
label nCells = 0;
do
{
label ownCelli = regionMesh().faceOwner()[facei];
if (ownCelli != celli)
{
celli = ownCelli;
}
else
{
celli = regionMesh().faceNeighbour()[facei];
}
nCells++;
cellIDs.append(celli);
const cell& cFaces = regionMesh().cells()[celli];
facei = cFaces.opposingFaceLabel(facei, regionMesh().faces());
faceIDs.append(facei);
nFaces++;
} while (regionMesh().isInternalFace(facei));
boundaryFaceOppositeFace_[localPyrolysisFacei] = facei;
faceIDs.remove(); // remove boundary face.
nFaces--;
boundaryFaceFaces_[localPyrolysisFacei].transfer(faceIDs);
boundaryFaceCells_[localPyrolysisFacei].transfer(cellIDs);
localPyrolysisFacei++;
nLayers_ = nCells;
}
}
boundaryFaceOppositeFace_.setSize(localPyrolysisFacei);
boundaryFaceFaces_.setSize(localPyrolysisFacei);
boundaryFaceCells_.setSize(localPyrolysisFacei);
surfaceScalarField& nMagSf = nMagSfPtr_();
surfaceScalarField::Boundary& nMagSfBf = nMagSf.boundaryFieldRef();
localPyrolysisFacei = 0;
forAll(intCoupledPatchIDs_, i)
{
const label patchi = intCoupledPatchIDs_[i];
const polyPatch& ppCoupled = rbm[patchi];
const vectorField& pNormals = ppCoupled.faceNormals();
nMagSfBf[patchi] = regionMesh().Sf().boundaryField()[patchi] & pNormals;
forAll(pNormals, localFacei)
{
const vector& n = pNormals[localFacei];
const labelList& faces = boundaryFaceFaces_[localPyrolysisFacei++];
forAll(faces, facei)
{
const label faceID = faces[facei];
nMagSf[faceID] = regionMesh().Sf()[faceID] & n;
}
}
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::regionModels::regionModel1D::read()
{
if (regionModel::read())
{
moveMesh_.readIfPresent("moveMesh", coeffs_);
return true;
}
else
{
return false;
}
}
bool Foam::regionModels::regionModel1D::read(const dictionary& dict)
{
if (regionModel::read(dict))
{
moveMesh_.readIfPresent("moveMesh", coeffs_);
return true;
}
else
{
return false;
}
}
Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
(
const scalarList& deltaV,
const scalar minDelta
)
{
tmp<labelField> tcellMoveMap(new labelField(regionMesh().nCells(), 0));
labelField& cellMoveMap = tcellMoveMap.ref();
if (!moveMesh_)
{
return cellMoveMap;
}
pointField oldPoints = regionMesh().points();
pointField newPoints = oldPoints;
const polyBoundaryMesh& bm = regionMesh().boundaryMesh();
label totalFaceId = 0;
forAll(intCoupledPatchIDs_, localPatchi)
{
label patchi = intCoupledPatchIDs_[localPatchi];
const polyPatch pp = bm[patchi];
const vectorField& cf = regionMesh().Cf().boundaryField()[patchi];
forAll(pp, patchFacei)
{
const labelList& faces = boundaryFaceFaces_[totalFaceId];
const labelList& cells = boundaryFaceCells_[totalFaceId];
const vector n = pp.faceNormals()[patchFacei];
const vector sf = pp.faceAreas()[patchFacei];
List<point> oldCf(faces.size() + 1);
oldCf[0] = cf[patchFacei];
forAll(faces, i)
{
oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
}
vector newDelta = Zero;
point nbrCf = oldCf[0];
forAll(faces, i)
{
const label facei = faces[i];
const label celli = cells[i];
const face f = regionMesh().faces()[facei];
newDelta += (deltaV[celli]/mag(sf))*n;
vector localDelta = Zero;
forAll(f, pti)
{
const label pointi = f[pti];
if
(
mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
> minDelta
)
{
newPoints[pointi] = oldPoints[pointi] + newDelta;
localDelta = newDelta;
cellMoveMap[celli] = 1;
}
}
nbrCf = oldCf[i + 1] + localDelta;
}
// Modify boundary
const label bFacei = boundaryFaceOppositeFace_[totalFaceId];
const face f = regionMesh().faces()[bFacei];
const label celli = cells[cells.size() - 1];
newDelta += (deltaV[celli]/mag(sf))*n;
forAll(f, pti)
{
const label pointi = f[pti];
if
(
mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
> minDelta
)
{
newPoints[pointi] = oldPoints[pointi] + newDelta;
cellMoveMap[celli] = 1;
}
}
totalFaceId ++;
}
}
// Move points
regionMesh().movePoints(newPoints);
return tcellMoveMap;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionModels::regionModel1D::regionModel1D
(
const fvMesh& mesh,
const word& regionType
)
:
regionModel(mesh, regionType),
boundaryFaceFaces_(),
boundaryFaceCells_(),
boundaryFaceOppositeFace_(),
nLayers_(0),
nMagSfPtr_(nullptr),
moveMesh_(false)
{}
Foam::regionModels::regionModel1D::regionModel1D
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields
)
:
regionModel(mesh, regionType, modelName, false),
boundaryFaceFaces_(regionMesh().nCells()),
boundaryFaceCells_(regionMesh().nCells()),
boundaryFaceOppositeFace_(regionMesh().nCells()),
nLayers_(0),
nMagSfPtr_(nullptr),
moveMesh_(true)
{
constructMeshObjects();
initialise();
if (readFields)
{
read();
}
}
Foam::regionModels::regionModel1D::regionModel1D
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
const dictionary& dict,
bool readFields
)
:
regionModel(mesh, regionType, modelName, dict, readFields),
boundaryFaceFaces_(regionMesh().nCells()),
boundaryFaceCells_(regionMesh().nCells()),
boundaryFaceOppositeFace_(regionMesh().nCells()),
nLayers_(0),
nMagSfPtr_(nullptr),
moveMesh_(false)
{
constructMeshObjects();
initialise();
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionModels::regionModel1D::~regionModel1D()
{}
// ************************************************************************* //

View File

@ -1,196 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::regionModels::regionModel1D
Description
Base class for 1-D region models
SourceFiles
regionModel1D.C
\*---------------------------------------------------------------------------*/
#ifndef regionModel1D_H
#define regionModel1D_H
#include "regionModel.H"
#include "surfaceFields.H"
#include "labelList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
/*---------------------------------------------------------------------------*\
Class regionModel1D Declaration
\*---------------------------------------------------------------------------*/
class regionModel1D
:
public regionModel
{
// Private Member Functions
//- Disallow default bitwise copy construction
regionModel1D(const regionModel1D&) = delete;
//- Disallow default bitwise assignment
void operator=(const regionModel1D&) = delete;
//- Construct region mesh and fields
void constructMeshObjects();
//- Initialise the region
void initialise();
protected:
// Protected data
// Region addressing - per internally coupled patch face walking out
//- Global face IDs
labelListList boundaryFaceFaces_;
//- Global cell IDs
labelListList boundaryFaceCells_;
//- Global boundary face IDs opposite coupled patch
labelList boundaryFaceOppositeFace_;
//- Number of layers in the region
label nLayers_;
// Geometry
//- Face area magnitude normal to patch
autoPtr<surfaceScalarField> nMagSfPtr_;
//- Flag to allow mesh movement
Switch moveMesh_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
//- Read control parameters from dictionary
virtual bool read(const dictionary& dict);
//- Move mesh points according to change in cell volumes
// Returns map ordered by cell where 1 = cell moved, 0 = cell unchanged
tmp<labelField> moveMesh
(
const scalarList& deltaV,
const scalar minDelta = 0.0
);
public:
//- Runtime type information
TypeName("regionModel1D");
// Constructors
//- Construct null
regionModel1D
(
const fvMesh& mesh,
const word& regionType
);
//- Construct from mesh, region type and name
regionModel1D
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields = true
);
//- Construct from mesh, region type and name and dict
regionModel1D
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
const dictionary& dict,
bool readFields = true
);
//- Destructor
virtual ~regionModel1D();
// Member Functions
// Access
// Addressing
//- Return the global face IDs
inline const labelListList& boundaryFaceFaces() const;
//- Return the global cell IDs
inline const labelListList& boundaryFaceCells() const;
//- Return the global boundary face IDs opposite coupled patch
inline const labelList& boundaryFaceOppositeFace() const;
// Geometry
//- Return the face area magnitudes / [m^2]
inline const surfaceScalarField& nMagSf() const;
//- Return the number of layers in the region
inline label nLayers() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "regionModel1DI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,70 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "regionModel1D.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::labelListList&
Foam::regionModels::regionModel1D::boundaryFaceFaces() const
{
return boundaryFaceFaces_;
}
inline const Foam::labelListList&
Foam::regionModels::regionModel1D::boundaryFaceCells() const
{
return boundaryFaceCells_;
}
inline const Foam::labelList&
Foam::regionModels::regionModel1D::boundaryFaceOppositeFace() const
{
return boundaryFaceOppositeFace_;
}
inline const Foam::surfaceScalarField&
Foam::regionModels::regionModel1D::nMagSf() const
{
if (!nMagSfPtr_.valid())
{
FatalErrorInFunction
<< "Face normal areas not available" << abort(FatalError);
}
return nMagSfPtr_();
}
inline Foam::label Foam::regionModels::regionModel1D::nLayers() const
{
return nLayers_;
}
// ************************************************************************* //

View File

@ -1,102 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "regionModelFunctionObject.H"
#include "regionModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
defineTypeNameAndDebug(regionModelFunctionObject, 0);
defineRunTimeSelectionTable(regionModelFunctionObject, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject
(
regionModel& region
)
:
dict_(dictionary::null),
regionModel_(region),
modelType_("modelType")
{}
Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject
(
const dictionary& dict,
regionModel& region,
const word& type
)
:
dict_(dict),
regionModel_(region),
modelType_(type)
{}
Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject
(
const regionModelFunctionObject& rmfo
)
:
dict_(rmfo.dict_),
regionModel_(rmfo.regionModel_),
modelType_(rmfo.modelType_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionModels::regionModelFunctionObject::~regionModelFunctionObject()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::regionModels::regionModelFunctionObject::preEvolveRegion()
{}
void Foam::regionModels::regionModelFunctionObject::postEvolveRegion()
{
if (regionModel_.regionMesh().time().writeTime())
{
write();
}
}
void Foam::regionModels::regionModelFunctionObject::write() const
{}
// ************************************************************************* //

View File

@ -1,157 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::regionModels::regionModelFunctionObject
Description
Region model function object base class
SourceFiles
regionModelFunctionObject.C
regionModelFunctionObjectNew.C
\*---------------------------------------------------------------------------*/
#ifndef regionModelFunctionObject_H
#define regionModelFunctionObject_H
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
class regionModel;
/*---------------------------------------------------------------------------*\
Class regionModelFunctionObject Declaration
\*---------------------------------------------------------------------------*/
class regionModelFunctionObject
{
protected:
// Protected data
//- Dictionary
dictionary dict_;
//- Reference to the region model
regionModel& regionModel_;
//- Model type name
word modelType_;
public:
//- Runtime type information
TypeName("regionModelFunctionObject");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
regionModelFunctionObject,
dictionary,
(
const dictionary& dict,
regionModel& region
),
(dict, region)
);
// Constructors
//- Construct null from region
regionModelFunctionObject(regionModel& region);
//- Construct from dictionary
regionModelFunctionObject
(
const dictionary& dict,
regionModel& region,
const word& modelType
);
//- Construct copy
regionModelFunctionObject(const regionModelFunctionObject& ppm);
//- Construct and return a clone
virtual autoPtr<regionModelFunctionObject> clone() const
{
return autoPtr<regionModelFunctionObject>
(
new regionModelFunctionObject(*this)
);
}
//- Destructor
virtual ~regionModelFunctionObject();
//- Selector
static autoPtr<regionModelFunctionObject> New
(
const dictionary& dict,
regionModel& region,
const word& modelType
);
// Member Functions
// Evaluation
//- Pre-evolve region hook
virtual void preEvolveRegion();
//- Post-evolve region hook
virtual void postEvolveRegion();
// I-O
//- write
virtual void write() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,124 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "regionModelFunctionObjectList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList
(
regionModel& region
)
:
PtrList<regionModelFunctionObject>(),
regionModel_(region),
dict_(dictionary::null)
{}
Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList
(
regionModel& region,
const dictionary& dict,
const bool readFields
)
:
PtrList<regionModelFunctionObject>(),
regionModel_(region),
dict_(dict)
{
if (readFields)
{
wordList modelNames(dict.toc());
Info<< " Selecting region model functions" << endl;
if (modelNames.size() > 0)
{
this->setSize(modelNames.size());
forAll(modelNames, i)
{
const word& modelName = modelNames[i];
this->set
(
i,
regionModelFunctionObject::New
(
dict,
region,
modelName
)
);
}
}
else
{
Info<< " none" << endl;
}
}
}
Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList
(
const regionModelFunctionObjectList& cfol
)
:
PtrList<regionModelFunctionObject>(cfol),
regionModel_(cfol.regionModel_),
dict_(cfol.dict_)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::regionModels::regionModelFunctionObjectList::
~regionModelFunctionObjectList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::regionModels::regionModelFunctionObjectList::preEvolveRegion()
{
forAll(*this, i)
{
this->operator[](i).preEvolveRegion();
}
}
void Foam::regionModels::regionModelFunctionObjectList::postEvolveRegion()
{
forAll(*this, i)
{
this->operator[](i).postEvolveRegion();
}
}
// ************************************************************************* //

View File

@ -1,133 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::regionModels::regionModelFunctionObjectList
Description
List of cloud function objects
SourceFiles
regionModelFunctionObjectListI.H
regionModelFunctionObjectList.C
\*---------------------------------------------------------------------------*/
#ifndef regionModelFunctionObjectList_H
#define regionModelFunctionObjectList_H
#include "PtrList.H"
#include "regionModelFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
class regionModel;
/*---------------------------------------------------------------------------*\
Class regionModelFunctionObjectList Declaration
\*---------------------------------------------------------------------------*/
class regionModelFunctionObjectList
:
public PtrList<regionModelFunctionObject>
{
protected:
// Protected Data
//- Reference to the region region model
regionModel& regionModel_;
//- Dictionary
const dictionary dict_;
public:
// Constructors
//- Null constructor
regionModelFunctionObjectList(regionModel& region);
//- Construct from mesh
regionModelFunctionObjectList
(
regionModel& region,
const dictionary& dict,
const bool readFields = true
);
//- Construct copy
regionModelFunctionObjectList
(
const regionModelFunctionObjectList& rmfol
);
//- Destructor
virtual ~regionModelFunctionObjectList();
// Member Functions
// Access
//- Return const access to the cloud region
inline const regionModel& region() const;
//- Return references to the cloud region
inline regionModel& region();
//- Return the forces dictionary
inline const dictionary& dict() const;
// Evaluation
//- Pre-evolve hook
virtual void preEvolveRegion();
//- Post-evolve hook
virtual void postEvolveRegion();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "regionModelFunctionObjectListI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,47 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
inline const Foam::regionModels::regionModel&
Foam::regionModels::regionModelFunctionObjectList::region() const
{
return regionModel_;
}
inline Foam::regionModels::regionModel&
Foam::regionModels::regionModelFunctionObjectList::region()
{
return regionModel_;
}
inline const Foam::dictionary&
Foam::regionModels::regionModelFunctionObjectList::dict() const
{
return dict_;
}
// ************************************************************************* //

View File

@ -1,67 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "regionModelFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::regionModels::regionModelFunctionObject>
Foam::regionModels::regionModelFunctionObject::New
(
const dictionary& dict,
regionModel& region,
const word& modelName
)
{
const word modelType = dict.subDict(modelName).lookup("type");
Info<< " " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown region model function type "
<< modelType << nl << nl
<< "Valid region model function types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return
autoPtr<regionModelFunctionObject>
(
cstrIter()
(
dict.subDict(modelName),
region
)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,5 @@
thermalBaffle/thermalBaffle.C
derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libthermalBaffle

View File

@ -244,7 +244,7 @@ thermalBaffleFvPatchScalarField::initBaffleMesh() const
} }
autoPtr<regionModels::thermalBaffleModel> autoPtr<regionModels::thermalBaffle>
thermalBaffleFvPatchScalarField::initBaffle() const thermalBaffleFvPatchScalarField::initBaffle() const
{ {
if (!owner()) if (!owner())
@ -264,7 +264,10 @@ thermalBaffleFvPatchScalarField::initBaffle() const
dictionary dict(dict_); dictionary dict(dict_);
dict.add("regionName", mpp.sampleRegion()); dict.add("regionName", mpp.sampleRegion());
return regionModels::thermalBaffleModel::New(mesh, dict); return autoPtr<regionModels::thermalBaffle>
(
new regionModels::thermalBaffle("thermalBaffle", mesh, dict)
);
} }

View File

@ -135,7 +135,7 @@ Usage
See also See also
Foam::compressible::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField Foam::compressible::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
Foam::regionModels::thermalBaffleModels::thermalBaffleModel Foam::regionModels::thermalBaffle
SourceFiles SourceFiles
thermalBaffleFvPatchScalarField.C thermalBaffleFvPatchScalarField.C
@ -145,7 +145,7 @@ SourceFiles
#ifndef thermalBaffleFvPatchScalarField_H #ifndef thermalBaffleFvPatchScalarField_H
#define thermalBaffleFvPatchScalarField_H #define thermalBaffleFvPatchScalarField_H
#include "thermalBaffleModel.H" #include "thermalBaffle.H"
#include "extrudePatchMesh.H" #include "extrudePatchMesh.H"
#include "turbulentTemperatureRadCoupledMixedFvPatchScalarField.H" #include "turbulentTemperatureRadCoupledMixedFvPatchScalarField.H"
@ -176,7 +176,7 @@ class thermalBaffleFvPatchScalarField
autoPtr<extrudePatchMesh> baffleMeshPtr_; autoPtr<extrudePatchMesh> baffleMeshPtr_;
//- Thermal baffle model //- Thermal baffle model
autoPtr<regionModels::thermalBaffleModel> bafflePtr_; autoPtr<regionModels::thermalBaffle> bafflePtr_;
// Private Member Functions // Private Member Functions
@ -197,7 +197,7 @@ class thermalBaffleFvPatchScalarField
autoPtr<extrudePatchMesh> initBaffleMesh() const; autoPtr<extrudePatchMesh> initBaffleMesh() const;
//- Construct and return the thermal baffle model //- Construct and return the thermal baffle model
autoPtr<regionModels::thermalBaffleModel> initBaffle() const; autoPtr<regionModels::thermalBaffle> initBaffle() const;
public: public:

View File

@ -0,0 +1,204 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::DeltaInfoData
Description
Class to be used with FaceCellWave which calculates the delta (thickness)
across a layered mesh
SourceFiles
DeltaInfoDataI.H
\*---------------------------------------------------------------------------*/
#ifndef DeltaInfoData_H
#define DeltaInfoData_H
#include "pointField.H"
#include "face.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polyPatch;
class polyMesh;
class transformer;
// Forward declaration of friend functions and operators
template<class Type>
class DeltaInfoData;
template<class Type>
Ostream& operator<<(Ostream&, const DeltaInfoData<Type>&);
template<class Type>
Istream& operator>>(Istream&, DeltaInfoData<Type>&);
/*---------------------------------------------------------------------------*\
Class DeltaInfoData Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class DeltaInfoData
{
// Private Data
//- Direction of propagation (+1 or -1) relative to the face normal.
// Only valid when on a face. Takes a value of 0 when in a cell.
label direction_;
//- The previous face index. Only valid when in a cell. Takes a value
// of -1 if on a face.
label prevFace_;
//- Data
Type data_;
public:
// Constructors
//- Construct null
inline DeltaInfoData();
//- Construct for a face given a direction and data
inline DeltaInfoData(const label direction, const Type& data);
// Member Functions
// Access
//- Return the data
inline const Type& data() const;
// Needed by FaceCellWave
//- Check whether the DeltaInfoData has been changed at all or still
// contains original (invalid) value.
template<class TrackingData>
inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for checking
// consistency across cyclics.
template<class TrackingData>
inline bool sameGeometry
(
const polyMesh&,
const DeltaInfoData<Type>&,
const scalar,
TrackingData& td
) const;
//- Transform across an interface
template<class TrackingData>
inline void transform
(
const polyPatch& patch,
const label patchFacei,
const transformer& transform,
TrackingData& td
);
//- Influence of neighbouring face
template<class TrackingData>
inline bool updateCell
(
const polyMesh&,
const label thisCelli,
const label neighbourFacei,
const DeltaInfoData<Type>& neighbourInfo,
const scalar tol,
TrackingData& td
);
//- Influence of neighbouring cell
template<class TrackingData>
inline bool updateFace
(
const polyMesh&,
const label thisFacei,
const label neighbourCelli,
const DeltaInfoData<Type>& neighbourInfo,
const scalar tol,
TrackingData& td
);
//- Influence of different value on same face
template<class TrackingData>
inline bool updateFace
(
const polyMesh&,
const label thisFacei,
const DeltaInfoData<Type>& neighbourInfo,
const scalar tol,
TrackingData& td
);
//- Test equality
template<class TrackingData>
inline bool equal
(
const DeltaInfoData<Type>&,
TrackingData& td
) const;
// Member Operators
inline bool operator==(const DeltaInfoData<Type>&) const;
inline bool operator!=(const DeltaInfoData<Type>&) const;
// IOstream Operators
friend Ostream& operator<< <Type>
(
Ostream&,
const DeltaInfoData<Type>&
);
friend Istream& operator>> <Type>
(
Istream&,
DeltaInfoData<Type>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "DeltaInfoDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,233 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "DeltaInfoData.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
inline Foam::DeltaInfoData<Type>::DeltaInfoData()
:
direction_(0),
prevFace_(-labelMax),
data_()
{}
template<class Type>
inline Foam::DeltaInfoData<Type>::DeltaInfoData
(
const label direction,
const Type& data
)
:
direction_(direction),
prevFace_(-labelMax),
data_(data)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
inline const Type& Foam::DeltaInfoData<Type>::data() const
{
return data_;
}
template<class Type>
template<class TrackingData>
inline bool Foam::DeltaInfoData<Type>::valid(TrackingData& td) const
{
return direction_ != 0 || prevFace_ != -labelMax;
}
template<class Type>
template<class TrackingData>
inline bool Foam::DeltaInfoData<Type>::sameGeometry
(
const polyMesh&,
const DeltaInfoData<Type>& l,
const scalar tol,
TrackingData& td
) const
{
return true;
}
template<class Type>
template<class TrackingData>
inline void Foam::DeltaInfoData<Type>::transform
(
const polyPatch& patch,
const label patchFacei,
const transformer& transform,
TrackingData& td
)
{}
template<class Type>
template<class TrackingData>
inline bool Foam::DeltaInfoData<Type>::updateCell
(
const polyMesh& mesh,
const label thisCelli,
const label neighbourFacei,
const DeltaInfoData<Type>& neighbourDeltaInfo,
const scalar tol,
TrackingData& td
)
{
const bool o = thisCelli == mesh.faceOwner()[neighbourFacei];
if (o == (neighbourDeltaInfo.direction_ < 0))
{
direction_ = 0;
prevFace_ = neighbourFacei;
data_ = neighbourDeltaInfo.data_;
return true;
}
else
{
return false;
}
}
template<class Type>
template<class TrackingData>
inline bool Foam::DeltaInfoData<Type>::updateFace
(
const polyMesh& mesh,
const label thisFacei,
const label neighbourCelli,
const DeltaInfoData<Type>& neighbourDeltaInfo,
const scalar tol,
TrackingData& td
)
{
const cell& c = mesh.cells()[neighbourCelli];
const label prevFacei = neighbourDeltaInfo.prevFace_;
const label nextFacei = c.opposingFaceLabel(prevFacei, mesh.faces());
if (nextFacei == thisFacei)
{
const label direction =
mesh.faceOwner()[thisFacei] == neighbourCelli ? +1 : -1;
direction_ = direction;
prevFace_ = -labelMax;
data_ = neighbourDeltaInfo.data_;
return true;
}
else
{
return false;
}
}
template<class Type>
template<class TrackingData>
inline bool Foam::DeltaInfoData<Type>::updateFace
(
const polyMesh& mesh,
const label thisFacei,
const DeltaInfoData<Type>& neighbourDeltaInfo,
const scalar tol,
TrackingData& td
)
{
const label direction = -neighbourDeltaInfo.direction_;
direction_ = direction;
prevFace_ = -labelMax;
data_ = neighbourDeltaInfo.data_;
return true;
}
template<class Type>
template<class TrackingData>
inline bool Foam::DeltaInfoData<Type>::equal
(
const DeltaInfoData<Type>& rhs,
TrackingData& td
) const
{
return operator==(rhs);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
inline bool Foam::DeltaInfoData<Type>::operator==
(
const Foam::DeltaInfoData<Type>& rhs
) const
{
return direction_ == rhs.direction_ && prevFace_ == rhs.prevFace_;
}
template<class Type>
inline bool Foam::DeltaInfoData<Type>::operator!=
(
const Foam::DeltaInfoData<Type>& rhs
) const
{
return !(*this == rhs);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<(Ostream& os, const DeltaInfoData<Type>& l)
{
return os
<< l.direction_ << token::SPACE
<< l.prevFace_ << token::SPACE
<< l.data_;
}
template<class Type>
Foam::Istream& Foam::operator>>(Istream& is, DeltaInfoData<Type>& l)
{
return is >> l.direction_ >> l.prevFace_ >> l.data_;
}
// ************************************************************************* //

View File

@ -24,13 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "thermalBaffle.H" #include "thermalBaffle.H"
#include "fvm.H" #include "fvm.H"
#include "fvcDiv.H" #include "fvcDiv.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
#include "fvMatrices.H"
#include "absorptionEmissionModel.H" #include "absorptionEmissionModel.H"
#include "zeroGradientFvPatchFields.H"
#include "wedgePolyPatch.H"
#include "emptyPolyPatch.H"
#include "FaceCellWave.H"
#include "DeltaInfoData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -38,29 +39,149 @@ namespace Foam
{ {
namespace regionModels namespace regionModels
{ {
namespace thermalBaffleModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(thermalBaffle, 0); defineTypeNameAndDebug(thermalBaffle, 0);
addToRunTimeSelectionTable(thermalBaffleModel, thermalBaffle, mesh);
addToRunTimeSelectionTable(thermalBaffleModel, thermalBaffle, dictionary); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
tmp<volScalarField::Internal> thermalBaffle::calcDelta() const
{
if (intCoupledPatchIDs_.size() != 2)
{
FatalErrorInFunction
<< "Mesh \"" << regionMesh().name()
<< "\" does not have exactly two coupled patches"
<< exit(FatalError);
}
// Initial faces from which to wave
DynamicList<label> initialFaces;
// Initialise faces on the first coupled patch with their centres as data
initialFaces.clear();
DynamicList<DeltaInfoData<point>> initialFaceInfoPoints;
{
const polyPatch& pp =
regionMesh().boundaryMesh()[intCoupledPatchIDs_[0]];
initialFaces.setCapacity(initialFaces.size() + pp.size());
initialFaceInfoPoints.setCapacity(initialFaces.size() + pp.size());
forAll(pp, ppFacei)
{
const point& c = pp.faceCentres()[ppFacei];
initialFaces.append(pp.start() + ppFacei);
initialFaceInfoPoints.append(DeltaInfoData<point>(-1, c));
}
}
// Wave across the mesh layers
List<DeltaInfoData<point>> faceInfoPoints(regionMesh().nFaces());
List<DeltaInfoData<point>> cellInfoPoints(regionMesh().nCells());
FaceCellWave<DeltaInfoData<point>>
(
regionMesh(),
initialFaces,
initialFaceInfoPoints,
faceInfoPoints,
cellInfoPoints,
regionMesh().globalData().nTotalCells() + 1
);
// Calculate the distances between the opposite patch and load into data to
// wave back in the opposite direction
initialFaces.clear();
DynamicList<DeltaInfoData<scalar>> initialFaceInfoDeltas;
{
const polyPatch& pp =
regionMesh().boundaryMesh()[intCoupledPatchIDs_[1]];
forAll(pp, ppFacei)
{
const point& c = pp.faceCentres()[ppFacei];
static nil td;
if (faceInfoPoints[pp.start() + ppFacei].valid(td))
{
const scalar d =
mag(c - faceInfoPoints[pp.start() + ppFacei].data());
initialFaces.append(pp.start() + ppFacei);
initialFaceInfoDeltas.append(DeltaInfoData<scalar>(-1, d));
}
}
}
// Wave back across the layers
List<DeltaInfoData<scalar>> faceInfoDeltas(regionMesh().nFaces());
List<DeltaInfoData<scalar>> cellInfoDeltas(regionMesh().nCells());
FaceCellWave<DeltaInfoData<scalar>>
(
regionMesh(),
initialFaces,
initialFaceInfoDeltas,
faceInfoDeltas,
cellInfoDeltas,
regionMesh().globalData().nTotalCells() + 1
);
// Unpack distances into a dimensioned field and return
tmp<volScalarField::Internal> tDelta
(
new volScalarField::Internal
(
IOobject
(
"thickness",
regionMesh().pointsInstance(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
regionMesh(),
dimLength
)
);
volScalarField::Internal& delta = tDelta.ref();
forAll(cellInfoDeltas, celli)
{
static nil td;
if (!cellInfoDeltas[celli].valid(td))
{
FatalErrorInFunction
<< "Mesh \"" << regionMesh().name()
<< "\" is not layered between its coupled patches"
<< exit(FatalError);
}
delta[celli] = cellInfoDeltas[celli].data();
}
return tDelta;
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool thermalBaffle::read() bool thermalBaffle::read()
{ {
this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_; solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
return regionModel1D::read(); return regionModel::read();
} }
bool thermalBaffle::read(const dictionary& dict) bool thermalBaffle::read(const dictionary& dict)
{ {
this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_; solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
return regionModel1D::read(dict); return regionModel::read(dict);
} }
@ -68,62 +189,31 @@ void thermalBaffle::solveEnergy()
{ {
DebugInFunction << endl; DebugInFunction << endl;
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh(); // Modify thermo density and diffusivity to take into account the thickness
volScalarField dByT
tmp<volScalarField> tQ
( (
volScalarField::New volScalarField::New
( (
"tQ", "dByT",
regionMesh(), regionMesh(),
dimensionedScalar(dimEnergy/dimVolume/dimTime, 0) dimless,
extrapolatedCalculatedFvPatchField<scalar>::typeName
) )
); );
dByT.ref() = delta_/thickness_;
volScalarField& Q = tQ.ref(); dByT.correctBoundaryConditions();
const volScalarField rho("rho", thermo_->rho()*dByT);
volScalarField rho("rho", thermo_->rho()); const volScalarField alphahe("alphahe", thermo_->alphahe()*dByT);
volScalarField alphahe(thermo_->alphahe());
// If region is one-dimension variable thickness
if (oneD_ && !constantThickness_)
{
// Scale K and rhoCp and fill Q in the internal baffle region.
const label patchi = intCoupledPatchIDs_[0];
const polyPatch& ppCoupled = rbm[patchi];
forAll(ppCoupled, localFacei)
{
const labelList& cells = boundaryFaceCells_[localFacei];
forAll(cells, i)
{
const label cellId = cells[i];
Q[cellId] =
Qs_.boundaryField()[patchi][localFacei]
/thickness_[localFacei];
rho[cellId] *= delta_.value()/thickness_[localFacei];
alphahe[cellId] *= delta_.value()/thickness_[localFacei];
}
}
}
else
{
Q = Q_;
}
fvScalarMatrix hEqn fvScalarMatrix hEqn
( (
fvm::ddt(rho, he_) fvm::ddt(rho, he_)
- fvm::laplacian(alphahe, he_) - fvm::laplacian(alphahe, he_)
== ==
Q Q_ + Qs_/thickness_
); );
if (moveMesh_) if (regionMesh().moving())
{ {
surfaceScalarField phiMesh surfaceScalarField phiMesh
( (
@ -152,7 +242,20 @@ thermalBaffle::thermalBaffle
const dictionary& dict const dictionary& dict
) )
: :
thermalBaffleModel(modelType, mesh, dict), regionModel(mesh, "thermalBaffle", modelType, dict, true),
delta_(calcDelta()),
thickness_
(
IOobject
(
"thickness",
regionMesh().pointsInstance(),
regionMesh(),
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
delta_
),
nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")), nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")),
thermo_(solidThermo::New(regionMesh())), thermo_(solidThermo::New(regionMesh())),
he_(thermo_->he()), he_(thermo_->he()),
@ -191,56 +294,6 @@ thermalBaffle::thermalBaffle
) )
) )
{ {
init();
thermo_->correct();
}
thermalBaffle::thermalBaffle
(
const word& modelType,
const fvMesh& mesh
)
:
thermalBaffleModel(modelType, mesh),
nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")),
thermo_(solidThermo::New(regionMesh())),
he_(thermo_->he()),
Qs_
(
IOobject
(
"Qs",
regionMesh().time().timeName(),
regionMesh(),
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
regionMesh(),
dimensionedScalar(dimEnergy/dimArea/dimTime, Zero)
),
Q_
(
IOobject
(
"Q",
regionMesh().time().timeName(),
regionMesh(),
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
regionMesh(),
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
),
radiation_
(
radiationModel::New
(
thermo_->T()
)
)
{
init();
thermo_->correct(); thermo_->correct();
} }
@ -253,25 +306,6 @@ thermalBaffle::~thermalBaffle()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void thermalBaffle::init()
{
if (oneD_ && !constantThickness_)
{
label patchi = intCoupledPatchIDs_[0];
const label Qsb = Qs_.boundaryField()[patchi].size();
if (Qsb!= thickness_.size())
{
FatalErrorInFunction
<< "the boundary field of Qs is "
<< Qsb << " and " << nl
<< "the field 'thickness' is " << thickness_.size() << nl
<< exit(FatalError);
}
}
}
void thermalBaffle::preEvolveRegion() void thermalBaffle::preEvolveRegion()
{} {}
@ -330,20 +364,22 @@ void thermalBaffle::info()
const label patchi = coupledPatches[i]; const label patchi = coupledPatches[i];
const fvPatchScalarField& phe = he_.boundaryField()[patchi]; const fvPatchScalarField& phe = he_.boundaryField()[patchi];
const word patchName = regionMesh().boundary()[patchi].name(); const word patchName = regionMesh().boundary()[patchi].name();
Info<< indent << "Q : " << patchName << indent <<
Info<< indent << "Q : " << patchName << indent
<<
gSum gSum
( (
mag(regionMesh().Sf().boundaryField()[patchi]) mag(regionMesh().Sf().boundaryField()[patchi])
*phe.snGrad() *phe.snGrad()
*thermo_->alphahe(patchi) *thermo_->alphahe(patchi)
) << endl; )
<< endl;
} }
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // end namespace thermalBaffleModels
} // end namespace regionModels } // end namespace regionModels
} // end namespace Foam } // end namespace Foam

View File

@ -22,10 +22,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::regionModels::thermalBaffleModels::thermalBaffle Foam::regionModels::thermalBaffle
Description Description
2D thermal baffle Thermal baffle region model
SourceFiles SourceFiles
thermalBaffle.C thermalBaffle.C
@ -36,19 +36,17 @@ SourceFiles
#ifndef thermalBaffle_H #ifndef thermalBaffle_H
#define thermalBaffle_H #define thermalBaffle_H
#include "thermalBaffleModel.H" #include "radiationModel.H"
#include "regionModel.H"
#include "solidThermo.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
namespace regionModels namespace regionModels
{ {
namespace thermalBaffleModels
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class thermalBaffle Declaration Class thermalBaffle Declaration
@ -56,18 +54,27 @@ namespace thermalBaffleModels
class thermalBaffle class thermalBaffle
: :
public thermalBaffleModel public regionModel
{ {
// Private Member Functions // Private Member Functions
//- Initialise thermalBaffle //- Calculate the baffle mesh thickness
void init(); tmp<volScalarField::Internal> calcDelta() const;
protected: protected:
// Protected data // Protected data
// Geometric parameters
//- Baffle mesh thickness
volScalarField::Internal delta_;
//- Baffle physical thickness
volScalarField::Internal thickness_;
// Solution parameters // Solution parameters
//- Number of non orthogonal correctors //- Number of non orthogonal correctors
@ -85,10 +92,10 @@ protected:
// Source term fields // Source term fields
//- Surface energy source / [J/m2/s] //- Surface energy source [J/m2/s]
volScalarField Qs_; volScalarField Qs_;
//- Volumetric energy source / [J/m3/s] //- Volumetric energy source [J/m3/s]
volScalarField Q_; volScalarField Q_;
@ -100,11 +107,13 @@ protected:
// Protected member functions // Protected member functions
//- Read control parameters IO dictionary // IO
virtual bool read();
//- Read control parameters from dictionary //- Read control parameters IO dictionary
virtual bool read(const dictionary& dict); virtual bool read();
//- Read control parameters from dictionary
virtual bool read(const dictionary& dict);
// Equations // Equations
@ -121,9 +130,6 @@ public:
// Constructors // Constructors
//- Construct from components
thermalBaffle(const word& modelType, const fvMesh& mesh);
//- Construct from components and dict //- Construct from components and dict
thermalBaffle thermalBaffle
( (
@ -145,41 +151,25 @@ public:
// Thermo properties // Thermo properties
//- Return const reference to the solidThermo //- Return const reference to the solidThermo
virtual const solidThermo& thermo() const; const solidThermo& thermo() const;
// Fields // Fields
//- Return the film specific heat capacity [J/kg/K] //- Return the film specific heat capacity [J/kg/K]
virtual const tmp<volScalarField> Cp() const; const tmp<volScalarField> Cp() const;
//- Return solid absorptivity [1/m] //- Return solid absorptivity [1/m]
virtual const volScalarField& kappaRad() const; const volScalarField& kappaRad() const;
//- Return temperature [K] //- Return temperature [K]
virtual const volScalarField& T() const; const volScalarField& T() const;
//- Return density [Kg/m^3] //- Return density [Kg/m^3]
virtual const volScalarField& rho() const; const volScalarField& rho() const;
//- Return thermal conductivity [W/m/K] //- Return thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const; const volScalarField& kappa() const;
// Helper functions
//- Return sensible enthalpy/internal energy
// as a function of temperature
// for a patch
inline tmp<scalarField> he
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Return sensible enthalpy/internal energy
inline tmp<volScalarField> he() const;
// Evolution // Evolution
@ -206,16 +196,11 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace thermalBaffleModels
} // End namespace regionModels } // End namespace regionModels
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "thermalBaffleI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,9 +0,0 @@
thermalBaffleModel/thermalBaffleModel.C
thermalBaffleModel/thermalBaffleModelNew.C
thermalBaffle/thermalBaffle.C
noThermo/noThermo.C
derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libthermalBaffleModels

View File

@ -1,156 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "noThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace thermalBaffleModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(noThermo, 0);
addToRunTimeSelectionTable(thermalBaffleModel, noThermo, mesh);
addToRunTimeSelectionTable(thermalBaffleModel, noThermo, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool noThermo::read()
{
return regionModel1D::read();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
noThermo::noThermo(const word& modelType, const fvMesh& mesh)
:
thermalBaffleModel(mesh)
{}
noThermo::noThermo
(
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
thermalBaffleModel(modelType, mesh, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
noThermo::~noThermo()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void noThermo::preEvolveRegion()
{}
void noThermo::evolveRegion()
{}
const tmp<volScalarField> noThermo::Cp() const
{
FatalErrorInFunction
<< "Cp field not available for " << type()
<< abort(FatalError);
return tmp<volScalarField>
(
volScalarField::New
(
"noThermo::Cp",
primaryMesh(),
dimensionedScalar(dimEnergy/dimVolume/dimTime, 0)
)
);
}
const volScalarField& noThermo::kappaRad() const
{
FatalErrorInFunction
<< "kappa field not available for " << type()
<< abort(FatalError);
return volScalarField::null();
}
const volScalarField& noThermo::rho() const
{
FatalErrorInFunction
<< "rho field not available for " << type()
<< abort(FatalError);
return volScalarField::null();
}
const volScalarField& noThermo::kappa() const
{
FatalErrorInFunction
<< "K field not available for " << type()
<< abort(FatalError);
return volScalarField::null();
}
const volScalarField& noThermo::T() const
{
FatalErrorInFunction
<< "T field not available for " << type()
<< abort(FatalError);
return volScalarField::null();
}
const solidThermo& noThermo::thermo() const
{
FatalErrorInFunction
<< "T field not available for " << type()
<< abort(FatalError);
return NullObjectRef<solidThermo>();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace thermalBaffleModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,147 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::regionModels::thermalBaffleModels::noThermo
Description
Dummy surface model for 'none'
SourceFiles
noThermo.C
\*---------------------------------------------------------------------------*/
#ifndef noThermo_H
#define noThermo_H
#include "thermalBaffleModel.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace thermalBaffleModels
{
/*---------------------------------------------------------------------------*\
Class noThermo Declaration
\*---------------------------------------------------------------------------*/
class noThermo
:
public thermalBaffleModel
{
protected:
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
public:
//- Runtime type information
TypeName("none");
// Constructors
//- Construct from type name and mesh
noThermo(const word& modelType, const fvMesh& mesh);
//- Construct from components and dict
noThermo
(
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Disallow default bitwise copy construction
noThermo(const noThermo&) = delete;
//- Destructor
virtual ~noThermo();
// Member Functions
// Thermo properties
//- Return const reference to the solidThermo
virtual const solidThermo& thermo() const;
// Fields
//- Return the film specific heat capacity [J/kg/K]
virtual const tmp<volScalarField> Cp() const;
//- Return solid absorptivity [1/m]
virtual const volScalarField& kappaRad() const;
//- Return the film mean temperature [K]
virtual const volScalarField& T() const;
//- Return density [Kg/m^3]
virtual const volScalarField& rho() const;
//- Return thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const;
// Evolution
//- Pre-evolve film
virtual void preEvolveRegion();
//- Evolve the film equations
virtual void evolveRegion();
// Member Operators
//- Disallow default bitwise assignment
void operator=(const noThermo&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace thermalBaffleModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "thermalBaffle.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace thermalBaffleModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline tmp<scalarField> thermalBaffle::he
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
return thermo_->he(T, patchi);
}
inline tmp<volScalarField> thermalBaffle::he() const
{
return thermo_->he();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace thermalBaffleModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,238 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "thermalBaffleModel.H"
#include "fvMesh.H"
#include "mappedVariableThicknessWallPolyPatch.H"
#include "wedgePolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(thermalBaffleModel, 0);
defineRunTimeSelectionTable(thermalBaffleModel, mesh);
defineRunTimeSelectionTable(thermalBaffleModel, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool thermalBaffleModel::read()
{
regionModel1D::read();
return true;
}
bool thermalBaffleModel::read(const dictionary& dict)
{
regionModel1D::read(dict);
return true;
}
void thermalBaffleModel::init()
{
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
// Check if region mesh in 1-D
label nTotalEdges = 0;
const label patchi = intCoupledPatchIDs_[0];
nTotalEdges = 2*nLayers_*rbm[patchi].nInternalEdges();
nTotalEdges +=
nLayers_*(rbm[patchi].nEdges() - rbm[patchi].nInternalEdges());
reduce(nTotalEdges, sumOp<label>());
label nFaces = 0;
forAll(rbm, patchi)
{
if (
rbm[patchi].size()
&&
(
isA<wedgePolyPatch>(rbm[patchi])
|| isA<emptyPolyPatch>(rbm[patchi])
)
)
{
nFaces += rbm[patchi].size();
}
}
reduce(nFaces, sumOp<label>());
if (nTotalEdges == nFaces)
{
oneD_ = true;
Info << "\nThe thermal baffle is 1D \n" << endl;
}
else
{
Info << "\nThe thermal baffle is 3D \n" << endl;
}
forAll(intCoupledPatchIDs_, i)
{
const label patchi = intCoupledPatchIDs_[i];
const polyPatch& pp = rbm[patchi];
if
(
!isA<mappedVariableThicknessWallPolyPatch>(pp)
&& oneD_
&& !constantThickness_
)
{
FatalErrorInFunction
<< "' not type '"
<< mappedVariableThicknessWallPolyPatch::typeName
<< "'. This is necessary for 1D solution "
<< " and variable thickness"
<< "\n for patch. " << pp.name()
<< exit(FatalError);
}
else if (!isA<mappedWallPolyPatch>(pp))
{
FatalErrorInFunction
<< "' not type '"
<< mappedWallPolyPatch::typeName
<< "'. This is necessary for 3D solution"
<< "\n for patch. " << pp.name()
<< exit(FatalError);
}
}
if (oneD_ && !constantThickness_)
{
const label patchi = intCoupledPatchIDs_[0];
const polyPatch& pp = rbm[patchi];
const mappedVariableThicknessWallPolyPatch& ppCoupled =
refCast
<
const mappedVariableThicknessWallPolyPatch
>(pp);
thickness_ = ppCoupled.thickness();
// Check that thickness has the right size
if (thickness_.size() != pp.size())
{
FatalErrorInFunction
<< " coupled patches in thermalBaffle are " << nl
<< " different sizes from list thickness" << nl
<< exit(FatalError);
}
// Calculate thickness of the baffle on the first face only.
if (delta_.value() == 0.0)
{
forAll(ppCoupled, localFacei)
{
label facei = ppCoupled.start() + localFacei;
label faceO =
boundaryFaceOppositeFace_[localFacei];
delta_.value() = mag
(
regionMesh().faceCentres()[facei]
- regionMesh().faceCentres()[faceO]
);
break;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
thermalBaffleModel::thermalBaffleModel(const fvMesh& mesh)
:
regionModel1D(mesh, "thermalBaffle"),
thickness_(),
delta_("delta", dimLength, 0.0),
oneD_(false),
constantThickness_(true)
{}
thermalBaffleModel::thermalBaffleModel
(
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
regionModel1D(mesh, "thermalBaffle", modelType, dict, true),
thickness_(),
delta_("delta", dimLength, 0.0),
oneD_(false),
constantThickness_(dict.lookupOrDefault<bool>("constantThickness", true))
{
init();
}
thermalBaffleModel::thermalBaffleModel
(
const word& modelType,
const fvMesh& mesh
)
:
regionModel1D(mesh, "thermalBaffle", modelType),
thickness_(),
delta_("delta", dimLength, 0.0),
oneD_(false),
constantThickness_(lookupOrDefault<bool>("constantThickness", true))
{
init();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
thermalBaffleModel::~thermalBaffleModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void thermalBaffleModel::preEvolveRegion()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,238 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::regionModels::thermalBaffleModels
Class
Foam::regionModels::thermalBaffleModel
Description
SourceFiles
thermalBaffleModel.C
\*---------------------------------------------------------------------------*/
#ifndef thermalBaffleModel_H
#define thermalBaffleModel_H
#include "runTimeSelectionTables.H"
#include "scalarIOField.H"
#include "autoPtr.H"
#include "volFieldsFwd.H"
#include "solidThermo.H"
#include "regionModel1D.H"
#include "radiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
/*---------------------------------------------------------------------------*\
Class thermalBaffleModel Declaration
\*---------------------------------------------------------------------------*/
class thermalBaffleModel
:
public regionModel1D
{
// Private Member Functions
//- Initialise thermal Baffle
void init();
protected:
// Protected Data
//- Baffle physical thickness
scalarField thickness_;
//- Baffle mesh thickness
dimensionedScalar delta_;
//- Is it one dimension
bool oneD_;
//- Is thickness constant
bool constantThickness_;
// Protected Member Functions
//- Read control parameters from IO dictionary
virtual bool read();
//- Read control parameters from dictionary
virtual bool read(const dictionary&);
public:
//- Runtime type information
TypeName("thermalBaffleModel");
// Declare runtime constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
thermalBaffleModel,
mesh,
(
const word& modelType,
const fvMesh& mesh
),
(modelType, mesh)
);
declareRunTimeSelectionTable
(
autoPtr,
thermalBaffleModel,
dictionary,
(
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
),
(modelType, mesh, dict)
);
// Constructors
//- Construct null from mesh
thermalBaffleModel(const fvMesh& mesh);
//- Construct from type name and mesh
thermalBaffleModel(const word& modelType, const fvMesh& mesh);
//- Construct from type name and mesh and dict
thermalBaffleModel
(
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Disallow default bitwise copy construction
thermalBaffleModel(const thermalBaffleModel&) = delete;
// Selectors
//- Return a reference to the selected model
static autoPtr<thermalBaffleModel> New(const fvMesh& mesh);
//- Return a reference to the selected model using dictionary
static autoPtr<thermalBaffleModel> New
(
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~thermalBaffleModel();
// Member Functions
// Access
//- Return solid thermo
virtual const solidThermo& thermo() const = 0;
//- Return thickness
const scalarField& thickness() const
{
return thickness_;
}
//- Return geometrical thickness
const dimensionedScalar& delta() const
{
return delta_;
}
//- Return if region is one dimensional
bool oneD() const
{
return oneD_;
}
//- Return if region has constant thickness
bool constantThickness() const
{
return constantThickness_;
}
// Fields
//- Return density [kg/m^3]
virtual const volScalarField& rho() const = 0;
//- Return const temperature [K]
virtual const volScalarField& T() const = 0;
//- Return specific heat capacity [J/kg/K]
virtual const tmp<volScalarField> Cp() const = 0;
//- Return the region absorptivity [1/m]
virtual const volScalarField& kappaRad() const = 0;
//- Return the region thermal conductivity [W/m/k]
virtual const volScalarField& kappa() const = 0;
// Evolution
//- Pre-evolve region
virtual void preEvolveRegion();
// Member Operators
//- Disallow default bitwise assignment
void operator=(const thermalBaffleModel&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,112 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "thermalBaffleModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<thermalBaffleModel> thermalBaffleModel::New(const fvMesh& mesh)
{
word modelType;
{
IOdictionary thermalBafflePropertiesDict
(
IOobject
(
"thermalBaffleProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
word modelType =
thermalBafflePropertiesDict.lookupOrDefault<word>
(
"thermalBaffleModel",
"thermalBaffle"
);
}
meshConstructorTable::iterator cstrIter =
meshConstructorTablePtr_->find(modelType);
if (cstrIter == meshConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown thermalBaffleModel type " << modelType
<< nl << nl
<< "Valid thermalBaffleModel types are:" << nl
<< meshConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<thermalBaffleModel>(cstrIter()(modelType, mesh));
}
autoPtr<thermalBaffleModel> thermalBaffleModel::New
(
const fvMesh& mesh,
const dictionary& dict
)
{
word modelType =
dict.lookupOrDefault<word>("thermalBaffleModel", "thermalBaffle");
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown thermalBaffleModel type " << modelType
<< nl << nl
<< "Valid thermalBaffleModel types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<thermalBaffleModel>(cstrIter()(modelType, mesh, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -45,6 +45,6 @@ timePrecision 6;
runTimeModifiable true; runTimeModifiable true;
libs ("libthermalBaffleModels.so"); libs ("libthermalBaffle.so");
// ************************************************************************* // // ************************************************************************* //