API Documentation

WEC Design Optimization Toolbox (WecOptTool) developed by Sandia National Laboratories. See sandialabs.github.io/WecOptTool/.

The top-level wecopttool module contains:

  • The wecopttool.WEC class, which is the main way to interact with WecOptTool.

  • Support functions for basic functionality, accessed as wecoptool.<function>.

Other functionalities are implemented in the submodules, and can be accessed as wecopttool.<module>.<function>.

Type Aliases

Alias

Type

StateFunction

Callable[[WEC, np.ndarray, np.ndarray, xr.Dataset], np.ndarray]

Modules

wecopttool.geom

Geometry and parameters for some example devices (WEC).

wecopttool.pto

Provide power take-off (PTO) forces and produced energy functions for common PTO control approaches.

wecopttool.waves

Provide the wave definition structure and provide functions for creating different common types of waves.

Classes

WEC

A wave energy converter (WEC) object for performing simulations using the pseudo-spectral solution method.

Functions

add_linear_friction

Add linear friction to BEM data.

atleast_2d

Ensure an array is at least 2D, otherwise add trailing dimensions to make it 2D.

change_bem_convention

Change the convention from \(-iωt\) to \(+iωt\).

check_impedance

Ensure that the real part of the impedance (resistive) is positive.

check_linear_damping

Ensure that the linear hydrodynamics (friction + radiation damping) have positive damping.

complex_to_real

Convert from one complex amplitude to two real amplitudes per frequency.

decompose_state

Split the state vector into the WEC dynamics state and the optimization (control) state.

degrees_to_radians

Convert a 1D array of angles in degrees to radians in the range \([-π, π)\) and optionally sort them.

derivative2_mat

Assemble the second derivative matrix that converts the state vector of a response to the state vector of its second derivative.

derivative_mat

Assemble the derivative matrix that converts the state vector of a response to the state vector of its derivative.

dofmat_to_vec

Flatten a matrix that has one column per DOF.

fd_to_td

Convert a complex array of Fourier coefficients to a real array of time-domain responses.

force_from_impedance

Create a force function from its impedance.

force_from_rao_transfer_function

Create a force function from its position transfer matrix.

force_from_waves

Create a force function from waves excitation coefficients.

frequency

Construct equally spaced frequency array.

frequency_parameters

Return the fundamental frequency and the number of frequencies in a frequency array.

hydrodynamic_impedance

Calculate hydrodynamic intrinsic impedance.

inertia

Create the inertia "force" from the inertia matrix.

metadata

Get the metadata for the named package.

mimo_transfer_mat

Create a block matrix of the MIMO transfer function.

ncomponents

Number of Fourier components (2*nfreq) for each DOF.

read_netcdf

Read a NetCDF file with possibly complex entries as a xarray.Dataset.

real_to_complex

Convert from two real amplitudes to one complex amplitude per frequency.

run_bem

Run Capytaine for a range of frequencies and wave directions.

scale_dofs

Create a scaling vector based on a different scale for each DOF.

set_fb_centers

Sets default properties if not provided by the user: - center_of_mass is set to the geometric centroid - rotation_center is set to the center of mass

set_loglevel

Change the logging level of the wecopttool and capytaine loggers to the specified level.

standard_forces

Create functions for linear hydrodynamic forces.

subset_close

Check if the first set set_a is contained, to some tolerance, in the second set set_b.

td_to_fd

Convert a real array of time-domain responses to a complex array of Fourier coefficients.

time

Assemble the time vector with nsubsteps subdivisions.

time_mat

Assemble the time matrix that converts the state to a time-series.

time_results

Create a xarray.DataArray of time-domain results from xarray.DataArray of frequency-domain results.

vec_to_dofmat

Convert a vector back to a matrix with one column per DOF.

wave_excitation

Calculate the complex, frequency-domain, excitation force due to waves.

write_netcdf

Save an xarray.Dataset with possibly complex entries as a NetCDF file.