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=676, tabulation_rmax=100.0, tabulation_nz=372, tabulation_zmin=-251.0, tabulation_nb_integration_points=1001, tabulation_grid_shape='scaled_nemoh3', tabulation_cache_dir='/home/runner/.cache/capytaine/2.2', finite_depth_prony_decomposition_method='fortran', floating_point_precision='float64', gf_singularities='low_freq')[source]¶
Bases:
AbstractGreenFunction
The Green function as implemented in Aquadyn and Nemoh.
- Parameters:
tabulation_nr (int, optional) – Number of tabulation points for horizontal coordinate. If 0 is given, no tabulation is used at all. Default: 676
tabulation_rmax (float, optional) – Maximum value of r range for the tabulation. (Minimum is zero.) Only used with the
"scaled_nemoh3"
method. Default: 100.0tabulation_nz (int, optional) – Number of tabulation points for vertical coordinate. If 0 is given, no tabulation is used at all. Default: 372
tabulation_zmin (float, optional) – Minimum value of z range for the tabulation. (Maximum is zero.) Only used with the
"scaled_nemoh3"
method. Default: -251.0tabulation_nb_integration_points (int, optional) – Number of points for the numerical integration w.r.t. \(theta\) of Delhommeau’s integrals Default: 1000
tabulation_grid_shape (string, optional) – Either
"legacy"
or"scaled_nemoh3"
, which are the two methods currently implemented. Default:"scaled_nemoh3"
tabulation_cache_dir (str or None, optional) – Directory in which to save the tabulation file(s). If None, the tabulation is not saved on disk. Default: calls capytaine.tools.cache_on_disk.cache_directory(), which returns the value of the environment variable CAPYTAINE_CACHE_DIR if set, or else the default cache directory on your system.
finite_depth_prony_decomposition_method (string, optional) – The implementation of the Prony decomposition used to compute the finite water_depth Green function. Accepted values:
'fortran'
for Nemoh’s implementation (by default),'python'
for an experimental Python implementation. Seefind_best_exponential_decomposition()
.floating_point_precision (string, optional) – Either
'float32'
for single precision computations or'float64'
for double precision computations. Default:'float64'
.gf_singularities (string, optional) – Chose of the variant among the ways singularities can be extracted from the Green function. Currently only affects the infinite depth Green function. Default: “low_freq”.
- Variables:
fortran_core – Compiled Fortran module with functions used to compute the Green function.
tabulation_grid_shape_index (int) – Integer passed to Fortran code to describe which method is used.
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, nb_tabulated_values) and type floating_point_precision) – Tabulated Delhommeau integrals.
- evaluate(mesh1, mesh2, free_surface=0.0, water_depth=inf, wavenumber=1.0, adjoint_double_layer=True, early_dot_product=True)[source]¶
The main method of the class, called by the engine to assemble the influence matrices.
- Parameters:
mesh1 (Mesh or CollectionOfMeshes or list of points) – mesh of the receiving body (where the potential is measured) if only S is wanted or early_dot_product is False, then only a list of points as an array of shape (n, 3) can be passed.
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\))
water_depth (float, optional) – constant depth of water (default: \(+\infty\))
wavenumber (float, optional) – wavenumber (default: 1.0)
adjoint_double_layer (bool, optional) – compute double layer for direct method (F) or adjoint double layer for indirect method (T) matrices (default: True)
early_dot_product (boolean, optional) – if False, return K as a (n, m, 3) array storing ∫∇G if True, return K as a (n, m) array storing ∫∇G·n
- 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 water_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]
- class capytaine.green_functions.delhommeau.XieDelhommeau(**kwargs)[source]¶
Bases:
Delhommeau
Legacy way to call the gf_singularities=”low_freq” variant.