foxes.models.wake_frames.timelines

Classes

Timelines

Dynamic wakes for spatially uniform timeseries states.

Module Contents

class foxes.models.wake_frames.timelines.Timelines(cl_ipars: dict[str, Any] | None = None, dt_min: float | None = None, **kwargs: Any)[source]

Bases: foxes.core.WakeFrame

Dynamic wakes for spatially uniform timeseries states.

Parameters:
cl_ipars

Interpolation parameters for centre line point interpolation

dt_min

The delta t value in minutes, if not from timeseries data

kwargs

Additional parameters for the base class

calc_centreline_integral(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.data.MData, fdata: foxes.core.data.FData, downwind_index: int, variables: list[str], x: numpy.ndarray, dx: float, wake_models: list[Any] | None = None, self_wake: bool = True, **ipars: Any) numpy.ndarray

Integrates variables along the centreline.

Parameters:
algo

The calculation algorithm

mdata

The model data

fdata

The farm data

downwind_index

The index in the downwind order

variables

The variables to be integrated

x

The wake frame x coordinates of the upper integral bounds, shape: (n_states, n_points)

dx

The step size of the integral

wake_models

The wake models to consider, default: from algo

self_wake

Flag for considering only wake from states_source_turbine

ipars

Additional interpolation parameters

Returns:
results

The integration results, shape: (n_states, n_points, n_vars)

calc_order(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.MData, fdata: foxes.core.FData) numpy.ndarray[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

The calculation algorithm

mdata

The model data

fdata

The farm data

Returns:
order

The turbine order, shape: (n_states, n_turbines)

finalize(algo: foxes.core.algorithm.Algorithm, verbosity: int = 0) None[source]

Finalizes the model.

Parameters:
algo

The calculation algorithm

verbosity

The verbosity level, 0 = silent

get_centreline_points(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.MData, fdata: foxes.core.FData, downwind_index: int, x: numpy.ndarray) numpy.ndarray[source]

Gets the points along the centreline for given values of x.

Parameters:
algo

The calculation algorithm

mdata

The model data

fdata

The farm data

downwind_index

The index in the downwind order

x

The wake frame x coordinates, shape: (n_states, n_points)

Returns:
points

The centreline points, shape: (n_states, n_points, 3)

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, or FC.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.

get_wake_coos(algo: foxes.core.algorithm.Algorithm, mdata: foxes.core.MData, fdata: foxes.core.FData, tdata: foxes.core.TData, downwind_index: int) numpy.ndarray[source]

Calculate wake coordinates of rotor points.

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

Returns:
wake_coos

The wake frame coordinates of the evaluation points, shape: (n_states, n_targets, n_tpoints, 3)

get_wake_modelling_data(algo: foxes.core.algorithm.Algorithm, variable: str, downwind_index: int, fdata: foxes.core.data.FData, tdata: foxes.core.data.TData, target: str, states0: numpy.ndarray | None = None) numpy.ndarray

Return data that is required for computing the wake from source turbines to evaluation points.

Parameters:
algo

The algorithm, needed for data from previous iteration

variable

The variable, serves as data key

downwind_index

The index in the downwind order

fdata

The farm data

tdata

The target point data

target

The dimensions identifier for the output, FC.STATE_TURBINE, FC.STATE_TARGET, FC.STATE_TARGET_TPOINT

states0

The states of wake creation

Returns:
data

Data for wake modelling, shape: (n_states, n_turbines) or (n_states, n_target)

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 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, where 0 is silent.

classmethod new(wframe_type: str, *args: Any, **kwargs: Any) WakeFrame

Run-time wake frame factory.

Parameters:
wframe_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, Any] | None, sel: dict[str, Any] | None = None, isel: dict[str, Any] | None = None, verbosity: int = 0) None[source]

Sets this model status to running, and moves all large data to stash.

The stashed data will be returned by the unset_running() function after running calculations.

Parameters:
algo

The calculation algorithm

data_stash

Large data stash, this function adds data here, if given. Key: model name. Value: dict, large model data

sel

The subset selection dictionary

isel

The index subset selection dictionary

verbosity
states: States,
sub_models() list[Model]

Return the list of all sub-models.

Returns:
smdls

All sub-models.

unset_running(algo: foxes.core.algorithm.Algorithm, data_stash: dict[str, Any] | None, sel: dict[str, Any] | None = None, isel: dict[str, Any] | None = None, verbosity: int = 0) None[source]

Sets this model status to not running, recovering large data from stash

Parameters:
algo

The calculation algorithm

data_stash

Reconstruct model data from this stash, if given. Key: model name. Value: dict, large model data

sel

The subset selection dictionary

isel

The index subset selection dictionary

verbosity

The verbosity level, 0 = silent

unvar(vnm: str) str | None

Translate a model-specific variable name to the original variable name.

Parameters:
vnm

The model-specific variable name.

Returns:
v

The original variable name.

var(v: str) str

Create a model-specific variable name.

Parameters:
v

The variable name.

Returns:
vnm

The model-specific variable name.

cl_ipars
dt_min = None
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'
property running : bool

Flag for currently running models

Returns:
running

True if currently running

timelines_data : xarray.Dataset | None = None