Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
integration-cfmesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Community
integration-cfmesh
Commits
da83793c
Commit
da83793c
authored
Apr 10, 2015
by
Franjo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Description
parent
d56f72c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
88 deletions
+80
-88
utilities/generateBoundaryLayers/generateBoundaryLayers.C
utilities/generateBoundaryLayers/generateBoundaryLayers.C
+80
-88
No files found.
utilities/generateBoundaryLayers/generateBoundaryLayers.C
View file @
da83793c
...
...
@@ -22,8 +22,8 @@ License
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Performs point relocations in the mesh (smoothing) in order to
improve quality measures. It does not make the mesh invalied
.
Generates boundary layers in the existing mesh, based on the settings
given in meshDict. It also performs necessary quality optimisation
.
\*---------------------------------------------------------------------------*/
...
...
@@ -31,120 +31,112 @@ Description
#include "Time.H"
#include "polyMeshGenModifier.H"
#include "meshOptimizer.H"
#include "boundaryLayers.H"
#include "refineBoundaryLayers.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
void
generateLayer
(
polyMeshGen
&
mesh
,
const
dictionary
&
meshDict
,
const
bool
layers2D
)
{
argList
::
validArgs
.
clear
();
argList
::
validOptions
.
insert
(
"nLoops"
,
"int"
);
argList
::
validOptions
.
insert
(
"nIterations"
,
"int"
);
argList
::
validOptions
.
insert
(
"nSurfaceIterations"
,
"int"
);
argList
::
validOptions
.
insert
(
"qualityThreshold"
,
"scalar"
);
argList
::
validOptions
.
insert
(
"constrainedCellsSet"
,
"word"
);
# include "setRootCase.H"
# include "createTime.H"
boundaryLayers
bl
(
mesh
);
//- read the settings
label
nIterations
(
50
);
label
nLoops
(
10
);
label
nSurfaceIterations
(
2
);
scalar
qualityThreshold
(
0
.
1
);
if
(
layers2D
)
bl
.
activate2DMode
();
if
(
args
.
options
().
found
(
"nLoop
s"
)
)
if
(
meshDict
.
found
(
"boundaryLayer
s"
)
)
{
nLoops
=
readLabel
(
IStringStream
(
args
.
options
()[
"nLoops"
])());
const
dictionary
&
bndLayers
=
meshDict
.
subDict
(
"boundaryLayers"
);
if
(
bndLayers
.
found
(
"nLayers"
)
)
{
const
label
nLayers
=
readLabel
(
bndLayers
.
lookup
(
"nLayers"
));
if
(
nLayers
>
0
)
bl
.
addLayerForAllPatches
();
}
else
if
(
bndLayers
.
found
(
"patchBoundaryLayers"
)
)
{
const
dictionary
&
patchLayers
=
bndLayers
.
subDict
(
"patchBoundaryLayers"
);
const
wordList
createLayers
=
patchLayers
.
toc
();
forAll
(
createLayers
,
patchI
)
bl
.
addLayerForPatch
(
createLayers
[
patchI
]);
}
}
else
{
Info
<<
"Default number of loops is 10"
<<
endl
;
bl
.
addLayerForAllPatches
()
;
}
}
if
(
args
.
options
().
found
(
"nIterations"
)
)
{
nIterations
=
readLabel
(
IStringStream
(
args
.
options
()[
"nIterations"
])());
}
else
{
Info
<<
"Default number of iterations is 50"
<<
endl
;
}
void
meshOptimisation
(
polyMeshGen
&
mesh
)
{
meshOptimizer
mOpt
(
mesh
);
if
(
args
.
options
().
found
(
"nSurfaceIterations"
)
)
{
nSurfaceIterations
=
readLabel
(
IStringStream
(
args
.
options
()[
"nSurfaceIterations"
])());
}
else
{
Info
<<
"Default number of surface iterations is 2"
<<
endl
;
}
mOpt
.
optimizeMeshFV
();
mOpt
.
optimizeLowQualityFaces
();
mOpt
.
untangleMeshFV
();
mOpt
.
optimizeBoundaryLayer
();
mOpt
.
untangleMeshFV
();
}
if
(
args
.
options
().
found
(
"qualityThreshold"
)
)
{
qualityThreshold
=
readScalar
(
IStringStream
(
args
.
options
()[
"qualityThreshold"
])());
}
else
void
layerRefinement
(
polyMeshGen
&
mesh
,
const
dictionary
&
meshDict
)
{
if
(
meshDict
.
isDict
(
"boundaryLayers"
)
)
{
Info
<<
"Using default quality threshold 0.1"
<<
endl
;
}
refineBoundaryLayers
refLayers
(
mesh
);
word
constrainedCellSet
;
refineBoundaryLayers
::
readSettings
(
meshDict
,
refLayers
)
;
if
(
args
.
options
().
found
(
"constrainedCellsSet"
)
)
{
constrainedCellSet
=
args
.
options
()[
"constrainedCellsSet"
];
}
else
{
Info
<<
"No constraints applied on the smoothing procedure"
<<
endl
;
}
//- load the mesh from disk
polyMeshGen
pmg
(
runTime
);
pmg
.
read
();
refLayers
.
refineLayers
();
//- construct the smoother
meshOptimizer
mOpt
(
pmg
);
meshOptimizer
(
mesh
).
untangleBoundaryLayer
();
}
}
if
(
!
constrainedCellSet
.
empty
()
)
{
//- lock cells in constrainedCellSet
mOpt
.
lockCellsInSubset
(
constrainedCellSet
);
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
validOptions
.
insert
(
"2DLayers"
,
"bool"
);
//- find boundary faces which shall be locked
labelLongList
lockedBndFaces
,
selectedCells
;
# include "setRootCase.H"
# include "createTime.H"
const
label
sId
=
pmg
.
cellSubsetIndex
(
constrainedCellSet
);
pmg
.
cellsInSubset
(
sId
,
selectedCells
);
IOdictionary
meshDict
(
IOobject
(
"meshDict"
,
runTime
.
system
(),
runTime
,
IOobject
::
MUST_READ
,
IOobject
::
NO_WRITE
)
);
boolList
activeCell
(
pmg
.
cells
().
size
(),
false
);
forAll
(
selectedCells
,
i
)
activeCell
[
selectedCells
[
i
]]
=
true
;
}
//- load the mesh from disk
polyMeshGen
pmg
(
runTime
);
pmg
.
read
();
//- clear geometry information before volume smoothing
pmg
.
clearAddressingData
();
bool
is2DLayer
(
false
);
if
(
args
.
options
().
found
(
"2DLayers"
)
)
is2DLayer
=
true
;
//- perform optimisation using the laplace smoother and
mOpt
.
optimizeMeshFV
(
nLoops
,
nLoops
,
nIterations
,
nSurfaceIterations
);
//- generate the initial boundary layer
generateLayer
(
pmg
,
meshDict
,
is2DLayer
);
//-
perform optimisation of worst quality faces
m
Opt
.
optimizeMeshFVBestQuality
(
nLoops
,
qualityThreshold
);
//-
optimisation of mesh quality
m
eshOptimisation
(
pmg
);
//-
check the mesh again and untangl bad regions if any of them exis
t
mOpt
.
untangleMeshFV
(
nLoops
,
nIterations
,
nSurfaceIterations
);
//-
perform layer refinemen
t
layerRefinement
(
pmg
,
meshDict
);
Info
<<
"Writing mesh"
<<
endl
;
pmg
.
write
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment