BUG: Compiling wrong autoMesh library
This commit is contained in:
parent
ee43061315
commit
9203c0219e
38 changed files with 1 additions and 22610 deletions
|
@ -1,6 +1,6 @@
|
|||
EXE_INC = \
|
||||
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/autoMesh/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
autoHexMesh = autoHexMesh
|
||||
autoHexMeshDriver = $(autoHexMesh)/autoHexMeshDriver
|
||||
|
||||
$(autoHexMeshDriver)/autoLayerDriver.C
|
||||
$(autoHexMeshDriver)/autoLayerDriverShrink.C
|
||||
$(autoHexMeshDriver)/autoSnapDriver.C
|
||||
$(autoHexMeshDriver)/autoRefineDriver.C
|
||||
$(autoHexMeshDriver)/autoHexMeshDriver.C
|
||||
|
||||
$(autoHexMeshDriver)/layerParameters/layerParameters.C
|
||||
$(autoHexMeshDriver)/refinementParameters/refinementParameters.C
|
||||
$(autoHexMeshDriver)/snapParameters/snapParameters.C
|
||||
$(autoHexMeshDriver)/pointData/pointData.C
|
||||
|
||||
$(autoHexMesh)/meshRefinement/meshRefinementBaffles.C
|
||||
$(autoHexMesh)/meshRefinement/meshRefinement.C
|
||||
$(autoHexMesh)/meshRefinement/meshRefinementMerge.C
|
||||
$(autoHexMesh)/meshRefinement/meshRefinementProblemCells.C
|
||||
$(autoHexMesh)/meshRefinement/meshRefinementRefine.C
|
||||
$(autoHexMesh)/refinementSurfaces/refinementSurfaces.C
|
||||
$(autoHexMesh)/shellSurfaces/shellSurfaces.C
|
||||
$(autoHexMesh)/trackedParticle/trackedParticle.C
|
||||
$(autoHexMesh)/trackedParticle/trackedParticleCloud.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libautoMesh
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
EXE_INC = \
|
||||
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-ldecompositionMethods \
|
||||
-ldynamicMesh \
|
||||
-ldynamicFvMesh \
|
||||
-lfiniteVolume \
|
||||
-llagrangian \
|
||||
-lmeshTools \
|
||||
-ledgeMesh \
|
||||
-ltriSurface
|
|
@ -1,552 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "autoHexMeshDriver.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "boundBox.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "cellSet.H"
|
||||
#include "syncTools.H"
|
||||
#include "refinementParameters.H"
|
||||
#include "snapParameters.H"
|
||||
#include "layerParameters.H"
|
||||
#include "autoRefineDriver.H"
|
||||
#include "autoSnapDriver.H"
|
||||
#include "autoLayerDriver.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(autoHexMeshDriver, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Check writing tolerance before doing any serious work
|
||||
Foam::scalar Foam::autoHexMeshDriver::getMergeDistance(const scalar mergeTol)
|
||||
const
|
||||
{
|
||||
const boundBox& meshBb = mesh_.bounds();
|
||||
scalar mergeDist = mergeTol * meshBb.mag();
|
||||
scalar writeTol = std::pow
|
||||
(
|
||||
scalar(10.0),
|
||||
-scalar(IOstream::defaultPrecision())
|
||||
);
|
||||
|
||||
Info<< nl
|
||||
<< "Overall mesh bounding box : " << meshBb << nl
|
||||
<< "Relative tolerance : " << mergeTol << nl
|
||||
<< "Absolute matching distance : " << mergeDist << nl
|
||||
<< endl;
|
||||
|
||||
if (mesh_.time().writeFormat() == IOstream::ASCII && mergeTol < writeTol)
|
||||
{
|
||||
FatalErrorIn("autoHexMeshDriver::getMergeDistance(const scalar) const")
|
||||
<< "Your current settings specify ASCII writing with "
|
||||
<< IOstream::defaultPrecision() << " digits precision." << endl
|
||||
<< "Your merging tolerance (" << mergeTol << ") is finer than this."
|
||||
<< endl
|
||||
<< "Please change your writeFormat to binary"
|
||||
<< " or increase the writePrecision" << endl
|
||||
<< "or adjust the merge tolerance (-mergeTol)."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return mergeDist;
|
||||
}
|
||||
|
||||
|
||||
//// Specifically orient using a calculated point outside
|
||||
//void Foam::autoHexMeshDriver::orientOutside
|
||||
//(
|
||||
// PtrList<searchableSurface>& shells
|
||||
//)
|
||||
//{
|
||||
// // Determine outside point.
|
||||
// boundBox overallBb = boundBox::invertedBox;
|
||||
//
|
||||
// bool hasSurface = false;
|
||||
//
|
||||
// forAll(shells, shellI)
|
||||
// {
|
||||
// if (isA<triSurfaceMesh>(shells[shellI]))
|
||||
// {
|
||||
// const triSurfaceMesh& shell =
|
||||
// refCast<const triSurfaceMesh>(shells[shellI]);
|
||||
//
|
||||
// hasSurface = true;
|
||||
//
|
||||
// boundBox shellBb(shell.localPoints(), false);
|
||||
//
|
||||
// overallBb.min() = min(overallBb.min(), shellBb.min());
|
||||
// overallBb.max() = max(overallBb.max(), shellBb.max());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (hasSurface)
|
||||
// {
|
||||
// const point outsidePt = 2 * overallBb.span();
|
||||
//
|
||||
// //Info<< "Using point " << outsidePt << " to orient shells" << endl;
|
||||
//
|
||||
// forAll(shells, shellI)
|
||||
// {
|
||||
// if (isA<triSurfaceMesh>(shells[shellI]))
|
||||
// {
|
||||
// triSurfaceMesh& shell =
|
||||
// refCast<triSurfaceMesh>(shells[shellI]);
|
||||
//
|
||||
// if (!refinementSurfaces::isSurfaceClosed(shell))
|
||||
// {
|
||||
// FatalErrorIn("orientOutside(PtrList<searchableSurface>&)")
|
||||
// << "Refinement shell "
|
||||
// << shell.searchableSurface::name()
|
||||
// << " is not closed." << exit(FatalError);
|
||||
// }
|
||||
//
|
||||
// refinementSurfaces::orientSurface(outsidePt, shell);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::autoHexMeshDriver::autoHexMeshDriver
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const bool overwrite,
|
||||
const dictionary& dict,
|
||||
const dictionary& decomposeDict
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
dict_(dict),
|
||||
debug_(readLabel(dict_.lookup("debug"))),
|
||||
mergeDist_(getMergeDistance(readScalar(dict_.lookup("mergeTolerance"))))
|
||||
{
|
||||
if (debug_ > 0)
|
||||
{
|
||||
meshRefinement::debug = debug_;
|
||||
autoHexMeshDriver::debug = debug_;
|
||||
autoRefineDriver::debug = debug;
|
||||
autoSnapDriver::debug = debug;
|
||||
autoLayerDriver::debug = debug;
|
||||
}
|
||||
|
||||
refinementParameters refineParams(dict, 1);
|
||||
|
||||
Info<< "Overall cell limit : "
|
||||
<< refineParams.maxGlobalCells() << endl;
|
||||
Info<< "Per processor cell limit : "
|
||||
<< refineParams.maxLocalCells() << endl;
|
||||
Info<< "Minimum number of cells to refine : "
|
||||
<< refineParams.minRefineCells() << endl;
|
||||
Info<< "Curvature : "
|
||||
<< refineParams.curvature() << nl << endl;
|
||||
Info<< "Layers between different refinement levels : "
|
||||
<< refineParams.nBufferLayers() << endl;
|
||||
|
||||
PtrList<dictionary> shellDicts(dict_.lookup("refinementShells"));
|
||||
|
||||
PtrList<dictionary> surfaceDicts(dict_.lookup("surfaces"));
|
||||
|
||||
|
||||
// Read geometry
|
||||
// ~~~~~~~~~~~~~
|
||||
|
||||
{
|
||||
Info<< "Reading all geometry." << endl;
|
||||
|
||||
// Construct dictionary with all shells and all refinement surfaces
|
||||
dictionary geometryDict;
|
||||
|
||||
forAll(shellDicts, shellI)
|
||||
{
|
||||
dictionary shellDict = shellDicts[shellI];
|
||||
const word name(shellDict.lookup("name"));
|
||||
shellDict.remove("name");
|
||||
shellDict.remove("level");
|
||||
shellDict.remove("refineInside");
|
||||
geometryDict.add(name, shellDict);
|
||||
}
|
||||
|
||||
forAll(surfaceDicts, surfI)
|
||||
{
|
||||
dictionary surfDict = surfaceDicts[surfI];
|
||||
const word name(string::validate<word>(surfDict.lookup("file")));
|
||||
surfDict.remove("file");
|
||||
surfDict.remove("regions");
|
||||
if (!surfDict.found("name"))
|
||||
{
|
||||
surfDict.add("name", name);
|
||||
}
|
||||
surfDict.add("type", triSurfaceMesh::typeName);
|
||||
geometryDict.add(name, surfDict);
|
||||
}
|
||||
|
||||
allGeometryPtr_.reset
|
||||
(
|
||||
new searchableSurfaces
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"abc", // dummy name
|
||||
//mesh_.time().findInstance("triSurface", word::null),
|
||||
// instance
|
||||
mesh_.time().constant(), // instance
|
||||
"triSurface", // local
|
||||
mesh_.time(), // registry
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
geometryDict
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Read geometry in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
}
|
||||
|
||||
|
||||
// Read refinement surfaces
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
{
|
||||
Info<< "Reading surfaces and constructing search trees." << endl;
|
||||
|
||||
surfacesPtr_.reset
|
||||
(
|
||||
new refinementSurfaces
|
||||
(
|
||||
allGeometryPtr_(),
|
||||
surfaceDicts
|
||||
)
|
||||
);
|
||||
Info<< "Read surfaces in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
}
|
||||
|
||||
// Read refinement shells
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
{
|
||||
Info<< "Reading refinement shells." << endl;
|
||||
shellsPtr_.reset
|
||||
(
|
||||
new shellSurfaces
|
||||
(
|
||||
allGeometryPtr_(),
|
||||
shellDicts
|
||||
)
|
||||
);
|
||||
Info<< "Read refinement shells in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
//// Orient shell surfaces before any searching is done.
|
||||
//Info<< "Orienting triSurface shells so point far away is outside."
|
||||
// << endl;
|
||||
//orientOutside(shells_);
|
||||
//Info<< "Oriented shells in = "
|
||||
// << mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
Info<< "Setting refinement level of surface to be consistent"
|
||||
<< " with shells." << endl;
|
||||
surfacesPtr_().setMinLevelFields(shells());
|
||||
Info<< "Checked shell refinement in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
}
|
||||
|
||||
|
||||
// Check faceZones are synchronised
|
||||
meshRefinement::checkCoupledFaceZones(mesh_);
|
||||
|
||||
|
||||
// Refinement engine
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
{
|
||||
Info<< nl
|
||||
<< "Determining initial surface intersections" << nl
|
||||
<< "-----------------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
// Main refinement engine
|
||||
meshRefinerPtr_.reset
|
||||
(
|
||||
new meshRefinement
|
||||
(
|
||||
mesh,
|
||||
mergeDist_, // tolerance used in sorting coordinates
|
||||
overwrite,
|
||||
surfaces(),
|
||||
shells()
|
||||
)
|
||||
);
|
||||
Info<< "Calculated surface intersections in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
// Some stats
|
||||
meshRefinerPtr_().printMeshInfo(debug_, "Initial mesh");
|
||||
|
||||
meshRefinerPtr_().write
|
||||
(
|
||||
debug_&meshRefinement::OBJINTERSECTIONS,
|
||||
mesh_.time().path()/meshRefinerPtr_().timeName()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Add all the surface regions as patches
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
{
|
||||
Info<< nl
|
||||
<< "Adding patches for surface regions" << nl
|
||||
<< "----------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
// From global region number to mesh patch.
|
||||
globalToPatch_.setSize(surfaces().nRegions(), -1);
|
||||
|
||||
Info<< "Patch\tRegion" << nl
|
||||
<< "-----\t------"
|
||||
<< endl;
|
||||
|
||||
const labelList& surfaceGeometry = surfaces().surfaces();
|
||||
forAll(surfaceGeometry, surfI)
|
||||
{
|
||||
label geomI = surfaceGeometry[surfI];
|
||||
|
||||
const wordList& regNames = allGeometryPtr_().regionNames()[geomI];
|
||||
|
||||
Info<< surfaces().names()[surfI] << ':' << nl << nl;
|
||||
|
||||
forAll(regNames, i)
|
||||
{
|
||||
label patchI = meshRefinerPtr_().addMeshedPatch
|
||||
(
|
||||
regNames[i],
|
||||
wallPolyPatch::typeName
|
||||
);
|
||||
|
||||
Info<< patchI << '\t' << regNames[i] << nl;
|
||||
|
||||
globalToPatch_[surfaces().globalRegion(surfI, i)] = patchI;
|
||||
}
|
||||
|
||||
Info<< nl;
|
||||
}
|
||||
Info<< "Added patches in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s" << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
//// Add cyclics for any named faceZones
|
||||
//// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//// (these cyclics are used later on to temporarily put the faceZones
|
||||
//// in when snapping)
|
||||
//
|
||||
//labelList namedSurfaces(surfaces().getNamedSurfaces());
|
||||
//if (namedSurfaces.size())
|
||||
//{
|
||||
// Info<< nl
|
||||
// << "Introducing cyclics for faceZones" << nl
|
||||
// << "---------------------------------" << nl
|
||||
// << endl;
|
||||
//
|
||||
// // From surface to cyclic patch
|
||||
// surfaceToCyclicPatch_.setSize(surfaces().size(), -1);
|
||||
//
|
||||
// Info<< "Patch\tZone" << nl
|
||||
// << "----\t-----"
|
||||
// << endl;
|
||||
//
|
||||
// forAll(namedSurfaces, i)
|
||||
// {
|
||||
// label surfI = namedSurfaces[i];
|
||||
//
|
||||
// surfaceToCyclicPatch_[surfI] = meshRefinement::addPatch
|
||||
// (
|
||||
// mesh,
|
||||
// surfaces().faceZoneNames()[surfI],
|
||||
// cyclicPolyPatch::typeName
|
||||
// );
|
||||
//
|
||||
// Info<< surfaceToCyclicPatch_[surfI] << '\t'
|
||||
// << surfaces().faceZoneNames()[surfI] << nl << endl;
|
||||
// }
|
||||
// Info<< "Added cyclic patches in = "
|
||||
// << mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
//}
|
||||
|
||||
|
||||
// Parallel
|
||||
// ~~~~~~~~
|
||||
|
||||
{
|
||||
// Decomposition
|
||||
decomposerPtr_ = decompositionMethod::New
|
||||
(
|
||||
decomposeDict,
|
||||
mesh_
|
||||
);
|
||||
decompositionMethod& decomposer = decomposerPtr_();
|
||||
|
||||
|
||||
if (Pstream::parRun() && !decomposer.parallelAware())
|
||||
{
|
||||
FatalErrorIn("autoHexMeshDriver::autoHexMeshDriver"
|
||||
"(const IOobject&, fvMesh&)")
|
||||
<< "You have selected decomposition method "
|
||||
<< decomposer.typeName
|
||||
<< " which is not parallel aware." << endl
|
||||
<< "Please select one that is (parMetis, hierarchical)"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Mesh distribution engine (uses tolerance to reconstruct meshes)
|
||||
distributorPtr_.reset(new fvMeshDistribute(mesh_, mergeDist_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::autoHexMeshDriver::writeMesh(const string& msg) const
|
||||
{
|
||||
const meshRefinement& meshRefiner = meshRefinerPtr_();
|
||||
|
||||
meshRefiner.printMeshInfo(debug_, msg);
|
||||
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
|
||||
|
||||
meshRefiner.write(meshRefinement::MESH|meshRefinement::SCALARLEVELS, "");
|
||||
if (debug_ & meshRefinement::OBJINTERSECTIONS)
|
||||
{
|
||||
meshRefiner.write
|
||||
(
|
||||
meshRefinement::OBJINTERSECTIONS,
|
||||
mesh_.time().path()/meshRefiner.timeName()
|
||||
);
|
||||
}
|
||||
Info<< "Written mesh in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s." << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoHexMeshDriver::doMesh()
|
||||
{
|
||||
Switch wantRefine(dict_.lookup("doRefine"));
|
||||
Switch wantSnap(dict_.lookup("doSnap"));
|
||||
Switch wantLayers(dict_.lookup("doLayers"));
|
||||
|
||||
Info<< "Do refinement : " << wantRefine << nl
|
||||
<< "Do snapping : " << wantSnap << nl
|
||||
<< "Do layers : " << wantLayers << nl
|
||||
<< endl;
|
||||
|
||||
if (wantRefine)
|
||||
{
|
||||
const dictionary& motionDict = dict_.subDict("motionDict");
|
||||
|
||||
autoRefineDriver refineDriver
|
||||
(
|
||||
meshRefinerPtr_(),
|
||||
decomposerPtr_(),
|
||||
distributorPtr_(),
|
||||
globalToPatch_
|
||||
);
|
||||
|
||||
// Get all the refinement specific params
|
||||
refinementParameters refineParams(dict_, 1);
|
||||
|
||||
refineDriver.doRefine(dict_, refineParams, wantSnap, motionDict);
|
||||
|
||||
// Write mesh
|
||||
writeMesh("Refined mesh");
|
||||
}
|
||||
|
||||
if (wantSnap)
|
||||
{
|
||||
const dictionary& snapDict = dict_.subDict("snapDict");
|
||||
const dictionary& motionDict = dict_.subDict("motionDict");
|
||||
|
||||
autoSnapDriver snapDriver
|
||||
(
|
||||
meshRefinerPtr_(),
|
||||
globalToPatch_
|
||||
);
|
||||
|
||||
// Get all the snapping specific params
|
||||
snapParameters snapParams(snapDict, 1);
|
||||
|
||||
snapDriver.doSnap(snapDict, motionDict, snapParams);
|
||||
|
||||
// Write mesh.
|
||||
writeMesh("Snapped mesh");
|
||||
}
|
||||
|
||||
if (wantLayers)
|
||||
{
|
||||
const dictionary& motionDict = dict_.subDict("motionDict");
|
||||
const dictionary& shrinkDict = dict_.subDict("shrinkDict");
|
||||
PtrList<dictionary> surfaceDicts(dict_.lookup("surfaces"));
|
||||
|
||||
autoLayerDriver layerDriver(meshRefinerPtr_());
|
||||
|
||||
// Get all the layer specific params
|
||||
layerParameters layerParams
|
||||
(
|
||||
surfaceDicts,
|
||||
surfacesPtr_(),
|
||||
globalToPatch_,
|
||||
shrinkDict,
|
||||
mesh_.boundaryMesh()
|
||||
);
|
||||
|
||||
layerDriver.doLayers
|
||||
(
|
||||
shrinkDict,
|
||||
motionDict,
|
||||
layerParams,
|
||||
true, // pre-balance
|
||||
decomposerPtr_(),
|
||||
distributorPtr_()
|
||||
);
|
||||
|
||||
// Write mesh.
|
||||
writeMesh("Layer mesh");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,233 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::autoHexMeshDriver
|
||||
|
||||
Description
|
||||
main meshing driver.
|
||||
|
||||
SourceFiles
|
||||
autoHexMeshDriver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef autoHexMeshDriver_H
|
||||
#define autoHexMeshDriver_H
|
||||
|
||||
#include "autoPtr.H"
|
||||
#include "dictionary.H"
|
||||
#include "wallPoint.H"
|
||||
#include "searchableSurfaces.H"
|
||||
#include "refinementSurfaces.H"
|
||||
#include "shellSurfaces.H"
|
||||
#include "meshRefinement.H"
|
||||
#include "decompositionMethod.H"
|
||||
#include "fvMeshDistribute.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Class forward declarations
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class autoHexMeshDriver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class autoHexMeshDriver
|
||||
{
|
||||
// Static data members
|
||||
|
||||
//- Extrusion controls
|
||||
enum extrudeMode
|
||||
{
|
||||
NOEXTRUDE, /*!< Do not extrude. No layers added. */
|
||||
EXTRUDE, /*!< Extrude */
|
||||
EXTRUDEREMOVE /*!< Extrude but afterwards remove added */
|
||||
/*!< faces locally */
|
||||
};
|
||||
|
||||
|
||||
// Private classes
|
||||
|
||||
//- Combine operator class for equalizing displacements.
|
||||
class minMagEqOp
|
||||
{
|
||||
public:
|
||||
|
||||
void operator()(vector& x, const vector& y) const
|
||||
{
|
||||
if (magSqr(y) < magSqr(x))
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//- Combine operator class to combine normal with other normal.
|
||||
class nomalsCombine
|
||||
{
|
||||
public:
|
||||
|
||||
void operator()(vector& x, const vector& y) const
|
||||
{
|
||||
if (y != wallPoint::greatPoint)
|
||||
{
|
||||
if (x == wallPoint::greatPoint)
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
x *= (x&y);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
fvMesh& mesh_;
|
||||
|
||||
//- Input dictionary
|
||||
const dictionary dict_;
|
||||
|
||||
//- Debug level
|
||||
const label debug_;
|
||||
|
||||
//- Merge distance
|
||||
const scalar mergeDist_;
|
||||
|
||||
|
||||
//- All surface based geometry
|
||||
autoPtr<searchableSurfaces> allGeometryPtr_;
|
||||
|
||||
//- Shells (geometry for inside/outside refinement)
|
||||
autoPtr<shellSurfaces> shellsPtr_;
|
||||
|
||||
//- Surfaces (geometry for intersection based refinement)
|
||||
autoPtr<refinementSurfaces> surfacesPtr_;
|
||||
|
||||
//- Per refinement surface region the patch
|
||||
labelList globalToPatch_;
|
||||
|
||||
//- Mesh refinement engine
|
||||
autoPtr<meshRefinement> meshRefinerPtr_;
|
||||
|
||||
//- Decomposition engine
|
||||
autoPtr<decompositionMethod> decomposerPtr_;
|
||||
|
||||
//- Mesh distribution engine
|
||||
autoPtr<fvMeshDistribute> distributorPtr_;
|
||||
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Calculate merge distance. Check against writing tolerance.
|
||||
scalar getMergeDistance(const scalar mergeTol) const;
|
||||
|
||||
//static void orientOutside(PtrList<searchableSurface>&);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
autoHexMeshDriver(const autoHexMeshDriver&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const autoHexMeshDriver&);
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("autoHexMeshDriver");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary and mesh to modify
|
||||
autoHexMeshDriver
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const bool overwrite,
|
||||
const dictionary& meshDict,
|
||||
const dictionary& decomposeDict
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- reference to mesh
|
||||
const fvMesh& mesh() const
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
fvMesh& mesh()
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
//- Surfaces to base refinement on
|
||||
const refinementSurfaces& surfaces() const
|
||||
{
|
||||
return surfacesPtr_();
|
||||
}
|
||||
|
||||
//- Surfaces to volume refinement on
|
||||
const shellSurfaces& shells() const
|
||||
{
|
||||
return shellsPtr_();
|
||||
}
|
||||
|
||||
//- Per refinementsurface, per region the patch
|
||||
const labelList& globalToPatch() const
|
||||
{
|
||||
return globalToPatch_;
|
||||
}
|
||||
|
||||
|
||||
// Meshing
|
||||
|
||||
//- Write mesh
|
||||
void writeMesh(const string&) const;
|
||||
|
||||
//- Do all : refine, snap, layers
|
||||
void doMesh();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -1,561 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::autoLayerDriver
|
||||
|
||||
Description
|
||||
All to do with adding layers
|
||||
|
||||
SourceFiles
|
||||
autoLayerDriver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef autoLayerDriver_H
|
||||
#define autoLayerDriver_H
|
||||
|
||||
#include "PackedBoolList.H"
|
||||
#include "meshRefinement.H"
|
||||
#include "wallPoint.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class removePoints;
|
||||
class pointSet;
|
||||
class motionSmoother;
|
||||
class addPatchCellLayer;
|
||||
class pointData;
|
||||
class wallPoint;
|
||||
class faceSet;
|
||||
class layerParameters;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class autoLayerDriver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class autoLayerDriver
|
||||
{
|
||||
// Static data members
|
||||
|
||||
//- Extrusion controls
|
||||
enum extrudeMode
|
||||
{
|
||||
NOEXTRUDE, /*!< Do not extrude. No layers added. */
|
||||
EXTRUDE, /*!< Extrude */
|
||||
EXTRUDEREMOVE /*!< Extrude but afterwards remove added */
|
||||
/*!< faces locally */
|
||||
};
|
||||
|
||||
|
||||
// Private classes
|
||||
|
||||
//- Combine operator class to combine normal with other normal.
|
||||
class nomalsCombine
|
||||
{
|
||||
public:
|
||||
|
||||
void operator()(vector& x, const vector& y) const
|
||||
{
|
||||
if (y != wallPoint::greatPoint)
|
||||
{
|
||||
if (x == wallPoint::greatPoint)
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
x *= (x&y);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Mesh+surface
|
||||
meshRefinement& meshRefiner_;
|
||||
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
// Face merging
|
||||
|
||||
//- Merge patch faces. Undo until no checkMesh errors.
|
||||
label mergePatchFacesUndo
|
||||
(
|
||||
const scalar minCos,
|
||||
const scalar concaveCos,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Remove points.
|
||||
autoPtr<mapPolyMesh> doRemovePoints
|
||||
(
|
||||
removePoints& pointRemover,
|
||||
const boolList& pointCanBeDeleted
|
||||
);
|
||||
|
||||
//- Restore faces (which contain removed points)
|
||||
autoPtr<mapPolyMesh> doRestorePoints
|
||||
(
|
||||
removePoints& pointRemover,
|
||||
const labelList& facesToRestore
|
||||
);
|
||||
|
||||
//- Return candidateFaces that are also in set.
|
||||
labelList collectFaces
|
||||
(
|
||||
const labelList& candidateFaces,
|
||||
const labelHashSet& set
|
||||
) const;
|
||||
|
||||
//- Pick up faces of cells of faces in set.
|
||||
labelList growFaceCellFace(const labelHashSet&) const;
|
||||
|
||||
//- Remove points not used by any face or points used by only
|
||||
// two faces where the edges are in line
|
||||
label mergeEdgesUndo(const scalar minCos, const dictionary&);
|
||||
|
||||
|
||||
// Layers
|
||||
|
||||
//- For debugging: Dump displacement to .obj files
|
||||
static void dumpDisplacement
|
||||
(
|
||||
const fileName&,
|
||||
const indirectPrimitivePatch&,
|
||||
const vectorField&,
|
||||
const List<extrudeMode>&
|
||||
);
|
||||
|
||||
//- Check that primitivePatch is not multiply connected.
|
||||
// Collect non-manifold points in pointSet.
|
||||
static void checkManifold
|
||||
(
|
||||
const indirectPrimitivePatch&,
|
||||
pointSet& nonManifoldPoints
|
||||
);
|
||||
|
||||
//- Check that mesh outside is not multiply connected.
|
||||
void checkMeshManifold() const;
|
||||
|
||||
|
||||
// Static extrusion setup
|
||||
|
||||
//- Unset extrusion on point. Returns true if anything unset.
|
||||
static bool unmarkExtrusion
|
||||
(
|
||||
const label patchPointI,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
);
|
||||
|
||||
//- Unset extrusion on face. Returns true if anything unset.
|
||||
static bool unmarkExtrusion
|
||||
(
|
||||
const face& localFace,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
);
|
||||
|
||||
//- No extrusion at non-manifold points.
|
||||
void handleNonManifolds
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& meshEdges,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
) const;
|
||||
|
||||
//- No extrusion on feature edges. Assumes non-manifold
|
||||
// edges already handled.
|
||||
void handleFeatureAngle
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& meshEdges,
|
||||
const scalar minCos,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
) const;
|
||||
|
||||
//- No extrusion on warped faces
|
||||
void handleWarpedFaces
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalar faceRatio,
|
||||
const scalar edge0Len,
|
||||
const labelList& cellLevel,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
) const;
|
||||
|
||||
//- Determine the number of layers per point from the number of
|
||||
// layers per surface.
|
||||
void setNumLayers
|
||||
(
|
||||
const labelList& patchToNLayers,
|
||||
const labelList& patchIDs,
|
||||
const indirectPrimitivePatch& pp,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
) const;
|
||||
|
||||
//- Grow no-extrusion layer.
|
||||
static void growNoExtrusion
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
);
|
||||
|
||||
//- Calculate pointwise wanted and minimum thickness.
|
||||
// thickness: wanted thickness
|
||||
// minthickness: when to give up and not extrude
|
||||
// Gets per patch parameters and determine pp pointwise
|
||||
// parameters.
|
||||
void calculateLayerThickness
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& patchIDs,
|
||||
|
||||
const scalarField& patchExpansionRatio,
|
||||
const bool relativeSizes,
|
||||
const scalarField& patchFinalLayerThickness,
|
||||
const scalarField& patchMinThickness,
|
||||
|
||||
const labelList& cellLevel,
|
||||
const labelList& patchNLayers,
|
||||
const scalar edge0Len,
|
||||
|
||||
scalarField& thickness,
|
||||
scalarField& minThickness,
|
||||
scalarField& expansionRatio
|
||||
) const;
|
||||
|
||||
|
||||
// Extrusion execution
|
||||
|
||||
//- Synchronize displacement among coupled patches.
|
||||
void syncPatchDisplacement
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const scalarField& minThickness,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
) const;
|
||||
|
||||
//- Get nearest point on surface to snap to
|
||||
void getPatchDisplacement
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const scalarField& thickness,
|
||||
const scalarField& minThickness,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
) const;
|
||||
|
||||
//- Truncates displacement
|
||||
// - for all patchFaces in the faceset displacement gets set
|
||||
// to zero
|
||||
// - all displacement < minThickness gets set to zero
|
||||
label truncateDisplacement
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const scalarField& minThickness,
|
||||
const faceSet& illegalPatchFaces,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
) const;
|
||||
|
||||
//- Setup layer information (at points and faces) to
|
||||
// modify mesh topology in
|
||||
// regions where layer mesh terminates. Guarantees an
|
||||
// optional slow decreasing of the number of layers.
|
||||
// Returns the number of layers per face and per point
|
||||
// to go into the actual layer addition engine.
|
||||
void setupLayerInfoTruncation
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const labelList& patchNLayers,
|
||||
const List<extrudeMode>& extrudeStatus,
|
||||
const label nBufferCellsNoExtrude,
|
||||
labelList& nPatchPointLayers,
|
||||
labelList& nPatchFaceLayers
|
||||
) const;
|
||||
|
||||
//- Does any of the cells use a face from faces?
|
||||
static bool cellsUseFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& cellLabels,
|
||||
const labelHashSet& faces
|
||||
);
|
||||
|
||||
//- Checks the newly added cells and locally unmarks points
|
||||
// so they will not get extruded next time round. Returns
|
||||
// global number of unmarked points (0 if all was fine)
|
||||
static label checkAndUnmark
|
||||
(
|
||||
const addPatchCellLayer& addLayer,
|
||||
const dictionary& motionDict,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const polyMesh&,
|
||||
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
List<extrudeMode>& extrudeStatus
|
||||
);
|
||||
|
||||
//- Count global number of extruded faces
|
||||
static label countExtrusion
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const List<extrudeMode>& extrudeStatus
|
||||
);
|
||||
|
||||
//- Collect layer faces and layer cells into bools
|
||||
// for ease of handling
|
||||
static void getLayerCellsFaces
|
||||
(
|
||||
const polyMesh&,
|
||||
const addPatchCellLayer&,
|
||||
boolList&,
|
||||
boolList&
|
||||
);
|
||||
|
||||
// Mesh shrinking (to create space for layers)
|
||||
|
||||
//- Average field (over all subset of mesh points) by
|
||||
// summing contribution from edges. Global parallel since only
|
||||
// does master edges for coupled edges.
|
||||
template<class Type>
|
||||
static void averageNeighbours
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PackedBoolList& isMasterEdge,
|
||||
const labelList& meshEdges,
|
||||
const labelList& meshPoints,
|
||||
const edgeList& edges,
|
||||
const scalarField& invSumWeight,
|
||||
const Field<Type>& data,
|
||||
Field<Type>& average
|
||||
);
|
||||
|
||||
//- Calculate inverse sum of edge weights
|
||||
// (currently always 1.0)
|
||||
void sumWeights
|
||||
(
|
||||
const PackedBoolList& isMasterEdge,
|
||||
const labelList& meshEdges,
|
||||
const labelList& meshPoints,
|
||||
const edgeList& edges,
|
||||
scalarField& invSumWeight
|
||||
) const;
|
||||
|
||||
//- Smooth scalar field on patch
|
||||
void smoothField
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const PackedBoolList& isMasterEdge,
|
||||
const labelList& meshEdges,
|
||||
const scalarField& fieldMin,
|
||||
const label nSmoothDisp,
|
||||
scalarField& field
|
||||
) const;
|
||||
|
||||
//- Smooth normals on patch.
|
||||
void smoothPatchNormals
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const PackedBoolList& isMasterEdge,
|
||||
const labelList& meshEdges,
|
||||
const label nSmoothDisp,
|
||||
pointField& normals
|
||||
) const;
|
||||
|
||||
//- Smooth normals in interior.
|
||||
void smoothNormals
|
||||
(
|
||||
const label nSmoothDisp,
|
||||
const PackedBoolList& isMasterEdge,
|
||||
const labelList& fixedPoints,
|
||||
pointVectorField& normals
|
||||
) const;
|
||||
|
||||
bool isMaxEdge
|
||||
(
|
||||
const List<pointData>&,
|
||||
const label edgeI,
|
||||
const scalar minCos
|
||||
) const;
|
||||
|
||||
//- Stop layer growth where mesh wraps around edge with a
|
||||
// large feature angle
|
||||
void handleFeatureAngleLayerTerminations
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalar minCos,
|
||||
List<extrudeMode>& extrudeStatus,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers,
|
||||
label& nPointCounter
|
||||
) const;
|
||||
|
||||
//- Find isolated islands (points, edges and faces and
|
||||
// layer terminations)
|
||||
// in the layer mesh and stop any layer growth at these points.
|
||||
void findIsolatedRegions
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const PackedBoolList& isMasterEdge,
|
||||
const labelList& meshEdges,
|
||||
const scalar minCosLayerTermination,
|
||||
scalarField& field,
|
||||
List<extrudeMode>& extrudeStatus,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers
|
||||
) const;
|
||||
|
||||
// Calculate medial axis fields
|
||||
void medialAxisSmoothingInfo
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const label nSmoothNormals,
|
||||
const label nSmoothSurfaceNormals,
|
||||
const scalar minMedianAxisAngleCos,
|
||||
|
||||
pointVectorField& dispVec,
|
||||
pointScalarField& medialRatio,
|
||||
pointScalarField& medialDist
|
||||
) const;
|
||||
|
||||
//- Main routine to shrink mesh
|
||||
void shrinkMeshMedialDistance
|
||||
(
|
||||
motionSmoother& meshMover,
|
||||
const dictionary& meshQualityDict,
|
||||
const label nSmoothThickness,
|
||||
const scalar maxThicknessToMedialRatio,
|
||||
const label nAllowableErrors,
|
||||
const label nSnap,
|
||||
const scalar minCosLayerTermination,
|
||||
|
||||
const scalarField& layerThickness,
|
||||
const scalarField& minThickness,
|
||||
|
||||
const pointVectorField& dispVec,
|
||||
const pointScalarField& medialRatio,
|
||||
const pointScalarField& medialDist,
|
||||
|
||||
List<extrudeMode>& extrudeStatus,
|
||||
pointField& patchDisp,
|
||||
labelList& patchNLayers
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
autoLayerDriver(const autoLayerDriver&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const autoLayerDriver&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("autoLayerDriver");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
autoLayerDriver(meshRefinement& meshRefiner);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Merge patch faces on same cell.
|
||||
void mergePatchFacesUndo
|
||||
(
|
||||
const layerParameters& layerParams,
|
||||
const dictionary& motionDict
|
||||
);
|
||||
|
||||
//- Add cell layers
|
||||
void addLayers
|
||||
(
|
||||
const layerParameters& layerParams,
|
||||
const dictionary& motionDict,
|
||||
const labelList& patchIDs,
|
||||
const label nAllowableErrors,
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor
|
||||
);
|
||||
|
||||
//- Add layers according to the dictionary settings
|
||||
void doLayers
|
||||
(
|
||||
const dictionary& shrinkDict,
|
||||
const dictionary& motionDict,
|
||||
const layerParameters& layerParams,
|
||||
const bool preBalance, // balance before adding?
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "autoLayerDriverTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -1,75 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "autoLayerDriver.H"
|
||||
#include "syncTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::autoLayerDriver::averageNeighbours
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PackedBoolList& isMasterEdge,
|
||||
const labelList& meshEdges,
|
||||
const labelList& meshPoints,
|
||||
const edgeList& edges,
|
||||
const scalarField& invSumWeight,
|
||||
const Field<Type>& data,
|
||||
Field<Type>& average
|
||||
)
|
||||
{
|
||||
average = pTraits<Type>::zero;
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
if (isMasterEdge.get(meshEdges[edgeI]) == 1)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
//scalar eWeight = edgeWeights[edgeI];
|
||||
scalar eWeight = 1.0;
|
||||
label v0 = e[0];
|
||||
label v1 = e[1];
|
||||
|
||||
average[v0] += eWeight*data[v1];
|
||||
average[v1] += eWeight*data[v0];
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh,
|
||||
meshPoints,
|
||||
average,
|
||||
plusEqOp<Type>(),
|
||||
pTraits<Type>::zero, // null value
|
||||
false // no separation
|
||||
);
|
||||
|
||||
average *= invSumWeight;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,874 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "autoRefineDriver.H"
|
||||
#include "meshRefinement.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "cellSet.H"
|
||||
#include "syncTools.H"
|
||||
#include "refinementParameters.H"
|
||||
#include "featureEdgeMesh.H"
|
||||
#include "refinementSurfaces.H"
|
||||
#include "shellSurfaces.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(autoRefineDriver, 0);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Read explicit feature edges
|
||||
Foam::label Foam::autoRefineDriver::readFeatureEdges
|
||||
(
|
||||
const PtrList<dictionary>& featDicts,
|
||||
PtrList<featureEdgeMesh>& featureMeshes,
|
||||
labelList& featureLevels
|
||||
) const
|
||||
{
|
||||
Info<< "Reading external feature lines." << endl;
|
||||
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
featureMeshes.setSize(featDicts.size());
|
||||
featureLevels.setSize(featDicts.size());
|
||||
|
||||
forAll(featDicts, i)
|
||||
{
|
||||
const dictionary& dict = featDicts[i];
|
||||
|
||||
fileName featFileName(dict.lookup("file"));
|
||||
|
||||
featureMeshes.set
|
||||
(
|
||||
i,
|
||||
new featureEdgeMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
featFileName, // name
|
||||
//mesh.time().findInstance("triSurface", featFileName),
|
||||
// // instance
|
||||
mesh.time().constant(), // instance
|
||||
"triSurface", // local
|
||||
mesh.time(), // registry
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
featureMeshes[i].mergePoints(meshRefiner_.mergeDistance());
|
||||
featureLevels[i] = readLabel(dict.lookup("level"));
|
||||
|
||||
Info<< "Refinement level " << featureLevels[i]
|
||||
<< " for all cells crossed by feature " << featFileName
|
||||
<< " (" << featureMeshes[i].points().size() << " points, "
|
||||
<< featureMeshes[i].edges().size() << " edges)." << endl;
|
||||
}
|
||||
|
||||
Info<< "Read feature lines in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
return featureMeshes.size();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::autoRefineDriver::autoRefineDriver
|
||||
(
|
||||
meshRefinement& meshRefiner,
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor,
|
||||
const labelList& globalToPatch
|
||||
)
|
||||
:
|
||||
meshRefiner_(meshRefiner),
|
||||
decomposer_(decomposer),
|
||||
distributor_(distributor),
|
||||
globalToPatch_(globalToPatch)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::autoRefineDriver::featureEdgeRefine
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const PtrList<dictionary>& featDicts,
|
||||
const label maxIter,
|
||||
const label minRefine
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
// Read explicit feature edges
|
||||
PtrList<featureEdgeMesh> featureMeshes;
|
||||
// Per feature the refinement level
|
||||
labelList featureLevels;
|
||||
readFeatureEdges(featDicts, featureMeshes, featureLevels);
|
||||
|
||||
|
||||
label iter = 0;
|
||||
|
||||
if (featureMeshes.size() && maxIter > 0)
|
||||
{
|
||||
for (; iter < maxIter; iter++)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Feature refinement iteration " << iter << nl
|
||||
<< "------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
labelList candidateCells
|
||||
(
|
||||
meshRefiner_.refineCandidates
|
||||
(
|
||||
refineParams.keepPoints()[0], // For now only use one.
|
||||
refineParams.curvature(),
|
||||
|
||||
featureMeshes,
|
||||
featureLevels,
|
||||
|
||||
true, // featureRefinement
|
||||
false, // internalRefinement
|
||||
false, // surfaceRefinement
|
||||
false, // curvatureRefinement
|
||||
refineParams.maxGlobalCells(),
|
||||
refineParams.maxLocalCells()
|
||||
)
|
||||
);
|
||||
labelList cellsToRefine
|
||||
(
|
||||
meshRefiner_.meshCutter().consistentRefinement
|
||||
(
|
||||
candidateCells,
|
||||
true
|
||||
)
|
||||
);
|
||||
Info<< "Determined cells to refine in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
|
||||
|
||||
label nCellsToRefine = cellsToRefine.size();
|
||||
reduce(nCellsToRefine, sumOp<label>());
|
||||
|
||||
Info<< "Selected for feature refinement : " << nCellsToRefine
|
||||
<< " cells (out of " << mesh.globalData().nTotalCells()
|
||||
<< ')' << endl;
|
||||
|
||||
if (nCellsToRefine <= minRefine)
|
||||
{
|
||||
Info<< "Stopping refining since too few cells selected."
|
||||
<< nl << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (debug > 0)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
|
||||
if
|
||||
(
|
||||
returnReduce
|
||||
(
|
||||
(mesh.nCells() >= refineParams.maxLocalCells()),
|
||||
orOp<bool>()
|
||||
)
|
||||
)
|
||||
{
|
||||
meshRefiner_.balanceAndRefine
|
||||
(
|
||||
"feature refinement iteration " + name(iter),
|
||||
decomposer_,
|
||||
distributor_,
|
||||
cellsToRefine,
|
||||
refineParams.maxLoadUnbalance()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshRefiner_.refineAndBalance
|
||||
(
|
||||
"feature refinement iteration " + name(iter),
|
||||
decomposer_,
|
||||
distributor_,
|
||||
cellsToRefine,
|
||||
refineParams.maxLoadUnbalance()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::autoRefineDriver::surfaceOnlyRefine
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const label maxIter
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
// Determine the maximum refinement level over all surfaces. This
|
||||
// determines the minumum number of surface refinement iterations.
|
||||
label overallMaxLevel = max(meshRefiner_.surfaces().maxLevel());
|
||||
|
||||
label iter;
|
||||
for (iter = 0; iter < maxIter; iter++)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Surface refinement iteration " << iter << nl
|
||||
<< "------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
// Determine cells to refine
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Only look at surface intersections (minLevel and surface curvature),
|
||||
// do not do internal refinement (refinementShells)
|
||||
|
||||
const PtrList<featureEdgeMesh> dummyFeatures;
|
||||
|
||||
PtrList<featureEdgeMesh> dummy(0);
|
||||
|
||||
labelList candidateCells
|
||||
(
|
||||
meshRefiner_.refineCandidates
|
||||
(
|
||||
refineParams.keepPoints()[0],
|
||||
refineParams.curvature(),
|
||||
|
||||
dummyFeatures, // dummy featureMeshes;
|
||||
labelList(0), // dummy featureLevels;
|
||||
|
||||
false, // featureRefinement
|
||||
false, // internalRefinement
|
||||
true, // surfaceRefinement
|
||||
true, // curvatureRefinement
|
||||
refineParams.maxGlobalCells(),
|
||||
refineParams.maxLocalCells()
|
||||
)
|
||||
);
|
||||
labelList cellsToRefine
|
||||
(
|
||||
meshRefiner_.meshCutter().consistentRefinement
|
||||
(
|
||||
candidateCells,
|
||||
true
|
||||
)
|
||||
);
|
||||
Info<< "Determined cells to refine in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
|
||||
label nCellsToRefine = cellsToRefine.size();
|
||||
reduce(nCellsToRefine, sumOp<label>());
|
||||
|
||||
Info<< "Selected for refinement : " << nCellsToRefine
|
||||
<< " cells (out of " << mesh.globalData().nTotalCells()
|
||||
<< ')' << endl;
|
||||
|
||||
// Stop when no cells to refine or have done minimum nessecary
|
||||
// iterations and not enough cells to refine.
|
||||
if
|
||||
(
|
||||
nCellsToRefine == 0
|
||||
|| (
|
||||
iter >= overallMaxLevel
|
||||
&& nCellsToRefine <= refineParams.minRefineCells()
|
||||
)
|
||||
)
|
||||
{
|
||||
Info<< "Stopping refining since too few cells selected."
|
||||
<< nl << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
|
||||
if
|
||||
(
|
||||
returnReduce
|
||||
(
|
||||
(mesh.nCells() >= refineParams.maxLocalCells()),
|
||||
orOp<bool>()
|
||||
)
|
||||
)
|
||||
{
|
||||
meshRefiner_.balanceAndRefine
|
||||
(
|
||||
"surface refinement iteration " + name(iter),
|
||||
decomposer_,
|
||||
distributor_,
|
||||
cellsToRefine,
|
||||
refineParams.maxLoadUnbalance()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshRefiner_.refineAndBalance
|
||||
(
|
||||
"surface refinement iteration " + name(iter),
|
||||
decomposer_,
|
||||
distributor_,
|
||||
cellsToRefine,
|
||||
refineParams.maxLoadUnbalance()
|
||||
);
|
||||
}
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::removeInsideCells
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const label nBufferLayers
|
||||
)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Removing mesh beyond surface intersections" << nl
|
||||
<< "------------------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
meshRefiner_.splitMesh
|
||||
(
|
||||
nBufferLayers, // nBufferLayers
|
||||
globalToPatch_,
|
||||
refineParams.keepPoints()[0]
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Writing subsetted mesh to time "
|
||||
<< meshRefiner_.timeName() << '.' << endl;
|
||||
meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName());
|
||||
Pout<< "Dumped mesh in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::autoRefineDriver::shellRefine
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const label maxIter
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
// Mark current boundary faces with 0. Have meshRefiner maintain them.
|
||||
meshRefiner_.userFaceData().setSize(1);
|
||||
|
||||
// mark list to remove any refined faces
|
||||
meshRefiner_.userFaceData()[0].first() = meshRefinement::REMOVE;
|
||||
meshRefiner_.userFaceData()[0].second() = createWithValues<labelList>
|
||||
(
|
||||
mesh.nFaces(),
|
||||
-1,
|
||||
meshRefiner_.intersectedFaces(),
|
||||
0
|
||||
);
|
||||
|
||||
// Determine the maximum refinement level over all volume refinement
|
||||
// regions. This determines the minumum number of shell refinement
|
||||
// iterations.
|
||||
label overallMaxShellLevel = meshRefiner_.shells().maxLevel();
|
||||
|
||||
label iter;
|
||||
for (iter = 0; iter < maxIter; iter++)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Shell refinement iteration " << iter << nl
|
||||
<< "----------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
const PtrList<featureEdgeMesh> dummyFeatures;
|
||||
|
||||
PtrList<featureEdgeMesh> dummy(0);
|
||||
|
||||
labelList candidateCells
|
||||
(
|
||||
meshRefiner_.refineCandidates
|
||||
(
|
||||
refineParams.keepPoints()[0],
|
||||
refineParams.curvature(),
|
||||
|
||||
dummyFeatures, // dummy featureMeshes;
|
||||
labelList(0), // dummy featureLevels;
|
||||
|
||||
false, // featureRefinement
|
||||
true, // internalRefinement
|
||||
false, // surfaceRefinement
|
||||
false, // curvatureRefinement
|
||||
refineParams.maxGlobalCells(),
|
||||
refineParams.maxLocalCells()
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Dumping " << candidateCells.size()
|
||||
<< " cells to cellSet candidateCellsFromShells." << endl;
|
||||
|
||||
cellSet
|
||||
(
|
||||
mesh,
|
||||
"candidateCellsFromShells",
|
||||
labelHashSet(candidateCells)
|
||||
).write();
|
||||
}
|
||||
|
||||
// Problem choosing starting faces for bufferlayers (bFaces)
|
||||
// - we can't use the current intersected boundary faces
|
||||
// (intersectedFaces) since this grows indefinitely
|
||||
// - if we use 0 faces we don't satisfy bufferLayers from the
|
||||
// surface.
|
||||
// - possibly we want to have bFaces only the initial set of faces
|
||||
// and maintain the list while doing the refinement.
|
||||
labelList bFaces
|
||||
(
|
||||
findIndices(meshRefiner_.userFaceData()[0].second(), 0)
|
||||
);
|
||||
|
||||
//Info<< "Collected boundary faces : "
|
||||
// << returnReduce(bFaces.size(), sumOp<label>()) << endl;
|
||||
|
||||
labelList cellsToRefine;
|
||||
|
||||
if (refineParams.nBufferLayers() <= 2)
|
||||
{
|
||||
cellsToRefine = meshRefiner_.meshCutter().consistentSlowRefinement
|
||||
(
|
||||
refineParams.nBufferLayers(),
|
||||
candidateCells, // cells to refine
|
||||
bFaces, // faces for nBufferLayers
|
||||
1, // point difference
|
||||
meshRefiner_.intersectedPoints() // points to check
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellsToRefine = meshRefiner_.meshCutter().consistentSlowRefinement2
|
||||
(
|
||||
refineParams.nBufferLayers(),
|
||||
candidateCells, // cells to refine
|
||||
bFaces // faces for nBufferLayers
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "Determined cells to refine in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
|
||||
label nCellsToRefine = cellsToRefine.size();
|
||||
reduce(nCellsToRefine, sumOp<label>());
|
||||
|
||||
Info<< "Selected for internal refinement : " << nCellsToRefine
|
||||
<< " cells (out of " << mesh.globalData().nTotalCells()
|
||||
<< ')' << endl;
|
||||
|
||||
// Stop when no cells to refine or have done minimum nessecary
|
||||
// iterations and not enough cells to refine.
|
||||
if
|
||||
(
|
||||
nCellsToRefine == 0
|
||||
|| (
|
||||
iter >= overallMaxShellLevel
|
||||
&& nCellsToRefine <= refineParams.minRefineCells()
|
||||
)
|
||||
)
|
||||
{
|
||||
Info<< "Stopping refining since too few cells selected."
|
||||
<< nl << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
returnReduce
|
||||
(
|
||||
(mesh.nCells() >= refineParams.maxLocalCells()),
|
||||
orOp<bool>()
|
||||
)
|
||||
)
|
||||
{
|
||||
meshRefiner_.balanceAndRefine
|
||||
(
|
||||
"shell refinement iteration " + name(iter),
|
||||
decomposer_,
|
||||
distributor_,
|
||||
cellsToRefine,
|
||||
refineParams.maxLoadUnbalance()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshRefiner_.refineAndBalance
|
||||
(
|
||||
"shell refinement iteration " + name(iter),
|
||||
decomposer_,
|
||||
distributor_,
|
||||
cellsToRefine,
|
||||
refineParams.maxLoadUnbalance()
|
||||
);
|
||||
}
|
||||
}
|
||||
meshRefiner_.userFaceData().clear();
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::baffleAndSplitMesh
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const bool handleSnapProblems,
|
||||
const dictionary& motionDict
|
||||
)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Splitting mesh at surface intersections" << nl
|
||||
<< "---------------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
// Introduce baffles at surface intersections. Note:
|
||||
// meshRefiment::surfaceIndex() will
|
||||
// be like boundary face from now on so not coupled anymore.
|
||||
meshRefiner_.baffleAndSplitMesh
|
||||
(
|
||||
handleSnapProblems, // detect&remove potential snap problem
|
||||
false, // perpendicular edge connected cells
|
||||
scalarField(0), // per region perpendicular angle
|
||||
!handleSnapProblems, // merge free standing baffles?
|
||||
motionDict,
|
||||
const_cast<Time&>(mesh.time()),
|
||||
globalToPatch_,
|
||||
refineParams.keepPoints()[0]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::zonify
|
||||
(
|
||||
const refinementParameters& refineParams
|
||||
)
|
||||
{
|
||||
// Mesh is at its finest. Do zoning
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// This puts all faces with intersection across a zoneable surface
|
||||
// into that surface's faceZone. All cells inside faceZone get given the
|
||||
// same cellZone.
|
||||
|
||||
if (meshRefiner_.surfaces().getNamedSurfaces().size())
|
||||
{
|
||||
Info<< nl
|
||||
<< "Introducing zones for interfaces" << nl
|
||||
<< "--------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
meshRefiner_.zonify
|
||||
(
|
||||
refineParams.keepPoints()[0],
|
||||
refineParams.allowFreeStandingZoneFaces()
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Writing zoned mesh to time "
|
||||
<< meshRefiner_.timeName() << '.' << endl;
|
||||
meshRefiner_.write
|
||||
(
|
||||
debug,
|
||||
mesh.time().path()/meshRefiner_.timeName()
|
||||
);
|
||||
}
|
||||
|
||||
// Check that all faces are synced
|
||||
meshRefinement::checkCoupledFaceZones(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::splitAndMergeBaffles
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const bool handleSnapProblems,
|
||||
const dictionary& motionDict
|
||||
)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Handling cells with snap problems" << nl
|
||||
<< "---------------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
// Introduce baffles and split mesh
|
||||
if (debug)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
const scalarField& perpAngle = meshRefiner_.surfaces().perpendicularAngle();
|
||||
|
||||
meshRefiner_.baffleAndSplitMesh
|
||||
(
|
||||
handleSnapProblems,
|
||||
handleSnapProblems, // remove perp edge connected cells
|
||||
perpAngle, // perp angle
|
||||
false, // merge free standing baffles?
|
||||
motionDict,
|
||||
const_cast<Time&>(mesh.time()),
|
||||
globalToPatch_,
|
||||
refineParams.keepPoints()[0]
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
// Duplicate points on baffles that are on more than one cell
|
||||
// region. This will help snapping pull them to separate surfaces.
|
||||
meshRefiner_.dupNonManifoldPoints();
|
||||
|
||||
|
||||
// Merge all baffles that are still remaining after duplicating points.
|
||||
List<labelPair> couples
|
||||
(
|
||||
meshRefiner_.getDuplicateFaces // get all baffles
|
||||
(
|
||||
identity(mesh.nFaces()-mesh.nInternalFaces())
|
||||
+ mesh.nInternalFaces()
|
||||
)
|
||||
);
|
||||
|
||||
label nCouples = returnReduce(couples.size(), sumOp<label>());
|
||||
|
||||
Info<< "Detected unsplittable baffles : "
|
||||
<< nCouples << endl;
|
||||
|
||||
if (nCouples > 0)
|
||||
{
|
||||
// Actually merge baffles. Note: not exactly parallellized. Should
|
||||
// convert baffle faces into processor faces if they resulted
|
||||
// from them.
|
||||
meshRefiner_.mergeBaffles(couples);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
// Debug:test all is still synced across proc patches
|
||||
meshRefiner_.checkData();
|
||||
}
|
||||
Info<< "Merged free-standing baffles in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s." << endl;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Writing handleProblemCells mesh to time "
|
||||
<< meshRefiner_.timeName() << '.' << endl;
|
||||
meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::mergePatchFaces
|
||||
(
|
||||
const refinementParameters& refineParams
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
Info<< nl
|
||||
<< "Merge refined boundary faces" << nl
|
||||
<< "----------------------------" << nl
|
||||
<< endl;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
meshRefiner_.mergePatchFaces
|
||||
(
|
||||
Foam::cos(45*mathematicalConstant::pi/180.0),
|
||||
Foam::cos(45*mathematicalConstant::pi/180.0),
|
||||
meshRefiner_.meshedPatches()
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
meshRefiner_.checkData();
|
||||
}
|
||||
|
||||
meshRefiner_.mergeEdges(Foam::cos(45*mathematicalConstant::pi/180.0));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
meshRefiner_.checkData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoRefineDriver::doRefine
|
||||
(
|
||||
const dictionary& refineDict,
|
||||
const refinementParameters& refineParams,
|
||||
const bool prepareForSnapping,
|
||||
const dictionary& motionDict
|
||||
)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Refinement phase" << nl
|
||||
<< "----------------" << nl
|
||||
<< endl;
|
||||
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
// Check that all the keep points are inside the mesh.
|
||||
refineParams.findCells(mesh);
|
||||
|
||||
PtrList<dictionary> featDicts(refineDict.lookup("features"));
|
||||
|
||||
// Refine around feature edges
|
||||
featureEdgeRefine
|
||||
(
|
||||
refineParams,
|
||||
featDicts,
|
||||
100, // maxIter
|
||||
0 // min cells to refine
|
||||
);
|
||||
|
||||
// Refine based on surface
|
||||
surfaceOnlyRefine
|
||||
(
|
||||
refineParams,
|
||||
100 // maxIter
|
||||
);
|
||||
|
||||
// Remove cells (a certain distance) beyond surface intersections
|
||||
removeInsideCells
|
||||
(
|
||||
refineParams,
|
||||
1 // nBufferLayers
|
||||
);
|
||||
|
||||
// Internal mesh refinement
|
||||
shellRefine
|
||||
(
|
||||
refineParams,
|
||||
100 // maxIter
|
||||
);
|
||||
|
||||
// Introduce baffles at surface intersections
|
||||
baffleAndSplitMesh(refineParams, prepareForSnapping, motionDict);
|
||||
|
||||
// Mesh is at its finest. Do optional zoning.
|
||||
zonify(refineParams);
|
||||
|
||||
// Pull baffles apart
|
||||
splitAndMergeBaffles(refineParams, prepareForSnapping, motionDict);
|
||||
|
||||
// Do something about cells with refined faces on the boundary
|
||||
if (prepareForSnapping)
|
||||
{
|
||||
mergePatchFaces(refineParams);
|
||||
}
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Info<< nl
|
||||
<< "Doing final balancing" << nl
|
||||
<< "---------------------" << nl
|
||||
<< endl;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
}
|
||||
|
||||
// Do final balancing. Keep zoned faces on one processor since the
|
||||
// snap phase will convert them to baffles and this only works for
|
||||
// internal faces.
|
||||
meshRefiner_.balance
|
||||
(
|
||||
true,
|
||||
false,
|
||||
scalarField(mesh.nCells(), 1), // dummy weights
|
||||
decomposer_,
|
||||
distributor_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,183 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::autoRefineDriver
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
autoRefineDriver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef autoRefineDriver_H
|
||||
#define autoRefineDriver_H
|
||||
|
||||
#include "treeBoundBox.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class featureEdgeMesh;
|
||||
class refinementParameters;
|
||||
class meshRefinement;
|
||||
class decompositionMethod;
|
||||
class fvMeshDistribute;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class autoRefineDriver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class autoRefineDriver
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Mesh+surface
|
||||
meshRefinement& meshRefiner_;
|
||||
|
||||
//- Reference to decomposition method
|
||||
decompositionMethod& decomposer_;
|
||||
|
||||
//- Reference to mesh distribution engine
|
||||
fvMeshDistribute& distributor_;
|
||||
|
||||
//- From surface region to patch
|
||||
const labelList globalToPatch_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read explicit feature edges
|
||||
label readFeatureEdges
|
||||
(
|
||||
const PtrList<dictionary>& featDicts,
|
||||
PtrList<featureEdgeMesh>& featureMeshes,
|
||||
labelList& featureLevel
|
||||
) const;
|
||||
|
||||
//- Refine all cells pierced by explicit feature edges
|
||||
label featureEdgeRefine
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const PtrList<dictionary>& featDicts,
|
||||
const label maxIter,
|
||||
const label minRefine
|
||||
);
|
||||
|
||||
//- Refine all cells interacting with the surface
|
||||
label surfaceOnlyRefine
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const label maxIter
|
||||
);
|
||||
|
||||
//- Remove all cells within intersected region
|
||||
void removeInsideCells
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const label nBufferLayers
|
||||
);
|
||||
|
||||
//- Remove all cells inside/outside shell
|
||||
label shellRefine
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const label maxIter
|
||||
);
|
||||
|
||||
//- Add baffles and remove unreachable cells
|
||||
void baffleAndSplitMesh
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const bool handleSnapProblems,
|
||||
const dictionary& motionDict
|
||||
);
|
||||
|
||||
//- Add zones
|
||||
void zonify(const refinementParameters& refineParams);
|
||||
|
||||
void splitAndMergeBaffles
|
||||
(
|
||||
const refinementParameters& refineParams,
|
||||
const bool handleSnapProblems,
|
||||
const dictionary& motionDict
|
||||
);
|
||||
|
||||
//- Merge refined boundary faces (from exposing coarser cell)
|
||||
void mergePatchFaces
|
||||
(
|
||||
const refinementParameters& refineParams
|
||||
);
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
autoRefineDriver(const autoRefineDriver&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const autoRefineDriver&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("autoRefineDriver");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
autoRefineDriver
|
||||
(
|
||||
meshRefinement& meshRefiner,
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor,
|
||||
const labelList& globalToPatch
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Do all the refinement
|
||||
void doRefine
|
||||
(
|
||||
const dictionary& refineDict,
|
||||
const refinementParameters& refineParams,
|
||||
const bool prepareForSnapping,
|
||||
const dictionary& motionDict
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -1,242 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::autoSnapDriver
|
||||
|
||||
Description
|
||||
All to do with snapping to surface
|
||||
|
||||
SourceFiles
|
||||
autoSnapDriver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef autoSnapDriver_H
|
||||
#define autoSnapDriver_H
|
||||
|
||||
#include "PackedBoolList.H"
|
||||
#include "meshRefinement.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class motionSmoother;
|
||||
class snapParameters;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class autoSnapDriver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class autoSnapDriver
|
||||
{
|
||||
// Private classes
|
||||
|
||||
//- Combine operator class for equalizing displacements.
|
||||
class minMagEqOp
|
||||
{
|
||||
public:
|
||||
|
||||
void operator()(vector& x, const vector& y) const
|
||||
{
|
||||
if (magSqr(y) < magSqr(x))
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Mesh+surface
|
||||
meshRefinement& meshRefiner_;
|
||||
|
||||
//- From surface region to patch
|
||||
const labelList globalToPatch_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
// Snapping
|
||||
|
||||
//- Get faces to repatch. Returns map from face to patch.
|
||||
Map<label> getZoneBafflePatches(const bool allowBoundary) const;
|
||||
|
||||
//- Calculates (geometric) shared points
|
||||
static label getCollocatedPoints
|
||||
(
|
||||
const scalar tol,
|
||||
const pointField&,
|
||||
PackedBoolList&
|
||||
);
|
||||
|
||||
//- Calculate displacement per patch point to smooth out patch.
|
||||
// Quite complicated in determining which points to move where.
|
||||
pointField smoothPatchDisplacement
|
||||
(
|
||||
const motionSmoother&,
|
||||
const List<labelPair>&
|
||||
) const;
|
||||
|
||||
//- Check that face zones are synced
|
||||
void checkCoupledFaceZones() const;
|
||||
|
||||
//- Per edge distance to patch
|
||||
static tmp<scalarField> edgePatchDist
|
||||
(
|
||||
const pointMesh&,
|
||||
const indirectPrimitivePatch&
|
||||
);
|
||||
|
||||
//- Write displacement as .obj file.
|
||||
static void dumpMove
|
||||
(
|
||||
const fileName&,
|
||||
const pointField&,
|
||||
const pointField&
|
||||
);
|
||||
|
||||
//- Check displacement is outwards pointing
|
||||
static bool outwardsDisplacement
|
||||
(
|
||||
const indirectPrimitivePatch&,
|
||||
const vectorField&
|
||||
);
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
autoSnapDriver(const autoSnapDriver&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const autoSnapDriver&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("autoSnapDriver");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
autoSnapDriver
|
||||
(
|
||||
meshRefinement& meshRefiner,
|
||||
const labelList& globalToPatch
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Snapping
|
||||
|
||||
//- Create baffles for faces straddling zoned surfaces. Return
|
||||
// baffles.
|
||||
autoPtr<mapPolyMesh> createZoneBaffles(List<labelPair>&);
|
||||
|
||||
//- Merge baffles.
|
||||
autoPtr<mapPolyMesh> mergeZoneBaffles(const List<labelPair>&);
|
||||
|
||||
//- Calculate edge length per patch point.
|
||||
scalarField calcSnapDistance
|
||||
(
|
||||
const snapParameters& snapParams,
|
||||
const indirectPrimitivePatch&
|
||||
) const;
|
||||
|
||||
//- Smooth the mesh (patch and internal) to increase visibility
|
||||
// of surface points (on castellated mesh) w.r.t. surface.
|
||||
void preSmoothPatch
|
||||
(
|
||||
const snapParameters& snapParams,
|
||||
const label nInitErrors,
|
||||
const List<labelPair>& baffles,
|
||||
motionSmoother&
|
||||
) const;
|
||||
|
||||
//- Get points both on patch and facezone.
|
||||
labelList getZoneSurfacePoints
|
||||
(
|
||||
const indirectPrimitivePatch&,
|
||||
const word& zoneName
|
||||
) const;
|
||||
|
||||
//- Per patch point calculate point on nearest surface. Set as
|
||||
// boundary conditions of motionSmoother displacement field. Return
|
||||
// displacement of patch points.
|
||||
vectorField calcNearestSurface
|
||||
(
|
||||
const scalarField& snapDist,
|
||||
motionSmoother& meshMover
|
||||
) const;
|
||||
|
||||
//- Smooth the displacement field to the internal.
|
||||
void smoothDisplacement
|
||||
(
|
||||
const snapParameters& snapParams,
|
||||
motionSmoother&
|
||||
) const;
|
||||
|
||||
//- Do the hard work: move the mesh according to displacement,
|
||||
// locally relax the displacement.
|
||||
void scaleMesh
|
||||
(
|
||||
const snapParameters& snapParams,
|
||||
const label nInitErrors,
|
||||
const List<labelPair>& baffles,
|
||||
motionSmoother&
|
||||
);
|
||||
|
||||
//- Repatch faces according to surface nearest the face centre
|
||||
autoPtr<mapPolyMesh> repatchToSurface
|
||||
(
|
||||
const snapParameters& snapParams,
|
||||
const labelList& adaptPatchIDs
|
||||
);
|
||||
|
||||
|
||||
void doSnap
|
||||
(
|
||||
const dictionary& snapDict,
|
||||
const dictionary& motionDict,
|
||||
const snapParameters& snapParams
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,384 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "layerParameters.H"
|
||||
#include "polyBoundaryMesh.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "refinementSurfaces.H"
|
||||
#include "searchableSurfaces.H"
|
||||
#include "regExp.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::layerParameters::defaultConcaveAngle = 90;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Read the number of layers from dictionary. Per patch 0 or the number
|
||||
// of layers.
|
||||
Foam::labelList Foam::layerParameters::readNumLayers
|
||||
(
|
||||
const PtrList<dictionary>& surfaceDicts,
|
||||
const refinementSurfaces& refineSurfaces,
|
||||
const labelList& globalToPatch,
|
||||
const polyBoundaryMesh& boundaryMesh
|
||||
)
|
||||
{
|
||||
// Per surface the number of layers
|
||||
labelList globalSurfLayers(surfaceDicts.size());
|
||||
// Per surface, per region the number of layers
|
||||
List<Map<label> > regionSurfLayers(surfaceDicts.size());
|
||||
|
||||
const labelList& surfaceIndices = refineSurfaces.surfaces();
|
||||
|
||||
forAll(surfaceDicts, surfI)
|
||||
{
|
||||
const dictionary& dict = surfaceDicts[surfI];
|
||||
|
||||
globalSurfLayers[surfI] = readLabel(dict.lookup("surfaceLayers"));
|
||||
|
||||
if (dict.found("regions"))
|
||||
{
|
||||
// Per-region layer information
|
||||
|
||||
PtrList<dictionary> regionDicts(dict.lookup("regions"));
|
||||
|
||||
const wordList& regionNames =
|
||||
refineSurfaces.geometry()[surfaceIndices[surfI]].regions();
|
||||
|
||||
forAll(regionDicts, dictI)
|
||||
{
|
||||
const dictionary& regionDict = regionDicts[dictI];
|
||||
|
||||
const word regionName(regionDict.lookup("name"));
|
||||
|
||||
label regionI = findIndex(regionNames, regionName);
|
||||
|
||||
label nLayers = readLabel(regionDict.lookup("surfaceLayers"));
|
||||
|
||||
Info<< " region " << regionName << ':'<< nl
|
||||
<< " surface layers:" << nLayers << nl;
|
||||
|
||||
regionSurfLayers[surfI].insert(regionI, nLayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Transfer per surface/region information into patchwise region info
|
||||
|
||||
labelList nLayers(boundaryMesh.size(), 0);
|
||||
|
||||
forAll(surfaceIndices, surfI)
|
||||
{
|
||||
const wordList& regionNames =
|
||||
refineSurfaces.geometry()[surfaceIndices[surfI]].regions();
|
||||
|
||||
forAll(regionNames, regionI)
|
||||
{
|
||||
const word& regionName = regionNames[regionI];
|
||||
|
||||
label global = refineSurfaces.globalRegion(surfI, regionI);
|
||||
|
||||
label patchI = globalToPatch[global];
|
||||
|
||||
// Initialise to surface-wise layers
|
||||
nLayers[patchI] = globalSurfLayers[surfI];
|
||||
|
||||
// Override with region specific data if available
|
||||
Map<label>::const_iterator iter =
|
||||
regionSurfLayers[surfI].find(regionI);
|
||||
|
||||
if (iter != regionSurfLayers[surfI].end())
|
||||
{
|
||||
nLayers[patchI] = iter();
|
||||
}
|
||||
|
||||
// Check
|
||||
if (nLayers[patchI] < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"layerParameters::readNumLayers(..)"
|
||||
) << "Illegal number of layers " << nLayers[patchI]
|
||||
<< " for surface "
|
||||
<< refineSurfaces.names()[surfI]
|
||||
<< " region " << regionName << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nLayers;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::layerParameters::layerParameters
|
||||
(
|
||||
const PtrList<dictionary>& surfaceDicts,
|
||||
const refinementSurfaces& refineSurfaces,
|
||||
const labelList& globalToPatch,
|
||||
const dictionary& dict,
|
||||
const polyBoundaryMesh& boundaryMesh
|
||||
)
|
||||
:
|
||||
numLayers_
|
||||
(
|
||||
readNumLayers
|
||||
(
|
||||
surfaceDicts,
|
||||
refineSurfaces,
|
||||
globalToPatch,
|
||||
boundaryMesh
|
||||
)
|
||||
),
|
||||
expansionRatio_
|
||||
(
|
||||
numLayers_.size(),
|
||||
readScalar(dict.lookup("expansionRatio"))
|
||||
),
|
||||
relativeSizes_(false),
|
||||
finalLayerThickness_
|
||||
(
|
||||
numLayers_.size(),
|
||||
readScalar(dict.lookup("finalLayerRatio"))
|
||||
),
|
||||
minThickness_
|
||||
(
|
||||
numLayers_.size(),
|
||||
readScalar(dict.lookup("minThickness"))
|
||||
),
|
||||
featureAngle_(readScalar(dict.lookup("featureAngle"))),
|
||||
concaveAngle_
|
||||
(
|
||||
dict.lookupOrDefault("concaveAngle", defaultConcaveAngle)
|
||||
),
|
||||
nGrow_(readLabel(dict.lookup("nGrow"))),
|
||||
nSmoothSurfaceNormals_
|
||||
(
|
||||
readLabel(dict.lookup("nSmoothSurfaceNormals"))
|
||||
),
|
||||
nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))),
|
||||
nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))),
|
||||
maxFaceThicknessRatio_
|
||||
(
|
||||
readScalar(dict.lookup("maxFaceThicknessRatio"))
|
||||
),
|
||||
layerTerminationCos_
|
||||
(
|
||||
Foam::cos
|
||||
(
|
||||
0.5
|
||||
* featureAngle_
|
||||
* mathematicalConstant::pi/180.
|
||||
)
|
||||
),
|
||||
maxThicknessToMedialRatio_
|
||||
(
|
||||
readScalar(dict.lookup("maxThicknessToMedialRatio"))
|
||||
),
|
||||
minMedianAxisAngleCos_
|
||||
(
|
||||
Foam::cos(readScalar(dict.lookup("minMedianAxisAngle")))
|
||||
* mathematicalConstant::pi/180.
|
||||
),
|
||||
nBufferCellsNoExtrude_
|
||||
(
|
||||
readLabel(dict.lookup("nBufferCellsNoExtrude"))
|
||||
),
|
||||
nSnap_(readLabel(dict.lookup("nSnap"))),
|
||||
nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
|
||||
nRelaxedIter_(labelMax)
|
||||
{
|
||||
if (dict.found("nRelaxedIter"))
|
||||
{
|
||||
dict.lookup("nRelaxedIter") >> nRelaxedIter_;
|
||||
}
|
||||
|
||||
if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
|
||||
{
|
||||
FatalErrorIn("layerParameters::layerParameters(..)")
|
||||
<< "Layer iterations should be >= 0." << endl
|
||||
<< "nLayerIter:" << nLayerIter_
|
||||
<< " nRelaxedIter:" << nRelaxedIter_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::layerParameters::layerParameters
|
||||
(
|
||||
const dictionary& dict,
|
||||
const polyBoundaryMesh& boundaryMesh
|
||||
)
|
||||
:
|
||||
numLayers_(boundaryMesh.size(), 0),
|
||||
expansionRatio_
|
||||
(
|
||||
boundaryMesh.size(),
|
||||
readScalar(dict.lookup("expansionRatio"))
|
||||
),
|
||||
relativeSizes_(dict.lookup("relativeSizes")),
|
||||
finalLayerThickness_
|
||||
(
|
||||
boundaryMesh.size(),
|
||||
readScalar(dict.lookup("finalLayerThickness"))
|
||||
),
|
||||
minThickness_
|
||||
(
|
||||
boundaryMesh.size(),
|
||||
readScalar(dict.lookup("minThickness"))
|
||||
),
|
||||
featureAngle_(readScalar(dict.lookup("featureAngle"))),
|
||||
concaveAngle_
|
||||
(
|
||||
dict.lookupOrDefault("concaveAngle", defaultConcaveAngle)
|
||||
),
|
||||
nGrow_(readLabel(dict.lookup("nGrow"))),
|
||||
nSmoothSurfaceNormals_
|
||||
(
|
||||
readLabel(dict.lookup("nSmoothSurfaceNormals"))
|
||||
),
|
||||
nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))),
|
||||
nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))),
|
||||
maxFaceThicknessRatio_
|
||||
(
|
||||
readScalar(dict.lookup("maxFaceThicknessRatio"))
|
||||
),
|
||||
layerTerminationCos_
|
||||
(
|
||||
Foam::cos
|
||||
(
|
||||
0.5
|
||||
* featureAngle_
|
||||
* mathematicalConstant::pi/180.
|
||||
)
|
||||
),
|
||||
maxThicknessToMedialRatio_
|
||||
(
|
||||
readScalar(dict.lookup("maxThicknessToMedialRatio"))
|
||||
),
|
||||
minMedianAxisAngleCos_
|
||||
(
|
||||
Foam::cos(readScalar(dict.lookup("minMedianAxisAngle")))
|
||||
* mathematicalConstant::pi/180.
|
||||
),
|
||||
nBufferCellsNoExtrude_
|
||||
(
|
||||
readLabel(dict.lookup("nBufferCellsNoExtrude"))
|
||||
),
|
||||
nSnap_(readLabel(dict.lookup("nRelaxIter"))),
|
||||
nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
|
||||
nRelaxedIter_(labelMax)
|
||||
{
|
||||
if (dict.found("nRelaxedIter"))
|
||||
{
|
||||
dict.lookup("nRelaxedIter") >> nRelaxedIter_;
|
||||
}
|
||||
if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
|
||||
{
|
||||
FatalErrorIn("layerParameters::layerParameters(..)")
|
||||
<< "Layer iterations should be >= 0." << endl
|
||||
<< "nLayerIter:" << nLayerIter_
|
||||
<< " nRelaxedIter:" << nRelaxedIter_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
const dictionary& layersDict = dict.subDict("layers");
|
||||
|
||||
forAll(boundaryMesh, patchI)
|
||||
{
|
||||
const word& patchName = boundaryMesh[patchI].name();
|
||||
|
||||
if (layersDict.found(patchName))
|
||||
{
|
||||
const dictionary& layerDict = layersDict.subDict(patchName);
|
||||
|
||||
numLayers_[patchI] =
|
||||
readLabel(layerDict.lookup("nSurfaceLayers"));
|
||||
|
||||
layerDict.readIfPresent
|
||||
(
|
||||
"expansionRatio",
|
||||
expansionRatio_[patchI]
|
||||
);
|
||||
layerDict.readIfPresent
|
||||
(
|
||||
"finalLayerThickness",
|
||||
finalLayerThickness_[patchI]
|
||||
);
|
||||
layerDict.readIfPresent
|
||||
(
|
||||
"minThickness",
|
||||
minThickness_[patchI]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check whether layer specification matches any patches
|
||||
const List<keyType> wildCards = layersDict.keys(true);
|
||||
|
||||
forAll(wildCards, i)
|
||||
{
|
||||
regExp re(wildCards[i]);
|
||||
|
||||
bool hasMatch = false;
|
||||
forAll(boundaryMesh, patchI)
|
||||
{
|
||||
if (re.match(boundaryMesh[patchI].name()))
|
||||
{
|
||||
hasMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasMatch)
|
||||
{
|
||||
IOWarningIn("layerParameters::layerParameters(..)", layersDict)
|
||||
<< "Wildcard layer specification for " << wildCards[i]
|
||||
<< " does not match any patch." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
const List<keyType> nonWildCards = layersDict.keys(false);
|
||||
|
||||
forAll(nonWildCards, i)
|
||||
{
|
||||
if (boundaryMesh.findPatchID(nonWildCards[i]) == -1)
|
||||
{
|
||||
IOWarningIn("layerParameters::layerParameters(..)", layersDict)
|
||||
<< "Layer specification for " << nonWildCards[i]
|
||||
<< " does not match any patch." << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,290 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::layerParameters
|
||||
|
||||
Description
|
||||
Simple container to keep together layer specific information.
|
||||
|
||||
SourceFiles
|
||||
layerParameters.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef layerParameters_H
|
||||
#define layerParameters_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "scalarField.H"
|
||||
#include "labelList.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Class forward declarations
|
||||
class polyBoundaryMesh;
|
||||
class refinementSurfaces;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class layerParameters Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class layerParameters
|
||||
{
|
||||
// Static data members
|
||||
|
||||
//- Default angle for faces to be convcave
|
||||
static const scalar defaultConcaveAngle;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
// Per patch (not region!) information
|
||||
|
||||
//- How many layers to add.
|
||||
labelList numLayers_;
|
||||
|
||||
scalarField expansionRatio_;
|
||||
|
||||
Switch relativeSizes_;
|
||||
|
||||
scalarField finalLayerThickness_;
|
||||
|
||||
scalarField minThickness_;
|
||||
|
||||
|
||||
scalar featureAngle_;
|
||||
|
||||
scalar concaveAngle_;
|
||||
|
||||
label nGrow_;
|
||||
|
||||
label nSmoothSurfaceNormals_;
|
||||
|
||||
label nSmoothNormals_;
|
||||
|
||||
label nSmoothThickness_;
|
||||
|
||||
scalar maxFaceThicknessRatio_;
|
||||
|
||||
scalar layerTerminationCos_;
|
||||
|
||||
scalar maxThicknessToMedialRatio_;
|
||||
|
||||
scalar minMedianAxisAngleCos_;
|
||||
|
||||
label nBufferCellsNoExtrude_;
|
||||
|
||||
label nSnap_;
|
||||
|
||||
label nLayerIter_;
|
||||
|
||||
label nRelaxedIter_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Extract patch-wise number of layers
|
||||
static labelList readNumLayers
|
||||
(
|
||||
const PtrList<dictionary>& surfaceDicts,
|
||||
const refinementSurfaces& refineSurfaces,
|
||||
const labelList& globalToPatch,
|
||||
const polyBoundaryMesh& boundaryMesh
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
layerParameters(const layerParameters&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const layerParameters&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary - old syntax
|
||||
layerParameters
|
||||
(
|
||||
const PtrList<dictionary>& surfaceDicts,
|
||||
const refinementSurfaces& refineSurfaces,
|
||||
const labelList& globalToPatch,
|
||||
const dictionary& dict,
|
||||
const polyBoundaryMesh& boundaryMesh
|
||||
);
|
||||
|
||||
//- Construct from dictionary - new syntax
|
||||
layerParameters(const dictionary& dict, const polyBoundaryMesh&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
// Per patch information
|
||||
|
||||
//- How many layers to add.
|
||||
const labelList& numLayers() const
|
||||
{
|
||||
return numLayers_;
|
||||
}
|
||||
|
||||
// Expansion factor for layer mesh
|
||||
const scalarField& expansionRatio() const
|
||||
{
|
||||
return expansionRatio_;
|
||||
}
|
||||
|
||||
//- Are size parameters relative to inner cell size or
|
||||
// absolute distances.
|
||||
bool relativeSizes() const
|
||||
{
|
||||
return relativeSizes_;
|
||||
}
|
||||
|
||||
//- Wanted thickness of final added cell layer. If multiple
|
||||
// layers is the thickness of the layer furthest away
|
||||
// from the wall (i.e. nearest the original mesh)
|
||||
// If relativeSize() this number is relative to undistorted
|
||||
// size of the cell outside layer.
|
||||
const scalarField& finalLayerThickness() const
|
||||
{
|
||||
return finalLayerThickness_;
|
||||
}
|
||||
|
||||
//- Minimum thickness of cell layer. If for any reason layer
|
||||
// cannot be above minThickness do not add layer.
|
||||
// If relativeSize() this number is relative to undistorted
|
||||
// size of the cell outside layer.
|
||||
const scalarField& minThickness() const
|
||||
{
|
||||
return minThickness_;
|
||||
}
|
||||
|
||||
|
||||
scalar featureAngle() const
|
||||
{
|
||||
return featureAngle_;
|
||||
}
|
||||
|
||||
scalar concaveAngle() const
|
||||
{
|
||||
return concaveAngle_;
|
||||
}
|
||||
|
||||
//- If points get not extruded do nGrow layers of connected faces
|
||||
// that are not grown. Is used to not do layers at all close to
|
||||
// features.
|
||||
label nGrow() const
|
||||
{
|
||||
return nGrow_;
|
||||
}
|
||||
|
||||
//- Number of smoothing iterations of surface normals
|
||||
label nSmoothSurfaceNormals() const
|
||||
{
|
||||
return nSmoothSurfaceNormals_;
|
||||
}
|
||||
|
||||
//- Number of smoothing iterations of interior mesh movement
|
||||
// direction
|
||||
label nSmoothNormals() const
|
||||
{
|
||||
return nSmoothNormals_;
|
||||
}
|
||||
|
||||
//- Stop layer growth on highly warped cells
|
||||
scalar maxFaceThicknessRatio() const
|
||||
{
|
||||
return maxFaceThicknessRatio_;
|
||||
}
|
||||
|
||||
scalar layerTerminationCos() const
|
||||
{
|
||||
return layerTerminationCos_;
|
||||
}
|
||||
|
||||
//- Smooth layer thickness over surface patches
|
||||
label nSmoothThickness() const
|
||||
{
|
||||
return nSmoothThickness_;
|
||||
}
|
||||
|
||||
//- Reduce layer growth where ratio thickness to medial
|
||||
// distance is large
|
||||
scalar maxThicknessToMedialRatio() const
|
||||
{
|
||||
return maxThicknessToMedialRatio_;
|
||||
}
|
||||
|
||||
//- Angle used to pick up medial axis points
|
||||
scalar minMedianAxisAngleCos() const
|
||||
{
|
||||
return minMedianAxisAngleCos_;
|
||||
}
|
||||
|
||||
//- Create buffer region for new layer terminations
|
||||
label nBufferCellsNoExtrude() const
|
||||
{
|
||||
return nBufferCellsNoExtrude_;
|
||||
}
|
||||
|
||||
label nSnap() const
|
||||
{
|
||||
return nSnap_;
|
||||
}
|
||||
|
||||
// Overall
|
||||
|
||||
//- Number of overall layer addition iterations
|
||||
label nLayerIter() const
|
||||
{
|
||||
return nLayerIter_;
|
||||
}
|
||||
|
||||
//- Number of iterations after which relaxed motion rules
|
||||
// are to be used.
|
||||
label nRelaxedIter() const
|
||||
{
|
||||
return nRelaxedIter_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,50 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pointData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const pointData& wDist)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
return os
|
||||
<< wDist.origin() << token::SPACE << wDist.distSqr()
|
||||
<< token::SPACE << wDist.s() << token::SPACE << wDist.v();
|
||||
}
|
||||
else
|
||||
{
|
||||
return os
|
||||
<< wDist.origin() << wDist.distSqr() << wDist.s() << wDist.v();
|
||||
}
|
||||
}
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, pointData& wDist)
|
||||
{
|
||||
return is >> wDist.origin_ >> wDist.distSqr_ >> wDist.s_ >> wDist.v_;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,226 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::pointData
|
||||
|
||||
Description
|
||||
Holds information regarding nearest wall point. Used in pointEdgeWave.
|
||||
(so not standard meshWave)
|
||||
|
||||
To be used in wall distance calculation.
|
||||
|
||||
SourceFiles
|
||||
pointDataI.H
|
||||
pointData.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pointData_H
|
||||
#define pointData_H
|
||||
|
||||
#include "point.H"
|
||||
#include "label.H"
|
||||
#include "tensor.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Class forward declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pointData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class pointData
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- position of nearest wall center
|
||||
point origin_;
|
||||
|
||||
//- normal distance (squared) from point to origin
|
||||
scalar distSqr_;
|
||||
|
||||
//- additional information.
|
||||
scalar s_;
|
||||
|
||||
//- additional information.
|
||||
vector v_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Evaluate distance to point. Update distSqr, origin from whomever
|
||||
// is nearer pt. Return true if w2 is closer to point,
|
||||
// false otherwise.
|
||||
inline bool update
|
||||
(
|
||||
const point&,
|
||||
const pointData& w2,
|
||||
const scalar tol
|
||||
);
|
||||
|
||||
//- Combine current with w2. Update distSqr, origin if w2 has smaller
|
||||
// quantities and returns true.
|
||||
inline bool update
|
||||
(
|
||||
const pointData& w2,
|
||||
const scalar tol
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline pointData();
|
||||
|
||||
//- Construct from origin, distance
|
||||
inline pointData
|
||||
(
|
||||
const point& origin,
|
||||
const scalar distSqr,
|
||||
const scalar s,
|
||||
const vector& v
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
inline pointData(const pointData&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
inline const point& origin() const;
|
||||
|
||||
inline scalar distSqr() const;
|
||||
|
||||
inline scalar s() const;
|
||||
|
||||
inline const vector& v() const;
|
||||
|
||||
|
||||
// Needed by meshWave
|
||||
|
||||
//- Check whether origin has been changed at all or
|
||||
// still contains original (invalid) value.
|
||||
inline bool valid() const;
|
||||
|
||||
//- Check for identical geometrical data. Used for cyclics checking.
|
||||
inline bool sameGeometry(const pointData&, const scalar tol)
|
||||
const;
|
||||
|
||||
//- Convert origin to relative vector to leaving point
|
||||
// (= point coordinate)
|
||||
inline void leaveDomain
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchPointI,
|
||||
const point& pos
|
||||
);
|
||||
|
||||
//- Convert relative origin to absolute by adding entering point
|
||||
inline void enterDomain
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchPointI,
|
||||
const point& pos
|
||||
);
|
||||
|
||||
//- Apply rotation matrix to origin
|
||||
inline void transform(const tensor& rotTensor);
|
||||
|
||||
//- Influence of edge on point
|
||||
inline bool updatePoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label pointI,
|
||||
const label edgeI,
|
||||
const pointData& edgeInfo,
|
||||
const scalar tol
|
||||
);
|
||||
|
||||
//- Influence of different value on same point.
|
||||
// Merge new and old info.
|
||||
inline bool updatePoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label pointI,
|
||||
const pointData& newPointInfo,
|
||||
const scalar tol
|
||||
);
|
||||
|
||||
//- Influence of different value on same point.
|
||||
// No information about current position whatsoever.
|
||||
inline bool updatePoint
|
||||
(
|
||||
const pointData& newPointInfo,
|
||||
const scalar tol
|
||||
);
|
||||
|
||||
//- Influence of point on edge.
|
||||
inline bool updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label edgeI,
|
||||
const label pointI,
|
||||
const pointData& pointInfo,
|
||||
const scalar tol
|
||||
);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//Note: Used to determine whether to call update.
|
||||
inline bool operator==(const pointData&) const;
|
||||
|
||||
inline bool operator!=(const pointData&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const pointData&);
|
||||
friend Istream& operator>>(Istream&, pointData&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "pointDataI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,353 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "transform.H"
|
||||
#include "wallPoint.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Update this with w2 if w2 nearer to pt.
|
||||
inline bool Foam::pointData::update
|
||||
(
|
||||
const point& pt,
|
||||
const pointData& w2,
|
||||
const scalar tol
|
||||
)
|
||||
{
|
||||
scalar dist2 = magSqr(pt - w2.origin());
|
||||
|
||||
if (!valid())
|
||||
{
|
||||
distSqr_ = dist2;
|
||||
origin_ = w2.origin();
|
||||
s_ = w2.s();
|
||||
v_ = w2.v();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// if (v_ != w2.v())
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
scalar diff = distSqr_ - dist2;
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
// already nearer to pt
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
|
||||
{
|
||||
// don't propagate small changes
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// update with new values
|
||||
distSqr_ = dist2;
|
||||
origin_ = w2.origin();
|
||||
s_ = w2.s();
|
||||
v_ = w2.v();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update this with w2 (information on same point)
|
||||
inline bool Foam::pointData::update
|
||||
(
|
||||
const pointData& w2,
|
||||
const scalar tol
|
||||
)
|
||||
{
|
||||
if (!valid())
|
||||
{
|
||||
// current not yet set so use any value
|
||||
distSqr_ = w2.distSqr();
|
||||
origin_ = w2.origin();
|
||||
s_ = w2.s();
|
||||
v_ = w2.v();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// if (v_ != w2.v())
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
scalar diff = distSqr_ - w2.distSqr();
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
// already nearer to pt
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
|
||||
{
|
||||
// don't propagate small changes
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// update with new values
|
||||
distSqr_ = w2.distSqr();
|
||||
origin_ = w2.origin();
|
||||
s_ = w2.s();
|
||||
v_ = w2.v();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Null constructor
|
||||
inline Foam::pointData::pointData()
|
||||
:
|
||||
origin_(wallPoint::greatPoint),
|
||||
distSqr_(GREAT),
|
||||
s_(GREAT),
|
||||
v_(wallPoint::greatPoint)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from origin, distance
|
||||
inline Foam::pointData::pointData
|
||||
(
|
||||
const point& origin,
|
||||
const scalar distSqr,
|
||||
const scalar s,
|
||||
const vector& v
|
||||
)
|
||||
:
|
||||
origin_(origin),
|
||||
distSqr_(distSqr),
|
||||
s_(s),
|
||||
v_(v)
|
||||
{}
|
||||
|
||||
|
||||
// Construct as copy
|
||||
inline Foam::pointData::pointData(const pointData& wpt)
|
||||
:
|
||||
origin_(wpt.origin()),
|
||||
distSqr_(wpt.distSqr()),
|
||||
s_(wpt.s()),
|
||||
v_(wpt.v())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::point& Foam::pointData::origin() const
|
||||
{
|
||||
return origin_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::pointData::distSqr() const
|
||||
{
|
||||
return distSqr_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::pointData::s() const
|
||||
{
|
||||
return s_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vector& Foam::pointData::v() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pointData::valid() const
|
||||
{
|
||||
return origin_ != wallPoint::greatPoint;
|
||||
}
|
||||
|
||||
|
||||
// Checks for cyclic points
|
||||
inline bool Foam::pointData::sameGeometry
|
||||
(
|
||||
const pointData& w2,
|
||||
const scalar tol
|
||||
) const
|
||||
{
|
||||
scalar diff = Foam::mag(distSqr() - w2.distSqr());
|
||||
|
||||
if (diff < SMALL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((distSqr() > SMALL) && ((diff/distSqr()) < tol))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::pointData::leaveDomain
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchPointI,
|
||||
const point& coord
|
||||
)
|
||||
{
|
||||
origin_ -= coord;
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::pointData::transform(const tensor& rotTensor)
|
||||
{
|
||||
origin_ = Foam::transform(rotTensor, origin_);
|
||||
}
|
||||
|
||||
|
||||
// Update absolute geometric quantities. Note that distance (distSqr_)
|
||||
// is not affected by leaving/entering domain.
|
||||
inline void Foam::pointData::enterDomain
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchPointI,
|
||||
const point& coord
|
||||
)
|
||||
{
|
||||
// back to absolute form
|
||||
origin_ += coord;
|
||||
}
|
||||
|
||||
|
||||
// Update this with information from connected edge
|
||||
inline bool Foam::pointData::updatePoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label pointI,
|
||||
const label edgeI,
|
||||
const pointData& edgeInfo,
|
||||
const scalar tol
|
||||
)
|
||||
{
|
||||
return
|
||||
update
|
||||
(
|
||||
mesh.points()[pointI],
|
||||
edgeInfo,
|
||||
tol
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Update this with new information on same point
|
||||
inline bool Foam::pointData::updatePoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label pointI,
|
||||
const pointData& newPointInfo,
|
||||
const scalar tol
|
||||
)
|
||||
{
|
||||
return
|
||||
update
|
||||
(
|
||||
mesh.points()[pointI],
|
||||
newPointInfo,
|
||||
tol
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Update this with new information on same point. No extra information.
|
||||
inline bool Foam::pointData::updatePoint
|
||||
(
|
||||
const pointData& newPointInfo,
|
||||
const scalar tol
|
||||
)
|
||||
{
|
||||
return update(newPointInfo, tol);
|
||||
}
|
||||
|
||||
|
||||
// Update this with information from connected point
|
||||
inline bool Foam::pointData::updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label edgeI,
|
||||
const label pointI,
|
||||
const pointData& pointInfo,
|
||||
const scalar tol
|
||||
)
|
||||
{
|
||||
const pointField& points = mesh.points();
|
||||
|
||||
const edge& e = mesh.edges()[edgeI];
|
||||
|
||||
const point edgeMid(0.5*(points[e[0]] + points[e[1]]));
|
||||
|
||||
return
|
||||
update
|
||||
(
|
||||
edgeMid,
|
||||
pointInfo,
|
||||
tol
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::pointData::operator==(const pointData& rhs) const
|
||||
{
|
||||
return origin() == rhs.origin();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pointData::operator!=(const pointData& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,140 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "refinementParameters.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "polyMesh.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::refinementParameters::refinementParameters
|
||||
(
|
||||
const dictionary& dict,
|
||||
const label dummy
|
||||
)
|
||||
:
|
||||
maxGlobalCells_(readLabel(dict.lookup("cellLimit"))),
|
||||
maxLocalCells_(readLabel(dict.lookup("procCellLimit"))),
|
||||
minRefineCells_(readLabel(dict.lookup("minimumRefine"))),
|
||||
curvature_(readScalar(dict.lookup("curvature"))),
|
||||
nBufferLayers_(readLabel(dict.lookup("nBufferLayers"))),
|
||||
keepPoints_(dict.lookup("keepPoints")),
|
||||
allowFreeStandingZoneFaces_
|
||||
(
|
||||
dict.lookupOrDefault<Switch>
|
||||
(
|
||||
"allowFreeStandingZoneFaces",
|
||||
true
|
||||
)
|
||||
),
|
||||
maxLoadUnbalance_(dict.lookupOrDefault<scalar>("maxLoadUnbalance",0))
|
||||
{}
|
||||
|
||||
|
||||
Foam::refinementParameters::refinementParameters(const dictionary& dict)
|
||||
:
|
||||
maxGlobalCells_(readLabel(dict.lookup("maxGlobalCells"))),
|
||||
maxLocalCells_(readLabel(dict.lookup("maxLocalCells"))),
|
||||
minRefineCells_(readLabel(dict.lookup("minRefinementCells"))),
|
||||
nBufferLayers_(readLabel(dict.lookup("nCellsBetweenLevels"))),
|
||||
keepPoints_(pointField(1, dict.lookup("locationInMesh"))),
|
||||
allowFreeStandingZoneFaces_
|
||||
(
|
||||
dict.lookupOrDefault<Switch>
|
||||
(
|
||||
"allowFreeStandingZoneFaces",
|
||||
true
|
||||
)
|
||||
),
|
||||
maxLoadUnbalance_(dict.lookupOrDefault<scalar>("maxLoadUnbalance",0))
|
||||
{
|
||||
scalar featAngle(readScalar(dict.lookup("resolveFeatureAngle")));
|
||||
|
||||
if (featAngle < 0 || featAngle > 180)
|
||||
{
|
||||
curvature_ = -GREAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
curvature_ = Foam::cos(featAngle*mathematicalConstant::pi/180.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::labelList Foam::refinementParameters::findCells(const polyMesh& mesh)
|
||||
const
|
||||
{
|
||||
// Global calculation engine
|
||||
globalIndex globalCells(mesh.nCells());
|
||||
|
||||
// Cell label per point
|
||||
labelList cellLabels(keepPoints_.size());
|
||||
|
||||
forAll(keepPoints_, i)
|
||||
{
|
||||
const point& keepPoint = keepPoints_[i];
|
||||
|
||||
label localCellI = mesh.findCell(keepPoint);
|
||||
|
||||
label globalCellI = -1;
|
||||
|
||||
if (localCellI != -1)
|
||||
{
|
||||
Pout<< "Found point " << keepPoint << " in cell " << localCellI
|
||||
<< " on processor " << Pstream::myProcNo() << endl;
|
||||
globalCellI = globalCells.toGlobal(localCellI);
|
||||
}
|
||||
|
||||
reduce(globalCellI, maxOp<label>());
|
||||
|
||||
if (globalCellI == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"refinementParameters::findCells(const polyMesh&) const"
|
||||
) << "Point " << keepPoint
|
||||
<< " is not inside the mesh or on a face or edge." << nl
|
||||
<< "Bounding box of the mesh:" << mesh.bounds()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (globalCells.isLocal(globalCellI))
|
||||
{
|
||||
cellLabels[i] = localCellI;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellLabels[i] = -1;
|
||||
}
|
||||
}
|
||||
return cellLabels;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,174 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::refinementParameters
|
||||
|
||||
Description
|
||||
Simple container to keep together refinement specific information.
|
||||
|
||||
SourceFiles
|
||||
refinementParameters.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef refinementParameters_H
|
||||
#define refinementParameters_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "pointField.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Class forward declarations
|
||||
class polyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class refinementParameters Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class refinementParameters
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Total number of cells
|
||||
const label maxGlobalCells_;
|
||||
|
||||
//- Per processor max number of cells
|
||||
const label maxLocalCells_;
|
||||
|
||||
//- When to stop refining
|
||||
const label minRefineCells_;
|
||||
|
||||
//- Curvature
|
||||
scalar curvature_;
|
||||
|
||||
//- Number of layers between different refinement levels
|
||||
const label nBufferLayers_;
|
||||
|
||||
//- Areas to keep
|
||||
const pointField keepPoints_;
|
||||
|
||||
//- FaceZone faces allowed which have owner and neighbour in same
|
||||
// cellZone?
|
||||
Switch allowFreeStandingZoneFaces_;
|
||||
|
||||
//- Allowed load unbalance
|
||||
scalar maxLoadUnbalance_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
refinementParameters(const refinementParameters&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const refinementParameters&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary - old syntax
|
||||
refinementParameters(const dictionary& dict, const label dummy);
|
||||
|
||||
//- Construct from dictionary - new syntax
|
||||
refinementParameters(const dictionary& dict);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Total number of cells
|
||||
label maxGlobalCells() const
|
||||
{
|
||||
return maxGlobalCells_;
|
||||
}
|
||||
|
||||
//- Per processor max number of cells
|
||||
label maxLocalCells() const
|
||||
{
|
||||
return maxLocalCells_;
|
||||
}
|
||||
|
||||
//- When to stop refining
|
||||
label minRefineCells() const
|
||||
{
|
||||
return minRefineCells_;
|
||||
}
|
||||
|
||||
//- Curvature
|
||||
scalar curvature() const
|
||||
{
|
||||
return curvature_;
|
||||
}
|
||||
|
||||
//- Number of layers between different refinement levels
|
||||
label nBufferLayers() const
|
||||
{
|
||||
return nBufferLayers_;
|
||||
}
|
||||
|
||||
//- Areas to keep
|
||||
const pointField& keepPoints() const
|
||||
{
|
||||
return keepPoints_;
|
||||
}
|
||||
|
||||
//- Are zone faces allowed only inbetween different cell zones
|
||||
// or also just free standing?
|
||||
bool allowFreeStandingZoneFaces() const
|
||||
{
|
||||
return allowFreeStandingZoneFaces_;
|
||||
}
|
||||
|
||||
//- Allowed load unbalance
|
||||
scalar maxLoadUnbalance() const
|
||||
{
|
||||
return maxLoadUnbalance_;
|
||||
}
|
||||
|
||||
|
||||
// Other
|
||||
|
||||
//- Checks that cells are in mesh. Returns cells they are in.
|
||||
labelList findCells(const polyMesh&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,53 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "snapParameters.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::snapParameters::snapParameters(const dictionary& dict, const label dummy)
|
||||
:
|
||||
nSmoothPatch_(readLabel(dict.lookup("nSmoothPatch"))),
|
||||
snapTol_(readScalar(dict.lookup("snapTol"))),
|
||||
nSmoothDispl_(readLabel(dict.lookup("nSmoothDispl"))),
|
||||
nSnap_(readLabel(dict.lookup("nSnap")))
|
||||
{}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::snapParameters::snapParameters(const dictionary& dict)
|
||||
:
|
||||
nSmoothPatch_(readLabel(dict.lookup("nSmoothPatch"))),
|
||||
snapTol_(readScalar(dict.lookup("tolerance"))),
|
||||
nSmoothDispl_(readLabel(dict.lookup("nSolveIter"))),
|
||||
nSnap_(readLabel(dict.lookup("nRelaxIter")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,128 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::snapParameters
|
||||
|
||||
Description
|
||||
Simple container to keep together snap specific information.
|
||||
|
||||
SourceFiles
|
||||
snapParameters.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef snapParameters_H
|
||||
#define snapParameters_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "scalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Class forward declarations
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class snapParameters Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class snapParameters
|
||||
{
|
||||
// Private data
|
||||
|
||||
const label nSmoothPatch_;
|
||||
|
||||
const scalar snapTol_;
|
||||
|
||||
const label nSmoothDispl_;
|
||||
|
||||
const label nSnap_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
snapParameters(const snapParameters&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const snapParameters&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary - old syntax
|
||||
snapParameters(const dictionary& dict, const label dummy);
|
||||
|
||||
//- Construct from dictionary - new syntax
|
||||
snapParameters(const dictionary& dict);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Number of patch smoothing iterations before finding
|
||||
// correspondence to surface
|
||||
label nSmoothPatch() const
|
||||
{
|
||||
return nSmoothPatch_;
|
||||
}
|
||||
|
||||
//- Relative distance for points to be attracted by surface
|
||||
// feature point
|
||||
// or edge. True distance is this factor times local
|
||||
// maximum edge length.
|
||||
scalar snapTol() const
|
||||
{
|
||||
return snapTol_;
|
||||
}
|
||||
|
||||
//- Number of mesh displacement smoothing iterations.
|
||||
label nSmoothDispl() const
|
||||
{
|
||||
return nSmoothDispl_;
|
||||
}
|
||||
|
||||
//- Maximum number of snapping relaxation iterations. Should stop
|
||||
// before upon reaching a correct mesh.
|
||||
label nSnap() const
|
||||
{
|
||||
return nSnap_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -1,841 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::meshRefinement
|
||||
|
||||
Description
|
||||
Helper class which maintains intersections of (changing) mesh with
|
||||
(static) surfaces.
|
||||
|
||||
Maintains
|
||||
- per face any intersections of the cc-cc segment with any of the surfaces
|
||||
|
||||
SourceFiles
|
||||
meshRefinement.C
|
||||
meshRefinementBaffles.C
|
||||
meshRefinementMerge.C
|
||||
meshRefinementProblemCells.C
|
||||
meshRefinementRefine.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef meshRefinement_H
|
||||
#define meshRefinement_H
|
||||
|
||||
#include "hexRef8.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "autoPtr.H"
|
||||
#include "labelPair.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "pointFieldsFwd.H"
|
||||
#include "Tuple2.H"
|
||||
#include "pointIndexHit.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Class forward declarations
|
||||
class fvMesh;
|
||||
class mapDistributePolyMesh;
|
||||
class decompositionMethod;
|
||||
class refinementSurfaces;
|
||||
class shellSurfaces;
|
||||
class removeCells;
|
||||
class featureEdgeMesh;
|
||||
class fvMeshDistribute;
|
||||
class searchableSurface;
|
||||
class regionSplit;
|
||||
class globalIndex;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class meshRefinement Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class meshRefinement
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Public data types
|
||||
|
||||
//- Enumeration for debug dumping
|
||||
enum writeFlag
|
||||
{
|
||||
MESH = 1,
|
||||
SCALARLEVELS = 2,
|
||||
OBJINTERSECTIONS = 4
|
||||
};
|
||||
|
||||
|
||||
//- Enumeration for how the userdata is to be mapped upon refinement.
|
||||
enum mapType
|
||||
{
|
||||
MASTERONLY = 1, /*!< maintain master only */
|
||||
KEEPALL = 2, /*!< have slaves (upon refinement) from master */
|
||||
REMOVE = 4 /*!< set value to -1 any face that was refined */
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
fvMesh& mesh_;
|
||||
|
||||
//- tolerance used for sorting coordinates (used in 'less' routine)
|
||||
const scalar mergeDistance_;
|
||||
|
||||
//- overwrite the mesh?
|
||||
const bool overwrite_;
|
||||
|
||||
//- Instance of mesh upon construction. Used when in overwrite_ mode.
|
||||
const word oldInstance_;
|
||||
|
||||
//- All surface-intersection interaction
|
||||
const refinementSurfaces& surfaces_;
|
||||
|
||||
//- All shell-refinement interaction
|
||||
const shellSurfaces& shells_;
|
||||
|
||||
//- refinement engine
|
||||
hexRef8 meshCutter_;
|
||||
|
||||
//- per cc-cc vector the index of the surface hit
|
||||
labelIOList surfaceIndex_;
|
||||
|
||||
//- user supplied face based data.
|
||||
List<Tuple2<mapType, labelList> > userFaceData_;
|
||||
|
||||
//- Meshed patches - are treated differently. Stored as wordList since
|
||||
// order changes.
|
||||
wordList meshedPatches_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Reorder list according to map.
|
||||
template<class T>
|
||||
static void updateList
|
||||
(
|
||||
const labelList& newToOld,
|
||||
const T& nullValue,
|
||||
List<T>& elems
|
||||
);
|
||||
|
||||
//- Add patchfield of given type to all fields on mesh
|
||||
template<class GeoField>
|
||||
static void addPatchFields(fvMesh&, const word& patchFieldType);
|
||||
|
||||
//- Reorder patchfields of all fields on mesh
|
||||
template<class GeoField>
|
||||
static void reorderPatchFields(fvMesh&, const labelList& oldToNew);
|
||||
|
||||
//- Find out which faces have changed given cells (old mesh labels)
|
||||
// that were marked for refinement.
|
||||
static labelList getChangedFaces
|
||||
(
|
||||
const mapPolyMesh&,
|
||||
const labelList& oldCellsToRefine
|
||||
);
|
||||
|
||||
//- Calculate coupled boundary end vector and refinement level
|
||||
void calcNeighbourData
|
||||
(
|
||||
labelList& neiLevel,
|
||||
pointField& neiCc
|
||||
) const;
|
||||
|
||||
//- Find any intersection of surface. Store in surfaceIndex_.
|
||||
void updateIntersections(const labelList& changedFaces);
|
||||
|
||||
//- Remove cells. Put exposedFaces into exposedPatchIDs.
|
||||
autoPtr<mapPolyMesh> doRemoveCells
|
||||
(
|
||||
const labelList& cellsToRemove,
|
||||
const labelList& exposedFaces,
|
||||
const labelList& exposedPatchIDs,
|
||||
removeCells& cellRemover
|
||||
);
|
||||
|
||||
// Get cells which are inside any closed surface. Note that
|
||||
// all closed surfaces
|
||||
// will have already been oriented to have keepPoint outside.
|
||||
labelList getInsideCells(const word&) const;
|
||||
|
||||
// Do all to remove inside cells
|
||||
autoPtr<mapPolyMesh> removeInsideCells
|
||||
(
|
||||
const string& msg,
|
||||
const label exposedPatchI
|
||||
);
|
||||
|
||||
// For decomposeCombineRegions
|
||||
|
||||
//- Used in decomposeCombineRegions. Given global region per cell
|
||||
// determines master processor/cell for regions straddling
|
||||
// procboundaries.
|
||||
void getCoupledRegionMaster
|
||||
(
|
||||
const globalIndex& globalCells,
|
||||
const boolList& blockedFace,
|
||||
const regionSplit& globalRegion,
|
||||
Map<label>& regionToMaster
|
||||
) const;
|
||||
|
||||
//- Determine regions that are local to me or coupled ones that
|
||||
// are owned by me. Determine representative location.
|
||||
void calcLocalRegions
|
||||
(
|
||||
const globalIndex& globalCells,
|
||||
const labelList& globalRegion,
|
||||
const Map<label>& coupledRegionToMaster,
|
||||
const scalarField& cellWeights,
|
||||
|
||||
Map<label>& globalToLocalRegion,
|
||||
pointField& localPoints,
|
||||
scalarField& localWeights
|
||||
) const;
|
||||
|
||||
//- Convert region into global index.
|
||||
static label getShiftedRegion
|
||||
(
|
||||
const globalIndex& indexer,
|
||||
const Map<label>& globalToLocalRegion,
|
||||
const Map<label>& coupledRegionToShifted,
|
||||
const label globalRegion
|
||||
);
|
||||
|
||||
//- helper: add element if not in list. Linear search.
|
||||
static void addUnique(const label, labelList&);
|
||||
|
||||
//- Calculate region connectivity. Major communication.
|
||||
void calcRegionRegions
|
||||
(
|
||||
const labelList& globalRegion,
|
||||
const Map<label>& globalToLocalRegion,
|
||||
const Map<label>& coupledRegionToMaster,
|
||||
labelListList& regionRegions
|
||||
) const;
|
||||
|
||||
|
||||
// Refinement candidate selection
|
||||
|
||||
//- Mark cell for refinement (if not already marked). Return false
|
||||
// if refinelimit hit. Keeps running count (in nRefine) of cells
|
||||
// marked for refinement
|
||||
static bool markForRefine
|
||||
(
|
||||
const label markValue,
|
||||
const label nAllowRefine,
|
||||
label& cellValue,
|
||||
label& nRefine
|
||||
);
|
||||
|
||||
//- Calculate list of cells to refine based on intersection of
|
||||
// features.
|
||||
label markFeatureRefinement
|
||||
(
|
||||
const point& keepPoint,
|
||||
const PtrList<featureEdgeMesh>& featureMeshes,
|
||||
const labelList& featureLevels,
|
||||
const label nAllowRefine,
|
||||
|
||||
labelList& refineCell,
|
||||
label& nRefine
|
||||
) const;
|
||||
|
||||
//- Mark cells for refinement-shells based refinement.
|
||||
label markInternalRefinement
|
||||
(
|
||||
const label nAllowRefine,
|
||||
labelList& refineCell,
|
||||
label& nRefine
|
||||
) const;
|
||||
|
||||
//- Collect faces that are intersected and whose neighbours aren't
|
||||
// yet marked for refinement.
|
||||
labelList getRefineCandidateFaces
|
||||
(
|
||||
const labelList& refineCell
|
||||
) const;
|
||||
|
||||
//- Mark cells for surface intersection based refinement.
|
||||
label markSurfaceRefinement
|
||||
(
|
||||
const label nAllowRefine,
|
||||
const labelList& neiLevel,
|
||||
const pointField& neiCc,
|
||||
labelList& refineCell,
|
||||
label& nRefine
|
||||
) const;
|
||||
|
||||
//- Mark cell if local curvature > curvature or
|
||||
// markDifferingRegions = true and intersections with different
|
||||
// regions.
|
||||
bool checkCurvature
|
||||
(
|
||||
const scalar curvature,
|
||||
const label nAllowRefine,
|
||||
const label surfaceLevel,
|
||||
const vector& surfaceNormal,
|
||||
const label cellI,
|
||||
label& cellMaxLevel,
|
||||
vector& cellMaxNormal,
|
||||
labelList& refineCell,
|
||||
label& nRefine
|
||||
) const;
|
||||
|
||||
|
||||
//- Mark cells for surface curvature based refinement. Marks if
|
||||
// local curvature > curvature or if on different regions
|
||||
// (markDifferingRegions)
|
||||
label markSurfaceCurvatureRefinement
|
||||
(
|
||||
const scalar curvature,
|
||||
const label nAllowRefine,
|
||||
const labelList& neiLevel,
|
||||
const pointField& neiCc,
|
||||
labelList& refineCell,
|
||||
label& nRefine
|
||||
) const;
|
||||
|
||||
// Baffle handling
|
||||
|
||||
//- Determine patches for baffles
|
||||
void getBafflePatches
|
||||
(
|
||||
const labelList& globalToPatch,
|
||||
const labelList& neiLevel,
|
||||
const pointField& neiCc,
|
||||
labelList& ownPatch,
|
||||
labelList& neiPatch
|
||||
) const;
|
||||
|
||||
//- Determine patch for baffle using some heuristic (and not
|
||||
// surface)
|
||||
label getBafflePatch
|
||||
(
|
||||
const labelList& facePatch,
|
||||
const label faceI
|
||||
) const;
|
||||
|
||||
//- Repatches external face or creates baffle for internal face
|
||||
// with user specified patches (might be different for both sides).
|
||||
// Returns label of added face.
|
||||
label createBaffle
|
||||
(
|
||||
const label faceI,
|
||||
const label ownPatch,
|
||||
const label neiPatch,
|
||||
directTopoChange& meshMod
|
||||
) const;
|
||||
|
||||
// Problem cell handling
|
||||
|
||||
//- Helper function to mark face as being on 'boundary'. Used by
|
||||
// markFacesOnProblemCells
|
||||
void markBoundaryFace
|
||||
(
|
||||
const label faceI,
|
||||
boolList& isBoundaryFace,
|
||||
boolList& isBoundaryEdge,
|
||||
boolList& isBoundaryPoint
|
||||
) const;
|
||||
|
||||
void findNearest
|
||||
(
|
||||
const labelList& meshFaces,
|
||||
List<pointIndexHit>& nearestInfo,
|
||||
labelList& nearestSurface,
|
||||
labelList& nearestRegion,
|
||||
vectorField& nearestNormal
|
||||
) const;
|
||||
|
||||
Map<label> findEdgeConnectedProblemCells
|
||||
(
|
||||
const scalarField& perpendicularAngle,
|
||||
const labelList&
|
||||
) const;
|
||||
|
||||
bool isCollapsedFace
|
||||
(
|
||||
const pointField&,
|
||||
const pointField& neiCc,
|
||||
const scalar minFaceArea,
|
||||
const scalar maxNonOrtho,
|
||||
const label faceI
|
||||
) const;
|
||||
|
||||
bool isCollapsedCell
|
||||
(
|
||||
const pointField&,
|
||||
const scalar volFraction,
|
||||
const label cellI
|
||||
) const;
|
||||
|
||||
//- Returns list with for every internal face -1 or the patch
|
||||
// they should be baffled into. If removeEdgeConnectedCells is set
|
||||
// removes cells based on perpendicularAngle.
|
||||
labelList markFacesOnProblemCells
|
||||
(
|
||||
const dictionary& motionDict,
|
||||
const bool removeEdgeConnectedCells,
|
||||
const scalarField& perpendicularAngle,
|
||||
const labelList& globalToPatch
|
||||
) const;
|
||||
|
||||
////- Initial test of marking faces using geometric information.
|
||||
//labelList markFacesOnProblemCellsGeometric
|
||||
//(
|
||||
// const dictionary& motionDict
|
||||
//) const;
|
||||
|
||||
|
||||
// Baffle merging
|
||||
|
||||
//- Extract those baffles (duplicate) faces that are on the edge
|
||||
// of a baffle region. These are candidates for merging.
|
||||
List<labelPair> filterDuplicateFaces(const List<labelPair>&) const;
|
||||
|
||||
|
||||
// Zone handling
|
||||
|
||||
//- Finds zone per cell for cells inside closed named surfaces.
|
||||
// (uses geometric test for insideness)
|
||||
// Adapts namedSurfaceIndex so all faces on boundary of cellZone
|
||||
// have corresponding faceZone.
|
||||
void findCellZoneGeometric
|
||||
(
|
||||
const labelList& closedNamedSurfaces,
|
||||
labelList& namedSurfaceIndex,
|
||||
const labelList& surfaceToCellZone,
|
||||
labelList& cellToZone
|
||||
) const;
|
||||
|
||||
//- Determines cell zone from cell region information.
|
||||
bool calcRegionToZone
|
||||
(
|
||||
const label surfZoneI,
|
||||
const label ownRegion,
|
||||
const label neiRegion,
|
||||
|
||||
labelList& regionToCellZone
|
||||
) const;
|
||||
|
||||
//- Finds zone per cell. Uses topological walk with all faces
|
||||
// marked in namedSurfaceIndex regarded as blocked.
|
||||
void findCellZoneTopo
|
||||
(
|
||||
const point& keepPoint,
|
||||
const labelList& namedSurfaceIndex,
|
||||
const labelList& surfaceToCellZone,
|
||||
labelList& cellToZone
|
||||
) const;
|
||||
|
||||
void makeConsistentFaceIndex
|
||||
(
|
||||
const labelList& cellToZone,
|
||||
labelList& namedSurfaceIndex
|
||||
) const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
meshRefinement(const meshRefinement&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const meshRefinement&);
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("meshRefinement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
meshRefinement
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const scalar mergeDistance,
|
||||
const bool overwrite,
|
||||
const refinementSurfaces&,
|
||||
const shellSurfaces&
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- reference to mesh
|
||||
const fvMesh& mesh() const
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
fvMesh& mesh()
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
scalar mergeDistance() const
|
||||
{
|
||||
return mergeDistance_;
|
||||
}
|
||||
|
||||
//- Overwrite the mesh?
|
||||
bool overwrite() const
|
||||
{
|
||||
return overwrite_;
|
||||
}
|
||||
|
||||
//- (points)instance of mesh upon construction
|
||||
const word& oldInstance() const
|
||||
{
|
||||
return oldInstance_;
|
||||
}
|
||||
|
||||
//- reference to surface search engines
|
||||
const refinementSurfaces& surfaces() const
|
||||
{
|
||||
return surfaces_;
|
||||
}
|
||||
|
||||
//- reference to refinement shells (regions)
|
||||
const shellSurfaces& shells() const
|
||||
{
|
||||
return shells_;
|
||||
}
|
||||
|
||||
//- reference to meshcutting engine
|
||||
const hexRef8& meshCutter() const
|
||||
{
|
||||
return meshCutter_;
|
||||
}
|
||||
|
||||
//- per start-end edge the index of the surface hit
|
||||
const labelList& surfaceIndex() const
|
||||
{
|
||||
return surfaceIndex_;
|
||||
}
|
||||
|
||||
labelList& surfaceIndex()
|
||||
{
|
||||
return surfaceIndex_;
|
||||
}
|
||||
|
||||
//- Additional face data that is maintained across
|
||||
// topo changes. Every entry is a list over all faces.
|
||||
// Bit of a hack. Additional flag to say whether to maintain master
|
||||
// only (false) or increase set to account for face-from-face.
|
||||
const List<Tuple2<mapType, labelList> >& userFaceData() const
|
||||
{
|
||||
return userFaceData_;
|
||||
}
|
||||
|
||||
List<Tuple2<mapType, labelList> >& userFaceData()
|
||||
{
|
||||
return userFaceData_;
|
||||
}
|
||||
|
||||
|
||||
// Other
|
||||
|
||||
//- Count number of intersections (local)
|
||||
label countHits() const;
|
||||
|
||||
//- Helper function to get decomposition such that all connected
|
||||
// regions get moved onto one processor. Used to prevent baffles
|
||||
// straddling processor boundaries. explicitConnections is to
|
||||
// keep pairs of non-coupled boundary faces together
|
||||
// (e.g. to keep baffles together)
|
||||
labelList decomposeCombineRegions
|
||||
(
|
||||
const scalarField& cellWeights,
|
||||
const boolList& blockedFace,
|
||||
const List<labelPair>& explicitConnections,
|
||||
decompositionMethod&
|
||||
) const;
|
||||
|
||||
//- Redecompose according to cell count
|
||||
// keepZoneFaces : find all faceZones from zoned surfaces and keep
|
||||
// owner and neighbour together
|
||||
// keepBaffles : find all baffles and keep them together
|
||||
autoPtr<mapDistributePolyMesh> balance
|
||||
(
|
||||
const bool keepZoneFaces,
|
||||
const bool keepBaffles,
|
||||
const scalarField& cellWeights,
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor
|
||||
);
|
||||
|
||||
//- Get faces with intersection.
|
||||
labelList intersectedFaces() const;
|
||||
|
||||
//- Get points on surfaces with intersection and boundary faces.
|
||||
labelList intersectedPoints() const;
|
||||
|
||||
//- Create patch from set of patches
|
||||
static autoPtr<indirectPrimitivePatch> makePatch
|
||||
(
|
||||
const polyMesh&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
//- Helper function to make a pointVectorField with correct
|
||||
// bcs for mesh movement:
|
||||
// - adaptPatchIDs : fixedValue
|
||||
// - processor : calculated (so free to move)
|
||||
// - cyclic/wedge/symmetry : slip
|
||||
// - other : slip
|
||||
static tmp<pointVectorField> makeDisplacementField
|
||||
(
|
||||
const pointMesh& pMesh,
|
||||
const labelList& adaptPatchIDs
|
||||
);
|
||||
|
||||
//- Helper function: check that face zones are synced
|
||||
static void checkCoupledFaceZones(const polyMesh&);
|
||||
|
||||
|
||||
// Refinement
|
||||
|
||||
//- Calculate list of cells to refine.
|
||||
labelList refineCandidates
|
||||
(
|
||||
const point& keepPoint,
|
||||
const scalar curvature,
|
||||
|
||||
const PtrList<featureEdgeMesh>& featureMeshes,
|
||||
const labelList& featureLevels,
|
||||
|
||||
const bool featureRefinement,
|
||||
const bool internalRefinement,
|
||||
const bool surfaceRefinement,
|
||||
const bool curvatureRefinement,
|
||||
const label maxGlobalCells,
|
||||
const label maxLocalCells
|
||||
) const;
|
||||
|
||||
//- Refine some cells
|
||||
autoPtr<mapPolyMesh> refine(const labelList& cellsToRefine);
|
||||
|
||||
//- Refine some cells and rebalance
|
||||
autoPtr<mapDistributePolyMesh> refineAndBalance
|
||||
(
|
||||
const string& msg,
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor,
|
||||
const labelList& cellsToRefine,
|
||||
const scalar maxLoadUnbalance
|
||||
);
|
||||
|
||||
//- Balance before refining some cells
|
||||
autoPtr<mapDistributePolyMesh> balanceAndRefine
|
||||
(
|
||||
const string& msg,
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor,
|
||||
const labelList& cellsToRefine,
|
||||
const scalar maxLoadUnbalance
|
||||
);
|
||||
|
||||
|
||||
// Baffle handling
|
||||
|
||||
//- Split off unreachable areas of mesh.
|
||||
void baffleAndSplitMesh
|
||||
(
|
||||
const bool handleSnapProblems,
|
||||
const bool removeEdgeConnectedCells,
|
||||
const scalarField& perpendicularAngle,
|
||||
const bool mergeFreeStanding,
|
||||
const dictionary& motionDict,
|
||||
Time& runTime,
|
||||
const labelList& globalToPatch,
|
||||
const point& keepPoint
|
||||
);
|
||||
|
||||
//- Split off (with optional buffer layers) unreachable areas
|
||||
// of mesh. Does not introduce baffles.
|
||||
autoPtr<mapPolyMesh> splitMesh
|
||||
(
|
||||
const label nBufferLayers,
|
||||
const labelList& globalToPatch,
|
||||
const point& keepPoint
|
||||
);
|
||||
|
||||
//- Find boundary points that connect to more than one cell
|
||||
// region and split them.
|
||||
autoPtr<mapPolyMesh> dupNonManifoldPoints();
|
||||
|
||||
//- Create baffle for every internal face where ownPatch != -1.
|
||||
// External faces get repatched according to ownPatch (neiPatch
|
||||
// should be -1 for these)
|
||||
autoPtr<mapPolyMesh> createBaffles
|
||||
(
|
||||
const labelList& ownPatch,
|
||||
const labelList& neiPatch
|
||||
);
|
||||
|
||||
//- Return a list of coupled face pairs, i.e. faces that
|
||||
// use the same vertices.
|
||||
List<labelPair> getDuplicateFaces(const labelList& testFaces) const;
|
||||
|
||||
//- Merge baffles. Gets pairs of faces.
|
||||
autoPtr<mapPolyMesh> mergeBaffles(const List<labelPair>&);
|
||||
|
||||
//- Put faces/cells into zones according to surface specification.
|
||||
// Returns null if no zone surfaces present. Region containing
|
||||
// the keepPoint will not be put into a cellZone.
|
||||
autoPtr<mapPolyMesh> zonify
|
||||
(
|
||||
const point& keepPoint,
|
||||
const bool allowFreeStandingZoneFaces
|
||||
);
|
||||
|
||||
|
||||
// Other topo changes
|
||||
|
||||
//- Helper:add patch to mesh. Update all registered fields.
|
||||
// Use addMeshedPatch to add patches originating from surfaces.
|
||||
static label addPatch(fvMesh&, const word& name, const word& type);
|
||||
|
||||
//- Add patch originating from meshing. Update meshedPatches_.
|
||||
label addMeshedPatch(const word& name, const word& type);
|
||||
|
||||
//- Get patchIDs for patches added in addMeshedPatch.
|
||||
labelList meshedPatches() const;
|
||||
|
||||
//- Split mesh. Keep part containing point.
|
||||
autoPtr<mapPolyMesh> splitMeshRegions(const point& keepPoint);
|
||||
|
||||
//- Update local numbering for mesh redistribution
|
||||
void distribute(const mapDistributePolyMesh&);
|
||||
|
||||
//- Update for external change to mesh. changedFaces are in new mesh
|
||||
// face labels.
|
||||
void updateMesh
|
||||
(
|
||||
const mapPolyMesh&,
|
||||
const labelList& changedFaces
|
||||
);
|
||||
|
||||
|
||||
// Restoring : is where other processes delete and reinsert data.
|
||||
|
||||
//- Signal points/face/cells for which to store data
|
||||
void storeData
|
||||
(
|
||||
const labelList& pointsToStore,
|
||||
const labelList& facesToStore,
|
||||
const labelList& cellsToStore
|
||||
);
|
||||
|
||||
//- Update local numbering + undo
|
||||
// Data to restore given as new pointlabel + stored pointlabel
|
||||
// (i.e. what was in pointsToStore)
|
||||
void updateMesh
|
||||
(
|
||||
const mapPolyMesh&,
|
||||
const labelList& changedFaces,
|
||||
const Map<label>& pointsToRestore,
|
||||
const Map<label>& facesToRestore,
|
||||
const Map<label>& cellsToRestore
|
||||
);
|
||||
|
||||
|
||||
//- Merge faces on the same patch (usually from exposing refinement)
|
||||
// Returns global number of faces merged.
|
||||
label mergePatchFaces
|
||||
(
|
||||
const scalar minCos,
|
||||
const scalar concaveCos,
|
||||
const labelList& patchIDs
|
||||
);
|
||||
|
||||
//- Remove points not used by any face or points used
|
||||
// by only two faces where the edges are in line
|
||||
autoPtr<mapPolyMesh> mergeEdges(const scalar minCos);
|
||||
|
||||
|
||||
// Debug/IO
|
||||
|
||||
//- Debugging: check that all faces still obey start()>end()
|
||||
void checkData();
|
||||
|
||||
//- Compare two lists over all boundary faces
|
||||
template<class T>
|
||||
void testSyncBoundaryFaceList
|
||||
(
|
||||
const scalar mergeDistance,
|
||||
const string&,
|
||||
const UList<T>&,
|
||||
const UList<T>&
|
||||
) const;
|
||||
|
||||
//- Print some mesh stats.
|
||||
void printMeshInfo(const bool, const string&) const;
|
||||
|
||||
//- Replacement for Time::timeName() : return oldInstance (if
|
||||
// overwrite_)
|
||||
word timeName() const;
|
||||
|
||||
//- Set instance of all local IOobjects
|
||||
void setInstance(const fileName&);
|
||||
|
||||
//- Write mesh and all data
|
||||
bool write() const;
|
||||
|
||||
//- Write refinement level as volScalarFields for postprocessing
|
||||
void dumpRefinementLevel() const;
|
||||
|
||||
//- Debug: Write intersection information to OBJ format
|
||||
void dumpIntersections(const fileName& prefix) const;
|
||||
|
||||
//- Do any one of above IO functions. flag is combination of
|
||||
// writeFlag values.
|
||||
void write(const label flag, const fileName&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "meshRefinementTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -1,246 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "meshRefinement.H"
|
||||
#include "combineFaces.H"
|
||||
#include "directTopoChange.H"
|
||||
#include "removePoints.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Merge faces that are in-line.
|
||||
Foam::label Foam::meshRefinement::mergePatchFaces
|
||||
(
|
||||
const scalar minCos,
|
||||
const scalar concaveCos,
|
||||
const labelList& patchIDs
|
||||
)
|
||||
{
|
||||
// Patch face merging engine
|
||||
combineFaces faceCombiner(mesh_);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
// Pick up all candidate cells on boundary
|
||||
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
|
||||
|
||||
forAll(patchIDs, i)
|
||||
{
|
||||
label patchI = patchIDs[i];
|
||||
|
||||
const polyPatch& patch = patches[patchI];
|
||||
|
||||
if (!patch.coupled())
|
||||
{
|
||||
forAll(patch, i)
|
||||
{
|
||||
boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get all sets of faces that can be merged
|
||||
labelListList mergeSets
|
||||
(
|
||||
faceCombiner.getMergeSets
|
||||
(
|
||||
minCos,
|
||||
concaveCos,
|
||||
boundaryCells
|
||||
)
|
||||
);
|
||||
|
||||
label nFaceSets = returnReduce(mergeSets.size(), sumOp<label>());
|
||||
|
||||
Info<< "mergePatchFaces : Merging " << nFaceSets
|
||||
<< " sets of faces." << endl;
|
||||
|
||||
if (nFaceSets > 0)
|
||||
{
|
||||
// Topology changes container
|
||||
directTopoChange meshMod(mesh_);
|
||||
|
||||
// Merge all faces of a set into the first face of the set. Remove
|
||||
// unused points.
|
||||
faceCombiner.setRefinement(mergeSets, meshMod);
|
||||
|
||||
// Change the mesh (no inflation)
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh_.movePoints(map().preMotionPoints());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete mesh volumes. No other way to do this?
|
||||
mesh_.clearOut();
|
||||
}
|
||||
|
||||
if (overwrite())
|
||||
{
|
||||
mesh_.setInstance(oldInstance());
|
||||
}
|
||||
|
||||
faceCombiner.updateMesh(map);
|
||||
|
||||
// Get the kept faces that need to be recalculated.
|
||||
// Merging two boundary faces might shift the cell centre
|
||||
// (unless the faces are absolutely planar)
|
||||
labelHashSet retestFaces(6*mergeSets.size());
|
||||
|
||||
forAll(mergeSets, setI)
|
||||
{
|
||||
label oldMasterI = mergeSets[setI][0];
|
||||
|
||||
label faceI = map().reverseFaceMap()[oldMasterI];
|
||||
|
||||
// faceI is always uncoupled boundary face
|
||||
const cell& cFaces = mesh_.cells()[mesh_.faceOwner()[faceI]];
|
||||
|
||||
forAll(cFaces, i)
|
||||
{
|
||||
retestFaces.insert(cFaces[i]);
|
||||
}
|
||||
}
|
||||
updateMesh(map, retestFaces.toc());
|
||||
}
|
||||
|
||||
|
||||
return nFaceSets;
|
||||
}
|
||||
|
||||
|
||||
// Remove points not used by any face or points used by only two faces where
|
||||
// the edges are in line
|
||||
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeEdges
|
||||
(
|
||||
const scalar minCos
|
||||
)
|
||||
{
|
||||
// Point removal analysis engine
|
||||
removePoints pointRemover(mesh_);
|
||||
|
||||
// Count usage of points
|
||||
boolList pointCanBeDeleted;
|
||||
label nRemove = pointRemover.countPointUsage(minCos, pointCanBeDeleted);
|
||||
|
||||
Info<< "Removing " << nRemove
|
||||
<< " straight edge points." << endl;
|
||||
|
||||
autoPtr<mapPolyMesh> map;
|
||||
|
||||
if (nRemove > 0)
|
||||
{
|
||||
// Save my local faces that will change. These changed faces might
|
||||
// cause a shift in the cell centre which needs to be retested.
|
||||
// Have to do this before changing mesh since point will be removed.
|
||||
labelHashSet retestOldFaces(nRemove / Pstream::nProcs());
|
||||
|
||||
{
|
||||
const faceList& faces = mesh_.faces();
|
||||
|
||||
forAll(faces, faceI)
|
||||
{
|
||||
const face& f = faces[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (pointCanBeDeleted[f[fp]])
|
||||
{
|
||||
retestOldFaces.insert(faceI);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Topology changes container
|
||||
directTopoChange meshMod(mesh_);
|
||||
|
||||
pointRemover.setRefinement(pointCanBeDeleted, meshMod);
|
||||
|
||||
// Change the mesh (no inflation)
|
||||
map = meshMod.changeMesh(mesh_, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh_.movePoints(map().preMotionPoints());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete mesh volumes. No other way to do this?
|
||||
mesh_.clearOut();
|
||||
}
|
||||
|
||||
if (overwrite())
|
||||
{
|
||||
mesh_.setInstance(oldInstance());
|
||||
}
|
||||
|
||||
pointRemover.updateMesh(map);
|
||||
|
||||
// Get the kept faces that need to be recalculated.
|
||||
labelHashSet retestFaces(6*retestOldFaces.size());
|
||||
|
||||
const cellList& cells = mesh_.cells();
|
||||
|
||||
forAllConstIter(labelHashSet, retestOldFaces, iter)
|
||||
{
|
||||
label faceI = map().reverseFaceMap()[iter.key()];
|
||||
|
||||
const cell& ownFaces = cells[mesh_.faceOwner()[faceI]];
|
||||
|
||||
forAll(ownFaces, i)
|
||||
{
|
||||
retestFaces.insert(ownFaces[i]);
|
||||
}
|
||||
|
||||
if (mesh_.isInternalFace(faceI))
|
||||
{
|
||||
const cell& neiFaces = cells[mesh_.faceNeighbour()[faceI]];
|
||||
|
||||
forAll(neiFaces, i)
|
||||
{
|
||||
retestFaces.insert(neiFaces[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateMesh(map, retestFaces.toc());
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,194 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "meshRefinement.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Add a T entry
|
||||
template<class T> void meshRefinement::updateList
|
||||
(
|
||||
const labelList& newToOld,
|
||||
const T& nullValue,
|
||||
List<T>& elems
|
||||
)
|
||||
{
|
||||
List<T> newElems(newToOld.size(), nullValue);
|
||||
|
||||
forAll(newElems, i)
|
||||
{
|
||||
label oldI = newToOld[i];
|
||||
|
||||
if (oldI >= 0)
|
||||
{
|
||||
newElems[i] = elems[oldI];
|
||||
}
|
||||
}
|
||||
|
||||
elems.transfer(newElems);
|
||||
}
|
||||
|
||||
|
||||
// Compare two lists over all boundary faces
|
||||
template<class T>
|
||||
void meshRefinement::testSyncBoundaryFaceList
|
||||
(
|
||||
const scalar tol,
|
||||
const string& msg,
|
||||
const UList<T>& faceData,
|
||||
const UList<T>& syncedFaceData
|
||||
) const
|
||||
{
|
||||
label nBFaces = mesh_.nFaces() - mesh_.nInternalFaces();
|
||||
|
||||
if (faceData.size() != nBFaces || syncedFaceData.size() != nBFaces)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"meshRefinement::testSyncBoundaryFaceList"
|
||||
"(const scalar, const string&, const List<T>&, const List<T>&)"
|
||||
) << "Boundary faces:" << nBFaces
|
||||
<< " faceData:" << faceData.size()
|
||||
<< " syncedFaceData:" << syncedFaceData.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
label bFaceI = pp.start() - mesh_.nInternalFaces();
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
const T& data = faceData[bFaceI];
|
||||
const T& syncData = syncedFaceData[bFaceI];
|
||||
|
||||
if (mag(data - syncData) > tol)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
|
||||
FatalErrorIn("testSyncFaces")
|
||||
<< msg
|
||||
<< "patchFace:" << i
|
||||
<< " face:" << faceI
|
||||
<< " fc:" << mesh_.faceCentres()[faceI]
|
||||
<< " patch:" << pp.name()
|
||||
<< " faceData:" << data
|
||||
<< " syncedFaceData:" << syncData
|
||||
<< " diff:" << mag(data - syncData)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
bFaceI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//template <class T, class Mesh>
|
||||
template<class GeoField>
|
||||
void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType)
|
||||
{
|
||||
HashTable<const GeoField*> flds
|
||||
(
|
||||
mesh.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
|
||||
iter != flds.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
const GeoField& fld = *iter();
|
||||
|
||||
typename GeoField::GeometricBoundaryField& bfld =
|
||||
const_cast<typename GeoField::GeometricBoundaryField&>
|
||||
(
|
||||
fld.boundaryField()
|
||||
);
|
||||
|
||||
label sz = bfld.size();
|
||||
bfld.setSize(sz+1);
|
||||
bfld.set
|
||||
(
|
||||
sz,
|
||||
GeoField::PatchFieldType::New
|
||||
(
|
||||
patchFieldType,
|
||||
mesh.boundary()[sz],
|
||||
fld.dimensionedInternalField()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Reorder patch field
|
||||
template<class GeoField>
|
||||
void meshRefinement::reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
|
||||
{
|
||||
HashTable<const GeoField*> flds
|
||||
(
|
||||
mesh.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
|
||||
iter != flds.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
const GeoField& fld = *iter();
|
||||
|
||||
typename GeoField::GeometricBoundaryField& bfld =
|
||||
const_cast<typename GeoField::GeometricBoundaryField&>
|
||||
(
|
||||
fld.boundaryField()
|
||||
);
|
||||
|
||||
bfld.reorder(oldToNew);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -1,317 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::refinementSurfaces
|
||||
|
||||
Description
|
||||
Container for data on surfaces used for surface-driven refinement.
|
||||
Contains all the data about the level of refinement needed per
|
||||
surface.
|
||||
|
||||
SourceFiles
|
||||
refinementSurfaces.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef refinementSurfaces_H
|
||||
#define refinementSurfaces_H
|
||||
|
||||
#include "triSurfaceGeoMesh.H"
|
||||
#include "triSurfaceFields.H"
|
||||
#include "vectorList.H"
|
||||
#include "pointIndexHit.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class searchableSurfaces;
|
||||
class shellSurfaces;
|
||||
class triSurfaceMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class refinementSurfaces Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class refinementSurfaces
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to all geometry.
|
||||
const searchableSurfaces& allGeometry_;
|
||||
|
||||
//- Indices of surfaces that are refinement ones
|
||||
labelList surfaces_;
|
||||
|
||||
//- Surface name (word)
|
||||
wordList names_;
|
||||
|
||||
//- Per 'interface' surface : name of faceZone to put faces into
|
||||
wordList faceZoneNames_;
|
||||
|
||||
//- Per 'interface' surface : name of cellZone to put cells into
|
||||
wordList cellZoneNames_;
|
||||
|
||||
//- Per 'interface' surface : (only used if surface is closed)
|
||||
// whether to zone cells inside or outside surface.
|
||||
boolList zoneInside_;
|
||||
|
||||
|
||||
//- From local region number to global region number
|
||||
labelList regionOffset_;
|
||||
|
||||
//- From global region number to refinement level
|
||||
labelList minLevel_;
|
||||
|
||||
//- From global region number to refinement level
|
||||
labelList maxLevel_;
|
||||
|
||||
//- From global region number to perpendicular angle
|
||||
scalarField perpendicularAngle_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
refinementSurfaces(const refinementSurfaces&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const refinementSurfaces&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from surfaces and dictionaries
|
||||
refinementSurfaces
|
||||
(
|
||||
const searchableSurfaces& allGeometry,
|
||||
const PtrList<dictionary>&
|
||||
);
|
||||
|
||||
//- Construct from surfaces and dictionary
|
||||
refinementSurfaces
|
||||
(
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
const searchableSurfaces& geometry() const
|
||||
{
|
||||
return allGeometry_;
|
||||
}
|
||||
|
||||
const labelList& surfaces() const
|
||||
{
|
||||
return surfaces_;
|
||||
}
|
||||
|
||||
//- Names of surfaces
|
||||
const wordList& names() const
|
||||
{
|
||||
return names_;
|
||||
}
|
||||
|
||||
//- Per 'interface' surface : name of faceZone to put faces into
|
||||
const wordList& faceZoneNames() const
|
||||
{
|
||||
return faceZoneNames_;
|
||||
}
|
||||
|
||||
//- Per 'interface' surface : name of cellZone to put cells into
|
||||
const wordList& cellZoneNames() const
|
||||
{
|
||||
return cellZoneNames_;
|
||||
}
|
||||
|
||||
//- Get indices of unnamed surfaces (surfaces without faceZoneName)
|
||||
labelList getUnnamedSurfaces() const;
|
||||
|
||||
//- Get indices of named surfaces (surfaces with faceZoneName)
|
||||
labelList getNamedSurfaces() const;
|
||||
|
||||
//- Get indices of closed named surfaces
|
||||
labelList getClosedNamedSurfaces() const;
|
||||
|
||||
//- From local region number to global region number
|
||||
const labelList& regionOffset() const
|
||||
{
|
||||
return regionOffset_;
|
||||
}
|
||||
|
||||
//- From global region number to refinement level
|
||||
const labelList& minLevel() const
|
||||
{
|
||||
return minLevel_;
|
||||
}
|
||||
|
||||
//- From global region number to refinement level
|
||||
const labelList& maxLevel() const
|
||||
{
|
||||
return maxLevel_;
|
||||
}
|
||||
|
||||
//- From global region number to perpendicular angle
|
||||
const scalarField& perpendicularAngle() const
|
||||
{
|
||||
return perpendicularAngle_;
|
||||
}
|
||||
|
||||
|
||||
// Helper
|
||||
|
||||
//- From surface and region on surface to global region
|
||||
label globalRegion(const label surfI, const label regionI) const
|
||||
{
|
||||
return regionOffset_[surfI]+regionI;
|
||||
}
|
||||
|
||||
//- Min level for surface and region on surface
|
||||
label minLevel(const label surfI, const label regionI) const
|
||||
{
|
||||
return minLevel_[globalRegion(surfI, regionI)];
|
||||
}
|
||||
|
||||
//- Max level for surface and region on surface
|
||||
label maxLevel(const label surfI, const label regionI) const
|
||||
{
|
||||
return maxLevel_[globalRegion(surfI, regionI)];
|
||||
}
|
||||
|
||||
label nRegions() const
|
||||
{
|
||||
return minLevel_.size();
|
||||
}
|
||||
|
||||
//- Calculate minLevelFields
|
||||
void setMinLevelFields
|
||||
(
|
||||
const shellSurfaces& shells
|
||||
);
|
||||
|
||||
////- Helper: count number of triangles per region
|
||||
//static labelList countRegions(const triSurface&);
|
||||
|
||||
|
||||
// Searching
|
||||
|
||||
//- Find intersection of edge. Return -1 or first surface
|
||||
// with higher (than currentLevel) minlevel.
|
||||
// Return surface number and level.
|
||||
void findHigherIntersection
|
||||
(
|
||||
const pointField& start,
|
||||
const pointField& end,
|
||||
const labelList& currentLevel, // current cell refinement level
|
||||
|
||||
labelList& surfaces,
|
||||
labelList& surfaceLevel
|
||||
) const;
|
||||
|
||||
//- Find all intersections of edge. Unsorted order.
|
||||
void findAllHigherIntersections
|
||||
(
|
||||
const pointField& start,
|
||||
const pointField& end,
|
||||
const labelList& currentLevel, // current cell refinement level
|
||||
|
||||
List<vectorList>& surfaceNormal,
|
||||
labelListList& surfaceLevel
|
||||
) const;
|
||||
|
||||
//- Find intersection nearest to the endpoints. surface1,2 are
|
||||
// not indices into surfacesToTest but refinement surface indices.
|
||||
// Returns surface, region on surface (so not global surface)
|
||||
// and position on surface.
|
||||
void findNearestIntersection
|
||||
(
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& start,
|
||||
const pointField& end,
|
||||
|
||||
labelList& surface1,
|
||||
List<pointIndexHit>& hit1,
|
||||
labelList& region1,
|
||||
labelList& surface2,
|
||||
List<pointIndexHit>& hit2,
|
||||
labelList& region2
|
||||
) const;
|
||||
|
||||
//- Used for debugging only: find intersection of edge.
|
||||
void findAnyIntersection
|
||||
(
|
||||
const pointField& start,
|
||||
const pointField& end,
|
||||
labelList& surfaces,
|
||||
List<pointIndexHit>&
|
||||
) const;
|
||||
|
||||
//- Find nearest point on surfaces.
|
||||
void findNearest
|
||||
(
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
labelList& surfaces,
|
||||
List<pointIndexHit>&
|
||||
) const;
|
||||
|
||||
//- Find nearest point on surfaces. Return surface and region on
|
||||
// surface (so not global surface)
|
||||
void findNearestRegion
|
||||
(
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
labelList& hitSurface,
|
||||
labelList& hitRegion
|
||||
) const;
|
||||
|
||||
//- Detect if a point is 'inside' (closed) surfaces.
|
||||
// Returns -1 if not, returns first surface it is.
|
||||
void findInside
|
||||
(
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& pt,
|
||||
labelList& insideSurfaces
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,481 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "searchableSurface.H"
|
||||
#include "shellSurfaces.H"
|
||||
#include "boundBox.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
#include "refinementSurfaces.H"
|
||||
#include "searchableSurfaces.H"
|
||||
#include "orientedSurface.H"
|
||||
#include "pointIndexHit.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<>
|
||||
const char*
|
||||
NamedEnum<shellSurfaces::refineMode, 3>::
|
||||
names[] =
|
||||
{
|
||||
"inside",
|
||||
"outside",
|
||||
"distance"
|
||||
};
|
||||
|
||||
const NamedEnum<shellSurfaces::refineMode, 3> shellSurfaces::refineModeNames_;
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::shellSurfaces::setAndCheckLevels
|
||||
(
|
||||
const label shellI,
|
||||
const List<Tuple2<scalar, label> >& distLevels
|
||||
)
|
||||
{
|
||||
if (modes_[shellI] != DISTANCE && distLevels.size() != 1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"shellSurfaces::shellSurfaces"
|
||||
"(const searchableSurfaces&, const dictionary&)"
|
||||
) << "For refinement mode "
|
||||
<< refineModeNames_[modes_[shellI]]
|
||||
<< " specify only one distance+level."
|
||||
<< " (its distance gets discarded)"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
// Extract information into separate distance and level
|
||||
distances_[shellI].setSize(distLevels.size());
|
||||
levels_[shellI].setSize(distLevels.size());
|
||||
|
||||
forAll(distLevels, j)
|
||||
{
|
||||
distances_[shellI][j] = distLevels[j].first();
|
||||
levels_[shellI][j] = distLevels[j].second();
|
||||
|
||||
// Check in incremental order
|
||||
if (j > 0)
|
||||
{
|
||||
if
|
||||
(
|
||||
(distances_[shellI][j] <= distances_[shellI][j-1])
|
||||
|| (levels_[shellI][j] > levels_[shellI][j-1])
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"shellSurfaces::shellSurfaces"
|
||||
"(const searchableSurfaces&, const dictionary&)"
|
||||
) << "For refinement mode "
|
||||
<< refineModeNames_[modes_[shellI]]
|
||||
<< " : Refinement should be specified in order"
|
||||
<< " of increasing distance"
|
||||
<< " (and decreasing refinement level)." << endl
|
||||
<< "Distance:" << distances_[shellI][j]
|
||||
<< " refinementLevel:" << levels_[shellI][j]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const searchableSurface& shell = allGeometry_[shells_[shellI]];
|
||||
|
||||
if (modes_[shellI] == DISTANCE)
|
||||
{
|
||||
Info<< "Refinement level according to distance to "
|
||||
<< shell.name() << endl;
|
||||
forAll(levels_[shellI], j)
|
||||
{
|
||||
Info<< " level " << levels_[shellI][j]
|
||||
<< " for all cells within " << distances_[shellI][j]
|
||||
<< " meter." << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!allGeometry_[shells_[shellI]].hasVolumeType())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"shellSurfaces::shellSurfaces"
|
||||
"(const searchableSurfaces&"
|
||||
", const PtrList<dictionary>&)"
|
||||
) << "Shell " << shell.name()
|
||||
<< " does not support testing for "
|
||||
<< refineModeNames_[modes_[shellI]] << endl
|
||||
<< "Probably it is not closed."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (modes_[shellI] == INSIDE)
|
||||
{
|
||||
Info<< "Refinement level " << levels_[shellI][0]
|
||||
<< " for all cells inside " << shell.name() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Refinement level " << levels_[shellI][0]
|
||||
<< " for all cells outside " << shell.name() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Specifically orient triSurfaces using a calculated point outside.
|
||||
// Done since quite often triSurfaces not of consistent orientation which
|
||||
// is (currently) necessary for sideness calculation
|
||||
void Foam::shellSurfaces::orient()
|
||||
{
|
||||
// Determine outside point.
|
||||
boundBox overallBb = boundBox::invertedBox;
|
||||
|
||||
bool hasSurface = false;
|
||||
|
||||
forAll(shells_, shellI)
|
||||
{
|
||||
const searchableSurface& s = allGeometry_[shells_[shellI]];
|
||||
|
||||
if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
|
||||
{
|
||||
const triSurfaceMesh& shell = refCast<const triSurfaceMesh>(s);
|
||||
|
||||
if (shell.triSurface::size())
|
||||
{
|
||||
const pointField& points = shell.points();
|
||||
|
||||
hasSurface = true;
|
||||
|
||||
boundBox shellBb(points[0], points[0]);
|
||||
// Assume surface is compact!
|
||||
for (label i = 0; i < points.size(); i++)
|
||||
{
|
||||
const point& pt = points[i];
|
||||
shellBb.min() = min(shellBb.min(), pt);
|
||||
shellBb.max() = max(shellBb.max(), pt);
|
||||
}
|
||||
|
||||
overallBb.min() = min(overallBb.min(), shellBb.min());
|
||||
overallBb.max() = max(overallBb.max(), shellBb.max());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSurface)
|
||||
{
|
||||
const point outsidePt = overallBb.max() + overallBb.span();
|
||||
|
||||
//Info<< "Using point " << outsidePt << " to orient shells" << endl;
|
||||
|
||||
forAll(shells_, shellI)
|
||||
{
|
||||
const searchableSurface& s = allGeometry_[shells_[shellI]];
|
||||
|
||||
if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
|
||||
{
|
||||
triSurfaceMesh& shell = const_cast<triSurfaceMesh&>
|
||||
(
|
||||
refCast<const triSurfaceMesh>(s)
|
||||
);
|
||||
|
||||
// Flip surface so outsidePt is outside.
|
||||
bool anyFlipped = orientedSurface::orient
|
||||
(
|
||||
shell,
|
||||
outsidePt,
|
||||
true
|
||||
);
|
||||
|
||||
if (anyFlipped)
|
||||
{
|
||||
// orientedSurface will have done a clearOut of the surface.
|
||||
// we could do a clearout of the triSurfaceMeshes::trees()
|
||||
// but these aren't affected by orientation
|
||||
// (except for cached
|
||||
// sideness which should not be set at this point.
|
||||
// !!Should check!)
|
||||
|
||||
Info<< "shellSurfaces : Flipped orientation of surface "
|
||||
<< s.name()
|
||||
<< " so point " << outsidePt << " is outside." << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Find maximum level of a shell.
|
||||
void Foam::shellSurfaces::findHigherLevel
|
||||
(
|
||||
const pointField& pt,
|
||||
const label shellI,
|
||||
labelList& maxLevel
|
||||
) const
|
||||
{
|
||||
const labelList& levels = levels_[shellI];
|
||||
|
||||
if (modes_[shellI] == DISTANCE)
|
||||
{
|
||||
// Distance mode.
|
||||
|
||||
const scalarField& distances = distances_[shellI];
|
||||
|
||||
// Collect all those points that have a current maxLevel less than
|
||||
// (any of) the shell. Also collect the furthest distance allowable
|
||||
// to any shell with a higher level.
|
||||
|
||||
pointField candidates(pt.size());
|
||||
labelList candidateMap(pt.size());
|
||||
scalarField candidateDistSqr(pt.size());
|
||||
label candidateI = 0;
|
||||
|
||||
forAll(maxLevel, pointI)
|
||||
{
|
||||
forAllReverse(levels, levelI)
|
||||
{
|
||||
if (levels[levelI] > maxLevel[pointI])
|
||||
{
|
||||
candidates[candidateI] = pt[pointI];
|
||||
candidateMap[candidateI] = pointI;
|
||||
candidateDistSqr[candidateI] = sqr(distances[levelI]);
|
||||
candidateI++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
candidates.setSize(candidateI);
|
||||
candidateMap.setSize(candidateI);
|
||||
candidateDistSqr.setSize(candidateI);
|
||||
|
||||
// Do the expensive nearest test only for the candidate points.
|
||||
List<pointIndexHit> nearInfo;
|
||||
allGeometry_[shells_[shellI]].findNearest
|
||||
(
|
||||
candidates,
|
||||
candidateDistSqr,
|
||||
nearInfo
|
||||
);
|
||||
|
||||
// Update maxLevel
|
||||
forAll(nearInfo, candidateI)
|
||||
{
|
||||
if (nearInfo[candidateI].hit())
|
||||
{
|
||||
// Check which level it actually is in.
|
||||
label minDistI = findLower
|
||||
(
|
||||
distances,
|
||||
mag(nearInfo[candidateI].hitPoint()-candidates[candidateI])
|
||||
);
|
||||
|
||||
label pointI = candidateMap[candidateI];
|
||||
|
||||
// pt is inbetween shell[minDistI] and shell[minDistI+1]
|
||||
maxLevel[pointI] = levels[minDistI+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inside/outside mode
|
||||
|
||||
// Collect all those points that have a current maxLevel less than the
|
||||
// shell.
|
||||
|
||||
pointField candidates(pt.size());
|
||||
labelList candidateMap(pt.size());
|
||||
label candidateI = 0;
|
||||
|
||||
forAll(maxLevel, pointI)
|
||||
{
|
||||
if (levels[0] > maxLevel[pointI])
|
||||
{
|
||||
candidates[candidateI] = pt[pointI];
|
||||
candidateMap[candidateI] = pointI;
|
||||
candidateI++;
|
||||
}
|
||||
}
|
||||
candidates.setSize(candidateI);
|
||||
candidateMap.setSize(candidateI);
|
||||
|
||||
// Do the expensive nearest test only for the candidate points.
|
||||
List<searchableSurface::volumeType> volType;
|
||||
allGeometry_[shells_[shellI]].getVolumeType(candidates, volType);
|
||||
|
||||
forAll(volType, i)
|
||||
{
|
||||
label pointI = candidateMap[i];
|
||||
|
||||
if
|
||||
(
|
||||
(
|
||||
modes_[shellI] == INSIDE
|
||||
&& volType[i] == searchableSurface::INSIDE
|
||||
)
|
||||
|| (
|
||||
modes_[shellI] == OUTSIDE
|
||||
&& volType[i] == searchableSurface::OUTSIDE
|
||||
)
|
||||
)
|
||||
{
|
||||
maxLevel[pointI] = levels[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::shellSurfaces::shellSurfaces
|
||||
(
|
||||
const searchableSurfaces& allGeometry,
|
||||
const PtrList<dictionary>& shellDicts
|
||||
)
|
||||
:
|
||||
allGeometry_(allGeometry)
|
||||
{
|
||||
shells_.setSize(shellDicts.size());
|
||||
modes_.setSize(shellDicts.size());
|
||||
distances_.setSize(shellDicts.size());
|
||||
levels_.setSize(shellDicts.size());
|
||||
|
||||
forAll(shellDicts, shellI)
|
||||
{
|
||||
const dictionary& dict = shellDicts[shellI];
|
||||
const word name = dict.lookup("name");
|
||||
const word type = dict.lookup("type");
|
||||
|
||||
shells_[shellI] = allGeometry_.findSurfaceID(name);
|
||||
|
||||
if (shells_[shellI] == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"shellSurfaces::shellSurfaces"
|
||||
"(const searchableSurfaces&, const PtrList<dictionary>&)"
|
||||
) << "No surface called " << name << endl
|
||||
<< "Valid surfaces are " << allGeometry_.names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
modes_[shellI] = refineModeNames_.read(dict.lookup("refineMode"));
|
||||
|
||||
// Read pairs of distance+level
|
||||
setAndCheckLevels(shellI, dict.lookup("levels"));
|
||||
}
|
||||
|
||||
// Orient shell surfaces before any searching is done. Note that this
|
||||
// only needs to be done for inside or outside. Orienting surfaces
|
||||
// constructs lots of addressing which we want to avoid.
|
||||
orient();
|
||||
}
|
||||
|
||||
|
||||
Foam::shellSurfaces::shellSurfaces
|
||||
(
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& shellsDict
|
||||
)
|
||||
:
|
||||
allGeometry_(allGeometry)
|
||||
{
|
||||
shells_.setSize(shellsDict.size());
|
||||
modes_.setSize(shellsDict.size());
|
||||
distances_.setSize(shellsDict.size());
|
||||
levels_.setSize(shellsDict.size());
|
||||
|
||||
label shellI = 0;
|
||||
forAllConstIter(dictionary, shellsDict, iter)
|
||||
{
|
||||
shells_[shellI] = allGeometry_.findSurfaceID(iter().keyword());
|
||||
|
||||
if (shells_[shellI] == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"shellSurfaces::shellSurfaces"
|
||||
"(const searchableSurfaces&, const dictionary>&"
|
||||
) << "No surface called " << iter().keyword() << endl
|
||||
<< "Valid surfaces are " << allGeometry_.names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
const dictionary& dict = shellsDict.subDict(iter().keyword());
|
||||
|
||||
modes_[shellI] = refineModeNames_.read(dict.lookup("mode"));
|
||||
|
||||
// Read pairs of distance+level
|
||||
setAndCheckLevels(shellI, dict.lookup("levels"));
|
||||
|
||||
shellI++;
|
||||
}
|
||||
|
||||
// Orient shell surfaces before any searching is done. Note that this
|
||||
// only needs to be done for inside or outside. Orienting surfaces
|
||||
// constructs lots of addressing which we want to avoid.
|
||||
orient();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Highest shell level
|
||||
Foam::label Foam::shellSurfaces::maxLevel() const
|
||||
{
|
||||
label overallMax = 0;
|
||||
forAll(levels_, shellI)
|
||||
{
|
||||
overallMax = max(overallMax, max(levels_[shellI]));
|
||||
}
|
||||
return overallMax;
|
||||
}
|
||||
|
||||
|
||||
void Foam::shellSurfaces::findHigherLevel
|
||||
(
|
||||
const pointField& pt,
|
||||
const labelList& ptLevel,
|
||||
labelList& maxLevel
|
||||
) const
|
||||
{
|
||||
// Maximum level of any shell. Start off with level of point.
|
||||
maxLevel = ptLevel;
|
||||
|
||||
forAll(shells_, shellI)
|
||||
{
|
||||
findHigherLevel(pt, shellI, maxLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,181 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::shellSurfaces
|
||||
|
||||
Description
|
||||
Encapsulates queries for volume refinement ('refine all cells within
|
||||
shell').
|
||||
|
||||
SourceFiles
|
||||
shellSurfaces.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef shellSurfaces_H
|
||||
#define shellSurfaces_H
|
||||
|
||||
#include "searchableSurface.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class searchableSurfaces;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class shellSurfaces Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class shellSurfaces
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data types
|
||||
|
||||
//- Volume refinement controls
|
||||
enum refineMode
|
||||
{
|
||||
INSIDE, // Refine all inside shell
|
||||
OUTSIDE, // ,, outside
|
||||
DISTANCE // Refine based on distance to shell
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to all geometry.
|
||||
const searchableSurfaces& allGeometry_;
|
||||
|
||||
//- Indices of surfaces that are shells
|
||||
labelList shells_;
|
||||
|
||||
//- Per shell whether to refine inside or outside
|
||||
List<refineMode> modes_;
|
||||
|
||||
//- Per shell the list of ranges
|
||||
List<scalarField> distances_;
|
||||
|
||||
//- Per shell per distance the refinement level
|
||||
labelListList levels_;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- refineMode names
|
||||
static const NamedEnum<refineMode, 3> refineModeNames_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Helper function for initialisation.
|
||||
void setAndCheckLevels
|
||||
(
|
||||
const label shellI,
|
||||
const List<Tuple2<scalar, label> >&
|
||||
);
|
||||
|
||||
void orient();
|
||||
|
||||
void findHigherLevel
|
||||
(
|
||||
const pointField& pt,
|
||||
const label shellI,
|
||||
labelList& maxLevel
|
||||
) const;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
shellSurfaces
|
||||
(
|
||||
const searchableSurfaces& allGeometry,
|
||||
const labelList& shells,
|
||||
const List<refineMode>& modes,
|
||||
const List<scalarField>& distances,
|
||||
const labelListList& levels
|
||||
);
|
||||
|
||||
//- Construct from geometry and dictionaries
|
||||
shellSurfaces
|
||||
(
|
||||
const searchableSurfaces& allGeometry,
|
||||
const PtrList<dictionary>& shellDicts
|
||||
);
|
||||
|
||||
//- Construct from geometry and dictionary
|
||||
shellSurfaces
|
||||
(
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& shellsDict
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//const List<scalarField>& distances() const
|
||||
//{
|
||||
// return distances_;
|
||||
//}
|
||||
//
|
||||
////- Per shell per distance the refinement level
|
||||
//const labelListList& levels() const
|
||||
//{
|
||||
// return levels_;
|
||||
//}
|
||||
|
||||
|
||||
// Query
|
||||
|
||||
//- Highest shell level
|
||||
label maxLevel() const;
|
||||
|
||||
//- Find shell level higher than ptLevel
|
||||
void findHigherLevel
|
||||
(
|
||||
const pointField& pt,
|
||||
const labelList& ptLevel,
|
||||
labelList& maxLevel
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,261 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ExactParticle.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class ParticleType>
|
||||
template<class TrackingData>
|
||||
Foam::label Foam::ExactParticle<ParticleType>::track
|
||||
(
|
||||
const vector& endPosition,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
this->facei_ = -1;
|
||||
|
||||
// Tracks to endPosition or stop on boundary
|
||||
while (!this->onBoundary() && this->stepFraction_ < 1.0 - SMALL)
|
||||
{
|
||||
this->stepFraction_ +=
|
||||
trackToFace(endPosition, td)
|
||||
*(1.0 - this->stepFraction_);
|
||||
}
|
||||
|
||||
return this->facei_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParticleType>
|
||||
Foam::label Foam::ExactParticle<ParticleType>::track
|
||||
(
|
||||
const vector& endPosition
|
||||
)
|
||||
{
|
||||
int dummyTd;
|
||||
return track(endPosition, dummyTd);
|
||||
}
|
||||
|
||||
|
||||
template<class ParticleType>
|
||||
template<class TrackingData>
|
||||
Foam::scalar Foam::ExactParticle<ParticleType>::trackToFace
|
||||
(
|
||||
const vector& endPosition,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const polyMesh& mesh = this->cloud().pMesh();
|
||||
const labelList& cFaces = mesh.cells()[this->celli_];
|
||||
|
||||
point intersection(vector::zero);
|
||||
scalar trackFraction = VGREAT;
|
||||
label hitFacei = -1;
|
||||
|
||||
const vector vec = endPosition-this->position_;
|
||||
|
||||
forAll(cFaces, i)
|
||||
{
|
||||
label facei = cFaces[i];
|
||||
|
||||
if (facei != this->face())
|
||||
{
|
||||
pointHit inter = mesh.faces()[facei].fastIntersection
|
||||
(
|
||||
this->position_,
|
||||
vec,
|
||||
mesh.faceCentres()[facei],
|
||||
mesh.points(),
|
||||
intersection::HALF_RAY
|
||||
);
|
||||
|
||||
if (inter.hit() && inter.distance() < trackFraction)
|
||||
{
|
||||
trackFraction = inter.distance();
|
||||
hitFacei = facei;
|
||||
intersection = inter.hitPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hitFacei == -1)
|
||||
{
|
||||
// Did not find any intersection. Fall back to original approximate
|
||||
// algorithm
|
||||
return Particle<ParticleType>::trackToFace
|
||||
(
|
||||
endPosition,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
if (trackFraction >= (1.0-SMALL))
|
||||
{
|
||||
// Nearest intersection beyond endPosition so we hit endPosition.
|
||||
trackFraction = 1.0;
|
||||
this->position_ = endPosition;
|
||||
this->facei_ = -1;
|
||||
return 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->position_ = intersection;
|
||||
this->facei_ = hitFacei;
|
||||
}
|
||||
|
||||
|
||||
// Normal situation (trackFraction 0..1). Straight copy
|
||||
// of Particle::trackToFace.
|
||||
|
||||
bool internalFace = this->cloud().internalFace(this->facei_);
|
||||
|
||||
// change cell
|
||||
if (internalFace) // Internal face
|
||||
{
|
||||
if (this->celli_ == mesh.faceOwner()[this->facei_])
|
||||
{
|
||||
this->celli_ = mesh.faceNeighbour()[this->facei_];
|
||||
}
|
||||
else if (this->celli_ == mesh.faceNeighbour()[this->facei_])
|
||||
{
|
||||
this->celli_ = mesh.faceOwner()[this->facei_];
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"ExactParticle::trackToFace"
|
||||
"(const vector&, TrackingData&)"
|
||||
)<< "addressing failure" << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ParticleType& p = static_cast<ParticleType&>(*this);
|
||||
|
||||
// Soft-sphere algorithm ignores the boundary
|
||||
if (p.softImpact())
|
||||
{
|
||||
trackFraction = 1.0;
|
||||
this->position_ = endPosition;
|
||||
}
|
||||
|
||||
label patchi = this->patch(this->facei_);
|
||||
const polyPatch& patch = mesh.boundaryMesh()[patchi];
|
||||
|
||||
if (isA<wedgePolyPatch>(patch))
|
||||
{
|
||||
p.hitWedgePatch
|
||||
(
|
||||
static_cast<const wedgePolyPatch&>(patch), td
|
||||
);
|
||||
}
|
||||
else if (isA<symmetryPolyPatch>(patch))
|
||||
{
|
||||
p.hitSymmetryPatch
|
||||
(
|
||||
static_cast<const symmetryPolyPatch&>(patch), td
|
||||
);
|
||||
}
|
||||
else if (isA<cyclicPolyPatch>(patch))
|
||||
{
|
||||
p.hitCyclicPatch
|
||||
(
|
||||
static_cast<const cyclicPolyPatch&>(patch), td
|
||||
);
|
||||
}
|
||||
else if (isA<processorPolyPatch>(patch))
|
||||
{
|
||||
p.hitProcessorPatch
|
||||
(
|
||||
static_cast<const processorPolyPatch&>(patch), td
|
||||
);
|
||||
}
|
||||
else if (isA<wallPolyPatch>(patch))
|
||||
{
|
||||
p.hitWallPatch
|
||||
(
|
||||
static_cast<const wallPolyPatch&>(patch), td
|
||||
);
|
||||
}
|
||||
else if (isA<polyPatch>(patch))
|
||||
{
|
||||
p.hitPatch
|
||||
(
|
||||
static_cast<const polyPatch&>(patch), td
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"ExactParticle::trackToFace"
|
||||
"(const vector& endPosition, scalar& trackFraction)"
|
||||
)<< "patch type " << patch.type() << " not suported" << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// If the trackFraction = 0 something went wrong.
|
||||
// Either the particle is flipping back and forth across a face perhaps
|
||||
// due to velocity interpolation errors or it is in a "hole" in the mesh
|
||||
// caused by face warpage.
|
||||
// In both cases resolve the positional ambiguity by moving the particle
|
||||
// slightly towards the cell-centre.
|
||||
if (trackFraction < SMALL)
|
||||
{
|
||||
this->position_ +=
|
||||
1.0e-6*(mesh.cellCentres()[this->celli_] - this->position_);
|
||||
}
|
||||
|
||||
return trackFraction;
|
||||
}
|
||||
|
||||
|
||||
template<class ParticleType>
|
||||
Foam::scalar Foam::ExactParticle<ParticleType>::trackToFace
|
||||
(
|
||||
const vector& endPosition
|
||||
)
|
||||
{
|
||||
int dummyTd;
|
||||
return trackToFace(endPosition, dummyTd);
|
||||
}
|
||||
|
||||
|
||||
template<class ParticleType>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const ExactParticle<ParticleType>& p
|
||||
)
|
||||
{
|
||||
return operator<<(os, static_cast<const Particle<ParticleType>&>(p));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,192 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::ExactParticle
|
||||
|
||||
Description
|
||||
Special version of Particle to do tracking on non-convex cells.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ExactParticle_H
|
||||
#define ExactParticle_H
|
||||
|
||||
#include "face.H"
|
||||
#include "Particle.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class ExactParticle>
|
||||
class Cloud;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class ParticleType>
|
||||
class ExactParticle;
|
||||
|
||||
template<class ParticleType>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const ExactParticle<ParticleType>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ExactParticle Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ParticleType>
|
||||
class ExactParticle
|
||||
:
|
||||
public Particle<ParticleType>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
friend class Cloud<ParticleType>;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
ExactParticle
|
||||
(
|
||||
const Cloud<ParticleType>& cloud,
|
||||
const vector& position,
|
||||
const label celli
|
||||
)
|
||||
:
|
||||
Particle<ParticleType>(cloud, position, celli)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from Istream
|
||||
ExactParticle
|
||||
(
|
||||
const Cloud<ParticleType>& cloud,
|
||||
Istream& is,
|
||||
bool readFields = true
|
||||
)
|
||||
:
|
||||
Particle<ParticleType>(cloud, is, readFields)
|
||||
{}
|
||||
|
||||
|
||||
//- Factory class to read-construct particles used for parallel transfer
|
||||
class iNew
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
const Cloud<ParticleType>& cloud_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
iNew(const Cloud<ParticleType>& cloud)
|
||||
:
|
||||
cloud_(cloud)
|
||||
{}
|
||||
|
||||
autoPtr<ParticleType> operator()(Istream& is) const
|
||||
{
|
||||
return autoPtr<ParticleType>
|
||||
(
|
||||
new ParticleType(cloud_, is)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~ExactParticle()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Track particle to end of trajectory
|
||||
// or until it hits the boundary.
|
||||
// On entry 'stepFraction()' should be set to the fraction of the
|
||||
// time-step at which the tracking starts and on exit it contains
|
||||
// the fraction of the time-step completed.
|
||||
// Returns the boundary face index if the track stops at the
|
||||
// boundary, -1 otherwise.
|
||||
template<class TrackingData>
|
||||
label track
|
||||
(
|
||||
const vector& endPosition,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Calls the templated track with dummy TrackingData
|
||||
label track(const vector& endPosition);
|
||||
|
||||
//- Track particle to a given position and returns 1.0 if the
|
||||
// trajectory is completed without hitting a face otherwise
|
||||
// stops at the face and returns the fraction of the trajectory
|
||||
// completed.
|
||||
// on entry 'stepFraction()' should be set to the fraction of the
|
||||
// time-step at which the tracking starts.
|
||||
template<class TrackingData>
|
||||
scalar trackToFace
|
||||
(
|
||||
const vector& endPosition,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Calls the templated trackToFace with dummy TrackingData
|
||||
scalar trackToFace(const vector& endPosition);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <ParticleType>
|
||||
(
|
||||
Ostream&,
|
||||
const ExactParticle<ParticleType>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ExactParticle.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,282 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "trackedParticle.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
//- Construct from components
|
||||
Foam::trackedParticle::trackedParticle
|
||||
(
|
||||
const Cloud<trackedParticle>& c,
|
||||
const vector& position,
|
||||
const label celli,
|
||||
const point& end,
|
||||
const label level,
|
||||
const label i,
|
||||
const label j
|
||||
)
|
||||
:
|
||||
ExactParticle<trackedParticle>(c, position, celli),
|
||||
end_(end),
|
||||
level_(level),
|
||||
i_(i),
|
||||
j_(j)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from Istream
|
||||
Foam::trackedParticle::trackedParticle
|
||||
(
|
||||
const Cloud<trackedParticle>& c,
|
||||
Istream& is,
|
||||
bool readFields
|
||||
)
|
||||
:
|
||||
ExactParticle<trackedParticle>(c, is, readFields)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
is >> end_;
|
||||
level_ = readLabel(is);
|
||||
i_ = readLabel(is);
|
||||
j_ = readLabel(is);
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&end_),
|
||||
sizeof(end_) + sizeof(level_) + sizeof(i_) + sizeof(j_)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"trackedParticle::trackedParticle"
|
||||
"(const Cloud<trackedParticle>&, Istream&, bool)"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::trackedParticle::move(trackedParticle::trackData& td)
|
||||
{
|
||||
td.switchProcessor = false;
|
||||
td.keepParticle = true;
|
||||
|
||||
scalar deltaT = cloud().pMesh().time().deltaT().value();
|
||||
scalar tEnd = (1.0 - stepFraction())*deltaT;
|
||||
scalar dtMax = tEnd;
|
||||
|
||||
while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
|
||||
{
|
||||
// set the lagrangian time-step
|
||||
scalar dt = min(dtMax, tEnd);
|
||||
|
||||
// mark visited cell with max level.
|
||||
td.maxLevel()[cell()] = max(td.maxLevel()[cell()], level_);
|
||||
|
||||
dt *= trackToFace(end_, td);
|
||||
|
||||
tEnd -= dt;
|
||||
stepFraction() = 1.0 - tEnd/deltaT;
|
||||
}
|
||||
|
||||
return td.keepParticle;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::trackedParticle::hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
trackedParticle::trackData& td,
|
||||
const label patchI
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::trackedParticle::hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
int&,
|
||||
const label
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitWedgePatch
|
||||
(
|
||||
const wedgePolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitWedgePatch
|
||||
(
|
||||
const wedgePolyPatch&,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitSymmetryPatch
|
||||
(
|
||||
const symmetryPolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitSymmetryPatch
|
||||
(
|
||||
const symmetryPolyPatch&,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitCyclicPatch
|
||||
(
|
||||
const cyclicPolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitCyclicPatch
|
||||
(
|
||||
const cyclicPolyPatch&,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.switchProcessor = true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitWallPatch
|
||||
(
|
||||
const wallPolyPatch& wpp,
|
||||
trackedParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitWallPatch
|
||||
(
|
||||
const wallPolyPatch& wpp,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitPatch
|
||||
(
|
||||
const polyPatch& wpp,
|
||||
trackedParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::trackedParticle::hitPatch
|
||||
(
|
||||
const polyPatch& wpp,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << static_cast<const ExactParticle<trackedParticle>&>(p)
|
||||
<< token::SPACE << p.end_
|
||||
<< token::SPACE << p.level_
|
||||
<< token::SPACE << p.i_
|
||||
<< token::SPACE << p.j_;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << static_cast<const ExactParticle<trackedParticle>&>(p);
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&p.end_),
|
||||
sizeof(p.end_) + sizeof(p.level_) + sizeof(p.i_) + sizeof(p.j_)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const trackedParticle&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,290 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::trackedParticle
|
||||
|
||||
Description
|
||||
Particle class that marks cells it passes through. Used to mark cells
|
||||
visited by feature edges. Uses ExactParticle tracking class so
|
||||
will work on concave cells.
|
||||
|
||||
SourceFiles
|
||||
trackedParticle.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef trackedParticle_H
|
||||
#define trackedParticle_H
|
||||
|
||||
#include "ExactParticle.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class trackedParticleCloud;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class trackedParticle Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class trackedParticle
|
||||
:
|
||||
public ExactParticle<trackedParticle>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- end point to track to
|
||||
point end_;
|
||||
|
||||
//- level of this particle
|
||||
label level_;
|
||||
|
||||
//- passive label
|
||||
label i_;
|
||||
|
||||
//- passive label
|
||||
label j_;
|
||||
|
||||
public:
|
||||
|
||||
friend class Cloud<trackedParticle>;
|
||||
|
||||
//- Class used to pass tracking data to the trackToFace function
|
||||
class trackData
|
||||
{
|
||||
//- Reference to the cloud containing this particle
|
||||
Cloud<trackedParticle>& cloud_;
|
||||
|
||||
labelList& maxLevel_;
|
||||
|
||||
public:
|
||||
|
||||
bool switchProcessor;
|
||||
bool keepParticle;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
trackData(Cloud<trackedParticle>& cloud, labelList& maxLevel)
|
||||
:
|
||||
cloud_(cloud),
|
||||
maxLevel_(maxLevel)
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
Cloud<trackedParticle>& cloud()
|
||||
{
|
||||
return cloud_;
|
||||
}
|
||||
|
||||
labelList& maxLevel()
|
||||
{
|
||||
return maxLevel_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
trackedParticle
|
||||
(
|
||||
const Cloud<trackedParticle>& c,
|
||||
const vector& position,
|
||||
const label celli,
|
||||
const point& end,
|
||||
const label level,
|
||||
const label i,
|
||||
const label j
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
trackedParticle
|
||||
(
|
||||
const Cloud<trackedParticle>& c,
|
||||
Istream& is,
|
||||
bool readFields = true
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<trackedParticle> clone() const
|
||||
{
|
||||
return autoPtr<trackedParticle>(new trackedParticle(*this));
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- point to track to
|
||||
point& end()
|
||||
{
|
||||
return end_;
|
||||
}
|
||||
|
||||
//- transported label
|
||||
label& i()
|
||||
{
|
||||
return i_;
|
||||
}
|
||||
|
||||
//- transported label
|
||||
label& j()
|
||||
{
|
||||
return j_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Tracking
|
||||
|
||||
//- Track all particles to their end point
|
||||
bool move(trackData&);
|
||||
|
||||
|
||||
//- Overridable function to handle the particle hitting a patch
|
||||
// Executed before other patch-hitting functions
|
||||
bool hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
trackedParticle::trackData& td,
|
||||
const label patchI
|
||||
);
|
||||
bool hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
int&,
|
||||
const label patchI
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a wedge
|
||||
void hitWedgePatch
|
||||
(
|
||||
const wedgePolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
);
|
||||
void hitWedgePatch
|
||||
(
|
||||
const wedgePolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a
|
||||
// symmetryPlane
|
||||
void hitSymmetryPatch
|
||||
(
|
||||
const symmetryPolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
);
|
||||
void hitSymmetryPatch
|
||||
(
|
||||
const symmetryPolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a cyclic
|
||||
void hitCyclicPatch
|
||||
(
|
||||
const cyclicPolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
);
|
||||
void hitCyclicPatch
|
||||
(
|
||||
const cyclicPolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a
|
||||
//- processorPatch
|
||||
void hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
);
|
||||
void hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a wallPatch
|
||||
void hitWallPatch
|
||||
(
|
||||
const wallPolyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
);
|
||||
void hitWallPatch
|
||||
(
|
||||
const wallPolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a polyPatch
|
||||
void hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
trackedParticle::trackData& td
|
||||
);
|
||||
void hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const trackedParticle&);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
inline bool contiguous<trackedParticle>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//template<>
|
||||
//void Cloud<trackedParticle>::readFields();
|
||||
//
|
||||
//template<>
|
||||
//void Cloud<trackedParticle>::writeFields() const;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,43 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "trackedParticle.H"
|
||||
#include "Cloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineParticleTypeNameAndDebug(trackedParticle, 0);
|
||||
defineTemplateTypeNameAndDebug(Cloud<trackedParticle>, 0);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
Reference in a new issue