foxes.models.wake_models.wind.bastankhah16¶
Classes¶
The Bastankhah 2016 wake model |
|
Common calculations for the wake model and the wake |
Module Contents¶
-
class foxes.models.wake_models.wind.bastankhah16.Bastankhah2016(superposition: str, alpha: float =
0.58, beta: float =0.077, induction: str ='Madsen', **wake_k: Any)[source]¶ Bases:
foxes.models.wake_models.dist_sliced.DistSlicedWakeModelThe Bastankhah 2016 wake model
Notes¶
Reference: “Experimental and theoretical study of wind turbine wakes in yawed conditions” Majid Bastankhah, Fernando Porté-Agel https://doi.org/10.1017/jfm.2016.595
- Parameters:
- superposition
The wind deficit superposition
- ct_max
The maximal value for ct, values beyond will be limited to this number, by default 0.9999
- alpha
model parameter used to determine onset of far wake region
- beta
model parameter used to determine onset of far wake region
- induction
The induction model
- wake_k
Parameters for the WakeK class
- calc_wakes_x_yz(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.data.MData, fdata: foxes.core.data.FData, tdata: foxes.core.data.TData, downwind_index: int, x: numpy.ndarray, yz: numpy.ndarray) tuple[dict[str, numpy.ndarray], numpy.ndarray][source]¶
Calculate wake deltas.
- Parameters:¶
- algo
The calculation algorithm
- mdata
The model data
- fdata
The farm data
- tdata
The target point data
- downwind_index
The index in the downwind order
- x
The x values, shape: (n_states, n_targets)
- yz
The yz values for each x value, shape: (n_states, n_targets, n_yz_per_target, 2)
- Returns:¶
- wdeltas
The wake deltas. Key: variable name str, value
- st_sel
The state-target selection, for which the wake is non-zero, shape: (n_states, n_targets)
- contribute(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.data.MData, fdata: foxes.core.data.FData, tdata: foxes.core.data.TData, downwind_index: int, wake_coos: numpy.ndarray, wake_deltas: dict[str, numpy.ndarray]) None¶
Modifies wake deltas at target points by contributions from the specified wake source turbines.
- Parameters:¶
- algo
The calculation algorithm
- mdata
The model data
- fdata
The farm data
- tdata
The target point data
- downwind_index
The index of the wake causing turbine in the downwind order
- wake_coos
The wake frame coordinates of the evaluation points, shape: (n_states, n_targets, n_tpoints, 3)
- wake_deltas
The wake deltas. Key: variable name, value (n_states, n_targets, n_tpoints, …)
-
finalize(algo: foxes.core.algorithm.Algorithm, verbosity: int =
0) None¶ Finalize the model.
- Parameters:¶
- algo
The calculation algorithm.
- verbosity
The verbosity level;
0is silent.
- finalize_wake_deltas(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.data.MData, fdata: foxes.core.data.FData, tdata: foxes.core.data.TData, wake_deltas: dict[str, numpy.ndarray]) None¶
Finalize the wake calculation.
Modifies wake_deltas on the fly.
- Parameters:¶
- algo
The calculation algorithm
- mdata
The model data
- fdata
The farm data
- tdata
The target point data
- wake_deltas
The wake deltas object at the selected target turbines. Keys are variable names and values are arrays with shape (n_states, n_targets, n_tpoints)
-
get_data(variable: str, target: str, lookup: str =
'smfp', mdata: foxes.core.data.MData | None =None, fdata: foxes.core.data.FData | None =None, tdata: foxes.core.data.TData | None =None, downwind_index: int | None =None, accept_none: False =False, accept_nan: bool =True, algo: foxes.core.algorithm.Algorithm | None =None, upcast: bool =False, selection: numpy.ndarray[Any, Any] | tuple[Any, ...] | list[Any] | None =None) numpy.ndarray[Any, Any]¶ -
get_data(variable: str, target: str, lookup: str =
'smfp', mdata: foxes.core.data.MData | None =None, fdata: foxes.core.data.FData | None =None, tdata: foxes.core.data.TData | None =None, downwind_index: int | None =None, accept_none: True =True, accept_nan: bool =True, algo: foxes.core.algorithm.Algorithm | None =None, upcast: bool =False, selection: numpy.ndarray[Any, Any] | tuple[Any, ...] | list[Any] | None =None) numpy.ndarray[Any, Any] | None Getter for a data entry in the model object or provided data sources
- Parameters:¶
- variable
The variable name used as the data key.
- target
The dimensions identifier for the output:
FC.STATE_TURBINE,FC.STATE_TARGET, orFC.STATE_TARGET_TPOINT.- lookup
The order of data sources. Combination of:
's'for self,'m'for mdata,'f'for fdata,'t'for tdata, and'w'for wake-modeling data.- mdata
The model data.
- fdata
The farm data.
- tdata
The target point data.
- downwind_index
The index in the downwind order.
- accept_none
Do not raise an error if the data entry is
None.- accept_nan
Do not raise an error if the data entry is
np.nan.- algo
The algorithm, needed for data from previous iterations.
- upcast
Ensure the target dimensions are present. If expansion is needed, the result is a read-only broadcasted view.
- selection
Apply this selection to the result, for state-turbine, state-target, or state-target-tpoint outputs.
-
initialize(algo: foxes.core.algorithm.Algorithm, loaded_data: foxes.core.model.LoadedData | None =
None, force: bool =False, verbosity: int =0) foxes.core.model.LoadedData[source]¶ Initializes the model.
- Parameters:¶
- algo
The calculation algorithm
- loaded_data
Data that has already been loaded, to be extended by this function. Keys are “coords”, a dict with entries dim_name_str -> dim_array; “data_vars”, a dict with entries name_str -> (dim_tuple, data_ndarray); and “extra_data”, a dict with non-array additional data.
- force
Overwrite existing data
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- loaded_data
The loaded data, containing keys “coords”, “data_vars”, and “extra_data”. Keys are “coords”, a dict with entries dim_name_str -> dim_array; “data_vars”, a dict with entries name_str -> (dim_tuple, data_ndarray); and “extra_data”, a dict with non-array additional data.
-
load_data(algo: foxes.core.algorithm.Algorithm, loaded_data: LoadedData, force: bool =
False, verbosity: int =0) None¶ Load and/or create all data required for model calculations.
The function adds to loaded_data.
- Parameters:¶
- algo
The calculation algorithm.
- loaded_data
Data that has already been loaded, to be extended by this function. Keys are “coords”, a dict with entries
dim_name_str -> dim_array; “data_vars”, a dict with entriesname_str -> (dim_tuple, data_ndarray); and “extra_data”, a dict with non-array additional data.- force
Overwrite existing data.
- verbosity
The verbosity level, where 0 is silent.
- classmethod new(wmodel_type: str, *args: Any, **kwargs: Any) WakeModel¶
Run-time wake model factory.
- Parameters:¶
- wmodel_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
- new_wake_deltas(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.data.MData, fdata: foxes.core.data.FData, tdata: foxes.core.data.TData) dict[str, numpy.ndarray]¶
Creates new empty wake delta arrays.
-
set_running(algo: foxes.core.algorithm.Algorithm, data_stash: dict[str, dict[str, Any]] | None, sel: dict[str, Any] | None =
None, isel: dict[str, Any] | None =None, verbosity: int =0) None¶ Set this model to the running state and move large data to the stash.
The stashed data is restored by
unset_runningafter the calculation has finished.- Parameters:¶
- algo
The calculation algorithm.
- data_stash
The large-data stash. This function adds entries here when provided. Keys are model names and values are dictionaries of large model data.
- sel
The subset selection dictionary.
- isel
The index subset selection dictionary.
- verbosity
The verbosity level;
0is silent.
- sub_models() list[foxes.core.Model][source]¶
List of all sub-models
- Returns:¶
- smdls
Names of all sub models
-
unset_running(algo: foxes.core.algorithm.Algorithm, data_stash: dict[str, dict[str, Any]] | None, sel: dict[str, Any] | None =
None, isel: dict[str, Any] | None =None, verbosity: int =0) None¶ Set this model status to not running and recover large data from stash.
- Parameters:¶
- algo
The calculation algorithm.
- data_stash
Reconstruct model data from this stash when provided. Keys are model names and values are dictionaries of large model data.
- sel
The subset selection dictionary.
- isel
The index subset selection dictionary.
- verbosity
The verbosity level;
0is silent.
- waked_variables() list[str][source]¶
Returns a list of variable names that are affected by this wake model.
- Returns:¶
- waked_variables
A list of variable names affected by this wake model.
- property affects_downwind : bool¶
Flag for downwind or upwind effects on other turbines
- Returns:¶
- affects_downwind
Flag for downwind effects by this model
- property affects_ws : bool¶
Flag for wind speed wake models
- Returns:¶
- dws
If True, this model affects wind speed
-
alpha =
0.58¶
-
beta =
0.077¶
- property has_vector_wind_superp : bool¶
This model uses a wind vector superposition
- Returns:¶
- has_vector_wind_superp
Flag for wind vector superposition
-
induction =
'Madsen'¶
- property initialized : bool¶
Initialization flag.
- Returns:¶
- initialized
True if the model has been initialized.
-
model : Bastankhah2016Model | None =
None¶
- property model_id : int¶
Unique id based on the model type.
- Returns:¶
- int
Unique id of the model object
-
name =
'Model'¶
- other_superpositions¶
- property running : bool¶
Flag for currently running models
- Returns:¶
- running
True if currently running
- wake_k¶
-
wind_superposition =
None¶
- class foxes.models.wake_models.wind.bastankhah16.Bastankhah2016Model(alpha: float, beta: float, induction: str)[source]¶
Bases:
foxes.core.ModelCommon calculations for the wake model and the wake frame, such that code repetitions can be avoided.
Notes¶
Reference: “Experimental and theoretical study of wind turbine wakes in yawed conditions” Majid Bastankhah, Fernando Porté-Agel https://doi.org/10.1017/jfm.2016.595
- Parameters:
- alpha
model parameter used to determine onset of far wake region
- beta
model parameter used to determine onset of far wake region
- induction
The induction model
- calc_data(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.data.MData, fdata: foxes.core.data.FData, tdata: foxes.core.data.TData, downwind_index: int, x: numpy.ndarray, gamma: numpy.ndarray, k: numpy.ndarray) None[source]¶
Calculate common model data, store it in mdata.
- Parameters:¶
- algo
The calculation algorithm
- mdata
The model data
- fdata
The farm data
- tdata
The target point data
- downwind_index
The index in the downwind order
- x
The x values, shape: (n_states, n_targets)
- gamma
The YAWM angles in radiants, shape: (n_states, n_targets)
- k
The k parameter values, shape: (n_states, n_targets)
- clean(mdata: foxes.core.data.MData) None[source]¶
Clean all data
-
finalize(algo: foxes.core.algorithm.Algorithm, verbosity: int =
0) None¶ Finalize the model.
- Parameters:¶
- algo
The calculation algorithm.
- verbosity
The verbosity level;
0is silent.
-
get_data(variable: str, target: str, lookup: str =
'smfp', mdata: foxes.core.data.MData | None =None, fdata: foxes.core.data.FData | None =None, tdata: foxes.core.data.TData | None =None, downwind_index: int | None =None, accept_none: False =False, accept_nan: bool =True, algo: foxes.core.algorithm.Algorithm | None =None, upcast: bool =False, selection: numpy.ndarray[Any, Any] | tuple[Any, ...] | list[Any] | None =None) numpy.ndarray[Any, Any]¶ -
get_data(variable: str, target: str, lookup: str =
'smfp', mdata: foxes.core.data.MData | None =None, fdata: foxes.core.data.FData | None =None, tdata: foxes.core.data.TData | None =None, downwind_index: int | None =None, accept_none: True =True, accept_nan: bool =True, algo: foxes.core.algorithm.Algorithm | None =None, upcast: bool =False, selection: numpy.ndarray[Any, Any] | tuple[Any, ...] | list[Any] | None =None) numpy.ndarray[Any, Any] | None Getter for a data entry in the model object or provided data sources
- Parameters:¶
- variable
The variable name used as the data key.
- target
The dimensions identifier for the output:
FC.STATE_TURBINE,FC.STATE_TARGET, orFC.STATE_TARGET_TPOINT.- lookup
The order of data sources. Combination of:
's'for self,'m'for mdata,'f'for fdata,'t'for tdata, and'w'for wake-modeling data.- mdata
The model data.
- fdata
The farm data.
- tdata
The target point data.
- downwind_index
The index in the downwind order.
- accept_none
Do not raise an error if the data entry is
None.- accept_nan
Do not raise an error if the data entry is
np.nan.- algo
The algorithm, needed for data from previous iterations.
- upcast
Ensure the target dimensions are present. If expansion is needed, the result is a read-only broadcasted view.
- selection
Apply this selection to the result, for state-turbine, state-target, or state-target-tpoint outputs.
- has_data(mdata: foxes.core.data.MData, downwind_index: int, x: numpy.ndarray) bool[source]¶
Check if data exists
-
initialize(algo: foxes.core.algorithm.Algorithm, loaded_data: foxes.core.model.LoadedData | None =
None, force: bool =False, verbosity: int =0) foxes.core.model.LoadedData[source]¶ Initializes the model.
- Parameters:¶
- algo
The calculation algorithm
- loaded_data
Data that has already been loaded, to be extended by this function. Keys are “coords”, a dict with entries dim_name_str -> dim_array; “data_vars”, a dict with entries name_str -> (dim_tuple, data_ndarray); and “extra_data”, a dict with non-array additional data.
- force
Overwrite existing data
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- loaded_data
The loaded data, containing keys “coords”, “data_vars”, and “extra_data”. Keys are “coords”, a dict with entries dim_name_str -> dim_array; “data_vars”, a dict with entries name_str -> (dim_tuple, data_ndarray); and “extra_data”, a dict with non-array additional data.
-
load_data(algo: foxes.core.algorithm.Algorithm, loaded_data: LoadedData, force: bool =
False, verbosity: int =0) None¶ Load and/or create all data required for model calculations.
The function adds to loaded_data.
- Parameters:¶
- algo
The calculation algorithm.
- loaded_data
Data that has already been loaded, to be extended by this function. Keys are “coords”, a dict with entries
dim_name_str -> dim_array; “data_vars”, a dict with entriesname_str -> (dim_tuple, data_ndarray); and “extra_data”, a dict with non-array additional data.- force
Overwrite existing data.
- verbosity
The verbosity level, where 0 is silent.
-
set_running(algo: foxes.core.algorithm.Algorithm, data_stash: dict[str, dict[str, Any]] | None, sel: dict[str, Any] | None =
None, isel: dict[str, Any] | None =None, verbosity: int =0) None¶ Set this model to the running state and move large data to the stash.
The stashed data is restored by
unset_runningafter the calculation has finished.- Parameters:¶
- algo
The calculation algorithm.
- data_stash
The large-data stash. This function adds entries here when provided. Keys are model names and values are dictionaries of large model data.
- sel
The subset selection dictionary.
- isel
The index subset selection dictionary.
- verbosity
The verbosity level;
0is silent.
-
unset_running(algo: foxes.core.algorithm.Algorithm, data_stash: dict[str, dict[str, Any]] | None, sel: dict[str, Any] | None =
None, isel: dict[str, Any] | None =None, verbosity: int =0) None¶ Set this model status to not running and recover large data from stash.
- Parameters:¶
- algo
The calculation algorithm.
- data_stash
Reconstruct model data from this stash when provided. Keys are model names and values are dictionaries of large model data.
- sel
The subset selection dictionary.
- isel
The index subset selection dictionary.
- verbosity
The verbosity level;
0is silent.
-
AMPL_FAR =
'ampl_far'¶
-
AMPL_NEAR =
'ampl_near'¶
-
CHECK =
'check'¶
-
DELTA_FAR =
'delta_far'¶
-
DELTA_NEAR =
'delta_near'¶
-
MDATA_KEY =
'Bastankhah2016Model'¶
-
NEAR =
'near'¶
-
PARS =
'pars'¶
-
R_PC =
'r_pc'¶
-
R_PC_S =
'r_pc_s'¶
-
SIGMA_Y_FAR =
'sigma_y_far'¶
-
SIGMA_Z_FAR =
'sigma_z_far'¶
-
ST_SEL =
'st_sel'¶
-
X0 =
'x0'¶
- induction¶
- property initialized : bool¶
Initialization flag.
- Returns:¶
- initialized
True if the model has been initialized.
- property model_id : int¶
Unique id based on the model type.
- Returns:¶
- int
Unique id of the model object
-
name =
'Model'¶