Merge branch 'feature-virtual-init' into 'develop'

Fix cyclicACMI (runtime-selection-geometry, scaling-of-weights)

See merge request Development/openfoam!419
This commit is contained in:
Andrew Heather
2020-12-21 14:55:00 +00:00
34 changed files with 468 additions and 107 deletions

View File

@ -899,6 +899,10 @@ public:
//- Clear geometry
void clearGeom();
//- Clear cell-based geometry only
// Use with care! currently used by cyclicACMI
void clearCellGeom();
//- Clear topological data
void clearAddressing();

View File

@ -140,6 +140,20 @@ void Foam::primitiveMesh::clearGeom()
}
void Foam::primitiveMesh::clearCellGeom()
{
if (debug)
{
Pout<< "primitiveMesh::clearCellGeom() : "
<< "clearing cell centres and volumes"
<< endl;
}
deleteDemandDrivenData(cellCentresPtr_);
deleteDemandDrivenData(cellVolumesPtr_);
}
void Foam::primitiveMesh::clearAddressing()
{
if (debug)

View File

@ -60,6 +60,12 @@ namespace Foam
interfaceTrackingFvMesh,
IOobject
);
addToRunTimeSelectionTable
(
dynamicFvMesh,
interfaceTrackingFvMesh,
doInit
);
}
@ -1553,9 +1559,13 @@ void Foam::interfaceTrackingFvMesh::correctContactLinePointNormals()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interfaceTrackingFvMesh::interfaceTrackingFvMesh(const IOobject& io)
Foam::interfaceTrackingFvMesh::interfaceTrackingFvMesh
(
const IOobject& io,
const bool doInit
)
:
dynamicMotionSolverFvMesh(io),
dynamicMotionSolverFvMesh(io, doInit),
aMeshPtr_(new faMesh(*this)),
fsPatchIndex_(-1),
fixedFreeSurfacePatches_

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 Zeljko Tukovic, FSB Zagreb.
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -250,7 +251,7 @@ public:
// Constructors
//- Construct from IOobject
interfaceTrackingFvMesh(const IOobject& io);
interfaceTrackingFvMesh(const IOobject& io, const bool doInit=true);
//- Construct from components without boundary.
// Boundary is added using addFvPatches() member function

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,6 +34,7 @@ namespace Foam
{
defineTypeNameAndDebug(dynamicFvMesh, 0);
defineRunTimeSelectionTable(dynamicFvMesh, IOobject);
defineRunTimeSelectionTable(dynamicFvMesh, doInit);
}
@ -74,12 +75,29 @@ void Foam::dynamicFvMesh::readDict()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io)
Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io, const bool doInit)
:
fvMesh(io),
timeControl_(io.time(), "update")
fvMesh(io, doInit),
timeControl_(io.time(), "update") // assume has no side effects
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::dynamicFvMesh::init(const bool doInit)
{
if (doInit)
{
fvMesh::init(doInit);
}
readDict();
// Assume something changed
return true;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -100,11 +100,23 @@ public:
(io)
);
declareRunTimeSelectionTable
(
autoPtr,
dynamicFvMesh,
doInit,
(
const IOobject& io,
const bool doInit
),
(io, doInit)
);
// Constructors
//- Construct from an IOobject
explicit dynamicFvMesh(const IOobject& io); //, const bool doInit=true);
explicit dynamicFvMesh(const IOobject& io, const bool doInit=true);
//- Construct from components without boundary.
// Boundary is added using addFvPatches() member function
@ -139,11 +151,7 @@ public:
//- Select, construct and return the dynamicFvMesh
// If the constant/dynamicMeshDict does not exist
// a staticFvMesh is returned
static autoPtr<dynamicFvMesh> New
(
const IOobject& io //,
//const bool doInit=true
);
static autoPtr<dynamicFvMesh> New(const IOobject& io);
//- Select, construct and return the dynamicFvMesh
@ -152,8 +160,7 @@ public:
static autoPtr<dynamicFvMesh> New
(
const argList& args,
const Time& runTime //,
//const bool doInit=true
const Time& runTime
);
@ -164,7 +171,7 @@ public:
// Member Functions
//- Initialise all non-demand-driven data
//virtual bool init(const bool doInit);
virtual bool init(const bool doInit);
//- Is mesh dynamic
virtual bool dynamic() const

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -72,6 +72,24 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
<< exit(FatalError);
}
auto doInitCstrIter = doInitConstructorTablePtr_->cfind(modelType);
if (doInitCstrIter.found())
{
DebugInfo
<< "Constructing dynamicFvMesh with explicit initialisation"
<< endl;
// Two-step constructor
// 1. Construct mesh, do not initialise
autoPtr<dynamicFvMesh> meshPtr(doInitCstrIter()(io, false));
// 2. Initialise parents and itself
meshPtr().init(true);
return meshPtr;
}
auto cstrIter = IOobjectConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
@ -88,7 +106,16 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
return autoPtr<dynamicFvMesh>(cstrIter()(io));
}
return autoPtr<dynamicFvMesh>(new staticFvMesh(io));
DebugInfo
<< "Constructing staticFvMesh with explicit initialisation" << endl;
// 1. Construct mesh, do not initialise
autoPtr<dynamicFvMesh> meshPtr(new staticFvMesh(io, false));
// 2. Initialise parents and itself
meshPtr().init(true);
return meshPtr;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,14 +37,19 @@ namespace Foam
{
defineTypeNameAndDebug(dynamicInkJetFvMesh, 0);
addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, IOobject);
addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, doInit);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io)
Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh
(
const IOobject& io,
const bool doInit
)
:
dynamicFvMesh(io),
dynamicFvMesh(io, doInit),
dynamicMeshCoeffs_
(
IOdictionary

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -88,7 +89,7 @@ public:
// Constructors
//- Construct from IOobject
dynamicInkJetFvMesh(const IOobject& io);
dynamicInkJetFvMesh(const IOobject& io, const bool doInit=true);
//- Destructor

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,16 +42,43 @@ namespace Foam
dynamicMotionSolverFvMesh,
IOobject
);
addToRunTimeSelectionTable
(
dynamicFvMesh,
dynamicMotionSolverFvMesh,
doInit
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh(const IOobject& io)
Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh
(
const IOobject& io,
const bool doInit
)
:
dynamicFvMesh(io),
motionPtr_(motionSolver::New(*this))
{}
dynamicFvMesh(io, doInit),
motionPtr_(nullptr)
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::dynamicMotionSolverFvMesh::init(const bool doInit)
{
if (doInit)
{
dynamicFvMesh::init(doInit);
}
motionPtr_ = motionSolver::New(*this);
return true;
}
Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -77,7 +78,7 @@ public:
// Constructors
//- Construct from IOobject
dynamicMotionSolverFvMesh(const IOobject& io);
dynamicMotionSolverFvMesh(const IOobject& io, bool syncPar=true);
//- Construct from components without boundary.
// Boundary is added using addFvPatches() member function
@ -98,6 +99,9 @@ public:
// Member Functions
//- Initialise all non-demand-driven data
virtual bool init(const bool doInit);
//- Return the motionSolver
const motionSolver& motion() const;

View File

@ -49,6 +49,12 @@ namespace Foam
dynamicMotionSolverFvMeshAMI,
IOobject
);
addToRunTimeSelectionTable
(
dynamicFvMesh,
dynamicMotionSolverFvMeshAMI,
doInit
);
}
@ -56,12 +62,29 @@ namespace Foam
Foam::dynamicMotionSolverFvMeshAMI::dynamicMotionSolverFvMeshAMI
(
const IOobject& io
const IOobject& io,
const bool doInit
)
:
dynamicFvMesh(io),
motionPtr_(motionSolver::New(*this))
{}
dynamicFvMesh(io, doInit)
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::dynamicMotionSolverFvMeshAMI::init(const bool doInit)
{
if (doInit)
{
dynamicFvMesh::init(doInit);
}
motionPtr_ = motionSolver::New(*this);
return true;
}
Foam::dynamicMotionSolverFvMeshAMI::dynamicMotionSolverFvMeshAMI

View File

@ -81,7 +81,11 @@ public:
// Constructors
//- Construct from IOobject
dynamicMotionSolverFvMeshAMI(const IOobject& io);
dynamicMotionSolverFvMeshAMI
(
const IOobject& io,
const bool doInit=true
);
//- Construct from components without boundary.
// Boundary is added using addFvPatches() member function
@ -102,6 +106,9 @@ public:
// Member Functions
//- Initialise all non-demand-driven data
virtual bool init(const bool doInit);
//- Return the motionSolver
const motionSolver& motion() const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,6 +43,12 @@ namespace Foam
dynamicMotionSolverListFvMesh,
IOobject
);
addToRunTimeSelectionTable
(
dynamicFvMesh,
dynamicMotionSolverListFvMesh,
doInit
);
}
@ -50,12 +56,27 @@ namespace Foam
Foam::dynamicMotionSolverListFvMesh::dynamicMotionSolverListFvMesh
(
const IOobject& io
const IOobject& io,
const bool doInit
)
:
dynamicFvMesh(io),
dynamicFvMesh(io, doInit),
motionSolvers_()
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::dynamicMotionSolverListFvMesh::init(const bool doInit)
{
if (doInit)
{
dynamicFvMesh::init(doInit);
}
IOobject ioDict
(
"dynamicMeshDict",
@ -104,6 +125,9 @@ Foam::dynamicMotionSolverListFvMesh::dynamicMotionSolverListFvMesh
motionSolvers_.setSize(1);
motionSolvers_.set(i++, motionSolver::New(*this));
}
// Assume something changed
return true;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -82,7 +83,11 @@ public:
// Constructors
//- Construct from IOobject
dynamicMotionSolverListFvMesh(const IOobject& io);
dynamicMotionSolverListFvMesh
(
const IOobject& io,
const bool doInit=true
);
//- Destructor
@ -91,6 +96,9 @@ public:
// Member Functions
//- Initialise all non-demand-driven data
virtual bool init(const bool doInit);
//- Dummy update function which does not change the mesh
virtual bool update();
};

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,6 +42,12 @@ namespace Foam
dynamicMultiMotionSolverFvMesh,
IOobject
);
addToRunTimeSelectionTable
(
dynamicFvMesh,
dynamicMultiMotionSolverFvMesh,
doInit
);
}
@ -49,17 +55,32 @@ namespace Foam
Foam::dynamicMultiMotionSolverFvMesh::dynamicMultiMotionSolverFvMesh
(
const IOobject& io
const IOobject& io,
const bool doInit
)
:
dynamicFvMesh(io)
dynamicFvMesh(io, doInit)
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::dynamicMultiMotionSolverFvMesh::init(const bool doInit)
{
if (doInit)
{
dynamicFvMesh::init(doInit);
}
IOdictionary dynDict
(
IOobject
(
"dynamicMeshDict",
io.time().constant(),
time().constant(),
*this,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
@ -139,6 +160,9 @@ Foam::dynamicMultiMotionSolverFvMesh::dynamicMultiMotionSolverFvMesh
zoneIDs_.setSize(zonei);
motionPtr_.setSize(zonei);
pointIDs_.setSize(zonei);
// Assume changed ...
return true;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,7 +87,11 @@ public:
// Constructors
//- Construct from IOobject
explicit dynamicMultiMotionSolverFvMesh(const IOobject& io);
explicit dynamicMultiMotionSolverFvMesh
(
const IOobject& io,
const bool doInit=true
);
//- Destructor
@ -96,6 +100,9 @@ public:
// Member Functions
//- Initialise all non-demand-driven data
virtual bool init(const bool doInit);
//- Update the mesh for both mesh motion and topology change
virtual bool update();
};

View File

@ -44,6 +44,7 @@ namespace Foam
{
defineTypeNameAndDebug(dynamicRefineFvMesh, 0);
addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMesh, IOobject);
addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMesh, doInit);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -1014,14 +1015,33 @@ void Foam::dynamicRefineFvMesh::checkEightAnchorPoints
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
Foam::dynamicRefineFvMesh::dynamicRefineFvMesh
(
const IOobject& io,
const bool doInit
)
:
dynamicFvMesh(io),
meshCutter_(*this),
protectedCell_(nCells()),
nRefinementIterations_(0),
dumpLevel_(false)
dynamicFvMesh(io, doInit),
meshCutter_(*this)
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::dynamicRefineFvMesh::init(const bool doInit)
{
if (doInit)
{
dynamicFvMesh::init(doInit);
}
protectedCell_.setSize(nCells());
nRefinementIterations_ = 0;
dumpLevel_ = false;
// Read static part of dictionary
readDict();
@ -1175,6 +1195,8 @@ Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
protectedCells.write();
}
return true;
}

View File

@ -228,7 +228,11 @@ public:
// Constructors
//- Construct from IOobject
explicit dynamicRefineFvMesh(const IOobject& io);
explicit dynamicRefineFvMesh
(
const IOobject& io,
const bool doInit=true
);
//- Destructor
@ -237,6 +241,9 @@ public:
// Member Functions
//- Initialise all non-demand-driven data
virtual bool init(const bool doInit);
//- Direct access to the refinement engine
const hexRef8& meshCutter() const
{

View File

@ -1,9 +1,6 @@
Info<< "Create mesh for time = "
<< runTime.timeName() << nl << endl;
autoPtr<dynamicFvMesh> meshPtr(dynamicFvMesh::New(args, runTime));//, false));
autoPtr<dynamicFvMesh> meshPtr(dynamicFvMesh::New(args, runTime));
dynamicFvMesh& mesh = meshPtr();
// initialise all (lower levels and current)
mesh.init(true);

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,14 +35,15 @@ namespace Foam
{
defineTypeNameAndDebug(staticFvMesh, 0);
addToRunTimeSelectionTable(dynamicFvMesh, staticFvMesh, IOobject);
addToRunTimeSelectionTable(dynamicFvMesh, staticFvMesh, doInit);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::staticFvMesh::staticFvMesh(const IOobject& io)
Foam::staticFvMesh::staticFvMesh(const IOobject& io, const bool doInit)
:
dynamicFvMesh(io)
dynamicFvMesh(io, doInit)
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -70,7 +71,7 @@ public:
// Constructors
//- Construct from IOobject
staticFvMesh(const IOobject& io);
staticFvMesh(const IOobject& io, const bool doInit=true);
//- Construct from components without boundary.
// Boundary is added using addFvPatches() member function

View File

@ -278,10 +278,6 @@ bool Foam::fvMesh::init(const bool doInit)
// Intialise my data
polyMesh::init(doInit);
// All addressing needs to be updated
// deleteDemandDrivenData(lduPtr_);
clearAddressing(true);
}
// Check the existence of the cell volumes and read if present
@ -345,7 +341,9 @@ bool Foam::fvMesh::init(const bool doInit)
moving(true);
}
return false;
// Assume something changed
return true;
}
@ -932,7 +930,8 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
void Foam::fvMesh::updateGeom()
{
// Let surfaceInterpolation handle geometry calculation
// Let surfaceInterpolation handle geometry calculation. Note: this does
// lower levels updateGeom
surfaceInterpolation::updateGeom();
}

View File

@ -288,24 +288,27 @@ void Foam::cyclicACMIPolyPatch::resetAMI(const UList<point>& points) const
{
DebugPout
<< "cyclicACMIPolyPatch::resetAMI : clearing cellCentres"
<< " for " << name() << " and " << nonOverlapPatch.name()
<< endl;
<< " for " << name() << " and " << nonOverlapPatch.name() << nl
<< "The mesh already has cellCentres calculated when"
<< " resetting ACMI " << name() << "." << nl
<< "This is a problem since ACMI adapts the face areas"
<< " (to close cells) so this has" << nl
<< "to be done before cell centre calculation." << nl
<< "This can happen if e.g. the cyclicACMI is after"
<< " any processor patches in the boundary." << endl;
WarningInFunction
<< "The mesh already has cellCentres calculated when"
<< " resetting ACMI " << name() << "." << nl
<< "This is a problem since ACMI adapts the face areas"
<< " (to close cells) so this has" << nl
<< "to be done before cell centre calculation." << nl
<< "This can happen if e.g. the cyclicACMI is after"
<< " any processor patches in the boundary." << endl;
const_cast<polyMesh&>(mesh).primitiveMesh::clearGeom();
const_cast<polyMesh&>(mesh).primitiveMesh::clearCellGeom();
}
// Trigger re-building of faceAreas
(void)mesh.faceAreas();
// At this point we want face geometry but not cell geometry since we want
// correct the face area on duplicate baffles before calculating the cell
// centres and volumes.
if (!mesh.hasFaceAreas())
{
FatalErrorInFunction
<< "primitiveMesh must already have face geometry"
<< abort(FatalError);
}
// Calculate the AMI using partial face-area-weighted. This leaves
// the weights as fractions of local areas (sum(weights) = 1 means
@ -423,9 +426,13 @@ void Foam::cyclicACMIPolyPatch::initMovePoints
DebugPout<< "cyclicACMIPolyPatch::initMovePoints : " << name() << endl;
// Note: calculates transformation and triggers face centre calculation
// - Note: resetAMI called by cyclicAMIPolyPatch::initMovePoints
cyclicAMIPolyPatch::initMovePoints(pBufs, p);
if (!createAMIFaces_ && canResetAMI())
{
resetAMI();
}
scalePatchFaceAreas();
}

View File

@ -38,6 +38,7 @@ namespace Foam
{
defineTypeNameAndDebug(dynamicOversetFvMesh, 0);
addToRunTimeSelectionTable(dynamicFvMesh, dynamicOversetFvMesh, IOobject);
addToRunTimeSelectionTable(dynamicFvMesh, dynamicOversetFvMesh, doInit);
}
@ -526,13 +527,35 @@ void Foam::dynamicOversetFvMesh::writeAgglomeration
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dynamicOversetFvMesh::dynamicOversetFvMesh(const IOobject& io)
Foam::dynamicOversetFvMesh::dynamicOversetFvMesh
(
const IOobject& io,
const bool doInit
)
:
dynamicMotionSolverListFvMesh(io),
active_(false)
dynamicMotionSolverListFvMesh(io, doInit)
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::dynamicOversetFvMesh::init(const bool doInit)
{
if (doInit)
{
dynamicMotionSolverListFvMesh::init(doInit);
}
active_ = false;
// Load stencil (but do not update)
(void)Stencil::New(*this, false);
// Assume something changed
return true;
}

View File

@ -186,7 +186,7 @@ public:
// Constructors
//- Construct from IOobject
dynamicOversetFvMesh(const IOobject& io);
dynamicOversetFvMesh(const IOobject& io, const bool doInit=true);
//- Destructor
@ -344,6 +344,9 @@ public:
}
//- Initialise all non-demand-driven data
virtual bool init(const bool doInit);
//- Update the mesh for both mesh motion and topology change
virtual bool update();

View File

@ -45,6 +45,12 @@ namespace Foam
dynamicMotionSolverTopoFvMesh,
IOobject
);
addToRunTimeSelectionTable
(
dynamicFvMesh,
dynamicMotionSolverTopoFvMesh,
doInit
);
}
@ -52,12 +58,31 @@ namespace Foam
Foam::dynamicMotionSolverTopoFvMesh::dynamicMotionSolverTopoFvMesh
(
const IOobject& io
const IOobject& io,
const bool doInit
)
:
topoChangerFvMesh(io),
motionPtr_(motionSolver::New(*this))
{}
topoChangerFvMesh(io, doInit)
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::dynamicMotionSolverTopoFvMesh::init(const bool doInit)
{
if (doInit)
{
topoChangerFvMesh::init(doInit);
}
motionPtr_ = motionSolver::New(*this);
// Assume something changed
return true;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd
Copyright (C) 2016-2020 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -85,7 +85,11 @@ public:
// Constructors
//- Construct from database
explicit dynamicMotionSolverTopoFvMesh(const IOobject& io);
explicit dynamicMotionSolverTopoFvMesh
(
const IOobject& io,
const bool doInit=true
);
//- Destructor
@ -94,6 +98,9 @@ public:
// Member Functions
//- Initialise all non-demand-driven data
virtual bool init(const bool doInit);
//- Update the mesh for both mesh motion and topology change
virtual bool update();
};

View File

@ -49,6 +49,12 @@ namespace Foam
movingConeTopoFvMesh,
IOobject
);
addToRunTimeSelectionTable
(
topoChangerFvMesh,
movingConeTopoFvMesh,
doInit
);
}
@ -238,9 +244,13 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
Foam::movingConeTopoFvMesh::movingConeTopoFvMesh
(
const IOobject& io,
const bool doInit
)
:
topoChangerFvMesh(io),
topoChangerFvMesh(io, doInit),
motionDict_
(
IOdictionary
@ -255,17 +265,30 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
false
)
).optionalSubDict(typeName + "Coeffs")
),
motionVelAmplitude_(motionDict_.get<vector>("motionVelAmplitude")),
motionVelPeriod_(motionDict_.get<scalar>("motionVelPeriod")),
curMotionVel_
(
motionVelAmplitude_*sin(time().value()*pi/motionVelPeriod_)
),
leftEdge_(motionDict_.get<scalar>("leftEdge")),
curLeft_(motionDict_.get<scalar>("leftObstacleEdge")),
curRight_(motionDict_.get<scalar>("rightObstacleEdge"))
)
{
if (doInit)
{
init(false); // do not initialise lower levels
}
}
bool Foam::movingConeTopoFvMesh::init(const bool doInit)
{
if (doInit)
{
topoChangerFvMesh::init(doInit);
}
motionVelAmplitude_ = motionDict_.get<vector>("motionVelAmplitude");
motionVelPeriod_ = motionDict_.get<scalar>("motionVelPeriod");
curMotionVel_ =
motionVelAmplitude_*sin(time().value()*pi/motionVelPeriod_);
leftEdge_ = motionDict_.get<scalar>("leftEdge");
curLeft_ = motionDict_.get<scalar>("leftObstacleEdge");
curRight_ = motionDict_.get<scalar>("rightObstacleEdge");
Pout<< "Initial time:" << time().value()
<< " Initial curMotionVel_:" << curMotionVel_
<< endl;
@ -294,6 +317,9 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
curLeft_,
curRight_
);
// Assume something changed
return true;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -113,7 +114,11 @@ public:
// Constructors
//- Construct from database
explicit movingConeTopoFvMesh(const IOobject& io);
explicit movingConeTopoFvMesh
(
const IOobject& io,
const bool doInit = true
);
//- Destructor
@ -122,6 +127,9 @@ public:
// Member Functions
//- Initialise all non-demand-driven data
virtual bool init(const bool doInit);
//- Update the mesh for both mesh motion and topology change
virtual bool update();
};

View File

@ -43,15 +43,25 @@ namespace Foam
rawTopoChangerFvMesh,
IOobject
);
addToRunTimeSelectionTable
(
topoChangerFvMesh,
rawTopoChangerFvMesh,
doInit
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::rawTopoChangerFvMesh::rawTopoChangerFvMesh(const IOobject& io)
Foam::rawTopoChangerFvMesh::rawTopoChangerFvMesh
(
const IOobject& io,
const bool doInit
)
:
topoChangerFvMesh(io)
topoChangerFvMesh(io, doInit)
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,7 +88,11 @@ public:
// Constructors
//- Construct from database
explicit rawTopoChangerFvMesh(const IOobject& io);
explicit rawTopoChangerFvMesh
(
const IOobject& io,
const bool doInit=true
);
//- Destructor
virtual ~rawTopoChangerFvMesh();

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,9 +39,13 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topoChangerFvMesh::topoChangerFvMesh(const IOobject& io)
Foam::topoChangerFvMesh::topoChangerFvMesh
(
const IOobject& io,
const bool doInit
)
:
dynamicFvMesh(io),
dynamicFvMesh(io, doInit),
topoChanger_(*this)
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -79,7 +80,7 @@ public:
// Constructors
//- Construct from objectRegistry, and read/write options
explicit topoChangerFvMesh(const IOobject& io);
explicit topoChangerFvMesh(const IOobject& io, const bool doInit=true);
//- Destructor