foxes.core.wake_model.WakeModel¶
- class foxes.core.wake_model.WakeModel[source]¶
Bases:
Model
Abstract base class for wake models.
- __init__()¶
Methods
__init__
()contribute_to_wake_deltas
(algo, mdata, ...)Calculate the contribution to the wake deltas by this wake model.
finalize
(algo[, verbosity])Finalizes the model.
finalize_wake_deltas
(algo, mdata, fdata, ...)Finalize the wake calculation.
get_data
(variable, data[, st_sel, upcast, ...])Getter for a data entry in either the given data source, or the model object.
init_wake_deltas
(algo, mdata, fdata, ...)Initialize wake delta storage.
initialize
(algo[, verbosity])Initializes the model.
var
(v)Creates a model specific variable name.
Attributes
Initialization flag.
Unique id based on the model type.
- __init__()¶
- abstract contribute_to_wake_deltas(algo, mdata, fdata, states_source_turbine, wake_coos, wake_deltas)[source]¶
Calculate the contribution to the wake deltas by this wake model.
Modifies wake_deltas on the fly.
- Parameters:
algo (foxes.core.Algorithm) – The calculation algorithm
mdata (foxes.core.Data) – The model data
fdata (foxes.core.Data) – The farm data
states_source_turbine (numpy.ndarray) – For each state, one turbine index for the wake causing turbine. Shape: (n_states,)
wake_coos (numpy.ndarray) – The wake frame coordinates of the evaluation points, shape: (n_states, n_points, 3)
wake_deltas (dict) – The wake deltas, are being modified ob the fly. Key: Variable name str, for which the wake delta applies, values: numpy.ndarray with shape (n_states, n_points, …)
- finalize(algo, verbosity=0)¶
Finalizes the model.
- Parameters:
algo (foxes.core.Algorithm) – The calculation algorithm
verbosity (int) – The verbosity level, 0 = silent
- finalize_wake_deltas(algo, mdata, fdata, amb_results, wake_deltas)[source]¶
Finalize the wake calculation.
Modifies wake_deltas on the fly.
- Parameters:
algo (foxes.core.Algorithm) – The calculation algorithm
mdata (foxes.core.Data) – The model data
fdata (foxes.core.Data) – The farm data
amb_results (dict) – The ambient results, key: variable name str, values: numpy.ndarray with shape (n_states, n_points)
wake_deltas (dict) – The wake deltas, are being modified ob the fly. Key: Variable name str, for which the wake delta applies, values: numpy.ndarray with shape (n_states, n_points, …) before evaluation, numpy.ndarray with shape (n_states, n_points) afterwards
- get_data(variable, data, st_sel=None, upcast=None, data_prio=False, accept_none=False)¶
Getter for a data entry in either the given data source, or the model object.
- Parameters:
variable (str) – The variable, serves as data key
data (dict) – The data source
st_sel (numpy.ndarray of bool, optional) – If given, get the specified state-turbine subset
upcast (str, optional) – Either ‘farm’ or ‘points’, broadcasts potential scalar data to numpy.ndarray with dimensions (n_states, n_turbines) or (n_states, n_points), respectively
data_prio (bool) – First search the data source, then the object
accept_none (bool) – Do not throw an error if data entry is None or np.nan
- abstract init_wake_deltas(algo, mdata, fdata, n_points, wake_deltas)[source]¶
Initialize wake delta storage.
They are added on the fly to the wake_deltas dict.
- Parameters:
algo (foxes.core.Algorithm) – The calculation algorithm
mdata (foxes.core.Data) – The model data
fdata (foxes.core.Data) – The farm data
n_points (int) – The number of wake evaluation points
wake_deltas (dict) – The wake deltas storage, add wake deltas on the fly. Keys: Variable name str, for which the wake delta applies, values: numpy.ndarray with shape (n_states, n_points, …)
- initialize(algo, verbosity=0)¶
Initializes the model.
This includes loading all required data from files. The model should return all array type data as part of the idata return dictionary (and not store it under self, for memory reasons). This data will then be chunked and provided as part of the mdata object during calculations.
- Parameters:
algo (foxes.core.Algorithm) – The calculation algorithm
verbosity (int) – The verbosity level, 0 = silent
- Returns:
idata – The dict has exactly two entries: data_vars, a dict with entries name_str -> (dim_tuple, data_ndarray); and coords, a dict with entries dim_name_str -> dim_array
- Return type:
- property initialized¶
Initialization flag.
- Returns:
True if the model has been initialized.
- Return type:
- property model_id¶
Unique id based on the model type.
- Returns:
Unique id of the model object
- Return type: