mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: primitiveMesh: make geometry calculation runtime selectable
This adds a 'geometry' scheme section to the system/fvSchemes:
geometry
{
type highAspectRatio;
}
These 'fvGeometryMethod's are used to calculate
- deltaCoeffs
- nonOrthoCoeffs
etc and can even modify the basic face/cellCentres calculation.
This commit is contained in:
committed by
Andrew Heather
parent
4a166c6f3e
commit
46dbfabd9d
@ -36,6 +36,7 @@ License
|
||||
#include "pointSet.H"
|
||||
#include "faceSet.H"
|
||||
#include "cellSet.H"
|
||||
#include "basicFvGeometryScheme.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -254,6 +255,19 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
|
||||
auto meshPtr = autoPtr<fvMesh>::New(io);
|
||||
fvMesh& mesh = *meshPtr;
|
||||
|
||||
// Make sure to use a non-parallel geometry calculation method
|
||||
{
|
||||
tmp<fvGeometryScheme> basicGeometry
|
||||
(
|
||||
fvGeometryScheme::New
|
||||
(
|
||||
mesh,
|
||||
dictionary(),
|
||||
basicFvGeometryScheme::typeName
|
||||
)
|
||||
);
|
||||
mesh.geometry(basicGeometry);
|
||||
}
|
||||
|
||||
|
||||
// Sync patches
|
||||
|
||||
@ -92,6 +92,7 @@ Usage
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "topoSet.H"
|
||||
#include "regionProperties.H"
|
||||
#include "basicFvGeometryScheme.H"
|
||||
|
||||
#include "parFvFieldReconstructor.H"
|
||||
#include "parLagrangianRedistributor.H"
|
||||
@ -152,6 +153,30 @@ scalar getMergeDistance
|
||||
}
|
||||
|
||||
|
||||
void setBasicGeometry(fvMesh& mesh)
|
||||
{
|
||||
// Set the fvGeometryScheme to basic since it does not require
|
||||
// any parallel communication to construct the geometry. During
|
||||
// redistributePar one might temporarily end up with processors
|
||||
// with zero procBoundaries. Normally procBoundaries trigger geometry
|
||||
// calculation (e.g. send over cellCentres) so on the processors without
|
||||
// procBoundaries this will not happen. The call to the geometry calculation
|
||||
// is not synchronised and this might lead to a hang for geometry schemes
|
||||
// that do require synchronisation
|
||||
|
||||
tmp<fvGeometryScheme> basicGeometry
|
||||
(
|
||||
fvGeometryScheme::New
|
||||
(
|
||||
mesh,
|
||||
dictionary(),
|
||||
basicFvGeometryScheme::typeName
|
||||
)
|
||||
);
|
||||
mesh.geometry(basicGeometry);
|
||||
}
|
||||
|
||||
|
||||
void printMeshData(const polyMesh& mesh)
|
||||
{
|
||||
// Collect all data on master
|
||||
@ -2675,6 +2700,10 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
fvMesh& mesh = meshPtr();
|
||||
|
||||
// Use basic geometry calculation to avoid synchronisation
|
||||
// problems. See comment in routine
|
||||
setBasicGeometry(mesh);
|
||||
|
||||
// Global matching tolerance
|
||||
const scalar tolDim = getMergeDistance
|
||||
(
|
||||
@ -2736,6 +2765,8 @@ int main(int argc, char *argv[])
|
||||
),
|
||||
true // read on master only
|
||||
);
|
||||
setBasicGeometry(baseMeshPtr());
|
||||
|
||||
|
||||
Info<< "Reading local, decomposed mesh" << endl;
|
||||
autoPtr<fvMesh> meshPtr = loadOrCreateMesh
|
||||
|
||||
Reference in New Issue
Block a user