Work-package-09 geometric constraint
This commit is contained in:
parent
69c3a6fb3b
commit
3cf177e759
@ -43,7 +43,6 @@ Description
|
||||
#include "refinementFeatures.H"
|
||||
#include "shellSurfaces.H"
|
||||
#include "decompositionMethod.H"
|
||||
#include "noDecomp.H"
|
||||
#include "fvMeshDistribute.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "refinementParameters.H"
|
||||
|
@ -183,50 +183,56 @@ structuredCoeffs
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Decomposition constraints
|
||||
|
||||
//constraints
|
||||
//{
|
||||
// preserveBaffles
|
||||
// {
|
||||
// //- Keep owner and neighbour of baffles on same processor (i.e.
|
||||
// // keep it detectable as a baffle). Baffles are two boundary face
|
||||
// // sharing the same points
|
||||
// type preserveBaffles;
|
||||
// }
|
||||
// preserveFaceZones
|
||||
// {
|
||||
// //- Keep owner and neighbour on same processor for faces in zones
|
||||
// type preserveFaceZones;
|
||||
// zones (".*");
|
||||
// }
|
||||
// preservePatches
|
||||
// {
|
||||
// //- Keep owner and neighbour on same processor for faces in patches
|
||||
// // (only makes sense for cyclic patches. Not suitable for e.g.
|
||||
// // cyclicAMI since these are not coupled on the patch level. Use
|
||||
// // singleProcessorFaceSets for those)
|
||||
// type preservePatches;
|
||||
// patches (".*");
|
||||
// }
|
||||
// singleProcessorFaceSets
|
||||
// {
|
||||
// //- Keep all of faceSet on a single processor. This puts all cells
|
||||
// // connected with a point, edge or face on the same processor.
|
||||
// // (just having face connected cells might not guarantee a balanced
|
||||
// // decomposition)
|
||||
// // The processor can be -1 (the decompositionMethod chooses the
|
||||
// // processor for a good load balance) or explicitly provided (upsets
|
||||
// // balance)
|
||||
// type singleProcessorFaceSets;
|
||||
// singleProcessorFaceSets ((f1 -1));
|
||||
// }
|
||||
// refinementHistory
|
||||
// {
|
||||
// //- Decompose cells such that all cell originating from single cell
|
||||
// // end up on same processor
|
||||
// type refinementHistory;
|
||||
// }
|
||||
//}
|
||||
|
||||
/*
|
||||
constraints
|
||||
{
|
||||
baffles
|
||||
{
|
||||
//- Keep owner and neighbour of baffles on same processor (i.e.
|
||||
// keep it detectable as a baffle). Baffles are two boundary face
|
||||
// sharing the same points
|
||||
type preserveBaffles;
|
||||
enabled false;
|
||||
}
|
||||
faces
|
||||
{
|
||||
//- Keep owner and neighbour on same processor for faces in zones
|
||||
type preserveFaceZones;
|
||||
zones (".*");
|
||||
enabled false;
|
||||
}
|
||||
patches
|
||||
{
|
||||
//- Keep owner and neighbour on same processor for faces in patches
|
||||
// (only makes sense for cyclic patches. Not suitable for e.g.
|
||||
// cyclicAMI since these are not coupled on the patch level. Use
|
||||
// singleProcessorFaceSets for those)
|
||||
type preservePatches;
|
||||
patches (".*");
|
||||
enabled false;
|
||||
}
|
||||
processors
|
||||
{
|
||||
//- Keep all of faceSet on a single processor. This puts all cells
|
||||
// connected with a point, edge or face on the same processor.
|
||||
// (just having face connected cells might not guarantee a balanced
|
||||
// decomposition)
|
||||
// The processor can be -1 (the decompositionMethod chooses the
|
||||
// processor for a good load balance) or explicitly provided (upsets
|
||||
// balance)
|
||||
type singleProcessorFaceSets;
|
||||
sets ((f1 -1));
|
||||
enabled false;
|
||||
}
|
||||
refinement
|
||||
{
|
||||
//- Decompose cells such that all cell originating from single cell
|
||||
// end up on same processor
|
||||
type refinementHistory;
|
||||
enabled false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Deprecated form of specifying decomposition constraints:
|
||||
//- Keep owner and neighbour on same processor for faces in zones:
|
||||
@ -251,5 +257,4 @@ structuredCoeffs
|
||||
// same points.
|
||||
//preserveBaffles true;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -33,8 +33,8 @@ Description
|
||||
processor has all triangles that overlap its mesh.
|
||||
|
||||
Note
|
||||
- best decomposition option is hierarchGeomDecomp since
|
||||
guarantees square decompositions.
|
||||
- best decomposition option is hierarchical since it guarantees
|
||||
square decompositions.
|
||||
- triangles might be present on multiple processors.
|
||||
- merging uses geometric tolerance so take care with writing precision.
|
||||
|
||||
|
@ -49,7 +49,6 @@ License
|
||||
#include "globalIndex.H"
|
||||
#include "meshTools.H"
|
||||
#include "OFstream.H"
|
||||
#include "geomDecomp.H"
|
||||
#include "Random.H"
|
||||
#include "searchableSurfaces.H"
|
||||
#include "treeBoundBox.H"
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -177,7 +177,7 @@ decomposition is termed a level. For example,
|
||||
method hierarchical;
|
||||
coeffs
|
||||
{
|
||||
n (16 4 2);
|
||||
n (16 4 2);
|
||||
}
|
||||
}
|
||||
cpus
|
||||
@ -228,53 +228,80 @@ For example,
|
||||
\verbatim
|
||||
constraints
|
||||
{
|
||||
preserveBaffles
|
||||
// Keep owner and neighbour of baffles on same processor
|
||||
// (ie, keep it detectable as a baffle).
|
||||
// Baffles are two boundary face sharing the same points
|
||||
baffles
|
||||
{
|
||||
// Keep owner and neighbour of baffles on same processor
|
||||
// (ie, keep it detectable as a baffle).
|
||||
// Baffles are two boundary face sharing the same points
|
||||
|
||||
type preserveBaffles;
|
||||
enabled true;
|
||||
}
|
||||
|
||||
preserveFaceZones
|
||||
// Keep owner and neighbour on same processor for faces in zones
|
||||
faces
|
||||
{
|
||||
// Keep owner and neighbour on same processor for faces in zones
|
||||
|
||||
type preserveFaceZones;
|
||||
zones (".*");
|
||||
enabled true;
|
||||
}
|
||||
|
||||
preservePatches
|
||||
// Keep owner and neighbour on same processor for faces in patches
|
||||
// (only makes sense for cyclic patches. Not suitable for e.g.
|
||||
// cyclicAMI since these are not coupled on the patch level.
|
||||
// Use singleProcessorFaceSets for those.
|
||||
patches
|
||||
{
|
||||
// Keep owner and neighbour on same processor for faces in patches
|
||||
// (only makes sense for cyclic patches. Not suitable for e.g.
|
||||
// cyclicAMI since these are not coupled on the patch level.
|
||||
// Use singleProcessorFaceSets for those.
|
||||
|
||||
type preservePatches;
|
||||
patches (".*");
|
||||
enabled true;
|
||||
}
|
||||
|
||||
singleProcessorFaceSets
|
||||
// Keep all of faceSet on a single processor. This puts all cells
|
||||
// connected with a point, edge or face on the same processor.
|
||||
// (just having face connected cells might not guarantee a balanced
|
||||
// decomposition)
|
||||
// The processor can be -1 (the decompositionMethod chooses the
|
||||
// processor for a good load balance) or explicitly provided (upsets
|
||||
// balance)
|
||||
processors
|
||||
{
|
||||
// Keep all of faceSet on a single processor. This puts all cells
|
||||
// connected with a point, edge or face on the same processor.
|
||||
// (just having face connected cells might not guarantee a balanced
|
||||
// decomposition)
|
||||
// The processor can be -1 (the decompositionMethod chooses the
|
||||
// processor for a good load balance) or explicitly provided (upsets
|
||||
// balance)
|
||||
|
||||
type singleProcessorFaceSets;
|
||||
singleProcessorFaceSets ((f1 -1));
|
||||
sets ((f1 -1));
|
||||
enabled true;
|
||||
}
|
||||
|
||||
refinementHistory
|
||||
// Decompose cells such that all cell originating from single cell
|
||||
// end up on same processor
|
||||
refinement
|
||||
{
|
||||
// Decompose cells such that all cell originating from single cell
|
||||
// end up on same processor
|
||||
type refinementHistory;
|
||||
enabled true;
|
||||
}
|
||||
|
||||
// Prevent decomposition splitting of the geometric regions
|
||||
// Uses any topoSetFaceSource for selecting the constrained faces
|
||||
geometric
|
||||
{
|
||||
type geometric;
|
||||
|
||||
grow false;
|
||||
|
||||
selection
|
||||
{
|
||||
box1
|
||||
{
|
||||
source box;
|
||||
min (-10 -10 -10);
|
||||
max (1 1 1);
|
||||
}
|
||||
|
||||
ball1
|
||||
{
|
||||
source sphere;
|
||||
origin (-2 -2 1);
|
||||
radius 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
@ -9,14 +9,15 @@ structuredDecomp/structuredDecomp.C
|
||||
noDecomp/noDecomp.C
|
||||
|
||||
|
||||
decompositionConstraints = decompositionConstraints
|
||||
constraints = decompositionConstraints
|
||||
|
||||
$(decompositionConstraints)/decompositionConstraint/decompositionConstraint.C
|
||||
$(decompositionConstraints)/preserveBaffles/preserveBafflesConstraint.C
|
||||
$(decompositionConstraints)/preserveFaceZones/preserveFaceZonesConstraint.C
|
||||
$(decompositionConstraints)/preservePatches/preservePatchesConstraint.C
|
||||
$(decompositionConstraints)/singleProcessorFaceSets/singleProcessorFaceSetsConstraint.C
|
||||
$(decompositionConstraints)/refinementHistory/refinementHistoryConstraint.C
|
||||
$(constraints)/decompositionConstraint/decompositionConstraint.C
|
||||
$(constraints)/preserveBaffles/preserveBafflesConstraint.C
|
||||
$(constraints)/preserveFaceZones/preserveFaceZonesConstraint.C
|
||||
$(constraints)/preservePatches/preservePatchesConstraint.C
|
||||
$(constraints)/geometric/geometricConstraint.C
|
||||
$(constraints)/singleProcessorFaceSets/singleProcessorFaceSetsConstraint.C
|
||||
$(constraints)/refinementHistory/refinementHistoryConstraint.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libdecompositionMethods
|
||||
|
@ -1,9 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfileFormats \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-lfiniteVolume
|
||||
|
@ -37,16 +37,39 @@ namespace Foam
|
||||
|
||||
Foam::decompositionConstraint::decompositionConstraint
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
const dictionary& constraintDict
|
||||
)
|
||||
:
|
||||
coeffDict_(constraintsDict)
|
||||
coeffDict_(constraintDict)
|
||||
{}
|
||||
|
||||
|
||||
Foam::decompositionConstraint::decompositionConstraint
|
||||
(
|
||||
const dictionary& constraintDict,
|
||||
const word&
|
||||
)
|
||||
:
|
||||
coeffDict_(constraintDict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::decompositionConstraint>
|
||||
Foam::decompositionConstraint::New
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
return decompositionConstraint::New
|
||||
(
|
||||
dict,
|
||||
dict.get<word>("type")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::decompositionConstraint>
|
||||
Foam::decompositionConstraint::New
|
||||
(
|
||||
@ -61,14 +84,14 @@ Foam::decompositionConstraint::New
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Unknown decompositionConstraint type "
|
||||
<< "Unknown decompositionConstraint: "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid decompositionConstraint types :" << endl
|
||||
<< "Valid types:" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<decompositionConstraint>(cstrIter()(dict, modelType));
|
||||
return autoPtr<decompositionConstraint>(cstrIter()(dict));
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@ Class
|
||||
Foam::decompositionConstraint
|
||||
|
||||
Description
|
||||
Abstract class for handling decomposition constraints.
|
||||
|
||||
SourceFiles
|
||||
decompositionConstraint.C
|
||||
@ -35,10 +36,10 @@ SourceFiles
|
||||
#define decompositionConstraint_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "boolList.H"
|
||||
#include "labelList.H"
|
||||
#include "labelPair.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -58,12 +59,11 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Model coefficients dictionary
|
||||
//- Constraint coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
// Protected Member Functions
|
||||
|
||||
//- No copy construct
|
||||
decompositionConstraint(const decompositionConstraint&) = delete;
|
||||
@ -71,7 +71,6 @@ private:
|
||||
//- No copy assignment
|
||||
void operator=(const decompositionConstraint&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -86,20 +85,24 @@ public:
|
||||
decompositionConstraint,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
const dictionary& dict
|
||||
),
|
||||
(constraintsDict, type)
|
||||
(dict)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with generic dictionary with optional entry for type
|
||||
//- Construct with constraint dictionary
|
||||
explicit decompositionConstraint(const dictionary& constraintDict);
|
||||
|
||||
//- Construct with constraint dictionary and model type.
|
||||
// The model type could be used for defining a coefficients
|
||||
// sub-dictionary.
|
||||
decompositionConstraint
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
const dictionary& constraintDict,
|
||||
const word& modelType
|
||||
);
|
||||
|
||||
|
||||
@ -108,8 +111,14 @@ public:
|
||||
//- Return a reference to the selected decompositionConstraint
|
||||
static autoPtr<decompositionConstraint> New
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
const dictionary& constraintDict
|
||||
);
|
||||
|
||||
//- Return a reference to the selected decompositionConstraint
|
||||
static autoPtr<decompositionConstraint> New
|
||||
(
|
||||
const dictionary& constraintDict,
|
||||
const word& modelType
|
||||
);
|
||||
|
||||
|
||||
@ -119,7 +128,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add my constraints to list of constraints
|
||||
//- Add this constraint to list of constraints
|
||||
virtual void add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
@ -0,0 +1,226 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "geometricConstraint.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "syncTools.H"
|
||||
#include "polyMesh.H"
|
||||
#include "Time.H"
|
||||
#include "BitOps.H"
|
||||
#include "faceBoolSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
defineTypeName(geometric);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
decompositionConstraint,
|
||||
geometric,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::decompositionConstraints::geometric::geometric
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
decompositionConstraint(dict, typeName),
|
||||
sources_(),
|
||||
selection_(coeffDict_.subDict("selection")),
|
||||
grow_(dict.lookupOrDefault<bool>("grow", false))
|
||||
{
|
||||
// Stored as dictionary, since we do not have the mesh at this stage
|
||||
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type()
|
||||
<< " : adding " << selection_.size()
|
||||
<< " geometric constraints for faces" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::decompositionConstraints::geometric::geometric
|
||||
(
|
||||
PtrList<topoSetFaceSource>&& selections
|
||||
)
|
||||
:
|
||||
decompositionConstraint(dictionary(), typeName),
|
||||
sources_(std::move(selections)),
|
||||
selection_(),
|
||||
grow_(false)
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type()
|
||||
<< " : adding " << sources_.size()
|
||||
<< " geometric constraints for faces" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::decompositionConstraints::geometric::add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
boolList& blockedFace,
|
||||
PtrList<labelList>& specifiedProcessorFaces,
|
||||
labelList& specifiedProcessor,
|
||||
List<labelPair>& explicitConnections
|
||||
) const
|
||||
{
|
||||
const label nFaces = mesh.nFaces();
|
||||
|
||||
blockedFace.resize(nFaces, true);
|
||||
|
||||
label nchanged = 0;
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
nchanged = BitOps::count(blockedFace, false);
|
||||
}
|
||||
|
||||
// Modify via topoSetFaceSource
|
||||
faceBoolSet facesToBlock(mesh, std::move(blockedFace));
|
||||
|
||||
for (const topoSetFaceSource& source : sources_)
|
||||
{
|
||||
// source.verbose(false);
|
||||
source.applyToSet(topoSetSource::SUBTRACT, facesToBlock);
|
||||
}
|
||||
|
||||
for (const entry& dEntry : selection_)
|
||||
{
|
||||
if (!dEntry.isDict())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Ignoring non-dictionary entry "
|
||||
<< dEntry << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
const dictionary& spec = dEntry.dict();
|
||||
|
||||
auto source = topoSetFaceSource::New
|
||||
(
|
||||
spec.get<word>("source"),
|
||||
mesh,
|
||||
spec.optionalSubDict("sourceInfo")
|
||||
);
|
||||
// source->verbose(false);
|
||||
|
||||
source->applyToSet(topoSetSource::SUBTRACT, facesToBlock);
|
||||
}
|
||||
|
||||
|
||||
// Finished with topo changes
|
||||
blockedFace.transfer(facesToBlock.addressing());
|
||||
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
nchanged = BitOps::count(blockedFace, false) - nchanged;
|
||||
}
|
||||
else
|
||||
{
|
||||
nchanged = 0;
|
||||
}
|
||||
|
||||
// Grow mode.
|
||||
// Include the faces of cells for which there are already two
|
||||
// or more faces in a constraint.
|
||||
if (grow_)
|
||||
{
|
||||
bitSet moreUnblocking(nFaces, false);
|
||||
|
||||
label nUnblocked = 0;
|
||||
|
||||
for (label celli=0; celli < mesh.nCells(); ++celli)
|
||||
{
|
||||
const cell& cFaces = mesh.cells()[celli];
|
||||
|
||||
nUnblocked = 0;
|
||||
for (const label facei : cFaces)
|
||||
{
|
||||
if (!blockedFace[facei])
|
||||
{
|
||||
++nUnblocked;
|
||||
if (nUnblocked > 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nUnblocked > 2)
|
||||
{
|
||||
moreUnblocking.set(cFaces);
|
||||
}
|
||||
}
|
||||
|
||||
nUnblocked = 0;
|
||||
|
||||
for (label facei : moreUnblocking)
|
||||
{
|
||||
if (blockedFace[facei])
|
||||
{
|
||||
blockedFace[facei] = false;
|
||||
++nUnblocked;
|
||||
}
|
||||
}
|
||||
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type()
|
||||
<< " : geometric constraint grow added "
|
||||
<< returnReduce(nUnblocked, sumOp<label>())
|
||||
<<" faces" << endl;
|
||||
}
|
||||
|
||||
// Include in the total
|
||||
nchanged += nUnblocked;
|
||||
}
|
||||
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type()
|
||||
<< " : geometric constraint added for "
|
||||
<< returnReduce(nchanged, sumOp<label>())
|
||||
<<" faces" << endl;
|
||||
}
|
||||
|
||||
syncTools::syncFaceList(mesh, blockedFace, andEqOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,169 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::decompositionConstraints::geometric
|
||||
|
||||
Description
|
||||
Keep faces together based on geometric considerations from a
|
||||
searchableSurfaces list.
|
||||
The faces inside of each searchableSurface are to be kept together
|
||||
during the decomposition.
|
||||
|
||||
\verbatim
|
||||
constraints
|
||||
{
|
||||
geom1
|
||||
{
|
||||
type geometric;
|
||||
|
||||
grow false;
|
||||
|
||||
selection
|
||||
{
|
||||
box1
|
||||
{
|
||||
source box;
|
||||
min (-0.1 -0.01 -0.1);
|
||||
max (0.1 0.30 0.1);
|
||||
}
|
||||
ball
|
||||
{
|
||||
source sphere;
|
||||
origin (-0.1 -0.01 -0.1);
|
||||
radius 0.25;
|
||||
}
|
||||
blob
|
||||
{
|
||||
source surface;
|
||||
surfaceType triSurfaceMesh;
|
||||
surfaceName blob.obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | geometric | yes |
|
||||
grow | Grow cells with partial connectivity | no | false
|
||||
geometry | Dictionary of enclosing volumes | yes |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
The searchableSurface must describe a closed volume.
|
||||
Ie, its hasVolumeType() method must be true.
|
||||
|
||||
The selection of enclosing volumes is treated as an OR operation.
|
||||
|
||||
The "grow" mode includes an additional check to include cell faces
|
||||
for any cell that already has two or more of its faces "unblocked".
|
||||
This could indicate a connection over a corner, but does not distinguish
|
||||
between connectivity introduced by the constraint and the connectivity
|
||||
defined by other constraints.
|
||||
|
||||
SourceFiles
|
||||
geometricConstraint.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef geometricConstraint_H
|
||||
#define geometricConstraint_H
|
||||
|
||||
#include "decompositionConstraint.H"
|
||||
#include "PtrList.H"
|
||||
#include "topoSetFaceSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class geometric Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class geometric
|
||||
:
|
||||
public decompositionConstraint
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Face selections as topoSetFaceSource
|
||||
PtrList<topoSetFaceSource> sources_;
|
||||
|
||||
//- Dictionary of face selections for topoSetFaceSource
|
||||
dictionary selection_;
|
||||
|
||||
//- Additional check of cell connection (via corners?)
|
||||
bool grow_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("geometric");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with constraint dictionary
|
||||
explicit geometric(const dictionary& dict);
|
||||
|
||||
//- Move construct from components.
|
||||
// (topoSetFaceSource cannot be cloned)
|
||||
explicit geometric(PtrList<topoSetFaceSource>&& selections);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~geometric() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add this constraint to list of constraints
|
||||
virtual void add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
boolList& blockedFace,
|
||||
PtrList<labelList>& specifiedProcessorFaces,
|
||||
labelList& specifiedProcessor,
|
||||
List<labelPair>& explicitConnections
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace decompositionConstraints
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -34,12 +34,12 @@ namespace Foam
|
||||
{
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
defineTypeName(preserveBafflesConstraint);
|
||||
defineTypeName(preserveBaffles);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
decompositionConstraint,
|
||||
preserveBafflesConstraint,
|
||||
preserveBaffles,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
@ -48,32 +48,31 @@ namespace decompositionConstraints
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::decompositionConstraints::preserveBafflesConstraint::
|
||||
preserveBafflesConstraint
|
||||
Foam::decompositionConstraints::preserveBaffles::preserveBaffles
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& modelType
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
decompositionConstraint(constraintsDict, typeName)
|
||||
decompositionConstraint(dict, typeName)
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type() << " : setting constraints to preserve baffles"
|
||||
Info<< type()
|
||||
<< " : setting constraints to preserve baffles"
|
||||
//<< returnReduce(bafflePairs.size(), sumOp<label>())
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::decompositionConstraints::preserveBafflesConstraint::
|
||||
preserveBafflesConstraint()
|
||||
Foam::decompositionConstraints::preserveBaffles::preserveBaffles()
|
||||
:
|
||||
decompositionConstraint(dictionary(), typeName)
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type() << " : setting constraints to preserve baffles"
|
||||
Info<< type()
|
||||
<< " : setting constraints to preserve baffles"
|
||||
//<< returnReduce(bafflePairs.size(), sumOp<label>())
|
||||
<< endl;
|
||||
}
|
||||
@ -82,7 +81,7 @@ preserveBafflesConstraint()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::decompositionConstraints::preserveBafflesConstraint::add
|
||||
void Foam::decompositionConstraints::preserveBaffles::add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
boolList& blockedFace,
|
||||
@ -177,7 +176,7 @@ void Foam::decompositionConstraints::preserveBafflesConstraint::add
|
||||
}
|
||||
|
||||
|
||||
void Foam::decompositionConstraints::preserveBafflesConstraint::apply
|
||||
void Foam::decompositionConstraints::preserveBaffles::apply
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const boolList& blockedFace,
|
||||
|
@ -22,11 +22,17 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::preserveBafflesConstraint
|
||||
Foam::decompositionConstraints::preserveBaffles
|
||||
|
||||
Description
|
||||
Detects baffles and keeps owner and neighbour on same processor.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | preserveBaffles | yes |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
preserveBafflesConstraint.C
|
||||
|
||||
@ -41,15 +47,14 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class preserveBafflesConstraint Declaration
|
||||
Class preserveBaffles Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class preserveBafflesConstraint
|
||||
class preserveBaffles
|
||||
:
|
||||
public decompositionConstraint
|
||||
{
|
||||
@ -61,19 +66,15 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with generic dictionary with optional entry for type
|
||||
preserveBafflesConstraint
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
);
|
||||
//- Construct with constraint dictionary
|
||||
explicit preserveBaffles(const dictionary& dict);
|
||||
|
||||
//- Construct from components
|
||||
preserveBafflesConstraint();
|
||||
preserveBaffles();
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~preserveBafflesConstraint() = default;
|
||||
virtual ~preserveBaffles() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -33,12 +33,12 @@ namespace Foam
|
||||
{
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
defineTypeName(preserveFaceZonesConstraint);
|
||||
defineTypeName(preserveFaceZones);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
decompositionConstraint,
|
||||
preserveFaceZonesConstraint,
|
||||
preserveFaceZones,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
@ -47,15 +47,13 @@ namespace decompositionConstraints
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::decompositionConstraints::preserveFaceZonesConstraint::
|
||||
preserveFaceZonesConstraint
|
||||
Foam::decompositionConstraints::preserveFaceZones::preserveFaceZones
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& modelType
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
decompositionConstraint(constraintsDict, typeName),
|
||||
zones_(coeffDict_.lookup("zones"))
|
||||
decompositionConstraint(dict, typeName),
|
||||
zones_(coeffDict_.get<wordRes>("zones"))
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
@ -66,8 +64,7 @@ preserveFaceZonesConstraint
|
||||
}
|
||||
|
||||
|
||||
Foam::decompositionConstraints::preserveFaceZonesConstraint::
|
||||
preserveFaceZonesConstraint
|
||||
Foam::decompositionConstraints::preserveFaceZones::preserveFaceZones
|
||||
(
|
||||
const UList<wordRe>& zones
|
||||
)
|
||||
@ -86,7 +83,7 @@ preserveFaceZonesConstraint
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::decompositionConstraints::preserveFaceZonesConstraint::add
|
||||
void Foam::decompositionConstraints::preserveFaceZones::add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
boolList& blockedFace,
|
||||
@ -127,7 +124,7 @@ void Foam::decompositionConstraints::preserveFaceZonesConstraint::add
|
||||
}
|
||||
|
||||
|
||||
void Foam::decompositionConstraints::preserveFaceZonesConstraint::apply
|
||||
void Foam::decompositionConstraints::preserveFaceZones::apply
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const boolList& blockedFace,
|
||||
|
@ -22,12 +22,19 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::preserveFaceZonesConstraint
|
||||
Foam::decompositionConstraints::preserveFaceZones
|
||||
|
||||
Description
|
||||
Constraint to keep/move owner and neighbour of faceZone onto same
|
||||
processor.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | preserveFaceZones | yes |
|
||||
zones | List of face zone names or regexs | yes |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
preserveFaceZonesConstraint.C
|
||||
|
||||
@ -43,15 +50,14 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class preserveFaceZonesConstraint Declaration
|
||||
Class preserveFaceZones Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class preserveFaceZonesConstraint
|
||||
class preserveFaceZones
|
||||
:
|
||||
public decompositionConstraint
|
||||
{
|
||||
@ -69,19 +75,15 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with generic dictionary with optional entry for type
|
||||
preserveFaceZonesConstraint
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
);
|
||||
//- Construct with constraint dictionary
|
||||
explicit preserveFaceZones(const dictionary& dict);
|
||||
|
||||
//- Construct from components
|
||||
preserveFaceZonesConstraint(const UList<wordRe>& zones);
|
||||
explicit preserveFaceZones(const UList<wordRe>& zones);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~preserveFaceZonesConstraint() = default;
|
||||
virtual ~preserveFaceZones() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -33,12 +33,12 @@ namespace Foam
|
||||
{
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
defineTypeName(preservePatchesConstraint);
|
||||
defineTypeName(preservePatches);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
decompositionConstraint,
|
||||
preservePatchesConstraint,
|
||||
preservePatches,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
@ -47,15 +47,13 @@ namespace decompositionConstraints
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::decompositionConstraints::preservePatchesConstraint::
|
||||
preservePatchesConstraint
|
||||
Foam::decompositionConstraints::preservePatches::preservePatches
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& modelType
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
decompositionConstraint(constraintsDict, typeName),
|
||||
patches_(coeffDict_.lookup("patches"))
|
||||
decompositionConstraint(dict, typeName),
|
||||
patches_(coeffDict_.get<wordRes>("patches"))
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
@ -66,8 +64,7 @@ preservePatchesConstraint
|
||||
}
|
||||
|
||||
|
||||
Foam::decompositionConstraints::preservePatchesConstraint::
|
||||
preservePatchesConstraint
|
||||
Foam::decompositionConstraints::preservePatches::preservePatches
|
||||
(
|
||||
const UList<wordRe>& patches
|
||||
)
|
||||
@ -86,7 +83,7 @@ preservePatchesConstraint
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::decompositionConstraints::preservePatchesConstraint::add
|
||||
void Foam::decompositionConstraints::preservePatches::add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
boolList& blockedFace,
|
||||
@ -97,7 +94,7 @@ void Foam::decompositionConstraints::preservePatchesConstraint::add
|
||||
{
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
blockedFace.setSize(mesh.nFaces(), true);
|
||||
blockedFace.resize(mesh.nFaces(), true);
|
||||
|
||||
const labelList patchIDs(pbm.patchSet(patches_).sortedToc());
|
||||
|
||||
@ -129,7 +126,7 @@ void Foam::decompositionConstraints::preservePatchesConstraint::add
|
||||
}
|
||||
|
||||
|
||||
void Foam::decompositionConstraints::preservePatchesConstraint::apply
|
||||
void Foam::decompositionConstraints::preservePatches::apply
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const boolList& blockedFace,
|
||||
@ -177,7 +174,7 @@ void Foam::decompositionConstraints::preservePatchesConstraint::apply
|
||||
|
||||
forAll(faceCells, i)
|
||||
{
|
||||
label bFaceI = pp.start()+i-mesh.nInternalFaces();
|
||||
const label bFaceI = pp.start()+i-mesh.nInternalFaces();
|
||||
|
||||
if (decomposition[faceCells[i]] != destProc[bFaceI])
|
||||
{
|
||||
|
@ -22,12 +22,19 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::preservePatchesConstraint
|
||||
Foam::decompositionConstraints::preservePatches
|
||||
|
||||
Description
|
||||
Constraint to keep owner and neighbour of (cyclic) patch on same
|
||||
processor.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | preservePatches | yes |
|
||||
patches | List of patch names or regexs | yes |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
preservePatchesConstraint.C
|
||||
|
||||
@ -48,10 +55,10 @@ namespace decompositionConstraints
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class preservePatchesConstraint Declaration
|
||||
Class preservePatches Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class preservePatchesConstraint
|
||||
class preservePatches
|
||||
:
|
||||
public decompositionConstraint
|
||||
{
|
||||
@ -69,19 +76,15 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with generic dictionary with optional entry for type
|
||||
preservePatchesConstraint
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
);
|
||||
//- Construct with constraint dictionary
|
||||
explicit preservePatches(const dictionary& dict);
|
||||
|
||||
//- Construct from components
|
||||
preservePatchesConstraint(const UList<wordRe>& patches);
|
||||
explicit preservePatches(const UList<wordRe>& patches);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~preservePatchesConstraint() = default;
|
||||
virtual ~preservePatches() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -32,50 +32,52 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeName(refinementHistoryConstraint);
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
defineTypeName(refinementHistory);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
decompositionConstraint,
|
||||
refinementHistoryConstraint,
|
||||
refinementHistory,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::refinementHistoryConstraint::refinementHistoryConstraint
|
||||
Foam::decompositionConstraints::refinementHistory::refinementHistory
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& modelType
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
decompositionConstraint(constraintsDict, typeName)
|
||||
decompositionConstraint(dict, typeName)
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type() << " : setting constraints to refinement history"
|
||||
<< endl;
|
||||
Info<< type()
|
||||
<< " : setting constraints to refinement history" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::refinementHistoryConstraint::refinementHistoryConstraint()
|
||||
Foam::decompositionConstraints::refinementHistory::refinementHistory()
|
||||
:
|
||||
decompositionConstraint(dictionary(), typeName)
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type() << " : setting constraints to refinement history"
|
||||
<< endl;
|
||||
Info<< type()
|
||||
<< " : setting constraints to refinement history" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::refinementHistoryConstraint::add
|
||||
void Foam::decompositionConstraints::refinementHistory::add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
boolList& blockedFace,
|
||||
@ -84,16 +86,33 @@ void Foam::refinementHistoryConstraint::add
|
||||
List<labelPair>& explicitConnections
|
||||
) const
|
||||
{
|
||||
const refinementHistory* refPtr =
|
||||
mesh.findObject<refinementHistory>("refinementHistory");
|
||||
// The refinement history type
|
||||
typedef ::Foam::refinementHistory HistoryType;
|
||||
|
||||
autoPtr<const refinementHistory> storagePtr;
|
||||
// Local storage if read from file
|
||||
autoPtr<const HistoryType> readFromFile;
|
||||
|
||||
if (!refPtr)
|
||||
const HistoryType* historyPtr =
|
||||
mesh.findObject<HistoryType>("refinementHistory");
|
||||
|
||||
if (historyPtr)
|
||||
{
|
||||
storagePtr.reset
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type() << " : found refinementHistory" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type() << " : reading refinementHistory from time "
|
||||
<< mesh.facesInstance() << endl;
|
||||
}
|
||||
|
||||
readFromFile.reset
|
||||
(
|
||||
new refinementHistory
|
||||
new HistoryType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -107,27 +126,11 @@ void Foam::refinementHistoryConstraint::add
|
||||
mesh.nCells()
|
||||
)
|
||||
);
|
||||
|
||||
historyPtr = readFromFile.get(); // get(), not release()
|
||||
}
|
||||
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
if (refPtr)
|
||||
{
|
||||
Info<< type() << " : found refinementHistory" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< type() << " : reading refinementHistory from time "
|
||||
<< mesh.facesInstance() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
const refinementHistory& history =
|
||||
(
|
||||
storagePtr.valid()
|
||||
? *storagePtr
|
||||
: *refPtr
|
||||
);
|
||||
const auto& history = *historyPtr;
|
||||
|
||||
if (history.active())
|
||||
{
|
||||
@ -143,7 +146,7 @@ void Foam::refinementHistoryConstraint::add
|
||||
}
|
||||
|
||||
|
||||
void Foam::refinementHistoryConstraint::apply
|
||||
void Foam::decompositionConstraints::refinementHistory::apply
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const boolList& blockedFace,
|
||||
@ -153,16 +156,20 @@ void Foam::refinementHistoryConstraint::apply
|
||||
labelList& decomposition
|
||||
) const
|
||||
{
|
||||
const refinementHistory* refPtr =
|
||||
mesh.findObject<refinementHistory>("refinementHistory");
|
||||
// The refinement history type
|
||||
typedef ::Foam::refinementHistory HistoryType;
|
||||
|
||||
autoPtr<const refinementHistory> storagePtr;
|
||||
// Local storage if read from file
|
||||
autoPtr<const HistoryType> readFromFile;
|
||||
|
||||
if (!refPtr)
|
||||
const HistoryType* historyPtr =
|
||||
mesh.findObject<HistoryType>("refinementHistory");
|
||||
|
||||
if (!historyPtr)
|
||||
{
|
||||
storagePtr.reset
|
||||
readFromFile.reset
|
||||
(
|
||||
new refinementHistory
|
||||
new HistoryType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -176,14 +183,11 @@ void Foam::refinementHistoryConstraint::apply
|
||||
mesh.nCells()
|
||||
)
|
||||
);
|
||||
|
||||
historyPtr = readFromFile.get(); // get(), not release()
|
||||
}
|
||||
|
||||
const refinementHistory& history =
|
||||
(
|
||||
storagePtr.valid()
|
||||
? *storagePtr
|
||||
: *refPtr
|
||||
);
|
||||
const auto& history = *historyPtr;
|
||||
|
||||
if (history.active())
|
||||
{
|
||||
|
@ -22,12 +22,18 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::refinementHistoryConstraint
|
||||
Foam::decompositionConstraints::refinementHistory
|
||||
|
||||
Description
|
||||
Constraint to keep all cells originating from refining the same cell
|
||||
onto the same processor. Reads polyMesh/refinementHistory.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | refinementHistory | yes |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
refinementHistoryConstraint.C
|
||||
|
||||
@ -42,12 +48,14 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class refinementHistoryConstraint Declaration
|
||||
Class refinementHistory Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class refinementHistoryConstraint
|
||||
class refinementHistory
|
||||
:
|
||||
public decompositionConstraint
|
||||
{
|
||||
@ -59,24 +67,20 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with generic dictionary with optional entry for type
|
||||
refinementHistoryConstraint
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
);
|
||||
//- Construct with constraint dictionary
|
||||
explicit refinementHistory(const dictionary& dict);
|
||||
|
||||
//- Construct from components
|
||||
refinementHistoryConstraint();
|
||||
refinementHistory();
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~refinementHistoryConstraint() = default;
|
||||
virtual ~refinementHistory() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add my constraints to list of constraints
|
||||
//- Add this constraint to list of constraints
|
||||
virtual void add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -86,7 +90,7 @@ public:
|
||||
List<labelPair>& explicitConnections
|
||||
) const;
|
||||
|
||||
//- Apply any additional post-decomposition constraints
|
||||
//- Apply this constraint post-decomposition
|
||||
virtual void apply
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -101,6 +105,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace decompositionConstraints
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,34 +28,45 @@ License
|
||||
#include "syncTools.H"
|
||||
#include "faceSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
defineTypeName(singleProcessorFaceSetsConstraint);
|
||||
defineTypeName(singleProcessorFaceSets);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
decompositionConstraint,
|
||||
singleProcessorFaceSetsConstraint,
|
||||
singleProcessorFaceSets,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::decompositionConstraints::singleProcessorFaceSets::printInfo() const
|
||||
{
|
||||
for (const auto& nameAndProc : setNameAndProcs_)
|
||||
{
|
||||
Info<< " all cells connected to faceSet "
|
||||
<< nameAndProc.first()
|
||||
<< " on processor " << nameAndProc.second() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::
|
||||
singleProcessorFaceSetsConstraint
|
||||
Foam::decompositionConstraints::singleProcessorFaceSets::
|
||||
singleProcessorFaceSets
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& modelType
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
decompositionConstraint(constraintsDict, typeName),
|
||||
decompositionConstraint(dict, typeName),
|
||||
setNameAndProcs_
|
||||
(
|
||||
coeffDict_.lookupCompat("sets", {{"singleProcessorFaceSets", 1806}})
|
||||
@ -66,18 +77,13 @@ singleProcessorFaceSetsConstraint
|
||||
Info<< type()
|
||||
<< " : adding constraints to keep" << endl;
|
||||
|
||||
forAll(setNameAndProcs_, setI)
|
||||
{
|
||||
Info<< " all cells connected to faceSet "
|
||||
<< setNameAndProcs_[setI].first()
|
||||
<< " on processor " << setNameAndProcs_[setI].second() << endl;
|
||||
}
|
||||
printInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::
|
||||
singleProcessorFaceSetsConstraint
|
||||
Foam::decompositionConstraints::singleProcessorFaceSets::
|
||||
singleProcessorFaceSets
|
||||
(
|
||||
const List<Tuple2<word, label>>& setNameAndProcs
|
||||
)
|
||||
@ -90,19 +96,33 @@ singleProcessorFaceSetsConstraint
|
||||
Info<< type()
|
||||
<< " : adding constraints to keep" << endl;
|
||||
|
||||
forAll(setNameAndProcs_, setI)
|
||||
{
|
||||
Info<< " all cells connected to faceSet "
|
||||
<< setNameAndProcs_[setI].first()
|
||||
<< " on processor " << setNameAndProcs_[setI].second() << endl;
|
||||
}
|
||||
printInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::decompositionConstraints::singleProcessorFaceSets::
|
||||
singleProcessorFaceSets
|
||||
(
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
decompositionConstraint(dictionary(), typeName),
|
||||
setNameAndProcs_(is)
|
||||
{
|
||||
if (decompositionConstraint::debug)
|
||||
{
|
||||
Info<< type()
|
||||
<< " : adding constraints to keep" << endl;
|
||||
|
||||
printInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::add
|
||||
void Foam::decompositionConstraints::singleProcessorFaceSets::add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
boolList& blockedFace,
|
||||
@ -111,20 +131,19 @@ void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::add
|
||||
List<labelPair>& explicitConnections
|
||||
) const
|
||||
{
|
||||
blockedFace.setSize(mesh.nFaces(), true);
|
||||
blockedFace.resize(mesh.nFaces(), true);
|
||||
|
||||
// Mark faces already in set
|
||||
labelList faceToSet(mesh.nFaces(), -1);
|
||||
forAll(specifiedProcessorFaces, setI)
|
||||
{
|
||||
const labelList& faceLabels = specifiedProcessorFaces[setI];
|
||||
forAll(faceLabels, i)
|
||||
for (const label facei : faceLabels)
|
||||
{
|
||||
faceToSet[faceLabels[i]] = setI;
|
||||
faceToSet[facei] = setI;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
forAll(setNameAndProcs_, setI)
|
||||
{
|
||||
//Info<< "Keeping all cells connected to faceSet "
|
||||
@ -140,10 +159,10 @@ void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::add
|
||||
labelList nMatch(specifiedProcessorFaces.size(), 0);
|
||||
forAllConstIter(faceSet, fz, iter)
|
||||
{
|
||||
label setI = faceToSet[iter.key()];
|
||||
if (setI != -1)
|
||||
label seti = faceToSet[iter.key()];
|
||||
if (seti != -1)
|
||||
{
|
||||
nMatch[setI]++;
|
||||
++nMatch[seti];
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,13 +175,13 @@ void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::add
|
||||
{
|
||||
if (nMatch[setI] == fz.size())
|
||||
{
|
||||
// full match
|
||||
// Full match
|
||||
store = false;
|
||||
break;
|
||||
}
|
||||
else if (nMatch[setI] > 0)
|
||||
{
|
||||
// partial match
|
||||
// Partial match
|
||||
store = false;
|
||||
break;
|
||||
}
|
||||
@ -184,13 +203,14 @@ void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::add
|
||||
boolList procFacePoint(mesh.nPoints(), false);
|
||||
forAll(specifiedProcessorFaces, setI)
|
||||
{
|
||||
const labelList& set = specifiedProcessorFaces[setI];
|
||||
forAll(set, fI)
|
||||
const labelList& faceLabels = specifiedProcessorFaces[setI];
|
||||
for (const label facei : faceLabels)
|
||||
{
|
||||
const face& f = mesh.faces()[set[fI]];
|
||||
forAll(f, fp)
|
||||
const face& f = mesh.faces()[facei];
|
||||
|
||||
for (const label pointi : f)
|
||||
{
|
||||
procFacePoint[f[fp]] = true;
|
||||
procFacePoint[pointi] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,7 +230,7 @@ void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::add
|
||||
if (blockedFace[pFaces[i]])
|
||||
{
|
||||
blockedFace[pFaces[i]] = false;
|
||||
nUnblocked++;
|
||||
++nUnblocked;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,7 +246,7 @@ void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::add
|
||||
}
|
||||
|
||||
|
||||
void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::apply
|
||||
void Foam::decompositionConstraints::singleProcessorFaceSets::apply
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const boolList& blockedFace,
|
||||
@ -286,23 +306,23 @@ void Foam::decompositionConstraints::singleProcessorFaceSetsConstraint::apply
|
||||
if (procFacePoint[pointi])
|
||||
{
|
||||
const labelList& pFaces = mesh.pointFaces()[pointi];
|
||||
forAll(pFaces, i)
|
||||
for (const label faceI : pFaces)
|
||||
{
|
||||
label faceI = pFaces[i];
|
||||
const label own = mesh.faceOwner()[faceI];
|
||||
|
||||
label own = mesh.faceOwner()[faceI];
|
||||
if (decomposition[own] != procI)
|
||||
{
|
||||
decomposition[own] = procI;
|
||||
nChanged++;
|
||||
++nChanged;
|
||||
}
|
||||
|
||||
if (mesh.isInternalFace(faceI))
|
||||
{
|
||||
label nei = mesh.faceNeighbour()[faceI];
|
||||
const label nei = mesh.faceNeighbour()[faceI];
|
||||
if (decomposition[nei] != procI)
|
||||
{
|
||||
decomposition[nei] = procI;
|
||||
nChanged++;
|
||||
++nChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,36 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::singleProcessorFaceSetsConstraint
|
||||
Foam::decompositionConstraints::singleProcessorFaceSets
|
||||
|
||||
Description
|
||||
Constraint to keep all cells connected to face or point of faceSet on
|
||||
a single processor.
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | singleProcessorFaceSets | yes |
|
||||
sets | List of sets and processers | yes |
|
||||
\endtable
|
||||
|
||||
Example,
|
||||
\verbatim
|
||||
constraints
|
||||
{
|
||||
procs
|
||||
{
|
||||
type singleProcessorFaceSets;
|
||||
sets
|
||||
(
|
||||
(faceSet1 0)
|
||||
(faceSet5 12)
|
||||
(faceSet25 510)
|
||||
);
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
singleProcessorFaceSetsConstraint.C
|
||||
|
||||
@ -43,15 +67,14 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace decompositionConstraints
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class singleProcessorFaceSetsConstraint Declaration
|
||||
Class singleProcessorFaceSets Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class singleProcessorFaceSetsConstraint
|
||||
class singleProcessorFaceSets
|
||||
:
|
||||
public decompositionConstraint
|
||||
{
|
||||
@ -60,6 +83,10 @@ class singleProcessorFaceSetsConstraint
|
||||
//- List of faceSet+processor
|
||||
List<Tuple2<word, label>> setNameAndProcs_;
|
||||
|
||||
//- Report names of sets and processor numnbers
|
||||
void printInfo() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -68,27 +95,26 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with generic dictionary with optional entry for type
|
||||
singleProcessorFaceSetsConstraint
|
||||
(
|
||||
const dictionary& constraintsDict,
|
||||
const word& type
|
||||
);
|
||||
//- Construct with constraint dictionary
|
||||
explicit singleProcessorFaceSets(const dictionary& dict);
|
||||
|
||||
//- Construct from components
|
||||
singleProcessorFaceSetsConstraint
|
||||
//- Copy construct from components
|
||||
explicit singleProcessorFaceSets
|
||||
(
|
||||
const List<Tuple2<word, label>>& setNameAndProcs
|
||||
);
|
||||
|
||||
//- Read construct a List of (setName processor)
|
||||
explicit singleProcessorFaceSets(Istream& is);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~singleProcessorFaceSetsConstraint() = default;
|
||||
virtual ~singleProcessorFaceSets() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add my constraints to list of constraints
|
||||
//- Add this constraint to list of constraints
|
||||
virtual void add
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -98,7 +124,7 @@ public:
|
||||
List<labelPair>& explicitConnections
|
||||
) const;
|
||||
|
||||
//- Apply any additional post-decomposition constraints
|
||||
//- Add this constraint post-decomposition
|
||||
virtual void apply
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
@ -34,6 +34,7 @@ License
|
||||
#include "BitOps.H"
|
||||
#include "FaceCellWave.H"
|
||||
|
||||
// Compatibility (MAY-2014)
|
||||
#include "preserveBafflesConstraint.H"
|
||||
#include "preservePatchesConstraint.H"
|
||||
#include "preserveFaceZonesConstraint.H"
|
||||
@ -114,103 +115,106 @@ const Foam::dictionary& Foam::decompositionMethod::optionalRegionDict
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::decompositionMethod::constraintCompat(const word& modelType) const
|
||||
{
|
||||
bool usable = decompDict_.found(modelType);
|
||||
if (!usable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto& item : constraints_)
|
||||
{
|
||||
if (modelType == item.type())
|
||||
{
|
||||
usable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (usable)
|
||||
{
|
||||
Warning
|
||||
<< nl << " Using '" << modelType
|
||||
<< "' constraint specification." << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning
|
||||
<< nl << " Ignoring '" << modelType
|
||||
<< "' constraint specification - was already specified." << nl;
|
||||
}
|
||||
|
||||
// The syntax changed MAY-2014
|
||||
error::warnAboutAge("constraint keyword", 1406);
|
||||
|
||||
return usable;
|
||||
}
|
||||
|
||||
|
||||
void Foam::decompositionMethod::readConstraints()
|
||||
{
|
||||
constraints_.clear();
|
||||
|
||||
// Read any constraints
|
||||
wordList constraintTypes;
|
||||
|
||||
const dictionary* dictptr = decompositionDict_.findDict("constraints");
|
||||
const dictionary* dictptr = decompDict_.findDict("constraints");
|
||||
|
||||
if (dictptr)
|
||||
{
|
||||
for (const entry& dEntry : *dictptr)
|
||||
{
|
||||
if (!dEntry.isDict()) // safety
|
||||
{
|
||||
// Ignore or warn
|
||||
continue;
|
||||
}
|
||||
|
||||
const dictionary& dict = dEntry.dict();
|
||||
|
||||
constraintTypes.append(dict.get<word>("type"));
|
||||
|
||||
constraints_.append
|
||||
(
|
||||
decompositionConstraint::New
|
||||
(
|
||||
dict,
|
||||
constraintTypes.last()
|
||||
)
|
||||
);
|
||||
if (dict.lookupOrDefault("enabled", true))
|
||||
{
|
||||
constraints_.append(decompositionConstraint::New(dict));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Backwards compatibility
|
||||
if
|
||||
(
|
||||
decompositionDict_.found("preserveBaffles")
|
||||
&& !constraintTypes.found
|
||||
(
|
||||
decompositionConstraints::preserveBafflesConstraint::typeName
|
||||
)
|
||||
)
|
||||
// Backwards compatibility (MAY-2014)
|
||||
if (constraintCompat("preserveBaffles"))
|
||||
{
|
||||
constraints_.append
|
||||
(
|
||||
new decompositionConstraints::preserveBafflesConstraint()
|
||||
new decompositionConstraints::preserveBaffles()
|
||||
);
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
decompositionDict_.found("preservePatches")
|
||||
&& !constraintTypes.found
|
||||
(
|
||||
decompositionConstraints::preservePatchesConstraint::typeName
|
||||
)
|
||||
)
|
||||
if (constraintCompat("preservePatches"))
|
||||
{
|
||||
const wordReList pNames(decompositionDict_.lookup("preservePatches"));
|
||||
|
||||
constraints_.append
|
||||
(
|
||||
new decompositionConstraints::preservePatchesConstraint(pNames)
|
||||
);
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
decompositionDict_.found("preserveFaceZones")
|
||||
&& !constraintTypes.found
|
||||
(
|
||||
decompositionConstraints::preserveFaceZonesConstraint::typeName
|
||||
)
|
||||
)
|
||||
{
|
||||
const wordReList zNames(decompositionDict_.lookup("preserveFaceZones"));
|
||||
|
||||
constraints_.append
|
||||
(
|
||||
new decompositionConstraints::preserveFaceZonesConstraint(zNames)
|
||||
);
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
decompositionDict_.found("singleProcessorFaceSets")
|
||||
&& !constraintTypes.found
|
||||
(
|
||||
decompositionConstraints::preserveFaceZonesConstraint::typeName
|
||||
)
|
||||
)
|
||||
{
|
||||
const List<Tuple2<word, label>> zNameAndProcs
|
||||
(
|
||||
decompositionDict_.lookup("singleProcessorFaceSets")
|
||||
);
|
||||
|
||||
constraints_.append
|
||||
(
|
||||
new decompositionConstraints::singleProcessorFaceSetsConstraint
|
||||
new decompositionConstraints::preservePatches
|
||||
(
|
||||
zNameAndProcs
|
||||
decompDict_.get<wordRes>("preservePatches")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (constraintCompat("preserveFaceZones"))
|
||||
{
|
||||
constraints_.append
|
||||
(
|
||||
new decompositionConstraints::preserveFaceZones
|
||||
(
|
||||
decompDict_.get<wordRes>("preserveFaceZones")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (constraintCompat("singleProcessorFaceSets"))
|
||||
{
|
||||
constraints_.append
|
||||
(
|
||||
new decompositionConstraints::singleProcessorFaceSets
|
||||
(
|
||||
decompDict_.lookup("singleProcessorFaceSets")
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -268,14 +272,14 @@ const Foam::dictionary& Foam::decompositionMethod::findCoeffsDict
|
||||
|
||||
if
|
||||
(
|
||||
!decompositionRegionDict_.empty()
|
||||
!decompRegionDict_.empty()
|
||||
&&
|
||||
(
|
||||
(fnd = decompositionRegionDict_.csearch(coeffsName)).isDict()
|
||||
(fnd = decompRegionDict_.csearch(coeffsName)).isDict()
|
||||
||
|
||||
(
|
||||
!(select & selectionType::EXACT)
|
||||
&& (fnd = decompositionRegionDict_.csearch(defaultName)).isDict()
|
||||
&& (fnd = decompRegionDict_.csearch(defaultName)).isDict()
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -285,11 +289,11 @@ const Foam::dictionary& Foam::decompositionMethod::findCoeffsDict
|
||||
|
||||
if
|
||||
(
|
||||
(fnd = decompositionDict_.csearch(coeffsName)).isDict()
|
||||
(fnd = decompDict_.csearch(coeffsName)).isDict()
|
||||
||
|
||||
(
|
||||
!(select & selectionType::EXACT)
|
||||
&& (fnd = decompositionDict_.csearch(defaultName)).isDict()
|
||||
&& (fnd = decompDict_.csearch(defaultName)).isDict()
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -301,7 +305,7 @@ const Foam::dictionary& Foam::decompositionMethod::findCoeffsDict
|
||||
{
|
||||
FatalIOError
|
||||
<< "'" << coeffsName << "' dictionary not found in dictionary "
|
||||
<< decompositionDict_.name() << endl
|
||||
<< decompDict_.name() << endl
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
@ -310,7 +314,7 @@ const Foam::dictionary& Foam::decompositionMethod::findCoeffsDict
|
||||
return dictionary::null;
|
||||
}
|
||||
|
||||
return decompositionDict_;
|
||||
return decompDict_;
|
||||
}
|
||||
|
||||
|
||||
@ -321,8 +325,8 @@ Foam::decompositionMethod::decompositionMethod
|
||||
const dictionary& decompDict
|
||||
)
|
||||
:
|
||||
decompositionDict_(decompDict),
|
||||
decompositionRegionDict_(dictionary::null),
|
||||
decompDict_(decompDict),
|
||||
decompRegionDict_(dictionary::null),
|
||||
nDomains_(nDomains(decompDict))
|
||||
{
|
||||
readConstraints();
|
||||
@ -335,10 +339,10 @@ Foam::decompositionMethod::decompositionMethod
|
||||
const word& regionName
|
||||
)
|
||||
:
|
||||
decompositionDict_(decompDict),
|
||||
decompositionRegionDict_
|
||||
decompDict_(decompDict),
|
||||
decompRegionDict_
|
||||
(
|
||||
optionalRegionDict(decompositionDict_, regionName)
|
||||
optionalRegionDict(decompDict_, regionName)
|
||||
),
|
||||
nDomains_(nDomains(decompDict, regionName))
|
||||
{
|
||||
@ -381,7 +385,6 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
|
||||
(
|
||||
const dictionary& decompDict,
|
||||
const word& regionName
|
||||
|
||||
)
|
||||
{
|
||||
const dictionary& regionDict(optionalRegionDict(decompDict, regionName));
|
||||
@ -428,7 +431,7 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
const pointField& points
|
||||
) const
|
||||
{
|
||||
scalarField weights(points.size(), 1.0);
|
||||
scalarField weights(points.size(), scalar(1));
|
||||
|
||||
return decompose(mesh, points, weights);
|
||||
}
|
||||
@ -482,7 +485,7 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
const pointField& coarsePoints
|
||||
) const
|
||||
{
|
||||
scalarField weights(coarsePoints.size(), 1.0);
|
||||
scalarField weights(coarsePoints.size(), scalar(1));
|
||||
|
||||
return decompose
|
||||
(
|
||||
@ -500,7 +503,7 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
const pointField& cc
|
||||
) const
|
||||
{
|
||||
scalarField weights(cc.size(), 1.0);
|
||||
scalarField weights(cc.size(), scalar(1));
|
||||
|
||||
return decompose(globalCellCells, cc, weights);
|
||||
}
|
||||
@ -565,7 +568,7 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Number of faces per coarse cell
|
||||
labelList nFacesPerCell(nLocalCoarse, 0);
|
||||
labelList nFacesPerCell(nLocalCoarse, Zero);
|
||||
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
||||
{
|
||||
@ -764,7 +767,7 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Number of faces per coarse cell
|
||||
labelList nFacesPerCell(nLocalCoarse, 0);
|
||||
labelList nFacesPerCell(nLocalCoarse, Zero);
|
||||
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
||||
{
|
||||
@ -1016,7 +1019,7 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
// If we average the region centre instead, cyclics could cause
|
||||
// the average domain centre to be outside of domain.
|
||||
|
||||
scalarField regionWeights(localRegion.nLocalRegions(), 0.0);
|
||||
scalarField regionWeights(localRegion.nLocalRegions(), Zero);
|
||||
|
||||
pointField regionCentres(localRegion.nLocalRegions(), point::max);
|
||||
|
||||
|
@ -50,7 +50,14 @@ class decompositionMethod
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Set PtrList of constraints by reading decompositionDict_.
|
||||
//- Check (and warn) about existence of old constraint syntax.
|
||||
// The syntax changed MAY-2014.
|
||||
//
|
||||
// \return true if this model name was found in the decompDict_
|
||||
// but not previously added with the newer syntax.
|
||||
bool constraintCompat(const word& modelType) const;
|
||||
|
||||
//- Set PtrList of constraints by reading decompDict_.
|
||||
void readConstraints();
|
||||
|
||||
//- No copy construct
|
||||
@ -77,10 +84,10 @@ protected:
|
||||
// Protected data
|
||||
|
||||
//- Top-level decomposition dictionary (eg, decomposeParDict)
|
||||
const dictionary& decompositionDict_;
|
||||
const dictionary& decompDict_;
|
||||
|
||||
//- Region-specific decomposition dictionary information
|
||||
const dictionary& decompositionRegionDict_;
|
||||
const dictionary& decompRegionDict_;
|
||||
|
||||
//- Number of domains for the decomposition
|
||||
label nDomains_;
|
||||
@ -238,14 +245,14 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return labelList(0);
|
||||
return labelList();
|
||||
}
|
||||
|
||||
//- Decompose with uniform weights on the points
|
||||
virtual labelList decompose(const pointField& points) const
|
||||
{
|
||||
NotImplemented;
|
||||
return labelList(0);
|
||||
return labelList();
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +30,6 @@ License
|
||||
void Foam::geomDecomp::readCoeffs()
|
||||
{
|
||||
coeffsDict_.readIfPresent("delta", delta_);
|
||||
|
||||
coeffsDict_.readEntry("n", n_);
|
||||
|
||||
// Verify that the input makes sense
|
||||
@ -63,7 +62,7 @@ void Foam::geomDecomp::checkDecompositionDirections
|
||||
const Vector<label>& meshDirs
|
||||
) const
|
||||
{
|
||||
for (direction dir = 0; dir < Vector<label>::nComponents; dir++)
|
||||
for (direction dir = 0; dir < Vector<label>::nComponents; ++dir)
|
||||
{
|
||||
if (n_[dir] > 1 && meshDirs[dir] == -1)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ void Foam::hierarchGeomDecomp::setDecompOrder()
|
||||
{
|
||||
if (order.size() != 3)
|
||||
{
|
||||
FatalIOErrorInFunction(decompositionDict_)
|
||||
FatalIOErrorInFunction(decompDict_)
|
||||
<< "number of characters in order (" << order << ") != 3"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
@ -75,7 +75,7 @@ void Foam::hierarchGeomDecomp::setDecompOrder()
|
||||
case 'z': decompOrder_[i] = 2; break;
|
||||
|
||||
default:
|
||||
FatalIOErrorInFunction(decompositionDict_)
|
||||
FatalIOErrorInFunction(decompDict_)
|
||||
<< "Illegal decomposition order " << order << nl
|
||||
<< "It should only contain x, y or z"
|
||||
<< exit(FatalError);
|
||||
@ -536,7 +536,7 @@ void Foam::hierarchGeomDecomp::sortComponent
|
||||
|
||||
// Now evaluate local cumulative weights, based on the sorting.
|
||||
// Make one bigger than the nodes.
|
||||
scalarField sortedWeightedSizes(current.size()+1, 0);
|
||||
scalarField sortedWeightedSizes(current.size()+1, Zero);
|
||||
calculateSortedWeightedSizes
|
||||
(
|
||||
current,
|
||||
@ -719,7 +719,7 @@ Foam::labelList Foam::hierarchGeomDecomp::decompose
|
||||
) const
|
||||
{
|
||||
// construct a list for the final result
|
||||
labelList finalDecomp(points.size(), 0);
|
||||
labelList finalDecomp(points.size(), Zero);
|
||||
|
||||
// Start off with every point sorted onto itself.
|
||||
labelList slice(points.size());
|
||||
@ -759,8 +759,8 @@ Foam::labelList Foam::hierarchGeomDecomp::decompose
|
||||
const scalarField& weights
|
||||
) const
|
||||
{
|
||||
// construct a list for the final result
|
||||
labelList finalDecomp(points.size(), 0);
|
||||
// Construct a list for the final result
|
||||
labelList finalDecomp(points.size(), Zero);
|
||||
|
||||
// Start off with every point sorted onto itself.
|
||||
labelList slice(points.size());
|
||||
|
@ -24,9 +24,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "manualDecomp.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "IFstream.H"
|
||||
#include "labelIOList.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,7 +54,10 @@ namespace Foam
|
||||
Foam::manualDecomp::manualDecomp(const dictionary& decompDict)
|
||||
:
|
||||
decompositionMethod(decompDict),
|
||||
dataFile_(findCoeffsDict(typeName + "Coeffs").lookup("dataFile"))
|
||||
dataFile_
|
||||
(
|
||||
findCoeffsDict(typeName + "Coeffs").get<fileName>("dataFile")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -66,7 +68,10 @@ Foam::manualDecomp::manualDecomp
|
||||
)
|
||||
:
|
||||
decompositionMethod(decompDict, regionName),
|
||||
dataFile_(findCoeffsDict(typeName + "Coeffs").lookup("dataFile"))
|
||||
dataFile_
|
||||
(
|
||||
findCoeffsDict(typeName + "Coeffs").get<fileName>("dataFile")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -111,11 +111,6 @@ public:
|
||||
|
||||
//- Return for every coordinate the wanted processor number.
|
||||
// Explicitly provided connectivity - does not use mesh_.
|
||||
// The connectivity is equal to mesh.cellCells() except for
|
||||
// - in parallel the cell numbers are global cell numbers (starting
|
||||
// from 0 at processor0 and then incrementing all through the
|
||||
// processors)
|
||||
// - the connections are across coupled patches
|
||||
virtual labelList decompose
|
||||
(
|
||||
const labelListList& globalCellCells,
|
||||
@ -124,7 +119,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return labelList(0);
|
||||
return labelList();
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -397,7 +397,7 @@ void Foam::multiLevelDecomp::decompose
|
||||
Pout<< "Decomposition at level " << currLevel << " :" << endl;
|
||||
}
|
||||
|
||||
for (label domainI = 0; domainI < nCurrDomains; domainI++)
|
||||
for (label domainI = 0; domainI < nCurrDomains; ++domainI)
|
||||
{
|
||||
// Extract elements for current domain
|
||||
const labelList domainPoints(findIndices(dist, domainI));
|
||||
@ -505,12 +505,12 @@ void Foam::multiLevelDecomp::decompose
|
||||
)
|
||||
);
|
||||
|
||||
for (label blockI = 0; blockI < nCurrDomains; blockI++)
|
||||
for (label blockI = 0; blockI < nCurrDomains; ++blockI)
|
||||
{
|
||||
// Count the number inbetween blocks of nNext size
|
||||
|
||||
label nPoints = 0;
|
||||
labelList nOutsideConnections(nCurrDomains, 0);
|
||||
labelList nOutsideConnections(nCurrDomains, Zero);
|
||||
forAll(pointPoints, pointi)
|
||||
{
|
||||
if ((dist[pointi] / nNext) == blockI)
|
||||
@ -633,7 +633,7 @@ Foam::labelList Foam::multiLevelDecomp::decompose
|
||||
CompactListList<label> cellCells;
|
||||
calcCellCells(mesh, identity(cc.size()), cc.size(), true, cellCells);
|
||||
|
||||
labelList finalDecomp(cc.size(), 0);
|
||||
labelList finalDecomp(cc.size(), Zero);
|
||||
labelList cellMap(identity(cc.size()));
|
||||
|
||||
decompose
|
||||
@ -659,7 +659,7 @@ Foam::labelList Foam::multiLevelDecomp::decompose
|
||||
const scalarField& pointWeights
|
||||
) const
|
||||
{
|
||||
labelList finalDecomp(points.size(), 0);
|
||||
labelList finalDecomp(points.size(), Zero);
|
||||
labelList pointMap(identity(points.size()));
|
||||
|
||||
decompose
|
||||
|
@ -50,7 +50,7 @@ Foam::structuredDecomp::structuredDecomp(const dictionary& decompDict)
|
||||
:
|
||||
decompositionMethod(decompDict),
|
||||
methodDict_(findCoeffsDict(typeName + "Coeffs", selectionType::MANDATORY)),
|
||||
patches_(methodDict_.lookup("patches"))
|
||||
patches_(methodDict_.get<wordRes>("patches"))
|
||||
{
|
||||
methodDict_.set("numberOfSubdomains", nDomains());
|
||||
method_ = decompositionMethod::New(methodDict_);
|
||||
@ -150,7 +150,7 @@ Foam::labelList Foam::structuredDecomp::decompose
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Did not visit some cells, e.g. cell " << celli
|
||||
<< " at " << mesh.cellCentres()[celli] << endl
|
||||
<< " at " << mesh.cellCentres()[celli] << nl
|
||||
<< "Assigning these cells to domain 0." << endl;
|
||||
haveWarned = true;
|
||||
}
|
||||
@ -166,17 +166,4 @@ Foam::labelList Foam::structuredDecomp::decompose
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::structuredDecomp::decompose
|
||||
(
|
||||
const labelListList& globalCellCells,
|
||||
const pointField& cc,
|
||||
const scalarField& cWeights
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return labelList(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -105,7 +105,11 @@ public:
|
||||
const labelListList& globalCellCells,
|
||||
const pointField& cc,
|
||||
const scalarField& cWeights
|
||||
) const;
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return labelList();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -71,8 +71,7 @@ Foam::label Foam::metisDecomp::decomposeSerial
|
||||
// k-way: multi-level k-way
|
||||
word method("recursive");
|
||||
|
||||
const dictionary* coeffsDictPtr =
|
||||
decompositionDict_.findDict("metisCoeffs");
|
||||
const dictionary* coeffsDictPtr = decompDict_.findDict("metisCoeffs");
|
||||
|
||||
label numCells = xadj.size()-1;
|
||||
|
||||
@ -133,7 +132,7 @@ Foam::label Foam::metisDecomp::decomposeSerial
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Method " << method << " in metisCoeffs in dictionary : "
|
||||
<< decompositionDict_.name()
|
||||
<< decompDict_.name()
|
||||
<< " should be 'recursive' or 'k-way'"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -148,7 +147,7 @@ Foam::label Foam::metisDecomp::decomposeSerial
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Number of options in metisCoeffs in dictionary : "
|
||||
<< decompositionDict_.name()
|
||||
<< decompDict_.name()
|
||||
<< " should be " << METIS_NOPTIONS
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
9
tutorials/preProcessing/decompositionConstraints/geometric/Allclean
Executable file
9
tutorials/preProcessing/decompositionConstraints/geometric/Allclean
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
|
||||
\rm -f constant/triSurface/blob.obj
|
||||
|
||||
cleanCase0
|
||||
|
||||
#------------------------------------------------------------------------------
|
20
tutorials/preProcessing/decompositionConstraints/geometric/Allrun
Executable file
20
tutorials/preProcessing/decompositionConstraints/geometric/Allrun
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||
|
||||
mkdir -p constant/triSurface
|
||||
|
||||
# Use 'blob' as an arbitrary enclosing surface
|
||||
runApplication surfaceTransformPoints \
|
||||
-translate '(0 0 5)' \
|
||||
-origin '(0 0 5)' \
|
||||
-rotate-angle '((1 0 0) 45)' \
|
||||
$FOAM_TUTORIALS/resources/geometry/blob.stl.gz constant/triSurface/blob.obj
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication decomposePar -dry-run -cellDist
|
||||
|
||||
runApplication foamToVTK -xml -excludePatches '(".*")'
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1812 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
transportModel Newtonian;
|
||||
|
||||
nu 1.5e-05;
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,28 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1812 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType RAS;
|
||||
|
||||
RAS
|
||||
{
|
||||
RASModel kOmegaSST;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,86 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1812 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(-5 -4 0)
|
||||
(15 -4 0)
|
||||
(15 4 0)
|
||||
(-5 4 0)
|
||||
(-5 -4 8)
|
||||
(15 -4 8)
|
||||
(15 4 8)
|
||||
(-5 4 8)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (200 80 80) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
frontAndBack
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
(1 5 4 0)
|
||||
);
|
||||
}
|
||||
inlet
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(0 4 7 3)
|
||||
);
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(2 6 5 1)
|
||||
);
|
||||
}
|
||||
lowerWall
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(0 3 2 1)
|
||||
);
|
||||
}
|
||||
upperWall
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,48 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1812 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application decomposePar;
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 500;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 100;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat binary;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,84 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1812 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeConstraints;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Optional decomposition constraints
|
||||
constraints
|
||||
{
|
||||
geometric
|
||||
{
|
||||
type geometric;
|
||||
|
||||
grow true;
|
||||
|
||||
selection
|
||||
{
|
||||
blob
|
||||
{
|
||||
source surface;
|
||||
surfaceType triSurfaceMesh;
|
||||
surfaceName blob.obj;
|
||||
}
|
||||
|
||||
box1
|
||||
{
|
||||
source box;
|
||||
min (-10 -10 -10);
|
||||
max (1 1 1);
|
||||
}
|
||||
|
||||
semi
|
||||
{
|
||||
source sphere;
|
||||
origin (-2 -2 1);
|
||||
radius 1;
|
||||
}
|
||||
|
||||
mid
|
||||
{
|
||||
source sphere;
|
||||
origin (5 0 4);
|
||||
radius 1;
|
||||
}
|
||||
|
||||
ball
|
||||
{
|
||||
source sphere;
|
||||
origin (15 4 8);
|
||||
radius 3;
|
||||
}
|
||||
|
||||
// This entry should generate a warning (and be ignored)
|
||||
// since it does not describe an enclosed volume.
|
||||
disk
|
||||
{
|
||||
source surface;
|
||||
surface disk;
|
||||
origin (0 0 0);
|
||||
normal (0 0 1);
|
||||
radius 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
baffles
|
||||
{
|
||||
type preserveBaffles;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,34 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1812 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Do NOT attempt with hierarchical with these constraints!
|
||||
|
||||
numberOfSubdomains 128;
|
||||
|
||||
// method simple;
|
||||
method scotch;
|
||||
// method random;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (16 8 4);
|
||||
}
|
||||
|
||||
// Optional decomposition constraints
|
||||
#include "<system>/decomposeConstraints"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,31 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1812 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Do NOT attempt with hierarchical with these constraints!
|
||||
|
||||
numberOfSubdomains 8;
|
||||
|
||||
method scotch;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (2 2 2);
|
||||
}
|
||||
|
||||
// Optional decomposition constraints
|
||||
#include "<system>/decomposeConstraints"
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,58 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default steadyState;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(U) cellLimited Gauss linear 1;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) bounded Gauss linearUpwindV grad(U);
|
||||
div(phi,k) bounded Gauss upwind;
|
||||
div(phi,omega) bounded Gauss upwind;
|
||||
div((nuEff*dev2(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
wallDist
|
||||
{
|
||||
method meshWave;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,92 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p
|
||||
{
|
||||
solver GAMG;
|
||||
tolerance 1e-7;
|
||||
relTol 0.01;
|
||||
smoother GaussSeidel;
|
||||
nPreSweeps 0;
|
||||
nPostSweeps 2;
|
||||
cacheAgglomeration on;
|
||||
agglomerator faceAreaPair;
|
||||
nCellsInCoarsestLevel 10;
|
||||
mergeLevels 1;
|
||||
}
|
||||
|
||||
Phi
|
||||
{
|
||||
$p;
|
||||
}
|
||||
|
||||
U
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
|
||||
k
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
|
||||
omega
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
}
|
||||
|
||||
SIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
consistent yes;
|
||||
}
|
||||
|
||||
potentialFlow
|
||||
{
|
||||
nNonOrthogonalCorrectors 10;
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
equations
|
||||
{
|
||||
U 0.9;
|
||||
k 0.7;
|
||||
omega 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
cache
|
||||
{
|
||||
grad(U);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
Loading…
Reference in New Issue
Block a user