foxes.core.partial_wakes_model.PartialWakesModel

class foxes.core.partial_wakes_model.PartialWakesModel[source]

Bases: Model

Abstract base class for partial wakes models.

Partial wakes models compute wake effects for rotor effective quantities.

Parameters:
  • wake_models (list of foxes.core.WakeModel) – The wake model selection, None for all from algorithm.

  • wake_frame (foxes.core.WakeFrame, optional) – The wake frame, None takes from algorithm

wake_models

The wake model selection

Type:

list of foxes.core.WakeModel

wake_frame

The wake frame

Type:

foxes.core.WakeFrame, optional

__init__(wake_models=None, wake_frame=None)[source]

Methods

__init__([wake_models, wake_frame])

contribute_to_wake_deltas(algo, mdata, ...)

Modifies wake deltas by contributions from the specified wake source turbines.

evaluate_results(algo, mdata, fdata, ...[, ...])

Updates the farm data according to the wake deltas.

finalize(algo[, verbosity])

Finalizes the model.

get_data(variable, data[, st_sel, upcast, ...])

Getter for a data entry in either the given data source, or the model object.

initialize(algo[, verbosity])

Initializes the model.

new(pwake_type, **kwargs)

Run-time partial wakes factory.

new_wake_deltas(algo, mdata, fdata)

Creates new initial wake deltas, filled with zeros.

var(v)

Creates a model specific variable name.

Attributes

initialized

Initialization flag.

model_id

Unique id based on the model type.

__init__(wake_models=None, wake_frame=None)[source]
abstract contribute_to_wake_deltas(algo, mdata, fdata, states_source_turbine, wake_deltas)[source]

Modifies wake deltas by contributions from the specified wake source turbines.

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 of int) – For each state, one turbine index corresponding to the wake causing turbine. Shape: (n_states,)

  • wake_deltas (Any) – The wake deltas object created by the new_wake_deltas function

abstract evaluate_results(algo, mdata, fdata, wake_deltas, states_turbine, update_amb_res=False)[source]

Updates the farm data according to the wake deltas.

Parameters:
  • algo (foxes.core.Algorithm) – The calculation algorithm

  • mdata (foxes.core.Data) – The model data

  • fdata (foxes.core.Data) – The farm data Modified in-place by this function

  • wake_deltas (Any) – The wake deltas object, created by the new_wake_deltas function and filled by contribute_to_wake_deltas

  • states_turbine (numpy.ndarray of int) – For each state, the index of one turbine for which to evaluate the wake deltas. Shape: (n_states,)

  • update_amb_res (bool) – Flag for updating ambient results

finalize(algo, verbosity=0)

Finalizes the model.

Parameters:
  • algo (foxes.core.Algorithm) – The calculation algorithm

  • verbosity (int) – The verbosity level, 0 = silent

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

initialize(algo, verbosity=0)[source]

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:

dict

property initialized

Initialization flag.

Returns:

True if the model has been initialized.

Return type:

bool

property model_id

Unique id based on the model type.

Returns:

Unique id of the model object

Return type:

int

classmethod new(pwake_type, **kwargs)[source]

Run-time partial wakes factory.

Parameters:

pwake_type (str) – The selected derived class name

abstract new_wake_deltas(algo, mdata, fdata)[source]

Creates new initial wake deltas, filled with zeros.

Parameters:
  • algo (foxes.core.Algorithm) – The calculation algorithm

  • mdata (foxes.core.Data) – The model data

  • fdata (foxes.core.Data) – The farm data

Returns:

wake_deltas – Keys: Variable name str, values: any

Return type:

dict

var(v)

Creates a model specific variable name.

Parameters:

v (str) – The variable name

Returns:

Model specific variable name

Return type:

str