Commit 8076963c authored by mattijs's avatar mattijs
Browse files

ENH: snappyHexMesh: directional smoothing. See #1031

parent d9425875
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -587,6 +587,7 @@ Foam::shellSurfaces::shellSurfaces
dirLevels_.setSize(shellI);
smoothDirection_.setSize(shellI);
nSmoothExpansion_.setSize(shellI);
nSmoothPosition_.setSize(shellI);
extendedGapLevel_.setSize(shellI);
extendedGapMode_.setSize(shellI);
......@@ -666,10 +667,16 @@ Foam::shellSurfaces::shellSurfaces
// Directional smoothing
// ~~~~~~~~~~~~~~~~~~~~~
nSmoothExpansion_[shellI] = 0;
nSmoothPosition_[shellI] = 0;
smoothDirection_[shellI] =
dict.lookupOrDefault("smoothDirection", vector::zero);
nSmoothExpansion_[shellI] =
dict.lookupOrDefault("nSmoothExpansion", 0);
if (smoothDirection_[shellI] != vector::zero)
{
dict.lookup("nSmoothExpansion") >> nSmoothExpansion_[shellI];
dict.lookup("nSmoothPosition") >> nSmoothPosition_[shellI];
}
// Gap specification
......@@ -824,6 +831,12 @@ const Foam::vectorField& Foam::shellSurfaces::smoothDirection() const
}
const Foam::labelList& Foam::shellSurfaces::nSmoothPosition() const
{
return nSmoothPosition_;
}
void Foam::shellSurfaces::findHigherLevel
(
const pointField& pt,
......
......@@ -98,6 +98,9 @@ private:
//- Per shell the directional smoothing iterations
labelList nSmoothExpansion_;
//- Per shell the positional smoothing iterations
labelList nSmoothPosition_;
// Gap level refinement
......@@ -246,6 +249,9 @@ public:
//- Per shell the directional smoothing iterations
const labelList& nSmoothExpansion() const;
//- Per shell the positional smoothing iterations
const labelList& nSmoothPosition() const;
};
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -36,10 +36,8 @@ SourceFiles
#include "wordPairHashTable.H"
#include "labelList.H"
#include "PackedBoolList.H"
#include "labelVector.H"
#include "vector.H"
#include "scalarField.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -53,6 +51,7 @@ class snapParameters;
class meshRefinement;
class decompositionMethod;
class fvMeshDistribute;
class fvMesh;
/*---------------------------------------------------------------------------*\
Class snappyRefineDriver Declaration
......@@ -156,19 +155,16 @@ class snappyRefineDriver
);
//- Calculate local edge length from cell volumes
void getVirtualEdgeLength
void mergeAndSmoothRatio
(
const vector& userDirection,
const labelList& pointLabels,
const PackedBoolList& isXFace,
scalarField& maxUserSize
) const;
const scalarList& allSeedPointDist,
const label nSmoothExpansion,
List<Tuple2<scalar, scalar>>& keyAndValue
);
//- Smooth the directional expansion ratio
label directionalSmooth
(
const refinementParameters& refineParams
);
label directionalSmooth(const refinementParameters& refineParams);
//- Add baffles and remove unreachable cells
void baffleAndSplitMesh
......@@ -248,7 +244,6 @@ public:
const refinementParameters& refineParams,
const HashTable<Pair<word>>& faceZoneToPatches
);
};
......
......@@ -4,22 +4,13 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication blockMesh
# Serial
runApplication snappyHexMesh -overwrite
runApplication $(getApplication)
## Serial
#runApplication snappyHexMesh -overwrite
#runApplication $(getApplication)
## Parallel
#runApplication decomposePar -fileHandler collated
#runParallel snappyHexMesh -overwrite -fileHandler collated
## Remove any include files from the field dictionaries
#( mkdir -p processors/0 && \
# cd 0 && \
# for f in *; do [ -f "$f" ] && \
# foamDictionary "$f" > "../processors/0/$f"; done \
#)
#
#runParallel $(getApplication) -fileHandler collated
#runApplication reconstructParMesh -constant -mergeTol 1e-6
#runApplication reconstructPar
runApplication decomposePar -fileHandler collated
runParallel snappyHexMesh -overwrite -fileHandler collated
runApplication reconstructParMesh -constant -fileHandler collated -mergeTol 1e-6
#------------------------------------------------------------------------------
......@@ -18,13 +18,4 @@ numberOfSubdomains 2;
method scotch;
//coeffs
//{
// n (3 2 1);
// delta 0.001;
// order xyz;
// dataFile "cellDecomposition";
//}
// ************************************************************************* //
......@@ -124,10 +124,10 @@ castellatedMeshControls
// actually be a lot less.
maxGlobalCells 2000000;
// The surface refinement loop might spend lots of iterations refining just a
// few cells. This setting will cause refinement to stop if <= minimumRefine
// are selected for refinement. Note: it will at least do one iteration
// (unless the number of cells to refine is 0)
// The surface refinement loop might spend lots of iterations refining
// just a few cells. This setting will cause refinement to stop if <=
// minimumRefineare selected for refinement. Note: it will at least do one
// iteration (unless the number of cells to refine is 0)
minRefinementCells 100;
// Number of buffer layers between different levels.
......@@ -229,10 +229,10 @@ castellatedMeshControls
// (after all other refinement). Directional refinement
// for all cells according to 'mode' ('inside' or 'outside';
// 'distance' not supported) and within certain range. E.g.
// - for all cells with level 0-100
// - do two splits in z direction. The resulting mesh is
// - for all cells with level 0-1
// - do one split in z direction. The resulting mesh is
// no longer compatible with e.g. dynamic refinement/unrefinement.
levelIncrement (0 0 (0 0 1));
levelIncrement (0 1 (0 0 1));
}
dirRefineBox2
{
......@@ -245,7 +245,7 @@ castellatedMeshControls
// (after all other refinement). Directional refinement
// for all cells according to 'mode' ('inside' or 'outside';
// 'distance' not supported) and within certain range. E.g.
// - for all cells with level 0-100
// - for all cells with level 0-1
// - do two splits in z direction. The resulting mesh is
// no longer compatible with e.g. dynamic refinement/unrefinement.
levelIncrement (0 1 (0 0 2));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment