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

View File

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

View File

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

View File

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