pyts.runInput package¶
Submodules¶
pyts.runInput.base module¶
The base module for the runInput package. This module defines the TurbSim input class (tsinput). The tsinput class is a dictionary for storing data from a TurbSim input file. The class contains several methods that specify default values for several input variables. Those defaults documented in the Original-TurbSim documentation: https://wind.nrel.gov/designcodes/preprocessors/turbsim/TurbSim.pdf
-
class
pyts.runInput.base.tsinput(*args, **kwargs)[source]¶ Bases:
dictThe TurbSim input object and ‘global defaults’ handler.
This class works essentially as a dictionary, but with various functions and routines for providing default values in the event that ‘input’ values are not specified explicitly by the user.
Regarding global defaults: The ‘_dflt_…’ functions define ‘global’ default definitions (used by multiple profModels and/or turbModels). Other, model specific, defaults are defined in the model itself.
For further information on the ‘defaults’ defined here, consult the O-TurbSim documentation: https://wind.nrel.gov/designcodes/preprocessors/turbsim/TurbSim.pdf
-
incdec_a¶ The ‘a’ coherence decrement.
-
incdec_b¶
-
isdefault(key)[source]¶ Is the given variable a default?
True : The value is not specified and there is no ‘_dflt_…’ function. 2 : The value is defined by a ‘_dflt_…’ function. False: The value is specified explicitly in the configuration.
-
psiM¶
-
randseed¶
-
turbmodel¶
-
ustar0¶
-
zL¶
-
pyts.runInput.main module¶
The ‘main’ module for the PyTurbSim runInput package defines the ‘run’ and ‘write’ routines for performing a TurbSim run and writing-out data.
Example usage¶
First import the PyTurbSim api and runInput package. >>> import pyts.api as pyts >>> import pyts.runInput as runInput
First create a tsinput object from an input file using the io.input.read function:
>>> tsinput=pyts.io.input.read('MyInputFile.inp')
Now run PyTurbSim using the runInput ‘run’ function:
>>> tsdata=runInput.run(tsinput)
This data can be written to the files specified in the input file (tsinput) using:
>>> runInput.write(tsdata,tsinput)
-
pyts.runInput.main.cfg2grid(tsinput)[source]¶ cfg2grid produces a TurbSim-grid object that matches the specificitions in the tsinput object.
Parameters: tsinput :
tscfgA PyTurbSim input object.
Returns: tsgrid :
tsGridA PyTurbSim grid object.
-
pyts.runInput.main.cfg2tsrun(tsinput)[source]¶ Produce a tsrun object that matches the configuration options in tsinput.
Parameters: tsinput : str
A TurbSim input object.
Returns: tsrun : str
A TurbSim run object with grid, profModel, specModel, cohereModel and stressModel that match the input tsinput object.
-
pyts.runInput.main.run(tsinput)[source]¶ Perform a PyTurbSim run based on the input object tsinput.
Parameters: tsinput :
tsinputA PyTurbSim input object.
Returns: tsdata :
tsdataA PyTurbSim data object.
-
pyts.runInput.main.run_fname(fname)[source]¶ Perform a PyTurbSim run based on the input file fname.
Parameters: fname : str
A TurbSim input file.
Returns: tsdata :
tsdataA PyTurbSim data object.
-
pyts.runInput.main.write(tsdat, tsinput, fname=None)[source]¶ Write TurbSim-output to a file.
Parameters: tsdat :
tsdataThe PyTurbSim data object to write out.
tsinput :
tsinputA PyTurbSim input object.
fname : str, optional
The filename to writeout (default obtained from tsinput)
This function determines which file-types to writeout (bladed or
TurbSim) from the `tsinput` object
pyts.runInput.profModels module¶
This module contains functions for producing the appropriate profile model for a specific TurbSim input object (derived from an input file).
When a new model is added to the profModels package, it will need a wrapper function here in order to be accessible using input files.
-
pyts.runInput.profModels.getModel(tsinput)[source]¶ This is the wrapper function for all profile models implemented in the runInput package.
Parameters: tsinput :
tsinputA TurbSim input object.
Returns: profModel : A subclass of
profModelBaseThe appropriately initialized ‘profile model’ object specified in tsinput.
pyts.runInput.turbModels module¶
This module contains functions for producing the appropriate turbulence model for a specific TurbSim input object (derived from an input file).
The term ‘TurbModels’ encompasses the ‘specModel’, ‘cohereModel’ and ‘stressModel’ functionalities of the PyTurbSim program. Within the ‘runInput’ package all three of these statistics are handled in this module. Thus, each wrapper function for a ‘TurbModel’ should should specify/define a model for each of these statistics.
More information on the specific TurbModels can be found in the corresponding package for the statistic of interest.
To make a new specModel, cohereModel, or stressModel available from input files add a wrapper function for it here.
-
pyts.runInput.turbModels.getModel(tsinput)[source]¶ This is the wrapper function for all turbulence models implemented in the runInput package.
Parameters: tsinput :
tscfgA TurbSim input object.
Returns: specModel : A subclass of
specModelBaseThe appropriately initialized ‘spectral model’ object specified in tsinput.
cohereModel : A subclass of
cohereModelBaseThe appropriately initialized ‘coherence model’ object specified in tsinput.
stressModel : A subclass of
stressModelBaseThe appropriately initialized ‘stress model’ object specified in tsinput.
Module contents¶
This is the PyTurbSim package that provides tools for emulating O-TurbSim functionality. In particular it contains functions for taking a TurbSim ‘input’ file (.inp) and performing a TurbSim run that matches that file.
Example usage¶
- See either:
- the pyTurbSim.py executable script in the PyTurbSim root directory
- The
pyts.runInput.maindocstring for example usage.