Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry Weller
2023-07-19 12:11:40 +01:00
7 changed files with 205 additions and 38 deletions

View File

@ -5,6 +5,7 @@ blockMeshConfigurationBase.C
blockMeshCartesianConfiguration.C blockMeshCartesianConfiguration.C
blockMeshCylindricalConfiguration.C blockMeshCylindricalConfiguration.C
snappyHexMeshConfiguration.C snappyHexMeshConfiguration.C
meshQualityConfiguration.C
surfaceFeaturesConfiguration.C surfaceFeaturesConfiguration.C
snappyHexMeshConfig.C snappyHexMeshConfig.C

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ 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 "meshQualityConfiguration.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::meshQualityConfiguration::meshQualityConfiguration
(
const fileName& name,
const fileName& dir,
const Time& time
)
:
caseFileConfiguration(name, dir, time)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::meshQualityConfiguration::~meshQualityConfiguration()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::meshQualityConfiguration::write()
{
dict_.writeHeader(os_, word("dictionary"));
os_ << "#includeEtc \"caseDicts/mesh/generation/meshQualityDict.cfg\""
<< nl << endl;
os_ << "//- minFaceWeight (0 -> 0.5)" << nl
<< "//minFaceWeight 0.02;";
dict_.writeEndDivider(os_);
}
// ************************************************************************* //

View File

@ -0,0 +1,94 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ 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::meshQualityConfiguration
Description
Writes a meshQualityDict file which is included from the snappyHexMeshDict
file.
SourceFiles
meshQualityConfiguration.C
\*---------------------------------------------------------------------------*/
#ifndef meshQualityConfiguration_H
#define meshQualityConfiguration_H
#include "caseFileConfiguration.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class meshQualityConfiguration Declaration
\*---------------------------------------------------------------------------*/
class meshQualityConfiguration
:
public caseFileConfiguration
{
public:
// Constructors
meshQualityConfiguration
(
const fileName& name,
const fileName& dir,
const Time& time
);
//- Disallow default bitwise copy construction
meshQualityConfiguration(const meshQualityConfiguration&) = delete;
//- Destructor
~meshQualityConfiguration();
// Member Functions
// Write the snappyHexMeshDict
void write();
// Member Operators
//- Disallow default bitwise assignment
void operator=(const meshQualityConfiguration&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -75,20 +75,20 @@ Description
oriented along the z-axis along x = y = 0. oriented along the z-axis along x = y = 0.
The snappyHexMesh configuration is generated automatically, applying a set The snappyHexMesh configuration is generated automatically, applying a set
of defaults to the main configuration parameters. By default, explicit of defaults to the main configuration parameters. By default, implicit
feature capturing is configured, for which a surfaceFeaturesDict file is feature capturing is configured. Explicit feature capturing can
written for the user to generate the features files with the alternatively be selected with the '-explicitFeatures' option, when an
surfaceFeatures utility. Implicit feature capturing can alternatively be additional surfaceFeaturesDict file is written for the user to generate the
selected with the '-implicitFeatures' option. Refinement levels can be features files with the surfaceFeatures utility. Refinement levels can be
controlled with a range of options including: '-refinementLevel' for the controlled with a range of options including: '-refinementLevel' for the
baseline refinement level; '-refinementSurfaces' for levels on specific baseline refinement level; '-refinementSurfaces' for levels on specific
surfaces; '-refinementRegions' for levels inside specific surfaces; surfaces; '-refinementRegions' for levels inside specific surfaces;
'-refinementBoxes' for quick, box-shaped refinement regions specified by '-refinementBoxes' for quick, box-shaped refinement regions specified by min
min and max bounds; '-refinementDists' for distance-based refinement; and and max bounds; '-refinementDists' for distance-based refinement; and
'-nCellsBetweenLevels' to control the transition between refinement '-nCellsBetweenLevels' to control the transition between refinement
levels. A '-layers' option specifies additional layers of cells at wall levels. A '-layers' option specifies additional layers of cells at wall
boundaries. The insidePoint parameter is set to '(0 0 0)' by default but boundaries. The insidePoint parameter is set to '(0 0 0)' by default but can
can be overridden using the '-insidePoint' option. be overridden using the '-insidePoint' option.
Usage Usage
\b snappyHexMeshConfig [OPTIONS] \b snappyHexMeshConfig [OPTIONS]
@ -134,8 +134,8 @@ Usage
- \par -clearBoundary, - \par -clearBoundary,
Do not set default patch entries, i.e. xMin, xMax, yMin, etc... Do not set default patch entries, i.e. xMin, xMax, yMin, etc...
- \par -implicitFeatures, - \par -explicitFeatures,
Use implicit feature capturing Use explicit feature capturing, default is implicit
- \par -layers \<int\> - \par -layers \<int\>
Specify <int> surface layers at wall boundaries, default 0 Specify <int> surface layers at wall boundaries, default 0
@ -169,6 +169,7 @@ Usage
#include "blockMeshCartesianConfiguration.H" #include "blockMeshCartesianConfiguration.H"
#include "blockMeshCylindricalConfiguration.H" #include "blockMeshCylindricalConfiguration.H"
#include "snappyHexMeshConfiguration.H" #include "snappyHexMeshConfiguration.H"
#include "meshQualityConfiguration.H"
#include "surfaceFeaturesConfiguration.H" #include "surfaceFeaturesConfiguration.H"
#include "boundBox.H" #include "boundBox.H"
#include "searchableSurface.H" #include "searchableSurface.H"
@ -308,8 +309,8 @@ int main(int argc, char *argv[])
argList::addBoolOption argList::addBoolOption
( (
"implicitFeatures", "explicitFeatures",
"use implicit feature capturing" "use explicit feature capturing"
); );
argList::addOption argList::addOption
@ -569,7 +570,7 @@ int main(int argc, char *argv[])
); );
} }
const bool implicitFeatures(args.optionFound("implicitFeatures")); const bool explicitFeatures(args.optionFound("explicitFeatures"));
const label layers(args.optionLookupOrDefault<label>("layers", 0)); const label layers(args.optionLookupOrDefault<label>("layers", 0));
@ -583,15 +584,18 @@ int main(int argc, char *argv[])
args.optionLookupOrDefault<label>("nCellsBetweenLevels", 3) args.optionLookupOrDefault<label>("nCellsBetweenLevels", 3)
); );
surfaceFeaturesConfiguration surfaceFeaturesConfig if (explicitFeatures)
( {
"surfaceFeaturesDict", surfaceFeaturesConfiguration surfaceFeaturesConfig
runTime.system(), (
runTime, "surfaceFeaturesDict",
surfaces runTime.system(),
); runTime,
surfaces
);
surfaceFeaturesConfig.write(); surfaceFeaturesConfig.write();
}
snappyHexMeshConfiguration snappyConfig snappyHexMeshConfiguration snappyConfig
( (
@ -604,7 +608,7 @@ int main(int argc, char *argv[])
refinementRegions, refinementRegions,
refinementBoxes, refinementBoxes,
refinementDists, refinementDists,
implicitFeatures, explicitFeatures,
layers, layers,
insidePoint, insidePoint,
nCellsBetweenLevels nCellsBetweenLevels
@ -612,6 +616,15 @@ int main(int argc, char *argv[])
snappyConfig.write(); snappyConfig.write();
meshQualityConfiguration meshQualityConfig
(
"meshQualityDict",
runTime.system(),
runTime
);
meshQualityConfig.write();
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;
return 0; return 0;

View File

@ -133,7 +133,7 @@ void Foam::snappyHexMeshConfiguration::writeFeatures()
{ {
beginList(os_, "features"); beginList(os_, "features");
if (!implicitFeatures_) if (explicitFeatures_)
{ {
forAll(surfaces_, i) forAll(surfaces_, i)
{ {
@ -422,9 +422,9 @@ void Foam::snappyHexMeshConfiguration::writeSnapControls()
beginDict(os_, "snapControls"); beginDict(os_, "snapControls");
os_ << indent << "explicitFeatureSnap " os_ << indent << "explicitFeatureSnap "
<< (implicitFeatures_ ? "off" : "on") << ";" << endl; << (explicitFeatures_ ? "on" : "off") << ";" << endl;
os_ << indent << "implicitFeatureSnap " os_ << indent << "implicitFeatureSnap "
<< (implicitFeatures_ ? "on" : "off") << ";" << endl; << (explicitFeatures_ ? "off" : "on") << ";" << endl;
endDict(os_); endDict(os_);
} }
@ -432,10 +432,8 @@ void Foam::snappyHexMeshConfiguration::writeSnapControls()
void Foam::snappyHexMeshConfiguration::writeAddLayersControls() void Foam::snappyHexMeshConfiguration::writeAddLayersControls()
{ {
if (layers_ == 0) // Include addLayersControls sub-dict with zero layers when layers are
{ // switched off, so they can be conveniently switched on later.
return;
}
beginDict(os_, "addLayersControls"); beginDict(os_, "addLayersControls");
@ -499,7 +497,7 @@ Foam::snappyHexMeshConfiguration::snappyHexMeshConfiguration
const List<Tuple2<word, label>>& refinementRegions, const List<Tuple2<word, label>>& refinementRegions,
const List<Tuple3<vector, vector, label>>& refinementBoxes, const List<Tuple3<vector, vector, label>>& refinementBoxes,
const List<Tuple3<word, scalar, label>>& refinementDists, const List<Tuple3<word, scalar, label>>& refinementDists,
const bool implicitFeatures, const bool explicitFeatures,
const label layers, const label layers,
const point& insidePoint, const point& insidePoint,
const label nCellsBetweenLevels const label nCellsBetweenLevels
@ -512,7 +510,7 @@ Foam::snappyHexMeshConfiguration::snappyHexMeshConfiguration
refinementRegions_(refinementRegions), refinementRegions_(refinementRegions),
refinementBoxes_(refinementBoxes), refinementBoxes_(refinementBoxes),
refinementDists_(refinementDists), refinementDists_(refinementDists),
implicitFeatures_(implicitFeatures), explicitFeatures_(explicitFeatures),
layers_(layers), layers_(layers),
insidePoint_(insidePoint), insidePoint_(insidePoint),
nCellsBetweenLevels_(nCellsBetweenLevels) nCellsBetweenLevels_(nCellsBetweenLevels)

View File

@ -80,8 +80,8 @@ class snappyHexMeshConfiguration
//- Refinement distances with level of refinement //- Refinement distances with level of refinement
const List<Tuple3<word, scalar, label>>& refinementDists_; const List<Tuple3<word, scalar, label>>& refinementDists_;
//- Using implicit feature capturing? //- Using explicit feature capturing?
const bool implicitFeatures_; const bool explicitFeatures_;
//- Number of layers at wall patches, default 0 //- Number of layers at wall patches, default 0
const label layers_; const label layers_;
@ -173,7 +173,7 @@ public:
const List<Tuple2<word, label>>& refinementRegions, const List<Tuple2<word, label>>& refinementRegions,
const List<Tuple3<vector, vector, label>>& refinementBoxes, const List<Tuple3<vector, vector, label>>& refinementBoxes,
const List<Tuple3<word, scalar, label>>& refinementDists, const List<Tuple3<word, scalar, label>>& refinementDists,
const bool implicitFeatures, const bool explicitFeatures,
const label layers, const label layers,
const point& insidePoint, const point& insidePoint,
const label nCellsBetweenLevels const label nCellsBetweenLevels

View File

@ -1331,13 +1331,14 @@ Foam::domainDecomposition::procFaceAddressingBf() const
procMeshes_[proci].boundary().size() procMeshes_[proci].boundary().size()
); );
} }
if (completeMesh().conformal() && procMeshes_[0].conformal()) if (completeConformal() && procsConformal())
{ {
// Nothing to do // Nothing to do
} }
else if (!completeMesh().conformal()) else if (!completeConformal())
{ {
// Decompose non-conformal addressing // Decompose non-conformal addressing
const surfaceLabelField::Boundary& polyFacesBf = const surfaceLabelField::Boundary& polyFacesBf =
completeMesh().polyFacesBf(); completeMesh().polyFacesBf();
@ -1399,7 +1400,7 @@ Foam::domainDecomposition::procFaceAddressingBf() const
} }
} }
} }
else // if (!procMeshes_[0].conformal()) else // if (!procsConformal())
{ {
// Reconstruct non-conformal addressing // Reconstruct non-conformal addressing