mappedExtrudedPatchBase: New base class for extruded patches

mappedExtrudedPolyPatch and mappedExtrudedWallPolyPatch are now derived from mappedExtrudedPatchBase
This commit is contained in:
Henry Weller
2023-03-02 20:25:22 +00:00
parent 7cc5cba5b4
commit 390c588cd4
19 changed files with 470 additions and 296 deletions

View File

@ -552,11 +552,21 @@ void addCouplingPatches
<< "-------\t-----\t----"
<< endl;
const wordList patchNames
wordList patchNames
(
dict.lookupOrDefault("patchNames", wordList())
);
wordList regionPatchNames
(
dict.lookupOrDefault("regionPatchNames", wordList())
);
if (isShellMesh)
{
patchNames.swap(regionPatchNames);
}
const wordList patchTypes
(
isShellMesh
@ -572,11 +582,6 @@ void addCouplingPatches
)
);
const wordList regionPatchNames
(
dict.lookupOrDefault("regionPatchNames", wordList())
);
const wordList regionOppositePatchTypes
(
dict.lookupOrDefault("regionOppositePatchTypes", wordList())
@ -672,7 +677,7 @@ void addCouplingPatches
topPatchDict.add("neighbourPatch", topNbrPatchName);
if (isShellMesh)
{
topPatchDict.add("bottomPatch", bottomPatchName);
topPatchDict.add("oppositePatch", bottomPatchName);
}
zoneTopPatch[zonei] = addPatch

View File

@ -141,7 +141,8 @@ Foam::mappedValueFvPatchField<Type>::mappedValueFvPatchField
{
OStringStream str;
str << "Field " << this->internalField().name() << " of type "
<< type() << " on patch " << this->patch().name() << " does not "
<< type() << " on patch " << this->patch().name()
<< " of type " << p.patch().type() << " does not "
<< "have mapping specified (i.e., neighbourPatch, and/or "
<< "neighbourRegion entries) nor is the patch of "
<< mappedPolyPatch::typeName << " type";

View File

@ -230,10 +230,12 @@ meshToMesh/meshToMesh.C
mappedPatches/mappedPatchBase/mappedPatchBase.C
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
mappedPatches/mappedPolyPatch/mappedExtrudedWallPolyPatch.C
mappedPatches/mappedPointPatch/mappedPointPatch.C
mappedPatches/mappedPointPatch/mappedWallPointPatch.C
mappedPatches/mappedPointPatch/mappedExtrudedWallPointPatch.C
mappedPatches/mappedExtrudedPatchBase/mappedExtrudedPatchBase.C
mappedPatches/mappedExtrudedPolyPatch/mappedExtrudedWallPolyPatch.C
mappedPatches/mappedExtrudedPointPatch/mappedExtrudedWallPointPatch.C
mappedPatches/mappedInternalPatchBase/mappedInternalPatchBase.C
mappedPatches/mappedInternalPolyPatch/mappedInternalPolyPatch.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,9 +52,9 @@ class transformer;
template<class Type>
class LayerInfoData;
template<class Type>
Ostream& operator<<(Ostream&, const LayerInfoData<Type>&);
inline Ostream& operator<<(Ostream&, const LayerInfoData<Type>&);
template<class Type>
Istream& operator>>(Istream&, LayerInfoData<Type>&);
inline Istream& operator>>(Istream&, LayerInfoData<Type>&);
/*---------------------------------------------------------------------------*\
Class LayerInfoData Declaration

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -185,14 +185,18 @@ inline bool Foam::LayerInfoData<Type>::operator!=
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<(Ostream& os, const LayerInfoData<Type>& l)
inline Foam::Ostream& Foam::operator<<
(
Ostream& os,
const LayerInfoData<Type>& l
)
{
return os << static_cast<const layerInfo&>(l) << token::SPACE << l.data_;
}
template<class Type>
Foam::Istream& Foam::operator>>(Istream& is, LayerInfoData<Type>& l)
inline Foam::Istream& Foam::operator>>(Istream& is, LayerInfoData<Type>& l)
{
return is >> static_cast<layerInfo&>(l) >> l.data_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,8 +50,8 @@ class transformer;
// Forward declaration of friend functions and operators
class layerInfo;
Ostream& operator<<(Ostream&, const layerInfo&);
Istream& operator>>(Istream&, layerInfo&);
inline Ostream& operator<<(Ostream&, const layerInfo&);
inline Istream& operator>>(Istream&, layerInfo&);
/*---------------------------------------------------------------------------*\
Class layerInfo Declaration

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -229,13 +229,13 @@ inline bool Foam::layerInfo::operator!=(const Foam::layerInfo& rhs) const
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const layerInfo& l)
inline Foam::Ostream& Foam::operator<<(Ostream& os, const layerInfo& l)
{
return os << l.layer_ << token::SPACE << l.direction_;
}
Foam::Istream& Foam::operator>>(Istream& is, layerInfo& l)
inline Foam::Istream& Foam::operator>>(Istream& is, layerInfo& l)
{
return is >> l.layer_ >> l.direction_;
}

View File

@ -23,8 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mappedExtrudedWallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "mappedExtrudedPatchBase.H"
#include "LayerInfoData.H"
#include "FaceCellWave.H"
@ -32,73 +31,18 @@ License
namespace Foam
{
defineTypeNameAndDebug(mappedExtrudedWallPolyPatch, 0);
addToRunTimeSelectionTable(polyPatch, mappedExtrudedWallPolyPatch, word);
addToRunTimeSelectionTable
(
polyPatch,
mappedExtrudedWallPolyPatch,
dictionary
);
defineTypeNameAndDebug(mappedExtrudedPatchBase, 0);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::mappedExtrudedWallPolyPatch::initCalcGeometry(PstreamBuffers& pBufs)
{
mappedWallPolyPatch::initCalcGeometry(pBufs);
}
void Foam::mappedExtrudedWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
mappedWallPolyPatch::calcGeometry(pBufs);
bottomFaceCentresPtr_.clear();
}
void Foam::mappedExtrudedWallPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
mappedWallPolyPatch::initMovePoints(pBufs, p);
}
void Foam::mappedExtrudedWallPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
mappedWallPolyPatch::movePoints(pBufs, p);
bottomFaceCentresPtr_.clear();
}
void Foam::mappedExtrudedWallPolyPatch::initTopoChange(PstreamBuffers& pBufs)
{
mappedWallPolyPatch::initTopoChange(pBufs);
}
void Foam::mappedExtrudedWallPolyPatch::topoChange(PstreamBuffers& pBufs)
{
mappedWallPolyPatch::topoChange(pBufs);
bottomFaceCentresPtr_.clear();
}
Foam::tmp<Foam::vectorField>
Foam::mappedExtrudedWallPolyPatch::patchFaceAreas() const
Foam::mappedExtrudedPatchBase::patchFaceAreas() const
{
if (!bottomFaceAreasPtr_.valid())
{
const bool isExtrudedRegion = bottomPatch_ != word::null;
const bool isExtrudedRegion = oppositePatch_ != word::null;
if (isExtrudedRegion)
{
@ -106,9 +50,9 @@ Foam::mappedExtrudedWallPolyPatch::patchFaceAreas() const
// corresponding areas and centres are on the bottom patch. We do
// this by waving these values across the layers.
const polyMesh& mesh = boundaryMesh().mesh();
const polyPatch& pp = *this;
const polyPatch& bottomPp = boundaryMesh()[bottomPatch_];
const polyMesh& mesh = patch_.boundaryMesh().mesh();
const polyPatch& pp = patch_;
const polyPatch& bottomPp = patch_.boundaryMesh()[oppositePatch_];
// Initialise faces on the bottom patch to wave from
labelList initialFaces(bottomPp.size());
@ -157,7 +101,7 @@ Foam::mappedExtrudedWallPolyPatch::patchFaceAreas() const
{
FatalErrorInFunction
<< "Mesh \"" << mesh.name()
<< "\" is not layered between the extruded wall patch "
<< "\" is not layered between the extruded patch "
<< "\"" << pp.name() << "\" and the bottom patch \""
<< bottomPp.name() << "\"" << exit(FatalError);
}
@ -172,21 +116,21 @@ Foam::mappedExtrudedWallPolyPatch::patchFaceAreas() const
// of mapping on the extruded region and then reverse map the
// extruded region's data so it is available here
const mappedExtrudedWallPolyPatch& nbrPp =
refCast<const mappedExtrudedWallPolyPatch>(nbrPolyPatch());
const mappedExtrudedPatchBase& nbrPp =
refCast<const mappedExtrudedPatchBase>(nbrPolyPatch());
bottomFaceAreasPtr_.set
(
nbrPp.reverseDistribute
(
nbrPp.primitivePatch::faceAreas()
nbrPp.patch_.primitivePatch::faceAreas()
).ptr()
);
bottomFaceCentresPtr_.set
(
nbrPp.reverseDistribute
(
nbrPp.primitivePatch::faceCentres()
nbrPp.patch_.primitivePatch::faceCentres()
).ptr()
);
}
@ -197,7 +141,7 @@ Foam::mappedExtrudedWallPolyPatch::patchFaceAreas() const
Foam::tmp<Foam::pointField>
Foam::mappedExtrudedWallPolyPatch::patchFaceCentres() const
Foam::mappedExtrudedPatchBase::patchFaceCentres() const
{
if (!bottomFaceCentresPtr_.valid())
{
@ -209,7 +153,7 @@ Foam::mappedExtrudedWallPolyPatch::patchFaceCentres() const
Foam::tmp<Foam::pointField>
Foam::mappedExtrudedWallPolyPatch::patchLocalPoints() const
Foam::mappedExtrudedPatchBase::patchLocalPoints() const
{
NotImplemented;
return tmp<pointField>(nullptr);
@ -218,72 +162,72 @@ Foam::mappedExtrudedWallPolyPatch::patchLocalPoints() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
)
Foam::mappedExtrudedPatchBase::mappedExtrudedPatchBase(const polyPatch& pp)
:
mappedWallPolyPatch(name, size, start, index, bm, patchType),
bottomPatch_(word::null)
mappedPatchBase(pp),
oppositePatch_(word::null)
{}
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
Foam::mappedExtrudedPatchBase::mappedExtrudedPatchBase
(
const word& name,
const polyPatch& pp,
const word& nbrRegionName,
const word& nbrPatchName,
const word& oppositePatch,
const cyclicTransform& transform
)
:
mappedPatchBase(pp, nbrRegionName, nbrPatchName, transform),
oppositePatch_(oppositePatch)
{}
Foam::mappedExtrudedPatchBase::mappedExtrudedPatchBase
(
const polyPatch& pp,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
const bool transformIsNone
)
:
mappedWallPolyPatch(name, dict, index, bm, patchType),
bottomPatch_(dict.lookupOrDefault<word>("bottomPatch", word::null))
mappedPatchBase(pp, dict, transformIsNone),
oppositePatch_(dict.lookupOrDefault<word>("oppositePatch", word::null))
{}
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
Foam::mappedExtrudedPatchBase::mappedExtrudedPatchBase
(
const mappedExtrudedWallPolyPatch& pp,
const polyBoundaryMesh& bm
const polyPatch& pp,
const mappedExtrudedPatchBase& mepb
)
:
mappedWallPolyPatch(pp, bm),
bottomPatch_(pp.bottomPatch_)
{}
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
(
const mappedExtrudedWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
)
:
mappedWallPolyPatch(pp, bm, index, newSize, newStart),
bottomPatch_(pp.bottomPatch_)
mappedPatchBase(pp),
oppositePatch_(mepb.oppositePatch_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::mappedExtrudedWallPolyPatch::~mappedExtrudedWallPolyPatch()
Foam::mappedExtrudedPatchBase::~mappedExtrudedPatchBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mappedExtrudedWallPolyPatch::write(Ostream& os) const
void Foam::mappedExtrudedPatchBase::clearOut()
{
mappedWallPolyPatch::write(os);
writeEntryIfDifferent(os, "bottomPatch", word::null, bottomPatch_);
mappedPatchBase::clearOut();
if (reMapAfterMove_)
{
bottomFaceCentresPtr_.clear();
}
}
void Foam::mappedExtrudedPatchBase::write(Ostream& os) const
{
mappedPatchBase::write(os);
writeEntryIfDifferent(os, "oppositePatch", word::null, oppositePatch_);
}

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 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::mappedExtrudedPatchBase
Description
Engine which provides mapping between two patches
and which offsets the geometry to account for the extrusion thickness
SourceFiles
mappedExtrudedPatchBase.C
\*---------------------------------------------------------------------------*/
#ifndef mappedExtrudedPatchBase_H
#define mappedExtrudedPatchBase_H
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class mappedExtrudedPatchBase Declaration
\*---------------------------------------------------------------------------*/
class mappedExtrudedPatchBase
:
public mappedPatchBase
{
// Private Member Data
//- The patch on the opposite side of the extruded region.
// Empty if this is not the extruded region.
mutable word oppositePatch_;
//- The face areas on the bottom patch
mutable autoPtr<vectorField> bottomFaceAreasPtr_;
//- The face centres on the bottom patch
mutable autoPtr<pointField> bottomFaceCentresPtr_;
//- The local points on the bottom patch
mutable autoPtr<pointField> bottomLocalPointsPtr_;
protected:
// Protected Member Functions
//- Get the face-areas for the patch
virtual tmp<vectorField> patchFaceAreas() const;
//- Get the face-centres for the patch
virtual tmp<pointField> patchFaceCentres() const;
//- Get the local points for the patch
virtual tmp<pointField> patchLocalPoints() const;
public:
//- Runtime type information
TypeName("mappedExtrudedPatchBase");
// Constructors
//- Construct from patch
mappedExtrudedPatchBase(const polyPatch&);
//- Construct from components
mappedExtrudedPatchBase
(
const polyPatch& pp,
const word& nbrRegionName,
const word& nbrPatchName,
const word& oppositePatch,
const cyclicTransform& transform
);
//- Construct from dictionary
mappedExtrudedPatchBase
(
const polyPatch& pp,
const dictionary& dict,
const bool transformisNone
);
//- Construct as copy, resetting the boundary mesh
mappedExtrudedPatchBase
(
const polyPatch&,
const mappedExtrudedPatchBase&
);
//- Destructor
virtual ~mappedExtrudedPatchBase();
// Member Functions
// Edit
//- Clear out data on mesh change
virtual void clearOut();
// I/O
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -0,0 +1,179 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 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 "mappedExtrudedWallPolyPatch.H"
#include "mappedPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(mappedExtrudedWallPolyPatch, 0);
addToRunTimeSelectionTable(polyPatch, mappedExtrudedWallPolyPatch, word);
addToRunTimeSelectionTable
(
polyPatch,
mappedExtrudedWallPolyPatch,
dictionary
);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::mappedExtrudedWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
wallPolyPatch::calcGeometry(pBufs);
mappedExtrudedPatchBase::clearOut();
}
void Foam::mappedExtrudedWallPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
wallPolyPatch::movePoints(pBufs, p);
mappedExtrudedPatchBase::clearOut();
}
void Foam::mappedExtrudedWallPolyPatch::topoChange(PstreamBuffers& pBufs)
{
wallPolyPatch::topoChange(pBufs);
mappedExtrudedPatchBase::clearOut();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
)
:
wallPolyPatch(name, size, start, index, bm, patchType),
mappedExtrudedPatchBase(static_cast<const polyPatch&>(*this))
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
{
inGroups().append(mappedPolyPatch::typeName);
}
}
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& neighbourRegion,
const word& neighbourPatch,
const word& bottomPatch,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(name, size, start, index, bm, typeName),
mappedExtrudedPatchBase
(
*this,
neighbourRegion,
neighbourPatch,
bottomPatch,
cyclicTransform(true)
)
{}
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
)
:
wallPolyPatch(name, dict, index, bm, patchType),
mappedExtrudedPatchBase(*this, dict, true)
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
{
inGroups().append(mappedPolyPatch::typeName);
}
}
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
(
const mappedExtrudedWallPolyPatch& pp,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(pp, bm),
mappedExtrudedPatchBase(*this, pp)
{}
Foam::mappedExtrudedWallPolyPatch::mappedExtrudedWallPolyPatch
(
const mappedExtrudedWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
)
:
wallPolyPatch(pp, bm, index, newSize, newStart),
mappedExtrudedPatchBase(*this, pp)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::mappedExtrudedWallPolyPatch::~mappedExtrudedWallPolyPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mappedExtrudedWallPolyPatch::write(Ostream& os) const
{
wallPolyPatch::write(os);
mappedExtrudedPatchBase::write(os);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,8 +25,7 @@ Class
Foam::mappedExtrudedWallPolyPatch
Description
Wall patch which holds a mapping engine to map values from another patch,
and which offsets the geometry to account for the extrusion thickness
Wall patch which holds a mapping engine to map values from another patch
SourceFiles
mappedExtrudedWallPolyPatch.C
@ -36,72 +35,37 @@ SourceFiles
#ifndef mappedExtrudedWallPolyPatch_H
#define mappedExtrudedWallPolyPatch_H
#include "mappedWallPolyPatch.H"
#include "wallPolyPatch.H"
#include "mappedExtrudedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class mappedExtrudedWallPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class mappedExtrudedWallPolyPatch
:
public mappedWallPolyPatch
public wallPolyPatch,
public mappedExtrudedPatchBase
{
private:
// Private Member Data
//- The bottom patch on the other side of the extruded region. Empty if
// this is not the extruded region.
word bottomPatch_;
//- The face areas on the bottom patch
mutable autoPtr<vectorField> bottomFaceAreasPtr_;
//- The face centres on the bottom patch
mutable autoPtr<pointField> bottomFaceCentresPtr_;
//- The local points on the bottom patch
mutable autoPtr<pointField> bottomLocalPointsPtr_;
protected:
// Protected Member Functions
//- Initialise the calculation of the patch geometry
virtual void initCalcGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initTopoChange(PstreamBuffers&);
//- Update of the patch topology
virtual void topoChange(PstreamBuffers&);
//- Get the face-areas for the patch
virtual tmp<vectorField> patchFaceAreas() const;
//- Get the face-centres for the patch
virtual tmp<pointField> patchFaceCentres() const;
//- Get the local points for the patch
virtual tmp<pointField> patchLocalPoints() const;
public:
@ -122,6 +86,19 @@ public:
const word& patchType
);
//- Construct from components
mappedExtrudedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& neighbourRegion,
const word& neighbourPatch,
const word& bottomPatch,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
mappedExtrudedWallPolyPatch
(

View File

@ -31,8 +31,6 @@ License
#include "indexedOctree.H"
#include "globalIndex.H"
#include "RemoteData.H"
#include "OBJstream.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -317,7 +315,8 @@ Foam::mappedPatchBase::mappedPatchBase(const polyPatch& pp)
patchToPatchIsUsed_(false),
patchToPatchIsValid_(false),
patchToPatchPtr_(nullptr),
matchTol_(defaultMatchTol_)
matchTol_(defaultMatchTol_),
reMapAfterMove_(true)
{}
@ -339,7 +338,8 @@ Foam::mappedPatchBase::mappedPatchBase
patchToPatchIsUsed_(false),
patchToPatchIsValid_(false),
patchToPatchPtr_(nullptr),
matchTol_(defaultMatchTol_)
matchTol_(defaultMatchTol_),
reMapAfterMove_(true)
{}
@ -387,7 +387,8 @@ Foam::mappedPatchBase::mappedPatchBase
).ptr()
: nullptr
),
matchTol_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_))
matchTol_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_)),
reMapAfterMove_(dict.lookupOrDefault<bool>("reMapAfterMove", true))
{
const bool haveCoupleGroup = coupleGroup_.valid();
@ -435,7 +436,8 @@ Foam::mappedPatchBase::mappedPatchBase
? patchToPatch::New(mpb.patchToPatchPtr_->type(), false).ptr()
: nullptr
),
matchTol_(mpb.matchTol_)
matchTol_(mpb.matchTol_),
reMapAfterMove_(true)
{}
@ -492,11 +494,14 @@ const Foam::mappedPatchBase& Foam::mappedPatchBase::getMap
void Foam::mappedPatchBase::clearOut()
{
if (reMapAfterMove_)
{
mapPtr_.clear();
nbrPatchFaceIndices_.clear();
patchToPatchIsValid_ = false;
}
}
bool Foam::mappedPatchBase::specified(const dictionary& dict)
@ -526,6 +531,8 @@ void Foam::mappedPatchBase::write(Ostream& os) const
}
writeEntryIfDifferent(os, "matchTolerance", defaultMatchTol_, matchTol_);
writeEntryIfDifferent<bool>(os, "reMapAfterMove", true, reMapAfterMove_);
}

View File

@ -112,6 +112,10 @@ protected:
//- Matching tolerance
const scalar matchTol_;
//- Do we need to re-calculate the mapping if mesh motion takes place?
// Defaults to true.
const bool reMapAfterMove_;
// Protected Member Functions
@ -238,7 +242,7 @@ public:
// Edit
//- Clear out data on mesh change
void clearOut();
virtual void clearOut();
// Distribute

View File

@ -39,12 +39,6 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::mappedPolyPatch::initCalcGeometry(PstreamBuffers& pBufs)
{
polyPatch::initCalcGeometry(pBufs);
}
void Foam::mappedPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
polyPatch::calcGeometry(pBufs);
@ -52,16 +46,6 @@ void Foam::mappedPolyPatch::calcGeometry(PstreamBuffers& pBufs)
}
void Foam::mappedPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
polyPatch::initMovePoints(pBufs, p);
}
void Foam::mappedPolyPatch::movePoints
(
PstreamBuffers& pBufs,
@ -69,17 +53,8 @@ void Foam::mappedPolyPatch::movePoints
)
{
polyPatch::movePoints(pBufs, p);
if (reMapAfterMove_)
{
mappedPatchBase::clearOut();
}
}
void Foam::mappedPolyPatch::initTopoChange(PstreamBuffers& pBufs)
{
polyPatch::initTopoChange(pBufs);
}
void Foam::mappedPolyPatch::topoChange(PstreamBuffers& pBufs)
@ -102,8 +77,7 @@ Foam::mappedPolyPatch::mappedPolyPatch
)
:
polyPatch(name, size, start, index, bm, patchType),
mappedPatchBase(static_cast<const polyPatch&>(*this)),
reMapAfterMove_(true)
mappedPatchBase(static_cast<const polyPatch&>(*this))
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), typeName) == -1)
@ -123,8 +97,7 @@ Foam::mappedPolyPatch::mappedPolyPatch
)
:
polyPatch(name, dict, index, bm, patchType),
mappedPatchBase(*this, dict, false),
reMapAfterMove_(dict.lookupOrDefault<bool>("reMapAfterMove", true))
mappedPatchBase(*this, dict, false)
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), typeName) == -1)
@ -141,8 +114,7 @@ Foam::mappedPolyPatch::mappedPolyPatch
)
:
polyPatch(pp, bm),
mappedPatchBase(*this, pp),
reMapAfterMove_(true)
mappedPatchBase(*this, pp)
{}
@ -156,8 +128,7 @@ Foam::mappedPolyPatch::mappedPolyPatch
)
:
polyPatch(pp, bm, index, newSize, newStart),
mappedPatchBase(*this, pp),
reMapAfterMove_(true)
mappedPatchBase(*this, pp)
{}
@ -173,7 +144,6 @@ void Foam::mappedPolyPatch::write(Ostream& os) const
{
polyPatch::write(os);
mappedPatchBase::write(os);
writeEntryIfDifferent<bool>(os, "reMapAfterMove", true, reMapAfterMove_);
}

View File

@ -44,8 +44,6 @@ SourceFiles
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class mappedPolyPatch Declaration
\*---------------------------------------------------------------------------*/
@ -55,32 +53,17 @@ class mappedPolyPatch
public polyPatch,
public mappedPatchBase
{
// Private Data
//- Do we need to re-calculate the mapping if mesh motion takes place?
// Defaults to true.
const bool reMapAfterMove_;
protected:
// Protected Member Functions
//- Initialise the calculation of the patch geometry
virtual void initCalcGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initTopoChange(PstreamBuffers&);
//- Update of the patch topology
virtual void topoChange(PstreamBuffers&);

View File

@ -44,12 +44,6 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::mappedWallPolyPatch::initCalcGeometry(PstreamBuffers& pBufs)
{
wallPolyPatch::initCalcGeometry(pBufs);
}
void Foam::mappedWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
wallPolyPatch::calcGeometry(pBufs);
@ -57,16 +51,6 @@ void Foam::mappedWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
}
void Foam::mappedWallPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
wallPolyPatch::initMovePoints(pBufs, p);
}
void Foam::mappedWallPolyPatch::movePoints
(
PstreamBuffers& pBufs,
@ -74,17 +58,8 @@ void Foam::mappedWallPolyPatch::movePoints
)
{
wallPolyPatch::movePoints(pBufs, p);
if (reMapAfterMove_)
{
mappedPatchBase::clearOut();
}
}
void Foam::mappedWallPolyPatch::initTopoChange(PstreamBuffers& pBufs)
{
wallPolyPatch::initTopoChange(pBufs);
}
void Foam::mappedWallPolyPatch::topoChange(PstreamBuffers& pBufs)
@ -107,8 +82,7 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch
)
:
wallPolyPatch(name, size, start, index, bm, patchType),
mappedPatchBase(static_cast<const polyPatch&>(*this)),
reMapAfterMove_(true)
mappedPatchBase(static_cast<const polyPatch&>(*this))
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
@ -136,8 +110,7 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch
neighbourRegion,
neighbourPatch,
cyclicTransform(true)
),
reMapAfterMove_(true)
)
{}
@ -151,8 +124,7 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch
)
:
wallPolyPatch(name, dict, index, bm, patchType),
mappedPatchBase(*this, dict, true),
reMapAfterMove_(dict.lookupOrDefault<bool>("reMapAfterMove", true))
mappedPatchBase(*this, dict, true)
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
@ -169,8 +141,7 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch
)
:
wallPolyPatch(pp, bm),
mappedPatchBase(*this, pp),
reMapAfterMove_(true)
mappedPatchBase(*this, pp)
{}
@ -184,8 +155,7 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch
)
:
wallPolyPatch(pp, bm, index, newSize, newStart),
mappedPatchBase(*this, pp),
reMapAfterMove_(true)
mappedPatchBase(*this, pp)
{}
@ -201,7 +171,6 @@ void Foam::mappedWallPolyPatch::write(Ostream& os) const
{
wallPolyPatch::write(os);
mappedPatchBase::write(os);
writeEntryIfDifferent<bool>(os, "reMapAfterMove", true, reMapAfterMove_);
}

View File

@ -38,14 +38,11 @@ SourceFiles
#include "wallPolyPatch.H"
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class mappedWallPolyPatch Declaration
\*---------------------------------------------------------------------------*/
@ -55,32 +52,16 @@ class mappedWallPolyPatch
public wallPolyPatch,
public mappedPatchBase
{
// Private Data
//- Do we need to re-calculate the mapping if mesh motion takes place?
// Defaults to true.
const bool reMapAfterMove_;
protected:
// Protected Member Functions
//- Initialise the calculation of the patch geometry
virtual void initCalcGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initTopoChange(PstreamBuffers&);
//- Update of the patch topology
virtual void topoChange(PstreamBuffers&);