mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: Refactored creation of simplified meshes for -dry-run operation
TODO: migrate singleCellFvMesh into simplified mesh framework (?)
This commit is contained in:
@ -43,7 +43,7 @@ Description
|
||||
#include "OFstream.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
#include "basicSpecieMixture.H"
|
||||
#include "cellModel.H"
|
||||
#include "hexCellFvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Info<< "Constructing single cell mesh" << nl << endl;
|
||||
|
||||
Foam::proxyMeshes::hexCellFvMesh mesh(runTime);
|
||||
Foam::simplifiedMeshes::hexCellFvMesh mesh(runTime);
|
||||
|
||||
@ -9,7 +9,7 @@ if (args.optionFound("dry-run") || args.optionFound("dry-run-write"))
|
||||
Foam::FieldBase::allowConstructFromLargerSize = true;
|
||||
|
||||
// Create a simplified 1D mesh and attempt to re-create boundary conditions
|
||||
meshPtr.reset(new Foam::proxyMeshes::columnFvMesh(runTime));
|
||||
meshPtr.reset(new Foam::simplifiedMeshes::columnFvMesh(runTime));
|
||||
|
||||
// Stopping after 1 iteration of the simplified mesh
|
||||
// Note: using saNoWriteNow will only trigger the function object execute
|
||||
|
||||
@ -7,4 +7,7 @@ dynamicInkJetFvMesh/dynamicInkJetFvMesh.C
|
||||
dynamicRefineFvMesh/dynamicRefineFvMesh.C
|
||||
dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C
|
||||
|
||||
simplifiedDynamicFvMesh/simplifiedDynamicFvMeshes.C
|
||||
simplifiedDynamicFvMesh/simplifiedDynamicFvMesh.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libdynamicFvMesh
|
||||
|
||||
@ -119,6 +119,16 @@ public:
|
||||
static autoPtr<dynamicFvMesh> New(const IOobject& io);
|
||||
|
||||
|
||||
//- Select, construct and return the dynamicFvMesh
|
||||
// If the constant/dynamicMeshDict does not exist
|
||||
// a staticFvMesh is returned
|
||||
static autoPtr<dynamicFvMesh> New
|
||||
(
|
||||
const argList& args,
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~dynamicFvMesh() = default;
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "staticFvMesh.H"
|
||||
#include "simplifiedDynamicFvMesh.H"
|
||||
#include "argList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -87,4 +89,62 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New
|
||||
(
|
||||
const argList& args,
|
||||
const Time& runTime
|
||||
)
|
||||
{
|
||||
if (args.optionFound("dry-run") || args.optionFound("dry-run-write"))
|
||||
{
|
||||
Info
|
||||
<< "Operating in 'dry-run' mode: case will run for 1 time step. "
|
||||
<< "All checks assumed OK on a clean exit" << Foam::endl;
|
||||
|
||||
FieldBase::allowConstructFromLargerSize = true;
|
||||
|
||||
// Stopping after 1 iteration of the simplified mesh
|
||||
// Note: using saNoWriteNow will only trigger the function object execute
|
||||
// function and not the write function
|
||||
runTime.stopAt(Foam::Time::saNoWriteNow);
|
||||
|
||||
if (args.optionFound("dry-run-write"))
|
||||
{
|
||||
// Stopping after 1 iteration of the simplified mesh
|
||||
// Note: using saWriteNow to trigger writing/execution of function
|
||||
// objects
|
||||
runTime.stopAt(Foam::Time::saWriteNow);
|
||||
}
|
||||
|
||||
functionObject::outputPrefix = "postProcessing-dry-run";
|
||||
|
||||
return
|
||||
simplifiedMeshes::simplifiedDynamicFvMeshBase::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dynamicFvMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dynamicFvMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -51,6 +51,29 @@ Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh(const IOobject& io)
|
||||
{}
|
||||
|
||||
|
||||
Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
pointField&& points,
|
||||
faceList&& faces,
|
||||
labelList&& allOwner,
|
||||
labelList&& allNeighbour,
|
||||
const bool syncPar
|
||||
)
|
||||
:
|
||||
dynamicFvMesh
|
||||
(
|
||||
io,
|
||||
std::move(points),
|
||||
std::move(faces),
|
||||
std::move(allOwner),
|
||||
std::move(allNeighbour),
|
||||
syncPar
|
||||
),
|
||||
motionPtr_(motionSolver::New(*this))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dynamicMotionSolverFvMesh::~dynamicMotionSolverFvMesh()
|
||||
|
||||
@ -77,6 +77,18 @@ public:
|
||||
//- Construct from IOobject
|
||||
dynamicMotionSolverFvMesh(const IOobject& io);
|
||||
|
||||
//- Construct from components without boundary.
|
||||
// Boundary is added using addFvPatches() member function
|
||||
dynamicMotionSolverFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
pointField&& points,
|
||||
faceList&& faces,
|
||||
labelList&& allOwner,
|
||||
labelList&& allNeighbour,
|
||||
const bool syncPar = true
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~dynamicMotionSolverFvMesh();
|
||||
|
||||
@ -1,18 +1,6 @@
|
||||
Info<< "Create mesh for time = "
|
||||
<< runTime.timeName() << nl << endl;
|
||||
Info<< "Create mesh for time = "
|
||||
<< runTime.timeName() << nl << endl;
|
||||
|
||||
autoPtr<dynamicFvMesh> meshPtr
|
||||
(
|
||||
dynamicFvMesh::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dynamicFvMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
autoPtr<dynamicFvMesh> meshPtr(dynamicFvMesh::New(args, runTime));
|
||||
|
||||
dynamicFvMesh& mesh = meshPtr();
|
||||
dynamicFvMesh& mesh = meshPtr();
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ 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 "simplifiedDynamicFvMesh.H"
|
||||
#include "staticFvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace simplifiedMeshes
|
||||
{
|
||||
defineTypeNameAndDebug(simplifiedDynamicFvMeshBase, 0);
|
||||
defineRunTimeSelectionTable(simplifiedDynamicFvMeshBase, time);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::dynamicFvMesh>
|
||||
Foam::simplifiedMeshes::simplifiedDynamicFvMeshBase::New
|
||||
(
|
||||
const IOobject& io
|
||||
)
|
||||
{
|
||||
IOobject dictHeader
|
||||
(
|
||||
"dynamicMeshDict",
|
||||
io.time().constant(),
|
||||
(io.name() == polyMesh::defaultRegion ? "" : io.name()),
|
||||
io.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (dictHeader.typeHeaderOk<IOdictionary>(true))
|
||||
{
|
||||
IOdictionary dict(dictHeader);
|
||||
|
||||
const word modelType(dict.lookup("dynamicFvMesh"));
|
||||
|
||||
auto cstrIter = timeConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (cstrIter.found())
|
||||
{
|
||||
Info<< "Selecting simplified mesh model " << modelType << endl;
|
||||
return autoPtr<dynamicFvMesh>(cstrIter()(io.time()));
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Selecting simplified mesh model " << staticFvMesh::typeName << endl;
|
||||
return autoPtr<dynamicFvMesh>
|
||||
(
|
||||
new SimplifiedDynamicFvMesh<staticFvMesh>(io.time())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,149 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ 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::simplifiedFvMesh
|
||||
|
||||
Description
|
||||
Functions to generate simplified finite volume meshes
|
||||
|
||||
SourceFiles
|
||||
simplifiedFvMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef simplifiedDynamicFvMesh_H
|
||||
#define simplifiedDynamicFvMesh_H
|
||||
|
||||
#include "columnFvMesh.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class dynamicFvMesh;
|
||||
|
||||
namespace simplifiedMeshes
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class simplifiedDynamicFvMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class simplifiedDynamicFvMeshBase
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("simplifiedDynamicFvMeshBase");
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
dynamicFvMesh,
|
||||
time,
|
||||
(
|
||||
const Time& runTime
|
||||
),
|
||||
(runTime)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected simplified mesh
|
||||
static autoPtr<dynamicFvMesh> New(const IOobject& io);
|
||||
|
||||
|
||||
//- Constructor
|
||||
simplifiedDynamicFvMeshBase()
|
||||
{}
|
||||
|
||||
//- Destructor
|
||||
virtual ~simplifiedDynamicFvMeshBase() = default;
|
||||
};
|
||||
|
||||
|
||||
template<class DynamicMeshType>
|
||||
class SimplifiedDynamicFvMesh
|
||||
:
|
||||
public simplifiedDynamicFvMeshBase,
|
||||
public columnFvMeshInfo,
|
||||
public DynamicMeshType
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
ClassNameNoDebug(DynamicMeshType::typeName_.c_str());
|
||||
|
||||
//- Constructor
|
||||
SimplifiedDynamicFvMesh(const Time& runTime);
|
||||
|
||||
//- Update the mesh for both mesh motion and topology change
|
||||
virtual bool update()
|
||||
{
|
||||
// No updates performed
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace simplifiedMeshes
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "simplifiedDynamicFvMeshTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define createProxyDynamicFvMesh(Type) \
|
||||
\
|
||||
typedef simplifiedMeshes::SimplifiedDynamicFvMesh<Type> simplified##Type; \
|
||||
\
|
||||
template<> \
|
||||
const word simplified##Type::typeName = Type::typeName; \
|
||||
\
|
||||
namespace simplifiedMeshes \
|
||||
{ \
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
simplifiedDynamicFvMeshBase, \
|
||||
simplified##Type, \
|
||||
time \
|
||||
); \
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class DynamicMeshType>
|
||||
Foam::simplifiedMeshes::SimplifiedDynamicFvMesh<DynamicMeshType>::
|
||||
SimplifiedDynamicFvMesh
|
||||
(
|
||||
const Time& runTime
|
||||
)
|
||||
:
|
||||
simplifiedDynamicFvMeshBase(),
|
||||
columnFvMeshInfo(runTime),
|
||||
DynamicMeshType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fvMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime,
|
||||
IOobject::NO_READ, // Do not read any existing mesh
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
std::move(points1D_),
|
||||
std::move(faces1D_),
|
||||
std::move(owner1D_),
|
||||
std::move(neighbour1D_)
|
||||
)
|
||||
{
|
||||
// Workaround to read fvSchemes and fvSolution after setting NO_READ
|
||||
// when creating the mesh
|
||||
{
|
||||
fvSchemes::readOpt() = IOobject::MUST_READ;
|
||||
fvSchemes::read();
|
||||
fvSolution::readOpt() = IOobject::MUST_READ;
|
||||
fvSolution::read();
|
||||
}
|
||||
|
||||
// Add the patches
|
||||
addLocalPatches(*this);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ 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 "addToRunTimeSelectionTable.H"
|
||||
#include "simplifiedDynamicFvMesh.H"
|
||||
#include "staticFvMesh.H"
|
||||
#include "dynamicMotionSolverFvMesh.H"
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
createProxyDynamicFvMesh(staticFvMesh);
|
||||
createProxyDynamicFvMesh(dynamicMotionSolverFvMesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -43,6 +43,28 @@ Foam::staticFvMesh::staticFvMesh(const IOobject& io)
|
||||
{}
|
||||
|
||||
|
||||
Foam::staticFvMesh::staticFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
pointField&& points,
|
||||
faceList&& faces,
|
||||
labelList&& allOwner,
|
||||
labelList&& allNeighbour,
|
||||
const bool syncPar
|
||||
)
|
||||
:
|
||||
dynamicFvMesh
|
||||
(
|
||||
io,
|
||||
std::move(points),
|
||||
std::move(faces),
|
||||
std::move(allOwner),
|
||||
std::move(allNeighbour),
|
||||
syncPar
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::staticFvMesh::update()
|
||||
|
||||
@ -70,6 +70,18 @@ public:
|
||||
//- Construct from IOobject
|
||||
staticFvMesh(const IOobject& io);
|
||||
|
||||
//- Construct from components without boundary.
|
||||
// Boundary is added using addFvPatches() member function
|
||||
staticFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
pointField&& points,
|
||||
faceList&& faces,
|
||||
labelList&& allOwner,
|
||||
labelList&& allNeighbour,
|
||||
const bool syncPar = true
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~staticFvMesh() = default;
|
||||
|
||||
@ -113,7 +113,15 @@ Foam::points0MotionSolver::points0MotionSolver
|
||||
motionSolver(mesh, dict, type),
|
||||
points0_(points0IO(mesh))
|
||||
{
|
||||
if (points0_.size() != mesh.nPoints())
|
||||
if
|
||||
(
|
||||
FieldBase::allowConstructFromLargerSize
|
||||
&& (points0_.size() > mesh.nPoints())
|
||||
)
|
||||
{
|
||||
// Allowed
|
||||
}
|
||||
else if (points0_.size() != mesh.nPoints())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Number of points in mesh " << mesh.nPoints()
|
||||
|
||||
@ -3,9 +3,9 @@ fvMesh/fvMesh.C
|
||||
|
||||
fvMesh/singleCellFvMesh/singleCellFvMesh.C
|
||||
|
||||
fvMesh/proxyFvMesh/proxyFvMesh.C
|
||||
fvMesh/proxyFvMesh/columnFvMesh.C
|
||||
fvMesh/proxyFvMesh/hexCellFvMesh.C
|
||||
fvMesh/simplifiedFvMesh/simplifiedFvMesh/simplifiedFvMesh.C
|
||||
fvMesh/simplifiedFvMesh/columnFvMesh/columnFvMesh.C
|
||||
fvMesh/simplifiedFvMesh/hexCellFvMesh/hexCellFvMesh.C
|
||||
|
||||
fvBoundaryMesh = fvMesh/fvBoundaryMesh
|
||||
$(fvBoundaryMesh)/fvBoundaryMesh.C
|
||||
|
||||
@ -22,9 +22,7 @@
|
||||
#include "IOMRFZoneList.H"
|
||||
#include "constants.H"
|
||||
|
||||
#include "proxyFvMesh.H"
|
||||
#include "columnFvMesh.H"
|
||||
#include "hexCellFvMesh.H"
|
||||
|
||||
#include "OSspecific.H"
|
||||
#include "argList.H"
|
||||
|
||||
@ -36,14 +36,14 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace proxyMeshes
|
||||
namespace simplifiedMeshes
|
||||
{
|
||||
defineTypeNameAndDebug(columnFvMeshInfo, 0);
|
||||
defineTypeNameAndDebug(columnFvMesh, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
proxyFvMesh,
|
||||
simplifiedFvMesh,
|
||||
columnFvMesh,
|
||||
time
|
||||
);
|
||||
@ -53,7 +53,7 @@ namespace proxyMeshes
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::proxyMeshes::columnFvMeshInfo::setPatchEntries
|
||||
bool Foam::simplifiedMeshes::columnFvMeshInfo::setPatchEntries
|
||||
(
|
||||
const Time& runTime
|
||||
)
|
||||
@ -75,7 +75,7 @@ bool Foam::proxyMeshes::columnFvMeshInfo::setPatchEntries
|
||||
{
|
||||
polyBoundaryMeshEntries allPatchEntries(boundaryIO);
|
||||
|
||||
Info<< "Creating proxy mesh using " << allPatchEntries.path() << endl;
|
||||
Info<< "Creating simplified mesh using " << allPatchEntries.path() << endl;
|
||||
|
||||
for (const entry& e : allPatchEntries)
|
||||
{
|
||||
@ -115,7 +115,7 @@ bool Foam::proxyMeshes::columnFvMeshInfo::setPatchEntries
|
||||
|
||||
const fieldDictionary fieldDict(io, io.headerClassName());
|
||||
|
||||
Info<< "Creating proxy mesh from field "
|
||||
Info<< "Creating simplified mesh from field "
|
||||
<< fieldDict.objectPath()
|
||||
<< endl;
|
||||
|
||||
@ -126,17 +126,17 @@ bool Foam::proxyMeshes::columnFvMeshInfo::setPatchEntries
|
||||
{
|
||||
const word type(e.dict().lookup("type"));
|
||||
|
||||
if (proxyFvMesh::fvPatchFieldExists(type))
|
||||
if (simplifiedFvMesh::fvPatchFieldExists(type))
|
||||
{
|
||||
if (!constraintPatches.found(type))
|
||||
{
|
||||
++nPatchWithFace_;
|
||||
dictionary proxyEntries;
|
||||
proxyEntries.add("startFace", 0);
|
||||
proxyEntries.add("nFaces", 1);
|
||||
proxyEntries.add("type", "wall"); // default to wall type
|
||||
dictionary simplifiedEntries;
|
||||
simplifiedEntries.add("startFace", 0);
|
||||
simplifiedEntries.add("nFaces", 1);
|
||||
simplifiedEntries.add("type", "wall"); // default to wall type
|
||||
|
||||
patchEntries_.add(e.keyword(), proxyEntries);
|
||||
patchEntries_.add(e.keyword(), simplifiedEntries);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -150,7 +150,7 @@ bool Foam::proxyMeshes::columnFvMeshInfo::setPatchEntries
|
||||
}
|
||||
|
||||
|
||||
void Foam::proxyMeshes::columnFvMeshInfo::initialise(const Time& runTime)
|
||||
void Foam::simplifiedMeshes::columnFvMeshInfo::initialise(const Time& runTime)
|
||||
{
|
||||
DebugInfo << "Constructing 1-D mesh" << nl << endl;
|
||||
|
||||
@ -304,61 +304,8 @@ void Foam::proxyMeshes::columnFvMeshInfo::initialise(const Time& runTime)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::proxyMeshes::columnFvMeshInfo::columnFvMeshInfo(const Time& runTime)
|
||||
:
|
||||
localInstance_
|
||||
(
|
||||
runTime.findInstance
|
||||
(
|
||||
polyMesh::meshSubDir,
|
||||
"boundary",
|
||||
IOobject::READ_IF_PRESENT
|
||||
)
|
||||
),
|
||||
createFromMesh_(false),
|
||||
points1D_(),
|
||||
faces1D_(),
|
||||
owner1D_(),
|
||||
neighbour1D_(),
|
||||
patchEntries_(),
|
||||
nPatchWithFace_(0)
|
||||
void Foam::simplifiedMeshes::columnFvMeshInfo::addLocalPatches(fvMesh& mesh) const
|
||||
{
|
||||
initialise(runTime);
|
||||
}
|
||||
|
||||
|
||||
Foam::proxyMeshes::columnFvMesh::columnFvMesh(const Time& runTime)
|
||||
:
|
||||
columnFvMeshInfo(runTime),
|
||||
proxyFvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fvMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime,
|
||||
IOobject::NO_READ, // Do not read any existing mesh
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
std::move(points1D_),
|
||||
std::move(faces1D_),
|
||||
std::move(owner1D_),
|
||||
std::move(neighbour1D_)
|
||||
)
|
||||
{
|
||||
// Workaround to read fvSchemes and fvSolution after setting NO_READ
|
||||
// when creating the mesh
|
||||
{
|
||||
fvSchemes::readOpt() = IOobject::MUST_READ;
|
||||
fvSchemes::read();
|
||||
fvSolution::readOpt() = IOobject::MUST_READ;
|
||||
fvSolution::read();
|
||||
}
|
||||
|
||||
// Add the patches
|
||||
|
||||
const label nPatch = patchEntries_.size();
|
||||
|
||||
List<polyPatch*> patches(nPatch + 1);
|
||||
@ -390,7 +337,7 @@ Foam::proxyMeshes::columnFvMesh::columnFvMesh(const Time& runTime)
|
||||
patchName,
|
||||
patchDict,
|
||||
entryi,
|
||||
boundaryMesh()
|
||||
mesh.boundaryMesh()
|
||||
).ptr();
|
||||
|
||||
++entryi;
|
||||
@ -403,11 +350,11 @@ Foam::proxyMeshes::columnFvMesh::columnFvMesh(const Time& runTime)
|
||||
2, // number of faces
|
||||
nInternalFace + 4*nPatchWithFace_, // start face
|
||||
nPatch - 1, // index in boundary list
|
||||
boundaryMesh(), // polyBoundaryMesh
|
||||
mesh.boundaryMesh(), // polyBoundaryMesh
|
||||
emptyPolyPatch::typeName // patchType
|
||||
);
|
||||
|
||||
addFvPatches(patches);
|
||||
mesh.addFvPatches(patches);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -418,6 +365,63 @@ Foam::proxyMeshes::columnFvMesh::columnFvMesh(const Time& runTime)
|
||||
<< *patches[patchi] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::simplifiedMeshes::columnFvMeshInfo::columnFvMeshInfo(const Time& runTime)
|
||||
:
|
||||
localInstance_
|
||||
(
|
||||
runTime.findInstance
|
||||
(
|
||||
polyMesh::meshSubDir,
|
||||
"boundary",
|
||||
IOobject::READ_IF_PRESENT
|
||||
)
|
||||
),
|
||||
createFromMesh_(false),
|
||||
points1D_(),
|
||||
faces1D_(),
|
||||
owner1D_(),
|
||||
neighbour1D_(),
|
||||
patchEntries_(),
|
||||
nPatchWithFace_(0)
|
||||
{
|
||||
initialise(runTime);
|
||||
}
|
||||
|
||||
|
||||
Foam::simplifiedMeshes::columnFvMesh::columnFvMesh(const Time& runTime)
|
||||
:
|
||||
columnFvMeshInfo(runTime),
|
||||
simplifiedFvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fvMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime,
|
||||
IOobject::NO_READ, // Do not read any existing mesh
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
std::move(points1D_),
|
||||
std::move(faces1D_),
|
||||
std::move(owner1D_),
|
||||
std::move(neighbour1D_)
|
||||
)
|
||||
{
|
||||
// Workaround to read fvSchemes and fvSolution after setting NO_READ
|
||||
// when creating the mesh
|
||||
{
|
||||
fvSchemes::readOpt() = IOobject::MUST_READ;
|
||||
fvSchemes::read();
|
||||
fvSolution::readOpt() = IOobject::MUST_READ;
|
||||
fvSolution::read();
|
||||
}
|
||||
|
||||
// Add the patches
|
||||
addLocalPatches(*this);
|
||||
|
||||
// Add the zones
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::proxyMeshes::columnFvMesh
|
||||
Foam::simplifiedMeshes::columnFvMesh
|
||||
|
||||
Description
|
||||
Generates a 1D column representation of a mesh based on an existing mesh
|
||||
@ -33,16 +33,16 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef proxyMeshes_columnFvMesh_H
|
||||
#define proxyMeshes_columnFvMesh_H
|
||||
#ifndef simplifiedMeshes_columnFvMesh_H
|
||||
#define simplifiedMeshes_columnFvMesh_H
|
||||
|
||||
#include "proxyFvMesh.H"
|
||||
#include "simplifiedFvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace proxyMeshes
|
||||
namespace simplifiedMeshes
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -94,6 +94,11 @@ protected:
|
||||
//- Number of patches with at least 1 local face
|
||||
label nPatchWithFace_;
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Add the patches to the mesh
|
||||
void addLocalPatches(fvMesh& mesh) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -108,7 +113,7 @@ public:
|
||||
class columnFvMesh
|
||||
:
|
||||
public columnFvMeshInfo,
|
||||
public proxyFvMesh
|
||||
public simplifiedFvMesh
|
||||
{
|
||||
|
||||
public:
|
||||
@ -123,7 +128,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace proxyMeshes
|
||||
} // End namespace simplifiedMeshes
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -31,13 +31,13 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace proxyMeshes
|
||||
namespace simplifiedMeshes
|
||||
{
|
||||
defineTypeNameAndDebug(hexCellFvMesh, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
proxyFvMesh,
|
||||
simplifiedFvMesh,
|
||||
hexCellFvMesh,
|
||||
time
|
||||
);
|
||||
@ -47,13 +47,13 @@ namespace proxyMeshes
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::proxyMeshes::hexCellFvMesh::hexCellFvMesh
|
||||
Foam::simplifiedMeshes::hexCellFvMesh::hexCellFvMesh
|
||||
(
|
||||
const Time& runTime,
|
||||
const scalar d
|
||||
)
|
||||
:
|
||||
proxyFvMesh
|
||||
simplifiedFvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::proxyMeshes::hexCellFvMesh
|
||||
Foam::simplifiedMeshes::hexCellFvMesh
|
||||
|
||||
Description
|
||||
Generates a single hex cell representation of a mesh
|
||||
@ -32,16 +32,16 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef proxyMeshes_hexCellFvMesh_H
|
||||
#define proxyMeshes_hexCellFvMesh_H
|
||||
#ifndef simplifiedMeshes_hexCellFvMesh_H
|
||||
#define simplifiedMeshes_hexCellFvMesh_H
|
||||
|
||||
#include "proxyFvMesh.H"
|
||||
#include "simplifiedFvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace proxyMeshes
|
||||
namespace simplifiedMeshes
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -50,7 +50,7 @@ namespace proxyMeshes
|
||||
|
||||
class hexCellFvMesh
|
||||
:
|
||||
public proxyFvMesh
|
||||
public simplifiedFvMesh
|
||||
{
|
||||
|
||||
public:
|
||||
@ -65,7 +65,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace proxyMeshes
|
||||
} // End namespace simplifiedMeshes
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -23,21 +23,21 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "proxyFvMesh.H"
|
||||
#include "simplifiedFvMesh.H"
|
||||
#include "fvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(proxyFvMesh, 0);
|
||||
defineRunTimeSelectionTable(proxyFvMesh, time);
|
||||
defineTypeNameAndDebug(simplifiedFvMesh, 0);
|
||||
defineRunTimeSelectionTable(simplifiedFvMesh, time);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::proxyFvMesh::fvPatchFieldExists(const word& patchType)
|
||||
bool Foam::simplifiedFvMesh::fvPatchFieldExists(const word& patchType)
|
||||
{
|
||||
if
|
||||
(
|
||||
@ -57,7 +57,7 @@ bool Foam::proxyFvMesh::fvPatchFieldExists(const word& patchType)
|
||||
}
|
||||
|
||||
|
||||
Foam::proxyFvMesh::proxyFvMesh
|
||||
Foam::simplifiedFvMesh::simplifiedFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
pointField&& points,
|
||||
@ -77,27 +77,27 @@ Foam::proxyFvMesh::proxyFvMesh
|
||||
{}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::proxyFvMesh> Foam::proxyFvMesh::New
|
||||
Foam::autoPtr<Foam::simplifiedFvMesh> Foam::simplifiedFvMesh::New
|
||||
(
|
||||
const word& modelType,
|
||||
const Time& runTime
|
||||
)
|
||||
{
|
||||
Info<< "Selecting proxy mesh model " << modelType << endl;
|
||||
Info<< "Selecting simplified mesh model " << modelType << endl;
|
||||
|
||||
auto cstrIter = timeConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown proxy mesh type "
|
||||
<< "Unknown simplified fvMesh type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid dumy meshes :" << endl
|
||||
<< "Valid simplified fvMeshes :" << endl
|
||||
<< timeConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<proxyFvMesh>(cstrIter()(runTime));
|
||||
return autoPtr<simplifiedFvMesh>(cstrIter()(runTime));
|
||||
}
|
||||
|
||||
|
||||
@ -22,18 +22,18 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::proxyFvMesh
|
||||
Foam::simplifiedFvMesh
|
||||
|
||||
Description
|
||||
Functions to generate proxy finite volume meshes
|
||||
Functions to generate simplified finite volume meshes
|
||||
|
||||
SourceFiles
|
||||
proxyFvMesh.C
|
||||
simplifiedFvMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef proxyFvMesh_H
|
||||
#define proxyFvMesh_H
|
||||
#ifndef simplifiedFvMesh_H
|
||||
#define simplifiedFvMesh_H
|
||||
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "fvMesh.H"
|
||||
@ -45,10 +45,10 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class proxyFvMesh Declaration
|
||||
Class simplifiedFvMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class proxyFvMesh
|
||||
class simplifiedFvMesh
|
||||
:
|
||||
public fvMesh
|
||||
{
|
||||
@ -67,14 +67,14 @@ protected:
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("proxyFvMesh");
|
||||
TypeName("simplifiedFvMesh");
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
proxyFvMesh,
|
||||
simplifiedFvMesh,
|
||||
time,
|
||||
(
|
||||
const Time& runTime
|
||||
@ -85,8 +85,8 @@ public:
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected proxy mesh
|
||||
static autoPtr<proxyFvMesh> New
|
||||
//- Return a reference to the selected simplified mesh
|
||||
static autoPtr<simplifiedFvMesh> New
|
||||
(
|
||||
const word& modelType,
|
||||
const Time& runTime
|
||||
@ -94,7 +94,7 @@ public:
|
||||
|
||||
|
||||
//- Constructor
|
||||
proxyFvMesh
|
||||
simplifiedFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
pointField&& points,
|
||||
@ -119,7 +119,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "proxyFvMeshTemplates.C"
|
||||
#include "simplifiedFvMeshTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -26,7 +26,7 @@ License
|
||||
#include "polyMesh.H"
|
||||
|
||||
template<class ZoneMeshType>
|
||||
void Foam::proxyFvMesh::initialiseZone
|
||||
void Foam::simplifiedFvMesh::initialiseZone
|
||||
(
|
||||
const word& zoneTypeName,
|
||||
const fileName& instance,
|
||||
@ -155,7 +155,7 @@ public:
|
||||
singleCellFvMesh(const IOobject& io, const fvMesh&);
|
||||
|
||||
//- Construct from fvMesh and agglomeration of boundary faces.
|
||||
// agglomeration is per patch, per patch face index the agglomeration
|
||||
// Agglomeration is per patch, per patch face index the agglomeration
|
||||
// the face goes into.
|
||||
singleCellFvMesh
|
||||
(
|
||||
@ -193,14 +193,14 @@ public:
|
||||
}
|
||||
|
||||
//- From point on original mesh to point on this (or -1 for removed
|
||||
// points)
|
||||
//- points)
|
||||
const labelList& reversePointMap() const
|
||||
{
|
||||
return reversePointMap_;
|
||||
}
|
||||
|
||||
//- Map volField. Internal field set to average, patch fields straight
|
||||
// copies.
|
||||
//- copies.
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
||||
interpolate
|
||||
|
||||
Reference in New Issue
Block a user