RAO

class mafredo.Rao[source]

RAO is a data-object for dealing with RAO-type data being:

  • amplitude [any] and

  • phase [radians]

as function of:

  • heading [degrees]

  • omega [rad/s]

This class is created to provide methods for the correct interpolation of this type of data which means:

  • the amplitude and phase are interpolated separately (interpolation of complex numbers result in incorrect amplitude)

  • continuity in heading is considered (eg: interpolation of heading 355 from heading 345 and 0)

An attribute “mode” is added which determine which mode is represented (surge/sway/../yaw) and is needed to determine how symmetry should be applied (if any). Why? Well, for heave it does not matter whether a wave comes from sb or ps, but for roll it does.

The amplitude and phase can physically be anything. But typically would be one of the following:

  • A motion RAO (result of frequency domain response calculation)

  • A force or moment RAO (result of diffraction analysis)

  • A response spectrum with relative phase angles (result of a motion RAO combined with a wave-spectrum)

It is suggested to define the wave_direction as the direction of wave propagation relative to the X-axis. So heading 90 is propagation along the y-axis.

Create:

create_from_data()[source]
create_from_capytaine_wave_force()[source]
create_from_xarray_nocomplex()[source]

Modify:

regrid_omega()[source]
regrid_direction()[source]
add_direction()[source]
add_frequency()[source]
apply_symmetry_xz()

Properties:

  • n_frequencies

  • omega

  • n_wave_directions

  • wave_directions

Get data:

get_value()[source]
get_heading()[source]

['amplitude'] to get amplitude as xarray ['phase'] to get phase as xarray ['complex'] to get complex rao ['complex_unit'] to get normalized complex rao

Plotting:

For plotting just use xarray:

>>> my_rao['ampltiude'].plot()

others:

for netcdf:

to_xarray_nocomplex()[source]
  • anything from xarray. For example myrao[‘amplitude’].plot() or myrao[‘amplitude’].sel(wave_direction=180).values

Note For ease of interpolation the phase is stored internally as “complex_unit” which equals exp(1j*phase). This is a complex number with angle (phase) and amplitude 1. The relation bewteen these two is:

>>> phase = np.angle(cu)
>>> cu = np.exp(phase *1j)