wecopttool.WEC.from_bem

static WEC.from_bem(bem_data, friction=None, f_add=None, constraints=None, min_damping=1e-06, uniform_shift=False, dof_names=None)[source]

Create a WEC object from linear hydrodynamic coefficients obtained using the boundary element method (BEM) code Capytaine.

The bem_data can be a dataset or the name of a NetCDF file containing the dataset.

The returned wecopttool.WEC object contains the inertia and the default linear forces: radiation, diffraction, and Froude-Krylov. Additional forces can be specified through f_add.

Note that because Capytaine uses a different sign convention, the direct results from capytaine must be modified using wecopttool.change_bem_convention() before calling this initialization function. Instead, the recommended approach is to use wecopttool.run_bem(), rather than running Capytaine directly, which outputs the results in the correct convention. The results can be saved using wecopttool.write_netcdf(). wecopttool.run_bem() also computes the inertia and hydrostatic stiffness which should be included in bem_data.

Parameters:
  • bem_data (Dataset | str | Path) – Linear hydrodynamic coefficients obtained using the boundary element method (BEM) code Capytaine, with sign convention corrected. Also includes inertia and hydrostatic stiffness.

  • friction (ndarray | None) – Linear friction, in addition to radiation damping, of size (ndof, ndof). None if included in bem_data or to set to zero.

  • f_add (Mapping[str, StateFunction] | None) – Dictionary with entries {'force_name': fun}, where fun has a signature def 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. If None: empty list [].

  • min_damping (float | None) – Minimum damping level to ensure a stable system. See wecopttool.check_radiation_damping() for more details.

  • uniform_shift (bool | None) – Boolean determining whether damping corrections shifts the damping values uniformly for all frequencies or only for frequencies below min_damping. See wecopttool.check_radiation_damping() for more details.

  • dof_names (Iterable[str] | None) – Names of the different degrees of freedom (e.g. 'Heave'). If None the names ['DOF_0', ..., 'DOF_N'] are used.

Return type:

WEC