capytaine.post_pro.mean_drift_force module

Computation of the mean drift force.

capytaine.post_pro.mean_drift_force.far_field_mean_drift_force(X, dataset)[source]

Compute the mean drift forces using far field formulation. Note that the forces are proportional to the square of the wave amplitude, but this implementation does not take into account the wave amplitude.

Parameters:
  • X (xarray DataArray) – The motion RAO.

  • dataset (xarray Dataset) – This function supposes that variables named ‘kochin_diffraction’ and ‘kochin_radiation’ are in the dataset.

Returns:

The horizontal mean drift forces, depending on omega and the wave direction.

Return type:

xarray Dataset

capytaine.post_pro.mean_drift_force.near_field_mean_drift_force(first_order_motion_amplitude, dataset, body, *, solver=None, output_pressure=False)[source]

Compute the mean drift force using the near field formulation.

The force is the second-order part of the integral of the pressure on the moving body and along the waterline, for any dofs (rigid body motions or generalized modes with a gradient of motion). All the wave components have the same frequency, so all the terms of the result (for the same or for different wave directions) are at difference frequency zero, where the second-order potential does not contribute to the pressure.

The first-order fields are evaluated from a dataset computed with the indirect method and keep_details=True (e.g. solver.fill_dataset(test_matrix, body, keep_details=True)), which stores the pressures and the source distributions on the body. Several wavelengths and dofs are taken into account at once. Only datasets with a single value of rho, g and water depth, and without forward speed, are supported.

Parameters:
  • first_order_motion_amplitude (xarray DataArray) – The motion RAO, as returned by capytaine.post_pro.rao.rao().

  • dataset (xarray Dataset) – The dataset of the diffraction and radiation results, for all the wavelengths and wave directions of interest, with the source distributions on the body (sources_diffraction, sources_radiation, and on the lid if any).

  • body (FloatingBody or Multibody) – The body of the dataset.

  • solver (BEMSolver, optional) – The solver evaluating the potential and its gradient from the source distributions. It is recommended to use the same one as the one used to compute the dataset. Default: initialize default BEMSolver().

  • output_pressure (bool, optional) – If True, also return the second-order pressure field on the hull and the first-order fields on the waterline from which the waterline term of the force is computed. Default: False.

Returns:

A dataset with a near_field_mean_drift_force variable of shape (nb_freq, nb_wave_direction, nb_wave_direction, nb_dofs). If the inputs have different frequencies, wave direction or dofs, the output is computed on their intersection. If output_pressure is True, the dataset also contains the following variables:

  • pressure_hull_mean_drift, of shape (nb_freq, nb_wave_direction, nb_wave_direction, nb_hull_faces): the mean drift pressure field on the hull. It has the same normalization as near_field_mean_drift_force: its diagonal is the mean pressure in a single wave of unit amplitude. It does not include the waterline term.

  • pressure_waterline_total, of shape (nb_freq, nb_wave_direction, nb_waterline_segments): the complex first-order pressure p in the strip between the mean waterline and the free surface, at the middle of each segment of the waterline, for a wave of unit amplitude. It is the total pressure on the freely floating body: incident, diffracted and radiated (with the motion given by first_order_motion_amplitude) waves, as well as the hydrostatic pressure averaged over the height of the strip.

  • relative_elevation_waterline, of the same shape: the complex first-order relative elevation h of the free surface with respect to the body, at the same points, for a wave of unit amplitude.

  • mesh_waterline, of shape (nb_waterline_segments, 2, 3): the coordinates of the two ends of each segment of the waterline.

Return type:

xarray Dataset