netsse.model.ship
=================

.. py:module:: netsse.model.ship

.. autoapi-nested-parse::

   Hydrodynamic models for the linear wave-to-motion **transfer functions of ship responses**.

   .. dropdown:: Copyright (C) 2023-2026 Technical University of Denmark, R.E.G. Mounet
       :color: primary
       :icon: law

       *This code is part of the NetSSE software.*

       NetSSE is free software: you can redistribute it and/or modify it under
       the terms of the GNU General Public License as published by the Free
       Software Foundation, either version 3 of the License, or (at your
       option) any later version.

       NetSSE is distributed in the hope that it will be useful, but WITHOUT
       ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       for more details.

       You should have received a copy of the GNU General Public License along
       with this program.  If not, see https://www.gnu.org/licenses/.

       To credit the author, users are encouraged to use below reference:

       .. code-block:: text

           Mounet, R. E. G., & Nielsen, U. D. NetSSE: An open-source Python package
           for network-based sea state estimation from ships, buoys, and other
           observation platforms (version 2.3). Technical University of Denmark,
           GitLab. July 2026. https://doi.org/10.11583/DTU.26379811.

   *Last updated on 05-06-2026 by R.E.G. Mounet*



Functions
---------

.. autoapisummary::

   netsse.model.ship.Lewis_param
   netsse.model.ship.format_ANN_input_data
   netsse.model.ship.heaveCF
   netsse.model.ship.heaveST
   netsse.model.ship.pitchCF
   netsse.model.ship.pitchST
   netsse.model.ship.rollCF
   netsse.model.ship.vbmST


Module Contents
---------------

.. py:function:: Lewis_param(C_B)

   Computes the Lewis form parameter for a ship, based on its block coefficient.

   :param C_B: Block coefficient of the ship [-].
   :type C_B: float

   :returns: **gamma** -- Lewis form parameter for the ship [-].
   :rtype: float

   .. seealso::

      :py:obj:`format_ANN_input_data`
          Prepares the input data for the ANN models based on the ship parameters and wave conditions.

   .. rubric:: References

   Takami, T., Nielsen, U. D., Mounet, R. E. G., Jensen, J. J., Mori, R., Komoriyama, Y. (2026). Blind identification of incident waves and response transfer functions of a marine vessel based on measured responses. Expert Systems With Applications, 296, 129236. https://doi.org/10.1016/j.eswa.2025.129236.

   .. rubric:: Example

   >>> gamma = Lewis_param(C_B)


.. py:function:: format_ANN_input_data(om0, beta_deg, U, L, B0, T, C_B)

   Prepares the input data for the ANN models based on the ship parameters and wave conditions.

   :param om0: Vector of absolute wave frequencies [rad/s].
   :type om0: array_like of shape (Nom0,)
   :param beta_deg: Vector of relative wave heading angles [deg].
   :type beta_deg: array_like of shape (Nbeta,)
   :param U: Vessel forward speed [m/s].
   :type U: float
   :param L: Length of the ship [m].
   :type L: float
   :param B0: Breadth of the ship [m].
   :type B0: float
   :param T: Draft of the ship [m].
   :type T: float
   :param C_B: Block coefficient of the ship [-].
   :type C_B: float

   :returns: **ANN_input_data** -- Normalized input data for the ANN models, including ship parameters and wave conditions.
   :rtype: numpy.ndarray of shape (Nom0*Nbeta*Nkappas, 7)

   :raises warnings.warn: If any of the input parameters are outside the valid ranges for the ANN model.

   .. seealso::

      :py:obj:`Lewis_param`
          Computes the Lewis form parameter for a ship, based on its block coefficient.

   .. rubric:: References

   Takami, T., Nielsen, U. D., Mounet, R. E. G., Jensen, J. J., Mori, R., Komoriyama, Y. (2026). Blind identification of incident waves and response transfer functions of a marine vessel based on measured responses. Expert Systems With Applications, 296, 129236. https://doi.org/10.1016/j.eswa.2025.129236.

   .. rubric:: Example

   >>> ANN_input_data = format_ANN_input_data(om0, beta_deg, U, L, B0, T, C_B)


.. py:function:: heaveCF(om0, beta_deg, U, L, B0, T, C_B=1, gravity=None)

   Computes the heave transfer function amplitude, using the closed-form
   expressions proposed by Jensen et al. (2004), for a box-shaped uniformly-loaded
   **monohull ship**.

   :param om0: Vector of absolute wave frequencies [rad/s].
   :type om0: array_like of shape (Nom0,)
   :param beta_deg: Vector of heading angles [deg].
   :type beta_deg: array_like of shape (Nbeta,)
   :param U: Vessel forward speed [m/s].
   :type U: float
   :param L: Length of the ship [m].
   :type L: float
   :param B0: Breadth of the ship [m].
   :type B0: float
   :param T: Draft of the ship [m].
   :type T: float
   :param C_B: Block coefficient of the ship [-].
   :type C_B: float, default 1
   :param gravity: Gravitational acceleration [m/s^2]. If None, the default value from the NetSSE configuration is used.
   :type gravity: float, optional

   :returns: **heave** -- Coefficients of the heave transfer function amplitude [m/m].
   :rtype: numpy.ndarray of shape (Nom0,Nbeta)

   .. seealso:: :py:obj:`pitchCF`, :py:obj:`rollCF`

   .. rubric:: References

   Jensen, J. J., Mansour, A. E., & Olsen, A. S. (2004). Estimation of ship
   motions using closed-form expressions. Ocean Engineering, 31(1), 61–85.
   https://doi.org/10.1016/S0029-8018(03)00108-2

   .. rubric:: Example

   >>> heave = heaveCF(om0,beta_deg,U,L,B0,T,C_B=1)


.. py:function:: heaveST(om0, beta_deg, U, L, B0, T, C_B)

   Computes the heave transfer function amplitude and phase, using an ANN-based surrogate model of a strip theory code.

   The ANN was trained on data from a linear strip theory solver, the so-called New Strip Method (Takagi and Ganno, 1967), in which the Lewis form approximation of ship cross-sections is adopted. Further details of the implementation can be found in Takami et al. (2026).

   :param om0: Vector of absolute wave frequencies [rad/s].
   :type om0: array_like of shape (Nom0,)
   :param beta_deg: Vector of relative wave heading angles [deg].
   :type beta_deg: array_like of shape (Nbeta,)
   :param U: Vessel forward speed [m/s].
   :type U: float
   :param L: Length of the ship [m].
   :type L: float
   :param B0: Breadth of the ship [m].
   :type B0: float
   :param T: Draft of the ship [m].
   :type T: float
   :param C_B: Block coefficient of the ship [-].
   :type C_B: float, default 1

   :returns: * **heave_amp** (*numpy.ndarray of shape (Nom0,Nbeta)*) -- Coefficients of the heave transfer function amplitude [m/m].
             * **heave_phase** (*numpy.ndarray of shape (Nom0,Nbeta)*) -- Coefficients of the heave transfer function phase [rad].

   :raises warnings.warn: If any of the input parameters are outside the valid ranges for the ANN model.

   .. seealso::

      :py:obj:`pitchST`, :py:obj:`vbmST`

      :py:obj:`format_ANN_input_data`
          Prepares the input data for the ANN models based on the ship parameters and wave conditions.

   .. rubric:: References

   Takagi, M. & Ganno, M. (1967). On the Accuracy of the Strip Theory, Used for a Calculation of Ship Motions in Waves. Journal of Zosen Kiokai, 121, pp. 48–61. https://doi.org/10.2534/jjasnaoe1952.1967.48.

   Takami, T., Nielsen, U. D., Mounet, R. E. G., Jensen, J. J., Mori, R., & Komoriyama, Y. (2026). Blind identification of incident waves and response transfer functions of a marine vessel based on measured responses. Expert Systems With Applications, 296, 129236. https://doi.org/10.1016/j.eswa.2025.129236.

   .. rubric:: Example

   >>> heave_amp, heave_phase = heaveST(om0, beta_deg, U, L, B0, T, C_B)


.. py:function:: pitchCF(om0, beta_deg, U, L, B0, T, C_B=1, gravity=None)

   Computes the pitch transfer function amplitude, using the closed-form
   expressions proposed by Jensen et al. (2004), for a box-shaped uniformly-loaded
   **monohull ship**.

   :param om0: Vector of absolute wave frequency [rad/s].
   :type om0: array_like of shape (Nom0,)
   :param beta_deg: Vector of heading angle [deg].
   :type beta_deg: array_like of shape (Nbeta,)
   :param U: Vessel forward speed [m/s].
   :type U: float
   :param L: Length of the ship [m].
   :type L: float
   :param B0: Breadth of the ship [m].
   :type B0: float
   :param T: Draft of the ship [m].
   :type T: float
   :param C_B: Block coefficient of the ship [-].
   :type C_B: float, default 1
   :param gravity: Gravitational acceleration [m/s^2]. If None, the default value from the NetSSE configuration is used.
   :type gravity: float, optional

   :returns: **pitch** -- Coefficients of the pitch transfer function amplitude [rad/m].
   :rtype: numpy.ndarray of shape (Nom0,Nbeta)

   .. seealso:: :py:obj:`heaveCF`, :py:obj:`rollCF`

   .. rubric:: References

   Jensen, J. J., Mansour, A. E., & Olsen, A. S. (2004). Estimation of ship
   motions using closed-form expressions. Ocean Engineering, 31(1), 61–85.
   https://doi.org/10.1016/S0029-8018(03)00108-2

   .. rubric:: Example

   >>> pitch = pitchCF(om0,beta_deg,U,L,B0,T,C_B=1)


.. py:function:: pitchST(om0, beta_deg, U, L, B0, T, C_B)

   Computes the pitch transfer function amplitude and phase, using an ANN-based surrogate model of a strip theory code.

   The ANN was trained on data from a linear strip theory solver, the so-called New Strip Method (Takagi and Ganno, 1967), in which the Lewis form approximation of ship cross-sections is adopted. Further details of the implementation can be found in Takami et al. (2026).

   :param om0: Vector of absolute wave frequencies [rad/s].
   :type om0: array_like of shape (Nom0,)
   :param beta_deg: Vector of relative wave heading angles [deg].
   :type beta_deg: array_like of shape (Nbeta,)
   :param U: Vessel forward speed [m/s].
   :type U: float
   :param L: Length of the ship [m].
   :type L: float
   :param B0: Breadth of the ship [m].
   :type B0: float
   :param T: Draft of the ship [m].
   :type T: float
   :param C_B: Block coefficient of the ship [-].
   :type C_B: float, default 1

   :returns: * **pitch_amp** (*numpy.ndarray of shape (Nom0,Nbeta)*) -- Coefficients of the pitch transfer function amplitude [deg/m].
             * **pitch_phase** (*numpy.ndarray of shape (Nom0,Nbeta)*) -- Coefficients of the pitch transfer function phase [rad].

   :raises warnings.warn: If any of the input parameters are outside the valid ranges for the ANN model.

   .. seealso::

      :py:obj:`heaveST`, :py:obj:`vbmST`

      :py:obj:`format_ANN_input_data`
          Prepares the input data for the ANN models based on the ship parameters and wave conditions.

   .. rubric:: References

   Takagi, M. & Ganno, M. (1967). On the Accuracy of the Strip Theory, Used for a Calculation of Ship Motions in Waves. Journal of Zosen Kiokai, 121, pp. 48–61. https://doi.org/10.2534/jjasnaoe1952.1967.48.

   Takami, T., Nielsen, U. D., Mounet, R. E. G., Jensen, J. J., Mori, R., & Komoriyama, Y. (2026). Blind identification of incident waves and response transfer functions of a marine vessel based on measured responses. Expert Systems With Applications, 296, 129236. https://doi.org/10.1016/j.eswa.2025.129236.

   .. rubric:: Example

   >>> pitch_amp, pitch_phase = pitchST(om0, beta_deg, U, L, B0, T, C_B)


.. py:function:: rollCF(om0, beta_deg, U, L, B0, T, C_B, C_WP, GM_T, kappa, mu, T_N=0, gravity=None, rho=None)

   Computes the roll transfer function amplitude, using the closed-form
   expressions proposed by Jensen et al. (2004), for a **monohull ship**.

   :param om0: Vector of absolute wave frequencies [rad/s].
   :type om0: array_like of shape (Nom0,)
   :param beta_deg: Vector of heading angles [deg].
   :type beta_deg: array_like of shape (Nbeta,)
   :param U: Vessel forward speed [m/s].
   :type U: float
   :param L: Length of the ship [m].
   :type L: float
   :param B0: Breadth of the ship [m].
   :type B0: float
   :param T: Draft of the ship [m].
   :type T: float
   :param C_B: Block coefficient of the ship [-].
   :type C_B: float
   :param C_WP: Waterplane area coefficient of the ship [-].
   :type C_WP: float
   :param GM_T: Transverse metacentric height [m].
   :type GM_T: float
   :param kappa: Custom parameter (chosen between 0 and ``C_WP``) representing the ratio
                 between the length of the aft beam and the whole ship length in the
                 simplified ship model for roll.
   :type kappa: float
   :param mu: Ratio between added viscous damping and critical damping.
   :type mu: float, default 0
   :param T_N: Roll natural period [s].

               .. note::
                   If not specified as input, ``T_N`` is calculated using empirical
                   formulas from ADA147598.
   :type T_N: float, optional
   :param gravity: Gravitational acceleration [m/s^2]. If None, the default value from the NetSSE configuration is used.
   :type gravity: float, optional
   :param rho: Density of seawater [kg/m^3]. If None, the default value from the NetSSE configuration is used.
   :type rho: float, optional

   :returns: **roll** -- Coefficients of the roll transfer function amplitude [rad/m].
   :rtype: numpy.ndarray of shape (Nom0,Nbeta)

   .. seealso:: :py:obj:`heaveCF`, :py:obj:`pitchCF`

   .. rubric:: References

   1. Jensen, J. J., Mansour, A. E., & Olsen, A. S. (2004). Estimation of ship
      motions using closed-form expressions. Ocean Engineering, 31(1), 61–85.
      https://doi.org/10.1016/S0029-8018(03)00108-2
   2. ADA147598, 1973. Code of Safety for Fishermen and Fishing Vessels.
      Part B. Safety and Health Requirements for the Construction and Equipment
      of Fishing Vessels. Inter-Governmental Maritime Consultative Organization,
      London, England.

   .. rubric:: Example

   >>> roll = rollCF(om0,beta_deg,U,L,B0,T,C_B,C_WP,GM_T,kappa,mu,T_N=0)


.. py:function:: vbmST(om0, beta_deg, U, L, B0, T, C_B, gravity=None)

   Computes the Vertical Bending Moment (VBM) transfer function amplitude and phase, using an ANN-based surrogate model of a strip theory code.

   The ANN was trained on data from a linear strip theory solver, the so-called New Strip Method (Takagi and Ganno, 1967), in which the Lewis form approximation of ship cross-sections is adopted. Further details of the implementation can be found in Takami et al. (2026).

   :param om0: Vector of absolute wave frequencies [rad/s].
   :type om0: array_like of shape (Nom0,)
   :param beta_deg: Vector of relative wave heading angles [deg].
   :type beta_deg: array_like of shape (Nbeta,)
   :param U: Vessel forward speed [m/s].
   :type U: float
   :param L: Length of the ship [m].
   :type L: float
   :param B0: Breadth of the ship [m].
   :type B0: float
   :param T: Draft of the ship [m].
   :type T: float
   :param C_B: Block coefficient of the ship [-].
   :type C_B: float, default 1
   :param gravity: Gravitational acceleration [m/s^2]. If None, the default value from the NetSSE configuration is used.
   :type gravity: float, optional

   :returns: * **vbm_amp** (*numpy.ndarray of shape (Nom0,Nbeta)*) -- Coefficients of the VBM transfer function amplitude [kNm/m].
             * **vbm_phase** (*numpy.ndarray of shape (Nom0,Nbeta)*) -- Coefficients of the VBM transfer function phase [rad].

   :raises warnings.warn: If any of the input parameters are outside the valid ranges for the ANN model.

   .. seealso::

      :py:obj:`heaveST`, :py:obj:`pitchST`

      :py:obj:`format_ANN_input_data`
          Prepares the input data for the ANN models based on the ship parameters and wave conditions.

   .. rubric:: References

   Takagi, M. & Ganno, M. (1967). On the Accuracy of the Strip Theory, Used for a Calculation of Ship Motions in Waves. Journal of Zosen Kiokai, 121, pp. 48–61. https://doi.org/10.2534/jjasnaoe1952.1967.48.

   Takami, T., Nielsen, U. D., Mounet, R. E. G., Jensen, J. J., Mori, R., & Komoriyama, Y. (2026). Blind identification of incident waves and response transfer functions of a marine vessel based on measured responses. Expert Systems With Applications, 296, 129236. https://doi.org/10.1016/j.eswa.2025.129236.

   .. rubric:: Example

   >>> vbm_amp, vbm_phase = vbmST(om0, beta_deg, U, L, B0, T, C_B)


