pyts.stressModels package¶
Submodules¶
pyts.stressModels.api module¶
PyTurbSim ‘Reynold’s stress models’ package.
The Reynold’s stress quantifies correlations betweens turbulent velocity components. It has three components: <u’v’>, <u’w’> and <v’w’> (‘<x>’ denotes an ‘appropriate’ time average of the quantity ‘x’).
Available stress models:¶
main.uniform
(alias: uniform)- A uniform Reynold’s stress over the spatial domain.
hydro.tidal
(alias: tidal)- The ‘tidal` Reynold’s stress model (increases linearly toward the seafloor/ground).
stressModelBase
- This is the base class for stress models. To create a new one, subclass this class or subclass and modify an existing stress model.
stressObj
- This is the ‘stress object’ class. All stress model __call__
methods must take a
tsrun
as input and return this class.
Example usage¶
import pyts.stressmodels.api as rm
Create a uniform Reynold’s stress model where each component is specified explicitly:
>>> my_stress_model=rm.uniform(upvp_=0.01,upwp_=0.1,vpwp_=0.0)
This stress model can then be applied to a tsrun (see pyts.main.tsrun):
>>> tsrun.stress=my_stress_model(tsrun)
See also¶
For a description of the difference between ‘stress models’ (e.g. ‘my_stress_model’ in example above) and the stress they output (tsrun.prof), see the ‘models_and_stats_example.py’ file.
pyts.stressModels.base module¶
This is the stress package’s base module.
produce estimates of Reynold’s stress
-
class
pyts.stressModels.base.
stressModelBase
[source]¶ Bases:
pyts.base.modelBase
-
class
pyts.stressModels.base.
stressObj
(tsrun)[source]¶ Bases:
pyts.base.calcObj
,pyts.base.gridProps
-
calc_phases
(phases)[source]¶ Here we control the Reynold’s stress by setting the phases between components to be the same for a fraction of the frequencies.
-
corr
¶
-
upvp_
¶ The u’v’ Reynolds stress for this model.
-
upvp_max
¶ The product of the standard deviations of u’ and v’ (i.e. the maximum stress for the given turbulence model).
-
upwp_
¶ The u’w’ Reynolds stress for this model.
-
upwp_max
¶ The product of the standard deviations of u’ and w’ (i.e. the maximum stress for the given turbulence model).
-
validity
¶ Return a validity array for the stress magnitudes.
Returns: A 3 x n_z x n_y boolean array.
There are three criteria for each point in the grid. They are
listed here by their index in the array:
- The magnitude criteria: no stress can exceed the maximum stress (correlation between components cannot exceed 1).
- The ‘overlap’ criteria: The sum of the magnitude of the correlations can exceed one if they overlap. However, their are limits to the overlap. This criteria indicates that limit has been exceeded.
- The ‘sign’ criteria. If only one component is negative than they can not overlap. In this case the sum of magnitude of the correlations must be less than 1.
If any of the criteria are false at any point, than the
stressModel is invalid at that point.
-
vpwp_
¶ The v’w’ Reynolds stress for this model.
-
vpwp_max
¶ The product of the standard deviations of v’ and w’ (i.e. the maximum stress for the given turbulence model).
-
pyts.stressModels.hydro module¶
-
class
pyts.stressModels.hydro.
tidal
(Ustar, Zref)[source]¶ Bases:
pyts.stressModels.base.stressModelBase
The ‘tidal’ model Reynold’s stress model.
Parameters: Ustar : float
The friction velocity at the bottom boundary (aka \(U_*\)).
Zref : float
The height of the ‘no-stress’ level in the water-column.
Notes
The v’w’ and u’v’ components are zero. The u’w’ component is:
\[\overline{u'w'} = -U_*^2 (1-z/Z_{\mathrm{ref}})\]for 0<z<Zref, and 0 elsewhere.
pyts.stressModels.main module¶
-
class
pyts.stressModels.main.
uniform
(upvp_=0.0, upwp_=0.0, vpwp_=0.0)[source]¶ Bases:
pyts.stressModels.base.stressModelBase
Uniform Reynold’s stress model.
In this model each component of the Reynold’s stress can be specified explicitly, but the values are uniform in space.
Parameters: upvp_ : float
The u’v’ component of Reynold’s stress.
upwp_ : float
The u’w’ component of Reynold’s stress.
vpwp_ : float
The v’w’ component of Reynold’s stress.
pyts.stressModels.stress_freq module¶
-
class
pyts.stressModels.stress_freq.
stressModelBase_f
[source]¶ Bases:
pyts.stressModels.base.stressModelBase
A stress-model base-class that supports setting the stress by controlling the frequency-dependent coherence between velocity components.
Module contents¶
This is the PyTurbSim ‘stress models’ package.
For more information or to use this package import the stressModels.api package, e.g.:
>>> import pyts.stressModels.api as rm
Currently the stress package does not function properly, unless no coherence is used. Fixing this is near the top of the list of things to repair in PyTurbSim.