mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: adjust dynamicFvMesh to support controllable mesh motion updates
This commit is contained in:
committed by
Mark Olesen
parent
280be6312c
commit
fa57b4e45e
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -37,12 +37,36 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::dynamicFvMesh::readDict()
|
||||
{
|
||||
IOdictionary dict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dynamicMeshDict",
|
||||
thisDb().time().constant(),
|
||||
thisDb(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false // Do not register
|
||||
)
|
||||
);
|
||||
|
||||
timeControl_.read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io)
|
||||
:
|
||||
fvMesh(io)
|
||||
{}
|
||||
fvMesh(io),
|
||||
timeControl_(io.time(), "update")
|
||||
{
|
||||
readDict();
|
||||
}
|
||||
|
||||
|
||||
Foam::dynamicFvMesh::dynamicFvMesh
|
||||
@ -52,8 +76,11 @@ Foam::dynamicFvMesh::dynamicFvMesh
|
||||
const bool syncPar
|
||||
)
|
||||
:
|
||||
fvMesh(io, Zero, syncPar)
|
||||
{}
|
||||
fvMesh(io, Zero, syncPar),
|
||||
timeControl_(io.time(), "update")
|
||||
{
|
||||
readDict();
|
||||
}
|
||||
|
||||
|
||||
Foam::dynamicFvMesh::dynamicFvMesh
|
||||
@ -74,8 +101,11 @@ Foam::dynamicFvMesh::dynamicFvMesh
|
||||
std::move(allOwner),
|
||||
std::move(allNeighbour),
|
||||
syncPar
|
||||
)
|
||||
{}
|
||||
),
|
||||
timeControl_(io.time(), "update")
|
||||
{
|
||||
readDict();
|
||||
}
|
||||
|
||||
|
||||
Foam::dynamicFvMesh::dynamicFvMesh
|
||||
@ -94,8 +124,28 @@ Foam::dynamicFvMesh::dynamicFvMesh
|
||||
std::move(faces),
|
||||
std::move(cells),
|
||||
syncPar
|
||||
)
|
||||
{}
|
||||
),
|
||||
timeControl_(io.time(), "update")
|
||||
{
|
||||
readDict();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dynamicFvMesh::controlledUpdate()
|
||||
{
|
||||
if (timeControl_.execute())
|
||||
{
|
||||
if (!timeControl_.always())
|
||||
{
|
||||
// Feedback that update has been triggered
|
||||
Info<< "Mesh update triggered based on " << timeControl_.name() << nl;
|
||||
}
|
||||
|
||||
return this->update();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,16 @@ Class
|
||||
Description
|
||||
Abstract base class for geometry and/or topology changing fvMesh.
|
||||
|
||||
Supports optional update controls that may be used by custom solvers:
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
updateControl | See time controls below | no | timeStep
|
||||
updateInterval | Steps/time between update phases | no | 1
|
||||
\endtable
|
||||
|
||||
See also
|
||||
Foam::timeControl
|
||||
|
||||
SourceFiles
|
||||
dynamicFvMesh.C
|
||||
dynamicFvMeshNew.C
|
||||
@ -40,6 +50,7 @@ SourceFiles
|
||||
#define dynamicFvMesh_H
|
||||
|
||||
#include "fvMesh.H"
|
||||
#include "timeControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -47,15 +58,24 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dynamicFvMesh Declaration
|
||||
Class dynamicFvMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class dynamicFvMesh
|
||||
:
|
||||
public fvMesh
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Optional update control
|
||||
timeControl timeControl_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read the updateControl/updateInterval from dynamicMeshDict
|
||||
void readDict();
|
||||
|
||||
//- No copy construct
|
||||
dynamicFvMesh(const dynamicFvMesh&) = delete;
|
||||
|
||||
@ -83,7 +103,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectRegistry, and read/write options
|
||||
//- Construct from an IOobject
|
||||
explicit dynamicFvMesh(const IOobject& io);
|
||||
|
||||
//- Construct from components without boundary.
|
||||
@ -144,6 +164,9 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Update the mesh if controller permits
|
||||
virtual bool controlledUpdate();
|
||||
|
||||
//- Update the mesh for both mesh motion and topology change
|
||||
virtual bool update() = 0;
|
||||
};
|
||||
|
||||
@ -88,7 +88,6 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
|
||||
return autoPtr<dynamicFvMesh>(cstrIter()(io));
|
||||
}
|
||||
|
||||
|
||||
return autoPtr<dynamicFvMesh>(new staticFvMesh(io));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user