foxes.core.wake_frame.WakeFrame¶
- class foxes.core.wake_frame.WakeFrame[source]¶
Bases:
Model
Abstract base class for wake frames.
Wake frames translate global coordinates into wake frame coordinates, which are then evaluated by wake models.
They are also responsible for the calculation of the turbine evaluation order.
- __init__()¶
Methods
__init__
()calc_centreline_integral
(algo, mdata, fdata, ...)Integrates variables along the centreline.
calc_order
(algo, mdata, fdata)"
finalize
(algo[, verbosity])Finalizes the model.
get_centreline_points
(algo, mdata, fdata, ...)Gets the points along the centreline for given values of x.
get_data
(variable, data[, st_sel, upcast, ...])Getter for a data entry in either the given data source, or the model object.
get_wake_coos
(algo, mdata, fdata, ...)Calculate wake coordinates.
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__()¶
- calc_centreline_integral(algo, mdata, fdata, states_source_turbine, variables, x, dx, **ipars)[source]¶
Integrates variables along the centreline.
- 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,)
x (numpy.ndarray) – The wake frame x coordinates of the upper integral bounds, shape: (n_states, n_points)
dx (float) – The step size of the integral
ipars (dict, optional) – Additional interpolation parameters
- Returns:
results – The integration results, shape: (n_states, n_points, n_vars)
- Return type:
- abstract calc_order(algo, mdata, fdata)[source]¶
” Calculates the order of turbine evaluation.
This function is executed on a single chunk of data, all computations should be based on numpy arrays.
- Parameters:
algo (foxes.core.Algorithm) – The calculation algorithm
mdata (foxes.core.Data) – The model data
fdata (foxes.core.Data) – The farm data
- Returns:
order – The turbine order, shape: (n_states, n_turbines)
- Return type:
- finalize(algo, verbosity=0)¶
Finalizes the model.
- Parameters:
algo (foxes.core.Algorithm) – The calculation algorithm
verbosity (int) – The verbosity level, 0 = silent
- get_centreline_points(algo, mdata, fdata, states_source_turbine, x)[source]¶
Gets the points along the centreline for given values of x.
- 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,)
x (numpy.ndarray) – The wake frame x coordinates, shape: (n_states, n_points)
- Returns:
points – The centreline points, shape: (n_states, n_points, 3)
- Return type:
- 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 get_wake_coos(algo, mdata, fdata, states_source_turbine, points)[source]¶
Calculate wake coordinates.
- 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,)
points (numpy.ndarray) – The evaluation points, shape: (n_states, n_points, 3)
- Returns:
wake_coos – The wake frame coordinates of the evaluation points, shape: (n_states, n_points, 3)
- Return type:
- 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: