ENH: simplify turbulentDigitalFilterInlet BC
This commit is contained in:
parent
4a798b9ea5
commit
60809c3f50
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,152 +30,179 @@ Group
|
||||
grpInletBoundaryConditions
|
||||
|
||||
Description
|
||||
Velocity boundary condition generating synthetic turbulence-alike
|
||||
time-series for LES and DES turbulent flow computations.
|
||||
|
||||
To this end, two synthetic turbulence generators can be chosen:
|
||||
|
||||
- Digital-filter method-based generator (DFM)
|
||||
Digital-filter based boundary condition for velocity, i.e. \c U, to generate
|
||||
synthetic turbulence-alike time-series for LES and DES turbulent flow
|
||||
computations from input turbulence statistics.
|
||||
|
||||
References:
|
||||
\verbatim
|
||||
Klein, M., Sadiki, A., and Janicka, J.
|
||||
A digital filter based generation of inflow data for spatially
|
||||
developing direct numerical or large eddy simulations,
|
||||
Journal of Computational Physics (2003) 186(2):652-665.
|
||||
doi:10.1016/S0021-9991(03)00090-1
|
||||
Digital-filter method-based generator (DFM) (tag:KSJ):
|
||||
Klein, M., Sadiki, A., & Janicka, J. (2003).
|
||||
A digital filter based generation of inflow data for spatially
|
||||
developing direct numerical or large eddy simulations.
|
||||
Journal of computational Physics, 186(2), 652-665.
|
||||
DOI:10.1016/S0021-9991(03)00090-1
|
||||
|
||||
Forward-stepwise method-based generator (FSM) (tag:XC)
|
||||
Xie, Z. T., & Castro, I. P. (2008).
|
||||
Efficient generation of inflow conditions for
|
||||
large eddy simulation of street-scale flows.
|
||||
Flow, turbulence and combustion, 81(3), 449-470.
|
||||
DOI:10.1007/s10494-008-9151-5
|
||||
|
||||
Mass-inflow rate correction (tag:KCX):
|
||||
Kim, Y., Castro, I. P., & Xie, Z. T. (2013).
|
||||
Divergence-free turbulence inflow conditions for
|
||||
large-eddy simulations with incompressible flow solvers.
|
||||
Computers & Fluids, 84, 56-68.
|
||||
DOI:10.1016/j.compfluid.2013.06.001
|
||||
\endverbatim
|
||||
|
||||
- Forward-stepwise method-based generator (FSM)
|
||||
|
||||
\verbatim
|
||||
Xie, Z.-T., and Castro, I.
|
||||
Efficient generation of inflow conditions for large eddy simulation of
|
||||
street-scale flows, Flow, Turbulence and Combustion (2008) 81(3):449-470
|
||||
doi:10.1007/s10494-008-9151-5
|
||||
\endverbatim
|
||||
|
||||
In DFM or FSM, a random number set (mostly white noise), and a group
|
||||
In \c DFM or \c FSM, a random number set (mostly white noise), and a group
|
||||
of target statistics (mostly mean flow, Reynolds stress tensor profiles and
|
||||
length-scale sets) are fused into a new number set (stochastic time-series,
|
||||
length-scale sets) are merged into a new number set (stochastic time-series,
|
||||
yet consisting of the statistics) by a chain of mathematical operations
|
||||
whose characteristics are designated by the target statistics, so that the
|
||||
realised statistics of the new sets could match the target.
|
||||
|
||||
\verbatim
|
||||
Random number sets ---->-|
|
||||
|
|
||||
DFM or FSM ---> New stochastic time-series consisting
|
||||
| turbulence statistics
|
||||
Turbulence statistics ->-|
|
||||
\endverbatim
|
||||
|
||||
The main difference between DFM and FSM is that the latter replaces the
|
||||
streamwise convolution summation in DFM by a simpler and a quantitatively
|
||||
justified equivalent procedure in order to reduce computational costs.
|
||||
Accordingly, the latter potentially brings resource advantages for
|
||||
computations involving relatively large length-scale sets and small
|
||||
time-steps.
|
||||
The main difference between \c DFM and \c FSM is that \c FSM replaces
|
||||
the expensive-to-run streamwise convolution summation in \c DFM by a simpler
|
||||
and an almost-equivalent-in-effect numerical procedure in order to reduce
|
||||
computational costs. Accordingly, \c FSM potentially brings computational
|
||||
resource advantages for computations involving relatively large streamwise
|
||||
length-scale sets and small time-steps.
|
||||
|
||||
Synthetic turbulence is produced on a virtual rectangular structured-mesh
|
||||
turbulence plane, which is parallel to the actual patch, and is mapped onto
|
||||
the chosen patch by the selected mapping method.
|
||||
Synthetic turbulence is generated on a virtual rectangular structured-mesh
|
||||
plane, which is parallel to the chosen patch, and is mapped onto this patch
|
||||
by the selected mapping method.
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
planeDivisions | Number of nodes on turbulence plane (e2, e3) [-] | yes |
|
||||
L | Integral length-scale set (9-comp):{e1,e2,e3}{u,v,w} [m] | yes |
|
||||
R | Reynolds stress tensor set (xx xy xz yy yz zz) [m2/s2] | yes |
|
||||
patchNormalSpeed | Characteristic mean flow speed [m/s] | yes |
|
||||
isGaussian | Autocorrelation function form | no | true
|
||||
isFixedSeed | Flag to identify random-number seed is fixed | no | true
|
||||
isContinuous | Flag for random-number restart behaviour | no | false
|
||||
isCorrectedFlowRate | Flag for mass flow rate correction | no | true
|
||||
interpolateR | Placeholder flag: interpolate R field | no | false
|
||||
interpolateUMean | Placeholder flag: interpolate UMean field | no | false
|
||||
isInsideMesh | Placeholder flag: TP is inside mesh or on patch | no | false
|
||||
isTaylorHypot | Placeholder flag: Taylor's hypothesis is on | no | true
|
||||
mapMethod | Method to map reference values | no | nearestCell
|
||||
threshold | Threshold to avoid unintentional 'tiny' input | no | 1e-8
|
||||
modelConst | Model constant (Klein et al., Eq. 14) | no | -0.5*PI
|
||||
perturb | Point perturbation for interpolation | no | 1e-5
|
||||
const1FSM | A model coefficient in FSM (Xie-Castro, Eq. 14) | no | -0.25*PI
|
||||
const2FSM | A model coefficient in FSM (Xie-Castro, Eq. 14) | no | -0.5*PI
|
||||
\endtable
|
||||
|
||||
Minimal example of the boundary condition specification with commented
|
||||
options:
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
<patchName>
|
||||
{
|
||||
type turbulentDigitalFilter;
|
||||
variant digitalFilter; // reducedDigitalFilter;
|
||||
planeDivisions (<planeDivisionsHeight> <planeDivisionsWidth>);
|
||||
L (<Lxu> <Lxv> <Lxw> <Lyu> <Lyv> <Lyw> <Lzu> <Lzv> <Lzw>);
|
||||
R (<Rxx> <Rxy> <Rxz> <Ryy> <Ryz> <Rzz>);
|
||||
patchNormalSpeed <characteristic flow speed>;
|
||||
value uniform (0 0 0); // mandatory placeholder
|
||||
// Mandatory entries (unmodifiable)
|
||||
type turbulentDigitalFilterInlet;
|
||||
n (<nHeight> <nWidth>);
|
||||
L (<L1> <L2> ... <L9>);
|
||||
R uniform (<Rxx> <Rxy> <Rxz> <Ryy> <Ryz> <Rzz>);
|
||||
UMean uniform (1 0 0);
|
||||
Ubulk 10.0;
|
||||
|
||||
// Optional entries with default input
|
||||
isGaussian true; // false // always false for FSM
|
||||
isFixedSeed true; // false
|
||||
isContinuous false; // true
|
||||
isCorrectedFlowRate true; // false
|
||||
interpolateR false; // placeholder
|
||||
interpolateUMean false; // placeholder
|
||||
isInsideMesh false; // placeholder
|
||||
isTaylorHypot true; // placeholder
|
||||
mapMethod nearestCell; // planarInterpolation
|
||||
threshold 1e-8;
|
||||
modelConst -1.5707; //-0.5*PI;
|
||||
// Optional entries (unmodifiable)
|
||||
fsm false;
|
||||
Gaussian true; // always false for FSM
|
||||
fixSeed true;
|
||||
continuous false;
|
||||
correctFlowRate true;
|
||||
mapMethod nearestCell;
|
||||
perturb 1e-5;
|
||||
C1 -1.5707; //-0.5*PI;
|
||||
C1FSM -0.7854 //-0.25*PI;
|
||||
C2FSM -1.5707; //-0.5*PI;
|
||||
|
||||
// Optional entries for only FSM with default input
|
||||
const1FSM -0.7854 //-0.25*PI;
|
||||
const2FSM -1.5707; //-0.5*PI;
|
||||
// Optional (inherited) entries
|
||||
...
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Among the dictionary entries, two entries can be input as patch profiles:
|
||||
where the entries mean:
|
||||
\table
|
||||
Property | Description | Type | Req'd | Dflt
|
||||
type | Type name: turbulentDigitalFilterInlet | word | yes | -
|
||||
n | Number of cells on turbulence generation plane <!--
|
||||
--> | tuple of labels | yes | -
|
||||
L | Integral length-scale set <!--
|
||||
--> (Lxu Lxv Lxw Lyu Lyv Lyw Lzu Lzv Lzw) [m] | tensor | yes | -
|
||||
R | Reynolds stress tensor set <!--
|
||||
--> (xx xy xz yy yz zz) [m2/s2] | symmTensorField | yes | -
|
||||
UMean | Mean velocity profile [m/s] | vectorField | yes | -
|
||||
Ubulk | Characteristic patch-normal bulk flow speed [m/s] <!--
|
||||
--> | scalar | yes | -
|
||||
fsm | Flag to turn on the forward-stepwise method | bool | no | false
|
||||
Gaussian | Autocorrelation function form | bool | no | true
|
||||
fixSeed | Flag to fix random-number generator seed to 1234 <!--
|
||||
--> or generate a new seed based on clock-time per simulation <!--
|
||||
--> | bool | no | true
|
||||
continuous | Flag to write random-number sets at output time, <!--
|
||||
--> and to read them on restart. Otherwise, generate <!--
|
||||
--> new random-number sets of restart | bool | no false
|
||||
correctFlowRate | Flag to correct mass-inflow rate on turbulence <!--
|
||||
--> plane in (only) streamwise direction | bool | no | true
|
||||
mapMethod | Interpolation-to-patch method | word | no | nearestCell
|
||||
perturb | Point perturbation for planarInterpolation mapMethod <!--
|
||||
--> | scalar | no | 1e-5
|
||||
C1 | Model constant shaping autocorrelation function <!--
|
||||
--> (KSJ:Eq. 14) | scalar | no | -0.5*PI
|
||||
C1FSM | Model coefficient in FSM (XC:Eq. 14) | scalar | no | -0.25*PI
|
||||
C2FSM | Model coefficient in FSM (XC:Eq. 14) | scalar | no | -0.5*PI
|
||||
\endtable
|
||||
|
||||
The inherited entries are elaborated in:
|
||||
- \link fixedValueFvPatchFields.H \endlink
|
||||
|
||||
Options for the \c fsm entry:
|
||||
\verbatim
|
||||
- Reynolds stress tensor, R
|
||||
- Mean velocity, UMean
|
||||
false | Method due to (KSJ)
|
||||
true | Method due to (XC)
|
||||
\endverbatim
|
||||
|
||||
Profile data and corresponding coordinates are then input in the following
|
||||
directories:
|
||||
|
||||
Options for the \c Gaussian entry:
|
||||
\verbatim
|
||||
- $FOAM_CASE/constant/boundaryData/\<patchName\>/points
|
||||
- $FOAM_CASE/constant/boundaryData/\<patchName\>/0/\{R|UMean\}
|
||||
true | Gaussian function
|
||||
false | Exponential function (only option for FSM)
|
||||
\endverbatim
|
||||
|
||||
The profile data and corresponding coordinates take the same form used by
|
||||
the \c timeVaryingMappedFixedValue and \c turbulentDFSEMInlet boundary
|
||||
conditions, consisting of a \c points file containing a list of 3-D
|
||||
coordinates, and profile data files providing a value per coordinate.
|
||||
Options for the \c mapMethod entry:
|
||||
\verbatim
|
||||
nearestCell | One-to-one direct map, no interpolation
|
||||
planarInterpolation | Bilinear interpolation
|
||||
\endverbatim
|
||||
|
||||
Reynolds stress tensor and mean velocity input are in the global coordinate
|
||||
system whereas integral length scale set input is in the local patch
|
||||
coordinate system.
|
||||
Patch-profile input is available for two entries:
|
||||
\verbatim
|
||||
R | Reynolds stress tensor
|
||||
UMean | Mean velocity
|
||||
\endverbatim
|
||||
where the input profiles and profile coordinates are located in:
|
||||
\verbatim
|
||||
Coordinates | $FOAM_CASE/constant/boundaryData/\<patchName\>/points
|
||||
R/UMean | $FOAM_CASE/constant/boundaryData/\<patchName\>/0/\{R/UMean\}
|
||||
\endverbatim
|
||||
|
||||
It is assumed that the patch normal direction is \c e1, and the remaining
|
||||
patch plane directions are \c e2 and \c e3 following the right-handed
|
||||
coordinate system, which should be taken into consideration when the
|
||||
integral length scale set is input. The first three integral scale entries,
|
||||
i.e. L_e1u, Le1v, Le2w, should always correspond to the length scales
|
||||
that are in association with the convective mean flow direction.
|
||||
\c points file contains a list of three-dimensional coordinates, and
|
||||
profile data files provide a value corresponding to each coordinate.
|
||||
|
||||
Note
|
||||
- \c mapMethod \c planarInterpolation option requires point coordinates
|
||||
which can form a plane, thus input point coordinates varying only in a
|
||||
single direction will trigger error.
|
||||
- \c adjustTimeStep = true option is not fully supported at the moment.
|
||||
- \c mapMethod=planarInterpolation option needs point coordinates that can
|
||||
form a plane.
|
||||
- \c adjustTimeStep=true option is currently not fully supported.
|
||||
- In order to obtain Reynolds stress tensor information, experiments, RANS
|
||||
simulations or engineering relations can be used.
|
||||
- \c continuous=true means deterministic-statistical consistent restart
|
||||
(relatively more expensive), and \c continuous=false means deterministic
|
||||
discontinuity in synthetic turbulence time-series by keeping statistical
|
||||
consistency (relatively cheaper).
|
||||
- For \c L, the first three entries should always correspond to the
|
||||
length scales in association with the convective (streamwise) mean flow
|
||||
direction.
|
||||
- Streamwise integral length scales are converted to integral time scales
|
||||
by using Taylor's frozen turbulence hypothesis, and \c Ubulk.
|
||||
|
||||
SeeAlso
|
||||
turbulentDFSEMInletFvPatchVectorField.C
|
||||
See also
|
||||
- turbulentDFSEMInletFvPatchVectorField.C
|
||||
|
||||
SourceFiles
|
||||
turbulentDigitalFilterInletFvPatchVectorField.C
|
||||
turbulentDigitalFilterInletFvPatchVectorFieldTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -184,7 +211,6 @@ SourceFiles
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "Random.H"
|
||||
#include <functional>
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -202,172 +228,125 @@ class turbulentDigitalFilterInletFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
|
||||
// Private Enumerations
|
||||
|
||||
//- Options for the synthetic turbulence generator variant
|
||||
enum variantType : uint8_t
|
||||
{
|
||||
DIGITAL_FILTER = 1, //!< Digital-filter method (Klein et al.)
|
||||
FORWARD_STEPWISE = 2, //!< Forward-stepwise method (Xie-Castro)
|
||||
};
|
||||
|
||||
//- Names for variant types
|
||||
static const Enum<variantType> variantNames;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- 2D interpolation (for 'planarInterpolation' mapMethod)
|
||||
//- Bilinear interpolation (for 'mapMethod=planarInterpolation')
|
||||
mutable autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
|
||||
|
||||
//- Selected option for the synthetic turbulence generator variant
|
||||
const enum variantType variant_;
|
||||
//- Flag to enable the forward-stepwise method
|
||||
const bool fsm_;
|
||||
|
||||
//- Flag: correlation function form is Gaussian or Exponential
|
||||
// for variantType::DIGITAL_FILTER, default=Gaussian
|
||||
// for variantType::FORWARD_STEPWISE, default=Exponential (only option)
|
||||
const bool isGaussian_;
|
||||
//- Flag to select correlation function form: Gaussian or exponential
|
||||
const bool Gaussian_;
|
||||
|
||||
//- Flag: random-number generator seed is fixed (default=true) or
|
||||
//- generated pseudo-randomly based on clock-time per simulation
|
||||
const bool isFixedSeed_;
|
||||
//- Flag to fix the random-number generator seed to 1234 or
|
||||
//- generate a new seed based on clock-time per simulation
|
||||
const bool fixSeed_;
|
||||
|
||||
//- Flag: write non-manipulated random-number sets at output time, and
|
||||
//- to read them on restart. Otherwise, generate new random-number sets
|
||||
//- on restart. (default=false)
|
||||
// true: deterministic & statistically consistent, more expensive
|
||||
// false: deterministic discontinuity & statistically consistent, cheaper
|
||||
const bool isContinuous_;
|
||||
//- Flag to write random-number sets at output time, and to read them
|
||||
//- on restart. Otherwise, generate new random-number sets on restart
|
||||
const bool continuous_;
|
||||
|
||||
//- Flag: mass flow rate is corrected on turbulence plane (default=true)
|
||||
const bool isCorrectedFlowRate_;
|
||||
//- Flag to correct mass flow rate on turbulence plane
|
||||
const bool correctFlowRate_;
|
||||
|
||||
//- Flag: interpolate R field (default=false)
|
||||
bool interpolateR_;
|
||||
//- Internal flag to read R from data files
|
||||
bool interpR_;
|
||||
|
||||
//- Flag: interpolate UMean field (default=false)
|
||||
bool interpolateUMean_;
|
||||
|
||||
//- Flag: turbulence plane is inside mesh or on a patch (default=false)
|
||||
// Currently, true option is not available.
|
||||
const bool isInsideMesh_;
|
||||
|
||||
//- Flag: convert streamwise (x) length scales to time scales by
|
||||
//- Taylor's 'frozen turbulence' hypothesis (default=true)
|
||||
// Currently, false option is not available.
|
||||
const bool isTaylorHypot_;
|
||||
//- Internal flag to read UMean from data files
|
||||
bool interpUMean_;
|
||||
|
||||
//- Method for interpolation between a patch and turbulence plane
|
||||
//- (default=nearestCell)
|
||||
// Options:
|
||||
// - nearestCell: one-to-one direct map, no interpolation
|
||||
// - planarInterpolation: bilinear interpolation
|
||||
const word mapMethod_;
|
||||
|
||||
//- Current time index
|
||||
label curTimeIndex_;
|
||||
|
||||
//- Threshold to avoid unintentional 'tiny' input scalars (default=1e-8)
|
||||
const scalar tiny_;
|
||||
//- Characteristic patch-normal bulk flow speed [m/s]
|
||||
const scalar Ubulk_;
|
||||
|
||||
//- Characteristic (e.g. bulk) mean speed of flow in the patch normal
|
||||
//- direction [m/s]
|
||||
const scalar patchNormalSpeed_;
|
||||
//- Model constant shaping autocorrelation function (KSJ:Eq. 14)
|
||||
const scalar C1_;
|
||||
|
||||
//- Model constant shaping autocorr function [-] (default='-0.5*pi')
|
||||
// (Klein et al., 2003, Eq. 14)
|
||||
const scalar modelConst_;
|
||||
|
||||
//- Fraction of perturbation (fraction of bounding box) to add (for
|
||||
//- 'planarInterpolation' mapMethod)
|
||||
//- Fraction of perturbation (fraction of bounding box) to add
|
||||
const scalar perturb_;
|
||||
|
||||
//- Initial (first time-step) mass/vol flow rate [m^3/s]
|
||||
scalar initialFlowRate_;
|
||||
//- First time-step mass/volumetric flow rate
|
||||
scalar flowRate_;
|
||||
|
||||
//- Random number generator
|
||||
Random rndGen_;
|
||||
|
||||
//- Number of nodes on turbulence plane (e2 e3) [-]
|
||||
const Tuple2<label, label> planeDivisions_;
|
||||
//- Number of cells on turbulence plane (<nHeight> <nWidth>) [-]
|
||||
const Tuple2<label, label> n_;
|
||||
|
||||
//- Turbulence plane mesh size (reversed) (e2 e3) [1/m]
|
||||
//- Uniform mesh size on turbulence plane (reversed) [1/m]
|
||||
Vector2D<scalar> invDelta_;
|
||||
|
||||
//- Nearest cell mapping: Index pairs between patch and turbulence plane
|
||||
//- Index pairs between patch and turbulence plane
|
||||
//- for the nearest cell mapping
|
||||
const List<Pair<label>> indexPairs_;
|
||||
|
||||
//- Reynolds stress tensor profile (xx xy xz yy yz zz) in global
|
||||
//- coordinates [m^2/s^2]
|
||||
symmTensorField R_;
|
||||
//- Reynolds stress tensor profile field in global coordinates [m2/s2]
|
||||
const symmTensorField R_;
|
||||
|
||||
//- Lund-Wu-Squires transformation (Cholesky decomp.) [m/s]
|
||||
//- Lund-Wu-Squires transformed R field (Cholesky decomp.) [m/s]
|
||||
//- Mapped onto actual mesh patch rather than turbulence plane
|
||||
// (Klein et al., 2003, Eq. 5)
|
||||
symmTensorField LundWuSquires_;
|
||||
// (KSJ:Eq. 5)
|
||||
const symmTensorField Lund_;
|
||||
|
||||
//- Mean inlet velocity profile in global coordinates [m/s]
|
||||
//- Mean inlet velocity profile field in global coordinates [m/s]
|
||||
vectorField UMean_;
|
||||
|
||||
//- Integral length-scale set per turbulence plane section in local
|
||||
//- coordinates (e1u, e1v, e1w, e2u, e2v, e2w, e3u, e3v, e3w) [m]
|
||||
// First three entries should always correspond to the length scales
|
||||
// in association with the convective mean flow direction
|
||||
// Backup of L_ for restart purposes
|
||||
const tensor Lbak_;
|
||||
|
||||
//- Integral length-scale set in mesh units [node]
|
||||
//- Integral length-scale set in mesh units [cell]
|
||||
const tensor L_;
|
||||
|
||||
//- One of the two model coefficients in FSM
|
||||
// (Xie-Castro, 2008, the argument of the first exp func in Eq. 14)
|
||||
const scalar const1FSM_;
|
||||
// (XC:The argument of the first exp func in Eq. 14)
|
||||
const scalar C1FSM_;
|
||||
|
||||
//- One of the two model coefficients in FSM
|
||||
// (Xie-Castro, 2008, the argument of the second exp func in Eq. 14)
|
||||
const scalar const2FSM_;
|
||||
// (XC:The argument of the second exp func in Eq. 14)
|
||||
const scalar C2FSM_;
|
||||
|
||||
//- One of the two exponential functions in FSM
|
||||
// (Xie-Castro, 2008, the first exponential function in Eq. 14)
|
||||
const List<scalar> constList1FSM_;
|
||||
// (XC:The first exponential function in Eq. 14)
|
||||
const List<scalar> coeffs1FSM_;
|
||||
|
||||
//- One of the two exponential functions in FSM
|
||||
// (Xie-Castro, 2008, the first exponential function in Eq. 14)
|
||||
const List<scalar> constList2FSM_;
|
||||
// (XC:The first exponential function in Eq. 14)
|
||||
const List<scalar> coeffs2FSM_;
|
||||
|
||||
//- Number of nodes in random-number box [node]
|
||||
//- Number of cells in random-number box [cell]
|
||||
//- Random-number sets within box are filtered with filterCoeffs_
|
||||
//- (e1u, e1v, e1w, e2u, e2v, e2w, e3u, e3v, e3w)
|
||||
const List<label> lenRandomBox_;
|
||||
const List<label> szBox_;
|
||||
|
||||
//- Convenience factors for 2-D random-number box [-]
|
||||
const List<label> randomBoxFactors2D_;
|
||||
//- Convenience factors for two-dimensional random-number box [-]
|
||||
const List<label> boxFactors2D_;
|
||||
|
||||
//- Convenience factors for 3-D randomNum box [-]
|
||||
const List<label> randomBoxFactors3D_;
|
||||
//- Convenience factors for three-dimensional random-number box [-]
|
||||
const List<label> boxFactors3D_;
|
||||
|
||||
//- Index to the first elem of last plane of random-number box [-]
|
||||
const List<label> iNextToLastPlane_;
|
||||
|
||||
//- Random-number sets distributed over a 3-D box (u, v, w)
|
||||
List<List<scalar>> randomBox_;
|
||||
//- Random-number sets distributed over three-dimensional box (u, v, w)
|
||||
List<List<scalar>> box_;
|
||||
|
||||
//- Filter coefficients corresponding to L_ [-]
|
||||
//- Filter coefficients corresponding to L [-]
|
||||
const List<List<scalar>> filterCoeffs_;
|
||||
|
||||
//- Filter-applied random-number sets [m/s] (effectively turb plane)
|
||||
List<List<scalar>> filteredRandomBox_;
|
||||
//- Filter-applied random-number sets [m/s], i.e. turbulence plane
|
||||
List<List<scalar>> filteredBox_;
|
||||
|
||||
//- Filter-applied previous-time-step velocity field [m/s] used in FSM
|
||||
vectorField U0_;
|
||||
|
||||
//- Run-time function selector between the original and reduced methods
|
||||
const std::function
|
||||
<
|
||||
void(turbulentDigitalFilterInletFvPatchVectorField*, vectorField&)
|
||||
> computeVariant;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -393,82 +372,59 @@ class turbulentDigitalFilterInletFvPatchVectorField
|
||||
|
||||
//- Generate random-number sets obeying the standard normal distribution
|
||||
template<class Form, class Type>
|
||||
Form generateRandomSet(const label len);
|
||||
Form randomSet(const label len);
|
||||
|
||||
//- Compute nearest cell index-pairs between turbulence plane and patch
|
||||
List<Pair<label>> patchIndexPairs();
|
||||
List<Pair<label>> indexPairs();
|
||||
|
||||
//- Check R_ (mapped on actual mesh) for mathematical domain errors
|
||||
void checkRTensorRealisable() const;
|
||||
//- Check R on patch for mathematical domain errors
|
||||
void checkR() const;
|
||||
|
||||
//- Compute Lund-Wu-Squires transformation
|
||||
// (Klein et al., 2003, Eq. 5)
|
||||
symmTensorField computeLundWuSquires() const;
|
||||
symmTensorField calcLund() const;
|
||||
|
||||
//- Compute patch-normal into the domain
|
||||
vector computePatchNormal() const;
|
||||
//- Compute the first time-step mass/
|
||||
//- volumetric flow rate based on UMean
|
||||
scalar calcFlowRate() const;
|
||||
|
||||
//- Compute initial (first time-step) mass/vol flow rate based on UMean_
|
||||
scalar computeInitialFlowRate() const;
|
||||
|
||||
//- Convert streamwise integral length scales to integral time scales
|
||||
//- via Taylor's frozen turbulence hypothesis
|
||||
void convertToTimeScale(tensor& L) const;
|
||||
|
||||
//- Convert length scale phys. unit to turbulence plane mesh-size unit
|
||||
//- (Klein et al., 2003, Eq. 13)
|
||||
tensor convertScalesToGridUnits(const tensor& L) const;
|
||||
//- Convert integral length scales in meters
|
||||
//- to turbulence plane cell-size units
|
||||
tensor meterToCell(const tensor& L) const;
|
||||
|
||||
//- Resource allocation functions for the convenience factors
|
||||
List<label> initLenRandomBox() const;
|
||||
List<label> initBoxFactors2D() const;
|
||||
List<label> initBoxFactors3D() const;
|
||||
List<label> initBoxPlaneFactors() const;
|
||||
List<label> initBox() const;
|
||||
List<label> initFactors2D() const;
|
||||
List<label> initFactors3D() const;
|
||||
List<label> initPlaneFactors() const;
|
||||
|
||||
//- Compute various convenience factors for random-number box
|
||||
List<List<scalar>> fillRandomBox();
|
||||
List<List<scalar>> fillBox();
|
||||
|
||||
//- Compute filter coeffs once per simulation
|
||||
// (Klein et al., 2003, Eq. 14)
|
||||
List<List<scalar>> computeFilterCoeffs() const;
|
||||
List<List<scalar>> calcFilterCoeffs() const;
|
||||
|
||||
//- Discard current time-step random-box plane (closest to patch) by
|
||||
//- shifting from the back to the front, and dd new plane to the back
|
||||
void rndShiftRefill();
|
||||
//- shifting from the back to the front, and add new plane to the back
|
||||
void shiftRefill();
|
||||
|
||||
//- Map two-point correlated random-number sets on patch based on chosen
|
||||
//- mapping method
|
||||
void mapFilteredRandomBox(vectorField& U);
|
||||
//- Map two-point correlated random-number sets
|
||||
//- on patch based on chosen mapping method
|
||||
void mapFilteredBox(vectorField& U);
|
||||
|
||||
//- Map R_ on patch
|
||||
void embedOnePointCorrs(vectorField& U) const;
|
||||
//- Embed one-point correlations, i.e. R, on patch
|
||||
void onePointCorrs(vectorField& U) const;
|
||||
|
||||
//- Map UMean_ on patch
|
||||
void embedMeanVelocity(vectorField& U) const;
|
||||
//- Embed two-point correlations, i.e. L, on box
|
||||
// Three-dimensional "valid"-type separable
|
||||
// convolution summation algorithm
|
||||
// (Based on Song Ho Ahn's two-dimensional "full"-type convolution)
|
||||
void twoPointCorrs();
|
||||
|
||||
//- Correct mass/vol flow rate in (only) streamwise direction
|
||||
void correctFlowRate(vectorField& U) const;
|
||||
//- Compute coeffs1FSM_ once per simulation
|
||||
List<scalar> calcCoeffs1FSM() const;
|
||||
|
||||
//- 3-D 'valid'-type 'separable' convolution summation algorithm
|
||||
// 'Inspired' from Song Ho Ahn's 2-D 'full'-type convolution algorithm
|
||||
// with his permission
|
||||
void embedTwoPointCorrs();
|
||||
|
||||
//- Compute the DFM (Klein et al., 2003)
|
||||
void computeDFM(vectorField& U);
|
||||
|
||||
//- Compute the reduced DFM (i.e. hybrid FSM-DFM) (Xie-Castro, 2008)
|
||||
void computeReducedDFM(vectorField& U);
|
||||
|
||||
//- Compute constList1FSM_ once per simulation
|
||||
List<scalar> computeConstList1FSM() const;
|
||||
|
||||
//- Compute constList2FSM_ once per simulation
|
||||
List<scalar> computeConstList2FSM() const;
|
||||
|
||||
//- Compute the forward-stepwise method
|
||||
// (Xie-Castro, 2008, Eq. 14)
|
||||
void computeFSM(vectorField& U);
|
||||
//- Compute coeffs2FSM_ once per simulation
|
||||
List<scalar> calcCoeffs2FSM() const;
|
||||
|
||||
|
||||
public:
|
||||
@ -476,6 +432,7 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("turbulentDigitalFilterInlet");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
@ -550,6 +507,19 @@ public:
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap(const fvPatchFieldMapper& m);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchVectorField& ptf,
|
||||
const labelList& addr
|
||||
);
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -123,7 +122,7 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::interpolateBoundaryData
|
||||
const rawIOField<Type> vals(io, false);
|
||||
|
||||
|
||||
Info<< "Turbulent DFM/FSM patch " << patchName
|
||||
Info<< "turbulentDigitalFilterInlet patch " << patchName
|
||||
<< ": Interpolating field " << fieldName
|
||||
<< " from " << valsFile << endl;
|
||||
|
||||
@ -132,7 +131,7 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::interpolateBoundaryData
|
||||
|
||||
|
||||
template<class Form, class Type>
|
||||
Form Foam::turbulentDigitalFilterInletFvPatchVectorField::generateRandomSet
|
||||
Form Foam::turbulentDigitalFilterInletFvPatchVectorField::randomSet
|
||||
(
|
||||
const label len
|
||||
)
|
||||
@ -149,4 +148,5 @@ Form Foam::turbulentDigitalFilterInletFvPatchVectorField::generateRandomSet
|
||||
return randomSet;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -10,7 +10,6 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
location "0";
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -21,34 +20,28 @@ internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
bottomWall
|
||||
"bottomWall|topWall"
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform (0 0 0);
|
||||
value $internalField;
|
||||
}
|
||||
topWall
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
left
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
right
|
||||
|
||||
"left|right"
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
|
||||
inlet
|
||||
{
|
||||
value uniform (0 0 0);
|
||||
value $internalField;
|
||||
}
|
||||
#include "inlet/U"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue uniform (0 0 0);
|
||||
value uniform (0 0 0);
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,15 @@ FoamFile
|
||||
|
||||
inlet
|
||||
{
|
||||
type turbulentDigitalFilterInlet;
|
||||
variant digitalFilter;
|
||||
planeDivisions ( 64 70 );
|
||||
L ( 0.78035508 0.31085352 0.342261 0.1728125 0.171875
|
||||
0.22459375 0.172787596 0.171889998 0.224578995 );
|
||||
patchNormalSpeed 20.133;
|
||||
type turbulentDigitalFilterInlet;
|
||||
n ( 64 70 );
|
||||
L
|
||||
(
|
||||
0.78035508 0.31085352 0.342261 0.1728125 0.171875
|
||||
0.22459375 0.172787596 0.171889998 0.224578995
|
||||
);
|
||||
Ubulk 20.133;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -22,4 +22,5 @@ inlet
|
||||
mapMethod nearestCell;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -16,12 +16,16 @@ FoamFile
|
||||
|
||||
inlet
|
||||
{
|
||||
type turbulentDigitalFilterInlet;
|
||||
variant reducedDigitalFilter;
|
||||
planeDivisions ( 64 70 );
|
||||
L ( 0.78035508 0.31085352 0.342261 0.1728125 0.171875
|
||||
0.22459375 0.172787596 0.171889998 0.224578995 );
|
||||
patchNormalSpeed 20.133;
|
||||
type turbulentDigitalFilterInlet;
|
||||
fsm true;
|
||||
n ( 64 70 );
|
||||
L
|
||||
(
|
||||
0.78035508 0.31085352 0.342261 0.1728125 0.171875
|
||||
0.22459375 0.172787596 0.171889998 0.224578995
|
||||
);
|
||||
Ubulk 20.133;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -10,7 +10,6 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object nut;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -21,28 +20,17 @@ internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
bottomWall
|
||||
"bottomWall|topWall"
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
topWall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
left
|
||||
|
||||
"left|right"
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
right
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
inlet
|
||||
{
|
||||
type calculated;
|
||||
value uniform 1e-08;
|
||||
}
|
||||
outlet
|
||||
|
||||
"inlet|outlet"
|
||||
{
|
||||
type calculated;
|
||||
value uniform 1e-08;
|
@ -10,7 +10,6 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -21,30 +20,20 @@ internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
bottomWall
|
||||
"bottomWall|topWall|inlet"
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
topWall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
left
|
||||
|
||||
"left|right"
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
right
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
inlet
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 0;
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,11 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase0
|
||||
\rm -rf system/controlDict constant/boundaryData/inlet results
|
||||
|
||||
rm -f system/controlDict
|
||||
rm -rf constant/boundaryData/inlet
|
||||
rm -rf results
|
||||
rm -f *.png
|
||||
rm -f constant/{R*,points*,UMean*}
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -4,15 +4,6 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
endTime=10
|
||||
\cp system/controlDict.template system/controlDict
|
||||
if notTest "$@"
|
||||
then
|
||||
endTime=85
|
||||
fi
|
||||
\sed -i "s|END_TIME|$endTime|g" system/controlDict
|
||||
|
||||
|
||||
# Collect data into the 'results' directory,
|
||||
# and clean the case for the next run
|
||||
#
|
||||
@ -20,14 +11,15 @@ fi
|
||||
# ----
|
||||
collectData(){
|
||||
model=$1
|
||||
\echo " Moving results into 'results/$model'"
|
||||
results="results/$model"
|
||||
\mkdir -p "$results"
|
||||
runType=$2
|
||||
echo " Moving results into 'results/$model.$runType'"
|
||||
results="results/$model.$runType"
|
||||
mkdir -p "$results"
|
||||
timeDir=$(foamListTimes -latestTime)
|
||||
\mv -f log* *.png postProcessing "$timeDir" "$results" 2>/dev/null
|
||||
mv -f log* *.png postProcessing "$timeDir" "$results" 2>/dev/null
|
||||
|
||||
cleanTimeDirectories
|
||||
\rm -rf processor* > /dev/null 2>&1
|
||||
rm -rf processor* > /dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
@ -40,13 +32,13 @@ serialRun(){
|
||||
models=$*
|
||||
for model in $models
|
||||
do
|
||||
\echo " Running with the synthetic turbulence model: $model"
|
||||
(\cd 0 && \ln -snf "inlet.$model" inlet)
|
||||
(\cd constant/boundaryData && \ln -snf "inlet.$model" inlet)
|
||||
echo " Running with the synthetic turbulence model: $model"
|
||||
(cd 0 && ln -snf "inlet.$model" inlet)
|
||||
(cd constant/boundaryData && ln -snf "inlet.$model" inlet)
|
||||
|
||||
runApplication -s "$model" $(getApplication)
|
||||
./plot
|
||||
collectData $model
|
||||
collectData $model "serial"
|
||||
done
|
||||
}
|
||||
|
||||
@ -60,36 +52,35 @@ parallelRun(){
|
||||
models=$*
|
||||
for model in $models
|
||||
do
|
||||
\echo " Running with the synthetic turbulence model: $model"
|
||||
(\cd 0 && \ln -snf "inlet.$model" inlet)
|
||||
(\cd constant/boundaryData && \ln -snf "inlet.$model" inlet)
|
||||
echo " Running with the synthetic turbulence model: $model"
|
||||
(cd 0 && ln -snf "inlet.$model" inlet)
|
||||
(cd constant/boundaryData && ln -snf "inlet.$model" inlet)
|
||||
|
||||
runApplication -s "$model" decomposePar
|
||||
runApplication -s "$model" decomposePar -force
|
||||
runParallel -s "$model" $(getApplication)
|
||||
runApplication -s "$model" reconstructPar -latestTime
|
||||
./plot
|
||||
|
||||
collectData $model
|
||||
collectData $model "parallel"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Synthetic inflow models
|
||||
# Prepare the numerical setup
|
||||
./Allrun.pre
|
||||
|
||||
# Run with the synthetic turbulence models
|
||||
models="
|
||||
reducedDigitalFilter
|
||||
digitalFilter
|
||||
FSM
|
||||
DFM
|
||||
DFSEM
|
||||
"
|
||||
|
||||
# Prepare the numerical setup
|
||||
runApplication blockMesh
|
||||
restore0Dir
|
||||
\rm -rf "results"
|
||||
parallelRun $models
|
||||
|
||||
# Run with the synthetic turbulence models
|
||||
serialRun $models
|
||||
#parallelRun $models
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
20
tutorials/verificationAndValidation/turbulentInflow/PCF/Allrun.pre
Executable file
20
tutorials/verificationAndValidation/turbulentInflow/PCF/Allrun.pre
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
endTime=85
|
||||
if notTest "$@"
|
||||
then
|
||||
endTime=10
|
||||
fi
|
||||
|
||||
sed "s|END_TIME|$endTime|g" system/controlDict.template > system/controlDict
|
||||
|
||||
restore0Dir
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
rm -rf results
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -1,12 +1,11 @@
|
||||
Synthetic turbulence inflow tests
|
||||
======================
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
The following three synthetic turbulence inflow boundary conditions are
|
||||
examined through a single-cell-domain smooth-wall plane channel flow setup:
|
||||
|
||||
- turbulentDFSEMInlet
|
||||
- turbulentDigitalFilterInlet variant=digitalFilter
|
||||
- turbulentDigitalFilterInlet variant=reducedDigitalFilter
|
||||
- turbulentDFSEMInlet (DFSEM)
|
||||
- turbulentDigitalFilterInlet (DFM)
|
||||
- turbulentDigitalFilterInlet with the forward-stepwise method (FSM)
|
||||
|
||||
The input statistics are obtained from:
|
||||
|
||||
@ -22,13 +21,12 @@ The data is available online from (Retrieved: 21-06-2019):
|
||||
|
||||
https://turbulence.oden.utexas.edu/data/MKM/chan395/
|
||||
|
||||
Serial executing (comment out 'parallelRun'):
|
||||
|
||||
./Allrun
|
||||
|
||||
Parallel (decompositionMethod=scotch) executing (comment out 'serialRun'):
|
||||
Executing:
|
||||
|
||||
./Allrun
|
||||
|
||||
The script will run the test case, and collect the plots and samples into
|
||||
the 'results' directory.
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
135
tutorials/verificationAndValidation/turbulentInflow/PCF/plot
Executable file
135
tutorials/verificationAndValidation/turbulentInflow/PCF/plot
Executable file
@ -0,0 +1,135 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
plotCellR() {
|
||||
timeDir=$1
|
||||
echo " Plotting the normal and Reynolds stresses on cell."
|
||||
|
||||
outName="stress-cell.png"
|
||||
gnuplot<<PLT_CELL_R
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0:1]
|
||||
set yrange [-1:8]
|
||||
set grid
|
||||
set key top right
|
||||
set key samplen 2
|
||||
set key spacing 0.75
|
||||
set xlabel "Channel height from the bottomWall [m]"
|
||||
set ylabel "<u_i^' u_i^'> [m2/s2]"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
set title "Normal and Reynolds stresses on cell"
|
||||
|
||||
input = "$timeDir/inletCell_UPrime2Mean.xy"
|
||||
bench = "constant/pointsRdata"
|
||||
|
||||
plot \
|
||||
input u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
|
||||
input u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
|
||||
input u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
|
||||
input u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00", \
|
||||
bench u 2:4 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
|
||||
bench u 2:7 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
|
||||
bench u 2:9 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
|
||||
bench u 2:5 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
|
||||
PLT_CELL_R
|
||||
}
|
||||
|
||||
|
||||
plotPatchR() {
|
||||
timeDir=$1
|
||||
echo " Plotting the normal and Reynolds stresses on inlet patch faces."
|
||||
|
||||
outName="stress-patch.png"
|
||||
gnuplot<<PLT_PATCH_R
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0:1]
|
||||
set yrange [-1:8]
|
||||
set grid
|
||||
set key top right
|
||||
set key samplen 2
|
||||
set key spacing 0.75
|
||||
set xlabel "Channel height from the bottomWall [m]"
|
||||
set ylabel "<u_i^' u_i^'> [m2/s2]"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
set title "Normal and Reynolds stresses on patch"
|
||||
|
||||
input = "$timeDir/inletPatch_UPrime2Mean.xy"
|
||||
bench = "constant/pointsRdata"
|
||||
|
||||
plot \
|
||||
input u 1:2 t "<u^' u^'>" w l lw 2 lc rgb "#009E73", \
|
||||
input u 1:5 t "<v^' v^'>" w l lw 2 lc rgb "#F0E440", \
|
||||
input u 1:7 t "<w^' w^'>" w l lw 2 lc rgb "#0072B2", \
|
||||
input u 1:3 t "<u^' v^'>" w l lw 2 lc rgb "#D55E00", \
|
||||
bench u 2:4 t "<u^' u^'>_{DNS}" w l lw 2 dt 2 lc rgb "#009E73", \
|
||||
bench u 2:7 t "<v^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#F0E440", \
|
||||
bench u 2:9 t "<w^' w^'>_{DNS}" w l lw 2 dt 2 lc rgb "#0072B2", \
|
||||
bench u 2:5 t "<u^' v^'>_{DNS}" w l lw 2 dt 2 lc rgb "#D55E00"
|
||||
PLT_PATCH_R
|
||||
}
|
||||
|
||||
|
||||
plotPatchUMean() {
|
||||
timeDir=$1
|
||||
echo " Plotting the streamwise mean flow speed on inlet patch faces."
|
||||
|
||||
outName="u-patch.png"
|
||||
gnuplot<<PLT_PATCH_UMEAN
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0:1]
|
||||
set yrange [0:25]
|
||||
set grid
|
||||
set key top right
|
||||
set key samplen 2
|
||||
set key spacing 0.75
|
||||
set xlabel "Channel height from the bottomWall [m]"
|
||||
set ylabel "u [m/s]"
|
||||
set offset .05, .05
|
||||
set output "$outName"
|
||||
|
||||
input = "$timeDir/inletPatch_UMean.xy"
|
||||
bench = "constant/pointsUMeanData"
|
||||
|
||||
plot \
|
||||
input u 1:2 t "u" w l lw 2 lc rgb "#009E73", \
|
||||
bench u 2:4 t "u_{DNS}" w l lw 2 dt 2 lc rgb "#009E73"
|
||||
PLT_PATCH_UMEAN
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Require gnuplot
|
||||
command -v gnuplot >/dev/null || {
|
||||
echo "gnuplot not found - skipping graph creation" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Prepare the benchmark data
|
||||
cp -f constant/boundaryData/inlet/0/R constant/R
|
||||
cp -f constant/boundaryData/inlet/points constant/points
|
||||
cp -f constant/boundaryData/inlet.DFM/0/UMean constant/UMean
|
||||
cat constant/R | tr -d '()' > constant/Rdata
|
||||
cat constant/points | tr -d '()' > constant/pointsData
|
||||
cat constant/UMean | tr -d '()' > constant/UMeanData
|
||||
paste constant/pointsData constant/Rdata > constant/pointsRdata
|
||||
paste constant/pointsData constant/UMeanData > constant/pointsUMeanData
|
||||
|
||||
# The latestTime in postProcessing/sampling1
|
||||
timeDir=$(foamListTimes -case postProcessing/sampling1 -latestTime 2>/dev/null)
|
||||
[ -n "$timeDir" ] || {
|
||||
echo "No postProcessing/sampling1 found - skipping graph creation" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
timeDir="postProcessing/sampling1/$timeDir"
|
||||
|
||||
plotCellR "$timeDir"
|
||||
plotPatchR "$timeDir"
|
||||
plotPatchUMean "$timeDir"
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -88,4 +88,5 @@ mergePatchPairs
|
||||
(
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -29,7 +29,7 @@ deltaT 4e-3;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 1250;
|
||||
writeInterval 50;
|
||||
|
||||
purgeWrite 3;
|
||||
|
||||
@ -47,13 +47,59 @@ runTimeModifiable false;
|
||||
|
||||
adjustTimeStep false;
|
||||
|
||||
|
||||
// Allow 10% of time for initialisation before sampling
|
||||
timeStart #eval #{ 0.1 * ${/endTime} #};
|
||||
|
||||
functions
|
||||
{
|
||||
#include "fieldAverage"
|
||||
#include "sampling"
|
||||
fieldAverage1
|
||||
{
|
||||
type fieldAverage;
|
||||
libs (fieldFunctionObjects);
|
||||
writeControl writeTime;
|
||||
timeStart $/timeStart;
|
||||
|
||||
fields
|
||||
(
|
||||
U
|
||||
{
|
||||
mean on;
|
||||
prime2Mean on;
|
||||
base time;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
sampling1
|
||||
{
|
||||
type sets;
|
||||
libs (sampling);
|
||||
interpolationScheme cellPoint;
|
||||
setFormat raw;
|
||||
writeControl onEnd;
|
||||
fields (UPrime2Mean UMean);
|
||||
|
||||
sets
|
||||
(
|
||||
inletPatch
|
||||
{
|
||||
type face;
|
||||
axis y;
|
||||
start (0.0 0 1.57);
|
||||
end (0.0 2 1.57);
|
||||
}
|
||||
|
||||
inletCell
|
||||
{
|
||||
type midPoint;
|
||||
axis y;
|
||||
start (0.062832 0 1.57);
|
||||
end (0.062832 2 1.57);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -10,13 +10,19 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
note "mesh decomposition control dictionary";
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 3;
|
||||
numberOfSubdomains 4;
|
||||
|
||||
method hierarchical;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (1 2 2);
|
||||
}
|
||||
|
||||
method scotch;
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -51,4 +51,5 @@ snGradSchemes
|
||||
default corrected;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -1,73 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
plotStresses() {
|
||||
timeDir=$1
|
||||
\echo " Plotting the normal and Reynolds stresses"
|
||||
|
||||
gnuplot<<PLT_STRESSES
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0:1]
|
||||
set yrange [-1:8]
|
||||
set grid
|
||||
set key top right
|
||||
set xlabel "Channel height from the bottomWall [m]"
|
||||
set ylabel "<u_i^' u_i^'>"
|
||||
set offset .05, .05
|
||||
|
||||
set style data linespoints
|
||||
set linetype 1 lc rgb 'black' lw 2
|
||||
set linetype 2 lc rgb 'red' lw 2
|
||||
set linetype 3 lc rgb 'blue' lw 2
|
||||
set linetype 4 lc rgb 'green' lw 2
|
||||
set linetype 5 lc rgb 'black' pi -8 pt 4 ps 1.5
|
||||
set linetype 6 lc rgb 'red' pi -8 pt 4 ps 1.5
|
||||
set linetype 7 lc rgb 'blue' pi -8 pt 4 ps 1.5
|
||||
set linetype 8 lc rgb 'green' pi -8 pt 4 ps 1.5
|
||||
|
||||
set title "Normal and Reynolds stresses on cell"
|
||||
input="$timeDir/inletCell_UPrime2Mean.xy"
|
||||
set output 'stress-cell.png'
|
||||
plot \
|
||||
input u 1:2 w lines t "<u^' u^'>" lt 1, \
|
||||
input u 1:5 w lines t "<v^' v^'>" lt 2, \
|
||||
input u 1:7 w lines t "<w^' w^'>" lt 3, \
|
||||
input u 1:3 w lines t "<u^' v^'>" lt 4
|
||||
|
||||
set title "Normal and Reynolds stresses on patch"
|
||||
input = "$timeDir/inletPatch_UPrime2Mean.xy"
|
||||
set output 'stress-patch.png'
|
||||
plot \
|
||||
input u 1:2 w lines t "<u^' u^'>" lt 1, \
|
||||
input u 1:5 w lines t "<v^' v^'>" lt 2, \
|
||||
input u 1:7 w lines t "<w^' w^'>" lt 3, \
|
||||
input u 1:3 w lines t "<u^' v^'>" lt 4
|
||||
|
||||
PLT_STRESSES
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Require gnuplot
|
||||
command -v gnuplot >/dev/null || {
|
||||
\echo "gnuplot not found - skipping graph creation" 1>&2
|
||||
\exit 1
|
||||
}
|
||||
|
||||
|
||||
# The latestTime in postProcessing/inletSampling
|
||||
timeDir=$(foamListTimes -case postProcessing/inletSampling -latestTime 2>/dev/null)
|
||||
|
||||
[ -n "$timeDir" ] || {
|
||||
\echo "No postProcessing/inletSampling found - skipping graph creation" 1>&2
|
||||
\exit 2
|
||||
}
|
||||
|
||||
timeDir="postProcessing/inletSampling/$timeDir"
|
||||
|
||||
plotStresses "$timeDir"
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -1,36 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fieldAverage;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
fieldAverage1
|
||||
{
|
||||
type fieldAverage;
|
||||
libs (fieldFunctionObjects);
|
||||
writeControl writeTime;
|
||||
timeStart $/timeStart;
|
||||
|
||||
fields
|
||||
(
|
||||
U
|
||||
{
|
||||
mean on;
|
||||
prime2Mean on;
|
||||
base time;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -1,48 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object sampling;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inletSampling
|
||||
{
|
||||
type sets;
|
||||
libs (sampling);
|
||||
writeControl writeTime;
|
||||
timeStart $/timeStart;
|
||||
|
||||
interpolationScheme cellPoint;
|
||||
setFormat raw;
|
||||
fields (UPrime2Mean);
|
||||
|
||||
sets
|
||||
(
|
||||
inletPatch
|
||||
{
|
||||
type face;
|
||||
axis y;
|
||||
start (0.0 0 1.57);
|
||||
end (0.0 2 1.57);
|
||||
}
|
||||
inletCell
|
||||
{
|
||||
type midPoint;
|
||||
axis y;
|
||||
start (0.062832 0 1.57);
|
||||
end (0.062832 2 1.57);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
Loading…
Reference in New Issue
Block a user