ENH: Dry-run - Include creation of sets and zones for dyanmic mesh cases

This commit is contained in:
Andrew Heather 2018-06-19 13:34:33 +01:00
parent cf7dbcd0e4
commit 02f97872ca
7 changed files with 62 additions and 42 deletions

View File

@ -61,6 +61,9 @@ SimplifiedDynamicFvMesh
// Add the patches
addLocalPatches(*this);
// Add the zones if constructed from mesh
initialiseZones(*this);
}

View File

@ -75,7 +75,8 @@ bool Foam::simplifiedMeshes::columnFvMeshInfo::setPatchEntries
{
polyBoundaryMeshEntries allPatchEntries(boundaryIO);
Info<< "Creating simplified mesh using " << allPatchEntries.path() << endl;
Info<< "Creating simplified mesh using " << allPatchEntries.path()
<< endl;
for (const entry& e : allPatchEntries)
{
@ -134,7 +135,7 @@ bool Foam::simplifiedMeshes::columnFvMeshInfo::setPatchEntries
dictionary simplifiedEntries;
simplifiedEntries.add("startFace", 0);
simplifiedEntries.add("nFaces", 1);
simplifiedEntries.add("type", "wall"); // default to wall type
simplifiedEntries.add("type", "wall"); // default to wall
patchEntries_.add(e.keyword(), simplifiedEntries);
}
@ -304,7 +305,12 @@ void Foam::simplifiedMeshes::columnFvMeshInfo::initialise(const Time& runTime)
}
void Foam::simplifiedMeshes::columnFvMeshInfo::addLocalPatches(fvMesh& mesh) const
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::simplifiedMeshes::columnFvMeshInfo::addLocalPatches
(
fvMesh& mesh
) const
{
const label nPatch = patchEntries_.size();
@ -367,6 +373,24 @@ void Foam::simplifiedMeshes::columnFvMeshInfo::addLocalPatches(fvMesh& mesh) con
}
}
void Foam::simplifiedMeshes::columnFvMeshInfo::initialiseZones(fvMesh& mesh)
{
if (createFromMesh_)
{
// Initialise the zones
initialiseZone<pointZoneMesh>
(
"point",
localInstance_,
mesh.pointZones()
);
initialiseZone<faceZoneMesh>("face", localInstance_, mesh.faceZones());
initialiseZone<cellZoneMesh>("cell", localInstance_, mesh.cellZones());
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::simplifiedMeshes::columnFvMeshInfo::columnFvMeshInfo(const Time& runTime)
@ -389,6 +413,11 @@ Foam::simplifiedMeshes::columnFvMeshInfo::columnFvMeshInfo(const Time& runTime)
nPatchWithFace_(0)
{
initialise(runTime);
// Dummy zones and sets created on demand
// Note: zones can be updated post-construction
cellZoneMesh::disallowGenericZones = 1;
topoSet::disallowGenericSets = 1;
}
@ -423,24 +452,8 @@ Foam::simplifiedMeshes::columnFvMesh::columnFvMesh(const Time& runTime)
// Add the patches
addLocalPatches(*this);
// Add the zones
if (createFromMesh_)
{
// Initialise the zones
initialiseZone<pointZoneMesh>("point", localInstance_, pointZones());
initialiseZone<faceZoneMesh>("face", localInstance_, faceZones());
initialiseZone<cellZoneMesh>("cell", localInstance_, cellZones());
// Dummy sets created on demand
topoSet::disallowGenericSets = 1;
}
else
{
// Dummy zones and sets created on demand
cellZoneMesh::disallowGenericZones = 1;
topoSet::disallowGenericSets = 1;
}
// Add the zones if constructed from mesh
initialiseZones(*this);
if (debug)
{

View File

@ -59,6 +59,15 @@ class columnFvMeshInfo
//- Initialise
void initialise(const Time& runTime);
//- Helper function to initialise empty zones
template<class ZoneMeshType>
void initialiseZone
(
const word& zoneTypeName,
const fileName& instance,
ZoneMeshType& zoneType
);
protected:
@ -99,6 +108,9 @@ protected:
//- Add the patches to the mesh
void addLocalPatches(fvMesh& mesh) const;
//- Initialise zones if constructed from mesh
void initialiseZones(fvMesh& mesh);
public:
@ -133,6 +145,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "columnFvMeshTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -22,14 +22,13 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "polyMesh.H"
template<class ZoneMeshType>
void Foam::simplifiedFvMesh::initialiseZone
void Foam::simplifiedMeshes::columnFvMeshInfo::initialiseZone
(
const word& zoneTypeName,
const fileName& instance,
const fileName& instance,
ZoneMeshType& zoneType
)
{

View File

@ -94,6 +94,8 @@ Foam::simplifiedMeshes::hexCellFvMesh::hexCellFvMesh
);
addFvPatches(patches);
// Note: no sets or zones created
}

View File

@ -25,6 +25,7 @@ License
#include "simplifiedFvMesh.H"
#include "fvPatchField.H"
#include "topoSet.H"
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
@ -57,6 +58,8 @@ bool Foam::simplifiedFvMesh::fvPatchFieldExists(const word& patchType)
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::simplifiedFvMesh::simplifiedFvMesh
(
const IOobject& io,

View File

@ -52,18 +52,6 @@ class simplifiedFvMesh
:
public fvMesh
{
protected:
//- Helper function to initialise empty zones
template<class ZoneMeshType>
void initialiseZone
(
const word& zoneTypeName,
const fileName& instance,
ZoneMeshType& zoneType
);
public:
//- Runtime type information
@ -118,12 +106,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "simplifiedFvMeshTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //