capytaine.green_functions.delhommeau module

Variants of Delhommeau’s method for the computation of the Green function.

class capytaine.green_functions.delhommeau.Delhommeau(*, tabulation_nr=328, tabulation_nz=46, tabulation_nb_integration_points=251, finite_depth_prony_decomposition_method='fortran', floating_point_precision='float64')[source]

Bases: AbstractGreenFunction

The Green function as implemented in Aquadyn and Nemoh.

Parameters:
  • tabulation_nr (int, optional) – Number of tabulation points for horizontal distance. If 0 is given, the no tabulation is used. Default: 328, as in Nemoh.

  • tabulation_nz (int, optional) – Number of tabulation points for vertical distance. If 0 is given, the no tabulation is used. Default: 46, as in Nemoh.

  • tabulation_nb_integration_points (int, optional) – Number of points for the numerical integration w.r.t. \(theta\) of Delhommeau’s integrals Default: 251, as in Nemoh.

  • finite_depth_prony_decomposition_method (string, optional) – The implementation of the Prony decomposition used to compute the finite depth Green function. Accepted values: 'fortran' for Nemoh’s implementation (by default), 'python' for an experimental Python implementation. See find_best_exponential_decomposition().

  • floating_point_precision (string, optional) – Either 'float32' for single precision computations or 'float64' for double precision computations. Default: 'float64'.

Variables:
  • tabulated_r_range (numpy.array of shape (tabulation_nr,) and type floating_point_precision) –

  • tabulated_z_range (numpy.array of shape (tabulation_nz,) and type floating_point_precision) – Coordinates of the tabulation points.

  • tabulated_integrals (numpy.array of shape (tabulation_nr, tabulation_nz, 2, 2) and type floating_point_precision) – Tabulated Delhommeau integrals.

evaluate(mesh1, mesh2, free_surface=0.0, sea_bottom=-inf, wavenumber=1.0)[source]

The main method of the class, called by the engine to assemble the influence matrices.

Parameters:
  • mesh1 (Mesh or CollectionOfMeshes) – mesh of the receiving body (where the potential is measured)

  • mesh2 (Mesh or CollectionOfMeshes) – mesh of the source body (over which the source distribution is integrated)

  • free_surface (float, optional) – position of the free surface (default: \(z = 0\))

  • sea_bottom (float, optional) – position of the sea bottom (default: \(z = -\infty\))

  • wavenumber (float, optional) – wavenumber (default: 1.0)

Returns:

the matrices \(S\) and \(K\)

Return type:

tuple of numpy arrays

find_best_exponential_decomposition(dimensionless_omega, dimensionless_wavenumber)[source]

Compute the decomposition of a part of the finite depth Green function as a sum of exponential functions.

Two implementations are available: the legacy Fortran implementation from Nemoh and a newer one written in Python. For some still unexplained reasons, the two implementations do not always give the exact same result. Until the problem is better understood, the Fortran implementation is the default one, to ensure consistency with Nemoh. The Fortran version is also significantly faster…

Results are cached.

Parameters:
  • dimensionless_omega (float) – dimensionless angular frequency: \(kh \tanh (kh) = \omega^2 h/g\)

  • dimensionless_wavenumber (float) – dimensionless wavenumber: \(kh\)

  • method (string, optional) – the implementation that should be used to compute the Prony decomposition

Returns:

the amplitude and growth rates of the exponentials

Return type:

Tuple[np.ndarray, np.ndarray]

fortran_core_basename = 'Delhommeau'
class capytaine.green_functions.delhommeau.XieDelhommeau(*, tabulation_nr=328, tabulation_nz=46, tabulation_nb_integration_points=251, finite_depth_prony_decomposition_method='fortran', floating_point_precision='float64')[source]

Bases: Delhommeau

Variant of Nemoh’s Green function, more accurate near the free surface.

Same arguments and methods as Delhommeau.

fortran_core_basename = 'XieDelhommeau'