wecopttool.WEC.from_floating_body

static WEC.from_floating_body(fb, f1, nfreq, friction=None, f_add=None, constraints=None, min_damping=1e-06, wave_directions=array([0.]), rho=1025.0, g=9.81, depth=inf)[source]

Create a WEC object from a Capytaine FloatingBody (:py:class:capytaine.bodies.bodies.FloatingBody).

A :py:class:capytaine.bodies.bodies.FloatingBody object contains information on the mesh and degrees of freedom.

This initialization method calls wecopttool.run_bem() followed by wecopttool.WEC.from_bem().

This will run Capytaine to obtain the linear hydrodynamic coefficients, which can take from a few minutes to several hours. Instead, if the hydrodynamic coefficients can be reused, it is recommended to run Capytaine first and save the results using wecopttool.run_bem() and wecopttool.write_netcdf(), and then initialize the wecopttool.WEC object using wecopttool.WEC.from_bem(). This initialization method should be reserved for the cases where the hydrodynamic coefficients constantly change and are not reused, as for example for geometry optimization.

Parameters:
  • fb (FloatingBody) – Capytaine FloatingBody.

  • f1 (float) – Fundamental frequency f1 [\(Hz\)].

  • nfreq (int) – Number of frequencies (not including zero frequency), i.e., freqs = [0, f1, 2*f1, ..., nfreq*f1].

  • friction (ndarray | None) – Linear friction, in addition to radiation damping, of size (ndof, ndof). None 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, 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.

  • wave_directions (ArrayLike | None) – List of wave directions [degrees] to evaluate BEM at.

  • rho (float | None) – Water density in \(kg/m^3\).

  • g (float | None) – Gravitational acceleration in \(m/s^2\).

  • depth (float | None) – Water depth in \(m\).

Returns:

An instance of the wecopttool.WEC class.

Return type:

WEC