wecopttool.WEC
- class WEC[source]
A wave energy converter (WEC) object for performing simulations using the pseudo-spectral solution method.
To create the WEC use one of the initialization methods:
Note
Direct initialization of a
wecopttool.WEC
object asWEC(f1, nfreq, forces, ...)
usingwecopttool.WEC.__init__()
is discouraged. Instead use one of the other initialization methods listed in the See Also section.To solve the pseudo-spectral problem use
wecopttool.WEC.solve()
.- __init__(f1, nfreq, forces, constraints=None, inertia_matrix=None, ndof=None, inertia_in_forces=False, dof_names=None)[source]
Create a WEC object directly from its inertia matrix and list of forces.
The
wecopttool.WEC
class describes a WEC’s equation of motion as \(ma=Σf\) where theinertia_matrix
matrix specifies the inertia \(m\), and theforces
dictionary specifies the different forces to be summed. The forces can be linear or nonlinear. Ifinertia_in_forces is True
the equation of motion is \(Σf=0\), which is included to allow for initialization using an intrinsic impedance through theWEC.from_impedance
initialization function.Note
Direct initialization of a
wecopttool.WEC
object asWEC(f1, nfreq, forces, ...)
is discouraged. Instead use one of the other initialization methods listed in the See Also section.- Parameters:
f1 (float) – Fundamental frequency
f1
[\(Hz\)].nfreq (int) – Number of frequencies (not including zero frequency), i.e.,
freqs = [0, f1, 2*f1, ..., nfreq*f1]
.forces (Mapping[str, StateFunction]) – Dictionary with entries
{'force_name': fun}
, wherefun
has a signaturedef fun(wec, x_wec, x_opt, waves):
, and returns forces in the time-domain of size(2*nfreq+1, ndof)
.constraints (Iterable[Mapping] | None) – List of constraints, see documentation for
scipy.optimize.minimize()
for description and options of constraints dictionaries. IfNone
: empty list[]
.inertia_matrix (ndarray | None) – Inertia matrix of size
(ndof, ndof)
. Not used ifinertia_in_forces
isTrue
.ndof (int | None) – Number of degrees of freedom. Must be specified if
inertia_in_forces is True
, else not used.inertia_in_forces (bool | None) – Set to True if inertial “forces” are included in the
forces
argument. This scenario is rare. If using an intrinsic impedance, consider initializing withwecoptool.core.WEC.from_impedance()
instead.dof_names (Iterable[str] | None) – Names of the different degrees of freedom (e.g.
'Heave'
). IfNone
the names['DOF_0', ..., 'DOF_N']
are used.
- Raises:
ValueError – If
inertia_in_forces is True
butndof
is not specified.ValueError – If
inertia_in_forces is False
butinertia_matrix
is not specified.ValueError – If
inertia_matrix
does not have the correct size ((ndof, ndof)
).ValueError – If
dof_names
does not have the correct size (ndof
).
- Return type:
None
See also
from_bem
Initialize a
wecopttool.WEC
object from BEM results.from_floating_body
Initialize a
wecopttool.WEC
object from acapytaine.bodies.bodies.FloatingBody
object.from_impedance
Initialize a
wecopttool.WEC
object from an intrinsic impedance array and excitation coefficients.
Attributes
List of constraints. |
|
Matrix to create Fourier coefficients of the second derivative of some quantity. |
|
Matrix to create Fourier coefficients of the derivative of some quantity. |
|
Names of the different degrees of freedom. |
|
Time spacing [s]. |
|
Fundamental frequency |
|
Dictionary of forces. |
|
Frequency vector [\(Hz\)]. |
|
Function representing the inertial term \(ma\) in the WEC's dynamics equation. |
|
Whether inertial "forces" are included in the |
|
Inertia (mass) matrix. |
|
Number of Fourier components ( |
|
Number of degrees of freedom. |
|
Number of frequencies, not including the zero-frequency. |
|
Length of the WEC dynamics state vector consisting of the Fourier coefficient of the position of each degree of freedom. |
|
Number of timesteps. |
|
Radial frequency vector [rad/s]. |
|
Period vector [s]. |
|
Final time (repeat period) [s]. |
|
Time vector [s], size '(2*nfreq, ndof)', not containing the end time 'tf'. |
|
Matrix to create time-series from Fourier coefficients. |
|
Fundamental radial frequency [rad/s]. |
Methods
Split the state vector into the WEC dynamics state and the optimization (control) state. |
|
Flatten a matrix to a vector. |
|
Convert a frequency-domain array to time-domain. |
|
Create a WEC object from linear hydrodynamic coefficients obtained using the boundary element method (BEM) code Capytaine. |
|
Create a WEC object from a Capytaine |
|
Create a WEC object from the intrinsic impedance and excitation coefficients. |
|
Post-process the results from |
|
Return the residual of the dynamic equation (r = m⋅a-Σf). |
|
Simulate WEC dynamics using a pseudo-spectral solution method and returns the raw results dictionary produced by |
|
Convert a time-domain array to frequency-domain. |
|
Create a time matrix similar to |
|
Create a time vector with finer discretization. |
|
Convert a vector to a matrix with one column per degree of freedom. |