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 |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io)
|
Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io)
|
||||||
:
|
:
|
||||||
fvMesh(io)
|
fvMesh(io),
|
||||||
{}
|
timeControl_(io.time(), "update")
|
||||||
|
{
|
||||||
|
readDict();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dynamicFvMesh::dynamicFvMesh
|
Foam::dynamicFvMesh::dynamicFvMesh
|
||||||
@ -52,8 +76,11 @@ Foam::dynamicFvMesh::dynamicFvMesh
|
|||||||
const bool syncPar
|
const bool syncPar
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvMesh(io, Zero, syncPar)
|
fvMesh(io, Zero, syncPar),
|
||||||
{}
|
timeControl_(io.time(), "update")
|
||||||
|
{
|
||||||
|
readDict();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dynamicFvMesh::dynamicFvMesh
|
Foam::dynamicFvMesh::dynamicFvMesh
|
||||||
@ -74,8 +101,11 @@ Foam::dynamicFvMesh::dynamicFvMesh
|
|||||||
std::move(allOwner),
|
std::move(allOwner),
|
||||||
std::move(allNeighbour),
|
std::move(allNeighbour),
|
||||||
syncPar
|
syncPar
|
||||||
)
|
),
|
||||||
{}
|
timeControl_(io.time(), "update")
|
||||||
|
{
|
||||||
|
readDict();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dynamicFvMesh::dynamicFvMesh
|
Foam::dynamicFvMesh::dynamicFvMesh
|
||||||
@ -94,8 +124,28 @@ Foam::dynamicFvMesh::dynamicFvMesh
|
|||||||
std::move(faces),
|
std::move(faces),
|
||||||
std::move(cells),
|
std::move(cells),
|
||||||
syncPar
|
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 |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,6 +30,16 @@ Class
|
|||||||
Description
|
Description
|
||||||
Abstract base class for geometry and/or topology changing fvMesh.
|
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
|
SourceFiles
|
||||||
dynamicFvMesh.C
|
dynamicFvMesh.C
|
||||||
dynamicFvMeshNew.C
|
dynamicFvMeshNew.C
|
||||||
@ -40,6 +50,7 @@ SourceFiles
|
|||||||
#define dynamicFvMesh_H
|
#define dynamicFvMesh_H
|
||||||
|
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
|
#include "timeControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -47,15 +58,24 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class dynamicFvMesh Declaration
|
Class dynamicFvMesh Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class dynamicFvMesh
|
class dynamicFvMesh
|
||||||
:
|
:
|
||||||
public fvMesh
|
public fvMesh
|
||||||
{
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Optional update control
|
||||||
|
timeControl timeControl_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Read the updateControl/updateInterval from dynamicMeshDict
|
||||||
|
void readDict();
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
dynamicFvMesh(const dynamicFvMesh&) = delete;
|
dynamicFvMesh(const dynamicFvMesh&) = delete;
|
||||||
|
|
||||||
@ -83,7 +103,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from objectRegistry, and read/write options
|
//- Construct from an IOobject
|
||||||
explicit dynamicFvMesh(const IOobject& io);
|
explicit dynamicFvMesh(const IOobject& io);
|
||||||
|
|
||||||
//- Construct from components without boundary.
|
//- Construct from components without boundary.
|
||||||
@ -144,6 +164,9 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Update the mesh if controller permits
|
||||||
|
virtual bool controlledUpdate();
|
||||||
|
|
||||||
//- Update the mesh for both mesh motion and topology change
|
//- Update the mesh for both mesh motion and topology change
|
||||||
virtual bool update() = 0;
|
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>(cstrIter()(io));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return autoPtr<dynamicFvMesh>(new staticFvMesh(io));
|
return autoPtr<dynamicFvMesh>(new staticFvMesh(io));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user