fvMeshTopoChangers::meshToMesh: New fvMesh topoChanger which maps to a sequence of meshes at run-time

With fvMeshTopoChangers::meshToMesh it is now possible to map the solution to a
specified sequence of pre-generated meshes at run-time to support arbitrary mesh
changes, refinements, un-refinements, changes in region topology, geometry,
etc.  Additionally mesh-motion between the sequence of meshes is supported to
allow for e.g. piston and valve motion in engines.

The tutorials/incompressible/pimpleFoam/laminar/movingCone case has been updated
to provide a demonstration of the advantages of this run-time mesh-mapping by
mapping to meshes that are finer behind the cone and coarser in front of the
cone as the cone approaches the end of the domain, thus maintaining good
resolution while avoiding excessive cell aspect ratio as the mesh is squeezed.
The dynamicMeshDict for the movingCone case is;

mover
{
    type            motionSolver;

    libs            ("libfvMeshMovers.so" "libfvMotionSolvers.so");

    motionSolver    velocityComponentLaplacian;

    component       x;
    diffusivity     directional (1 200 0);
}

topoChanger
{
    type    meshToMesh;

    libs    ("libmeshToMeshTopoChanger.so");

    times   (0.0015 0.003);

    timeDelta 1e-6;
}

which lists the mesh mapping times 0.0015s 0.003s and meshes for these times in
directories constant/meshToMesh_0.0015 and constant/meshToMesh_0.003 are
generated in the Allrun script before the pimpleFoam run:

runApplication -a blockMesh -dict blockMeshDict.2
rm -rf constant/meshToMesh_0.0015
mkdir constant/meshToMesh_0.0015
mv constant/polyMesh constant/meshToMesh_0.0015

runApplication -a blockMesh -dict blockMeshDict.3
rm -rf constant/meshToMesh_0.003
mkdir constant/meshToMesh_0.003
mv constant/polyMesh constant/meshToMesh_0.003

runApplication -a blockMesh -dict blockMeshDict.1

runApplication $application

Note: This functionality is experimental and has only undergone basic testing.
It is likely that it does not yet work with all functionObject, fvModels
etc. which will need updating to support this form of mesh topology change.
This commit is contained in:
Henry Weller
2022-04-06 16:37:22 +01:00
parent 1c8f92f52a
commit 47b0cd54dd
48 changed files with 1585 additions and 131 deletions

View File

@ -440,13 +440,6 @@ bool Foam::functionObjects::layerAverage::write()
}
void Foam::functionObjects::layerAverage::topoChange(const polyTopoChangeMap&)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
}
void Foam::functionObjects::layerAverage::movePoints(const polyMesh&)
{
Info<< type() << " " << name() << ":" << nl;
@ -454,4 +447,18 @@ void Foam::functionObjects::layerAverage::movePoints(const polyMesh&)
}
void Foam::functionObjects::layerAverage::topoChange(const polyTopoChangeMap&)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
}
void Foam::functionObjects::layerAverage::mapMesh(const polyMeshMap&)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
}
// ************************************************************************* //

View File

@ -201,11 +201,14 @@ public:
//- Calculate and write the graphs
virtual bool write();
//- Update for mesh point-motion
virtual void movePoints(const polyMesh&);
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update for mesh point-motion
virtual void movePoints(const polyMesh&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
// Member Operators

View File

@ -585,6 +585,16 @@ bool Foam::functionObjects::streamlines::write()
}
void Foam::functionObjects::streamlines::movePoints(const polyMesh& mesh)
{
if (&mesh == &mesh_)
{
// Moving mesh affects the search tree
read(dict_);
}
}
void Foam::functionObjects::streamlines::topoChange
(
const polyTopoChangeMap& map
@ -597,13 +607,12 @@ void Foam::functionObjects::streamlines::topoChange
}
void Foam::functionObjects::streamlines::movePoints(const polyMesh& mesh)
void Foam::functionObjects::streamlines::mapMesh
(
const polyMeshMap& map
)
{
if (&mesh == &mesh_)
{
// Moving mesh affects the search tree
read(dict_);
}
read(dict_);
}

View File

@ -238,11 +238,14 @@ public:
//- Calculate and write the streamlines
virtual bool write();
//- Update for mesh point-motion
virtual void movePoints(const polyMesh&);
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update for mesh point-motion
virtual void movePoints(const polyMesh&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
// Member Operators