ENH: added updateMesh(mpm) callback for surfaceInterpolation/fvGeometryScheme

This commit is contained in:
Andrew Heather
2022-03-17 15:17:56 +00:00
committed by Andrew Heather
parent 823641ab9b
commit 2493102044
5 changed files with 32 additions and 6 deletions

View File

@ -145,4 +145,8 @@ void Foam::fvGeometryScheme::movePoints()
}
void Foam::fvGeometryScheme::updateMesh(const mapPolyMesh& mpm)
{}
// ************************************************************************* //

View File

@ -137,6 +137,9 @@ public:
//- Update basic geometric properties from provided points
virtual void movePoints();
//- Update mesh for topology changes
virtual void updateMesh(const mapPolyMesh& mpm);
//- Return linear difference weighting factors
virtual tmp<surfaceScalarField> weights() const = 0;

View File

@ -999,7 +999,7 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm)
mapFields(mpm);
// Clear the current volume and other geometry factors
surfaceInterpolation::clearOut();
surfaceInterpolation::updateMesh(mpm);
// Clear any non-updateable addressing
clearAddressing(true);

View File

@ -48,6 +48,8 @@ namespace Foam
void Foam::surfaceInterpolation::clearOut()
{
// TBD: potential to apply partial clear out only?
// Move to fvGeometryScheme?
weights_.clear();
deltaCoeffs_.clear();
nonOrthDeltaCoeffs_.clear();
@ -161,10 +163,7 @@ bool Foam::surfaceInterpolation::movePoints()
// Do any primitive geometry calculation
const_cast<fvGeometryScheme&>(geometry()).movePoints();
weights_.clear();
deltaCoeffs_.clear();
nonOrthDeltaCoeffs_.clear();
nonOrthCorrectionVectors_.clear();
clearOut();
return true;
}
@ -179,6 +178,22 @@ void Foam::surfaceInterpolation::updateGeom()
}
const_cast<fvGeometryScheme&>(geometry()).movePoints();
clearOut();
}
void Foam::surfaceInterpolation::updateMesh(const mapPolyMesh& mpm)
{
if (debug)
{
Pout<< "surfaceInterpolation::updateMesh() : "
<< "Updating geometric properties" << endl;
}
const_cast<fvGeometryScheme&>(geometry()).updateMesh(mpm);
clearOut();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,6 +52,7 @@ namespace Foam
// Forward Declarations
class fvMesh;
class fvGeometryScheme;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class surfaceInterpolation Declaration
@ -141,6 +142,9 @@ public:
//- Has weights
bool hasWeights() const noexcept { return bool(weights_); }
//- Update mesh for topology changes
virtual void updateMesh(const mapPolyMesh& mpm);
};