functionObjects::surfaceFieldValue: Update on mesh change

check that the mesh corresponds to the functionObject region
This commit is contained in:
Henry Weller
2022-07-10 19:40:14 +01:00
parent ce73ec45f9
commit b88be2d950
6 changed files with 60 additions and 19 deletions

View File

@ -27,7 +27,9 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polyMeshMap::polyMeshMap()
Foam::polyMeshMap::polyMeshMap(const polyMesh& mesh)
:
mesh_(mesh)
{}

View File

@ -50,19 +50,30 @@ class polyMesh;
class polyMeshMap
{
// Private Data
//- Reference to polyMesh
const polyMesh& mesh_;
public:
// Constructors
//- Construct null
polyMeshMap();
//- Construct for mesh
polyMeshMap(const polyMesh& mesh);
//- Disallow default bitwise copy construction
polyMeshMap(const polyMeshMap&) = delete;
// Member Functions
//- Return polyMesh
const polyMesh& mesh() const
{
return mesh_;
}
};

View File

@ -31,6 +31,7 @@ License
#include "indirectPrimitivePatch.H"
#include "PatchTools.H"
#include "polyTopoChangeMap.H"
#include "polyMeshMap.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -832,8 +833,11 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::movePoints
const polyMesh& mesh
)
{
// Moving mesh might affect patch or region area
totalArea_ = totalArea();
if (&mesh == &mesh_)
{
// It may be necessary to reset if the mesh moves
// initialise(dict_);
}
}
@ -842,7 +846,10 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::topoChange
const polyTopoChangeMap& map
)
{
initialise(dict_);
if (&map.mesh() == &mesh_)
{
initialise(dict_);
}
}
@ -851,7 +858,10 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::mapMesh
const polyMeshMap& map
)
{
initialise(dict_);
if (&map.mesh() == &mesh_)
{
initialise(dict_);
}
}

View File

@ -30,6 +30,8 @@ License
#include "syncTools.H"
#include "volFields.H"
#include "writeFile.H"
#include "polyTopoChangeMap.H"
#include "polyMeshMap.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -349,24 +351,36 @@ bool Foam::functionObjects::layerAverage::write()
}
void Foam::functionObjects::layerAverage::movePoints(const polyMesh&)
void Foam::functionObjects::layerAverage::movePoints(const polyMesh& mesh)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
if (&mesh == &mesh_)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
}
}
void Foam::functionObjects::layerAverage::topoChange(const polyTopoChangeMap&)
void Foam::functionObjects::layerAverage::topoChange
(
const polyTopoChangeMap& map
)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
if (&map.mesh() == &mesh_)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
}
}
void Foam::functionObjects::layerAverage::mapMesh(const polyMeshMap&)
void Foam::functionObjects::layerAverage::mapMesh(const polyMeshMap& map)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
if (&map.mesh() == &mesh_)
{
Info<< type() << " " << name() << ":" << nl;
calcLayers();
}
}

View File

@ -34,8 +34,9 @@ License
#include "distributionMap.H"
#include "interpolationCellPoint.H"
#include "PatchTools.H"
#include "polyTopoChangeMap.H"
#include "writeFile.H"
#include "polyTopoChangeMap.H"
#include "polyMeshMap.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -612,7 +613,10 @@ void Foam::functionObjects::streamlines::mapMesh
const polyMeshMap& map
)
{
read(dict_);
if (&map.mesh() == &mesh_)
{
read(dict_);
}
}

View File

@ -244,7 +244,7 @@ bool Foam::fvMeshTopoChangers::meshToMesh::update()
// Interpolate U's to Uf's
interpolateUfs();
polyMeshMap map;
polyMeshMap map(mesh());
mesh().mapMesh(map);
}