ENH: ensure consistent default mapping in turbulentDFSEMInlet

- Previously, the default mapping method was `planarInterpolation` which was
    silently suppressed by the default 'interpolate{R,U,L}=false'.

  STYLE: changes:
            `0` to `Zero`,
            `lookupOrDefault` to `getOrDefault`
         improves header documentation
This commit is contained in:
Kutalmis Bercin 2019-11-13 11:50:17 +00:00 committed by Andrew Heather
parent 69640bd3d8
commit 87250cb770
2 changed files with 57 additions and 51 deletions

View File

@ -730,12 +730,12 @@ turbulentDFSEMInletFvPatchVectorField
) )
: :
fixedValueFvPatchField<vector>(p, iF), fixedValueFvPatchField<vector>(p, iF),
delta_(0), delta_(Zero),
d_(0), d_(Zero),
kappa_(0), kappa_(Zero),
perturb_(1e-5), perturb_(1e-5),
mapMethod_("planarInterpolation"), mapMethod_("nearestCell"),
mapperPtr_(nullptr), mapperPtr_(nullptr),
interpolateR_(false), interpolateR_(false),
interpolateL_(false), interpolateL_(false),
@ -751,14 +751,14 @@ turbulentDFSEMInletFvPatchVectorField
triCumulativeMagSf_(), triCumulativeMagSf_(),
sumTriMagSf_(Pstream::nProcs() + 1, Zero), sumTriMagSf_(Pstream::nProcs() + 1, Zero),
eddies_(0), eddies_(Zero),
nCellPerEddy_(5), nCellPerEddy_(5),
patchNormal_(Zero), patchNormal_(Zero),
v0_(0), v0_(Zero),
rndGen_(Pstream::myProcNo()), rndGen_(Pstream::myProcNo()),
sigmax_(size(), 0), sigmax_(size(), Zero),
maxSigmaX_(0), maxSigmaX_(Zero),
nEddy_(0), nEddy_(Zero),
curTimeIndex_(-1), curTimeIndex_(-1),
patchBounds_(boundBox::invertedBox), patchBounds_(boundBox::invertedBox),
singleProc_(false), singleProc_(false),
@ -804,7 +804,7 @@ turbulentDFSEMInletFvPatchVectorField
rndGen_(ptf.rndGen_), rndGen_(ptf.rndGen_),
sigmax_(ptf.sigmax_, mapper), sigmax_(ptf.sigmax_, mapper),
maxSigmaX_(ptf.maxSigmaX_), maxSigmaX_(ptf.maxSigmaX_),
nEddy_(0), nEddy_(Zero),
curTimeIndex_(-1), curTimeIndex_(-1),
patchBounds_(ptf.patchBounds_), patchBounds_(ptf.patchBounds_),
singleProc_(ptf.singleProc_), singleProc_(ptf.singleProc_),
@ -822,15 +822,15 @@ turbulentDFSEMInletFvPatchVectorField
: :
fixedValueFvPatchField<vector>(p, iF, dict), fixedValueFvPatchField<vector>(p, iF, dict),
delta_(dict.get<scalar>("delta")), delta_(dict.get<scalar>("delta")),
d_(dict.lookupOrDefault<scalar>("d", 1)), d_(dict.getOrDefault<scalar>("d", 1.0)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.getOrDefault<scalar>("kappa", 0.41)),
perturb_(dict.lookupOrDefault<scalar>("perturb", 1e-5)), perturb_(dict.getOrDefault<scalar>("perturb", 1e-5)),
mapMethod_(dict.getOrDefault<word>("mapMethod", "planarInterpolation")), mapMethod_(dict.getOrDefault<word>("mapMethod", "nearestCell")),
mapperPtr_(nullptr), mapperPtr_(nullptr),
interpolateR_(false), interpolateR_(dict.getOrDefault<bool>("interpolateR", false)),
interpolateL_(false), interpolateL_(dict.getOrDefault<bool>("interpolateL", false)),
interpolateU_(false), interpolateU_(dict.getOrDefault<bool>("interpolateU", false)),
R_(interpolateOrRead<symmTensor>("R", dict, interpolateR_)), R_(interpolateOrRead<symmTensor>("R", dict, interpolateR_)),
L_(interpolateOrRead<scalar>("L", dict, interpolateL_)), L_(interpolateOrRead<scalar>("L", dict, interpolateL_)),
U_(interpolateOrRead<vector>("U", dict, interpolateU_)), U_(interpolateOrRead<vector>("U", dict, interpolateU_)),
@ -843,17 +843,17 @@ turbulentDFSEMInletFvPatchVectorField
sumTriMagSf_(Pstream::nProcs() + 1, Zero), sumTriMagSf_(Pstream::nProcs() + 1, Zero),
eddies_(), eddies_(),
nCellPerEddy_(dict.lookupOrDefault<label>("nCellPerEddy", 5)), nCellPerEddy_(dict.getOrDefault<label>("nCellPerEddy", 5)),
patchNormal_(Zero), patchNormal_(Zero),
v0_(0), v0_(Zero),
rndGen_(0, -1), rndGen_(0, -1),
sigmax_(size(), Zero), sigmax_(size(), Zero),
maxSigmaX_(0), maxSigmaX_(Zero),
nEddy_(0), nEddy_(Zero),
curTimeIndex_(-1), curTimeIndex_(-1),
patchBounds_(boundBox::invertedBox), patchBounds_(boundBox::invertedBox),
singleProc_(false), singleProc_(false),
writeEddies_(dict.lookupOrDefault("writeEddies", false)) writeEddies_(dict.getOrDefault<bool>("writeEddies", false))
{ {
eddy::debug = debug; eddy::debug = debug;
@ -899,7 +899,7 @@ turbulentDFSEMInletFvPatchVectorField
rndGen_(ptf.rndGen_), rndGen_(ptf.rndGen_),
sigmax_(ptf.sigmax_), sigmax_(ptf.sigmax_),
maxSigmaX_(ptf.maxSigmaX_), maxSigmaX_(ptf.maxSigmaX_),
nEddy_(0), nEddy_(Zero),
curTimeIndex_(-1), curTimeIndex_(-1),
patchBounds_(ptf.patchBounds_), patchBounds_(ptf.patchBounds_),
singleProc_(ptf.singleProc_), singleProc_(ptf.singleProc_),
@ -943,7 +943,7 @@ turbulentDFSEMInletFvPatchVectorField
rndGen_(ptf.rndGen_), rndGen_(ptf.rndGen_),
sigmax_(ptf.sigmax_), sigmax_(ptf.sigmax_),
maxSigmaX_(ptf.maxSigmaX_), maxSigmaX_(ptf.maxSigmaX_),
nEddy_(0), nEddy_(Zero),
curTimeIndex_(-1), curTimeIndex_(-1),
patchBounds_(ptf.patchBounds_), patchBounds_(ptf.patchBounds_),
singleProc_(ptf.singleProc_), singleProc_(ptf.singleProc_),
@ -1203,7 +1203,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::write(Ostream& os) const
os.writeEntryIfDifferent<word> os.writeEntryIfDifferent<word>
( (
"mapMethod", "mapMethod",
"planarInterpolation", "nearestCell",
mapMethod_ mapMethod_
); );
} }

View File

@ -36,15 +36,16 @@ Description
Reference: Reference:
\verbatim \verbatim
Poletto, R., Craft, T., and Revell, A., Poletto, R., Craft, T., & Revell, A. (2013).
"A New Divergence Free Synthetic Eddy Method for the Reproduction A new divergence free synthetic eddy method for
of Inlet Flow Conditions for LES", the reproduction of inlet flow conditions for LES.
Flow Turbulence Combust (2013) 91:519-539 Flow, turbulence and combustion, 91(3), 519-539.
DOI:10.1007/s10494-013-9488-2
\endverbatim \endverbatim
Reynolds stress, velocity and turbulence length scale values can either Reynolds stress, velocity and turbulence length scale values can either
be sepcified directly, or mapped. If mapping, the values should be be specified directly, or mapped. If mapping, the values should be
entered in the same form as the timeVaryingMappedFixedValue condition, entered in the same form as the \c timeVaryingMappedFixedValue condition,
except that no interpolation in time is supported. These should be except that no interpolation in time is supported. These should be
located in the directory: located in the directory:
@ -63,18 +64,23 @@ Usage
L | Turbulence length scale field | no | L | Turbulence length scale field | no |
d | Eddy density (fill fraction) | no | 1 d | Eddy density (fill fraction) | no | 1
kappa | Von Karman constant | no | 0.41 kappa | Von Karman constant | no | 0.41
mapMethod | Method to map reference values | no | planarInterpolation mapMethod | Method to map reference values | no | nearestCell
perturb | Point perturbation for interpolation | no | 1e-5 perturb | Point perturbation for interpolation | no | 1e-5
interpolateR | Flag to interpolate the R field | no | false
interpolateL | Flag to interpolate the L field | no | false
interpolateU | Flag to interpolate the U field | no | false
writeEddies | Flag to write eddies as OBJ file | no | no writeEddies | Flag to write eddies as OBJ file | no | no
\endtable \endtable
Note Note
- The \c delta value typically represents a channel half-height - The \c delta value typically represents the characteristic scale of flow
- For R, U and L specification: if the entry is not user input, it is or flow domain, e.g. a channel half-height
assumed that the data will be mapped - For \c R, \c U and \c L specification: if the entry is not user input,
it is assumed that the data will be mapped
SeeAlso SeeAlso
timeVaryingMappedFixedValueFvPatchField timeVaryingMappedFixedValueFvPatchField
turbulentDigitalFilterInlet
SourceFiles SourceFiles
turbulentDFSEMInletFvPatchVectorField.C turbulentDFSEMInletFvPatchVectorField.C
@ -110,7 +116,7 @@ class turbulentDFSEMInletFvPatchVectorField
//- Maximum number of attempts when seeding eddies //- Maximum number of attempts when seeding eddies
static label seedIterMax_; static label seedIterMax_;
//- Typical length scale, e.g. half channel height //- Characteristic length scale, e.g. half channel height
const scalar delta_; const scalar delta_;
//- Ratio of sum of eddy volumes to eddy box volume; default = 1 //- Ratio of sum of eddy volumes to eddy box volume; default = 1
@ -128,7 +134,7 @@ class turbulentDFSEMInletFvPatchVectorField
//- Fraction of perturbation (fraction of bounding box) to add //- Fraction of perturbation (fraction of bounding box) to add
scalar perturb_; scalar perturb_;
//- Interpolation scheme to use //- Interpolation scheme to use (nearestCell | planarInterpolation)
word mapMethod_; word mapMethod_;
//- 2D interpolation (for 'planarInterpolation' mapMethod) //- 2D interpolation (for 'planarInterpolation' mapMethod)
@ -232,7 +238,7 @@ class turbulentDFSEMInletFvPatchVectorField
vector uDashEddy(const List<eddy>& eddies, const point& globalX) const; vector uDashEddy(const List<eddy>& eddies, const point& globalX) const;
//- Helper function to interpolate values from the boundary data or //- Helper function to interpolate values from the boundary data or
// read from dictionary //- read from dictionary
template<class Type> template<class Type>
tmp<Field<Type>> interpolateOrRead tmp<Field<Type>> interpolateOrRead
( (
@ -258,7 +264,7 @@ class turbulentDFSEMInletFvPatchVectorField
const pointToPointPlanarInterpolation& patchMapper() const; const pointToPointPlanarInterpolation& patchMapper() const;
//- Return eddies from remote processors that interact with local //- Return eddies from remote processors that interact with local
// processor //- processor
void calcOverlappingProcEddies void calcOverlappingProcEddies
( (
List<List<eddy>>& overlappingEddies List<List<eddy>>& overlappingEddies
@ -289,7 +295,7 @@ public:
); );
//- Construct by mapping given turbulentDFSEMInletFvPatchVectorField //- Construct by mapping given turbulentDFSEMInletFvPatchVectorField
// onto a new patch //- onto a new patch
turbulentDFSEMInletFvPatchVectorField turbulentDFSEMInletFvPatchVectorField
( (
const turbulentDFSEMInletFvPatchVectorField&, const turbulentDFSEMInletFvPatchVectorField&,
@ -337,7 +343,7 @@ public:
virtual ~turbulentDFSEMInletFvPatchVectorField() = default; virtual ~turbulentDFSEMInletFvPatchVectorField() = default;
// Member functions // Member Functions
//- Helper function to check that Reynold stresses are valid //- Helper function to check that Reynold stresses are valid
static bool checkStresses(const symmTensorField& Rf); static bool checkStresses(const symmTensorField& Rf);