foxes.core.wake_deflection¶
Classes¶
Abstract base class for wake deflection models. |
Module Contents¶
- class foxes.core.wake_deflection.WakeDeflection[source]¶
Bases:
foxes.core.model.ModelAbstract base class for wake deflection models.
Constructor.
- abstract calc_deflection(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.data.MData, fdata: foxes.core.data.FData, tdata: foxes.core.data.TData, downwind_index: int, coos: numpy.ndarray) numpy.ndarray[source]¶
Calculates the wake deflection.
This function optionally adds FC.WDEFL_ROT_ANGLE or FC.WDEFL_DWS_FACTOR to the tdata.
- 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
- coos
The wake frame coordinates of the evaluation points, shape: (n_states, n_targets, n_tpoints, 3)
- Returns:¶
- coos
The wake frame coordinates of the evaluation points, shape: (n_states, n_targets, n_tpoints, 3)
-
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.
- abstract get_yaw_alpha_seq(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) numpy.ndarray[source]¶
Computes sequential wind vector rotation angles.
Wind vector rotation angles are computed at the current trace points due to a yawed rotor for sequential runs.
- 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
- x
The distance from the wake causing rotor for the first n_times subsequent time steps, shape: (n_times,)
- Returns:¶
- alpha
The delta WD result at the x locations, shape: (n_times,)
-
initialize(algo: foxes.core.algorithm.Algorithm, loaded_data: LoadedData | None =
None, force: bool =False, verbosity: int =0) LoadedData¶ Initialize 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 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.
- Returns:¶
- loaded_data
The loaded data, containing the keys “coords”, “data_vars”, and “extra_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(wdefl_type: str, *args: Any, **kwargs: Any) WakeDeflection[source]¶
Run-time wake deflection model factory.
- Parameters:¶
- wdefl_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
-
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.
- 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'¶