mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cvMeshBackgroundMesh: new application to get a background mesh
This commit is contained in:
@ -4,5 +4,7 @@ set -x
|
||||
|
||||
wclean libso conformalVoronoiMesh
|
||||
wclean
|
||||
wclean cvMeshSurfaceSimplify
|
||||
wclean cvMeshBackgroundMesh
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -5,5 +5,6 @@ set -x
|
||||
wmake libso conformalVoronoiMesh
|
||||
wmake
|
||||
wmake cvMeshSurfaceSimplify
|
||||
wmake cvMeshBackgroundMesh
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -142,7 +142,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
|
||||
const conformationSurfaces& geometry = geometryToConformTo_;
|
||||
|
||||
decompositionMethod& decomposer = decomposerPtr_();
|
||||
|
||||
@ -512,7 +512,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
||||
// Sample the box to find an estimate of the min size, and a volume
|
||||
// estimate when overlapping == true.
|
||||
|
||||
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
|
||||
const conformationSurfaces& geometry = geometryToConformTo_;
|
||||
|
||||
treeBoundBox cellBb
|
||||
(
|
||||
@ -578,7 +578,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
||||
|
||||
forAll(samplePoints, i)
|
||||
{
|
||||
scalar s = cvMesh_.cellSizeControl().cellSize
|
||||
scalar s = cellSizeControl_.cellSize
|
||||
(
|
||||
hitInfo[i].hitPoint()
|
||||
);
|
||||
@ -693,7 +693,7 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
||||
// Overall bb
|
||||
treeBoundBox overallBb(boundaryFacesPtr_().localPoints());
|
||||
|
||||
Random& rnd = cvMesh_.rndGen();
|
||||
Random& rnd = rndGen_;
|
||||
|
||||
bFTreePtr_.reset
|
||||
(
|
||||
@ -726,11 +726,11 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
||||
|
||||
octreeNearestDistances_ = bFTreePtr_().calcNearestDistance();
|
||||
|
||||
if (cvMesh_.cvMeshControls().objOutput())
|
||||
if (cvMeshControls_.objOutput())
|
||||
{
|
||||
OFstream fStr
|
||||
(
|
||||
cvMesh_.time().path()
|
||||
mesh_.time().path()
|
||||
/"backgroundMeshDecomposition_proc_"
|
||||
+ name(Pstream::myProcNo())
|
||||
+ "_boundaryFaces.obj"
|
||||
@ -777,15 +777,18 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
)
|
||||
:
|
||||
coeffsDict_(coeffsDict),
|
||||
cvMesh_(cvMesh),
|
||||
runTime_(cvMesh.time()),
|
||||
geometryToConformTo_(cvMesh.geometryToConformTo()),
|
||||
cellSizeControl_(cvMesh.cellSizeControl()),
|
||||
rndGen_(cvMesh.rndGen()),
|
||||
cvMeshControls_(cvMesh.cvMeshControls()),
|
||||
mesh_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fvMesh::defaultRegion,
|
||||
cvMesh_.time().timeName(),
|
||||
cvMesh_.time(),
|
||||
runTime_.timeName(),
|
||||
runTime_,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
),
|
||||
@ -805,22 +808,22 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
|
||||
IOobject
|
||||
(
|
||||
"decomposeParDict",
|
||||
cvMesh_.time().system(),
|
||||
cvMesh_.time(),
|
||||
runTime_.system(),
|
||||
runTime_,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
decomposerPtr_(decompositionMethod::New(decomposeDict_)),
|
||||
mergeDist_(1e-6*mesh_.bounds().mag()),
|
||||
spanScale_(readScalar(coeffsDict_.lookup("spanScale"))),
|
||||
spanScale_(readScalar(coeffsDict.lookup("spanScale"))),
|
||||
minCellSizeLimit_
|
||||
(
|
||||
coeffsDict_.lookupOrDefault<scalar>("minCellSizeLimit", 0.0)
|
||||
coeffsDict.lookupOrDefault<scalar>("minCellSizeLimit", 0.0)
|
||||
),
|
||||
minLevels_(readLabel(coeffsDict_.lookup("minLevels"))),
|
||||
volRes_(readLabel(coeffsDict_.lookup("sampleResolution"))),
|
||||
maxCellWeightCoeff_(readScalar(coeffsDict_.lookup("maxCellWeightCoeff")))
|
||||
minLevels_(readLabel(coeffsDict.lookup("minLevels"))),
|
||||
volRes_(readLabel(coeffsDict.lookup("sampleResolution"))),
|
||||
maxCellWeightCoeff_(readScalar(coeffsDict.lookup("maxCellWeightCoeff")))
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
@ -854,6 +857,74 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
|
||||
}
|
||||
|
||||
|
||||
Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
|
||||
(
|
||||
const scalar spanScale,
|
||||
const scalar minCellSizeLimit,
|
||||
const label minLevels,
|
||||
const label volRes,
|
||||
const scalar maxCellWeightCoeff,
|
||||
|
||||
const Time& runTime,
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const cellSizeControlSurfaces& cellSizeControl,
|
||||
Random& rndGen,
|
||||
const cvControls& cvMeshControls
|
||||
)
|
||||
:
|
||||
runTime_(runTime),
|
||||
geometryToConformTo_(geometryToConformTo),
|
||||
cellSizeControl_(cellSizeControl),
|
||||
rndGen_(rndGen),
|
||||
cvMeshControls_(cvMeshControls),
|
||||
mesh_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fvMesh::defaultRegion,
|
||||
runTime_.timeName(),
|
||||
runTime_,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
),
|
||||
meshCutter_
|
||||
(
|
||||
mesh_,
|
||||
labelList(mesh_.nCells(), 0),
|
||||
labelList(mesh_.nPoints(), 0)
|
||||
),
|
||||
boundaryFacesPtr_(),
|
||||
bFTreePtr_(),
|
||||
octreeNearestDistances_(),
|
||||
allBackgroundMeshBounds_(Pstream::nProcs()),
|
||||
globalBackgroundBounds_(),
|
||||
decomposeDict_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"decomposeParDict",
|
||||
runTime_.system(),
|
||||
runTime_,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
decomposerPtr_(decompositionMethod::New(decomposeDict_)),
|
||||
mergeDist_(1e-6*mesh_.bounds().mag()),
|
||||
spanScale_(spanScale),
|
||||
minCellSizeLimit_(minCellSizeLimit),
|
||||
minLevels_(minLevels),
|
||||
volRes_(volRes),
|
||||
maxCellWeightCoeff_(maxCellWeightCoeff)
|
||||
{
|
||||
// Stand-alone operation
|
||||
|
||||
Info<< nl << "Building initial background mesh decomposition" << endl;
|
||||
|
||||
initialRefinement();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,10 +92,22 @@ class backgroundMeshDecomposition
|
||||
// Private data
|
||||
|
||||
//- Method details dictionary
|
||||
dictionary coeffsDict_;
|
||||
//dictionary coeffsDict_;
|
||||
|
||||
//- Reference to the conformalVoronoiMesh holding this object
|
||||
const conformalVoronoiMesh& cvMesh_;
|
||||
//- Reference to runtime
|
||||
const Time& runTime_;
|
||||
|
||||
//- Reference to surface
|
||||
const conformationSurfaces& geometryToConformTo_;
|
||||
|
||||
//- The cell size control object
|
||||
const cellSizeControlSurfaces& cellSizeControl_;
|
||||
|
||||
//- Random number generator
|
||||
Random& rndGen_;
|
||||
|
||||
//- Controls
|
||||
const cvControls& cvMeshControls_;
|
||||
|
||||
//- Mesh stored on for this processor, specifiying the domain that it
|
||||
// is responsible for.
|
||||
@ -191,13 +203,29 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from components in cvMesh operation
|
||||
backgroundMeshDecomposition
|
||||
(
|
||||
const dictionary& coeffsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
);
|
||||
|
||||
//- Construct from components for standalone operation
|
||||
backgroundMeshDecomposition
|
||||
(
|
||||
const scalar spanScale,
|
||||
const scalar minCellSizeLimit,
|
||||
const label minLevels,
|
||||
const label volRes,
|
||||
const scalar maxCellWeightCoeff,
|
||||
|
||||
const Time& runTime,
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const cellSizeControlSurfaces& cellSizeControl,
|
||||
Random& rndGen,
|
||||
const cvControls& cvMeshControls
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~backgroundMeshDecomposition();
|
||||
@ -299,6 +327,15 @@ public:
|
||||
|
||||
//- Return the boundBox of this processor
|
||||
inline const treeBoundBox& procBounds() const;
|
||||
|
||||
//- Return the cell level of the underlying mesh
|
||||
inline const labelList& cellLevel() const;
|
||||
|
||||
//- Return the point level of the underlying mesh
|
||||
inline const labelList& pointLevel() const;
|
||||
|
||||
//- Return the current decomposition method
|
||||
inline const decompositionMethod& decomposer() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,9 +43,30 @@ Foam::backgroundMeshDecomposition::octreeNearestDistances() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::treeBoundBox& Foam::backgroundMeshDecomposition::procBounds() const
|
||||
const Foam::treeBoundBox&
|
||||
Foam::backgroundMeshDecomposition::procBounds() const
|
||||
{
|
||||
return allBackgroundMeshBounds_[Pstream::myProcNo()];
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelList& Foam::backgroundMeshDecomposition::cellLevel() const
|
||||
{
|
||||
return meshCutter_.cellLevel();
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelList& Foam::backgroundMeshDecomposition::pointLevel() const
|
||||
{
|
||||
return meshCutter_.pointLevel();
|
||||
}
|
||||
|
||||
|
||||
const Foam::decompositionMethod&
|
||||
Foam::backgroundMeshDecomposition::decomposer() const
|
||||
{
|
||||
return decomposerPtr_();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user