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

View File

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