swiift.lib.phase_shift ====================== .. py:module:: swiift.lib.phase_shift .. autoapi-nested-parse:: Pseudo-scattering parameterisations. Classes ------- .. autoapisummary:: swiift.lib.phase_shift.ContinuousScatteringHandler swiift.lib.phase_shift.UniformScatteringHandler swiift.lib.phase_shift.PerturbationScatteringHandler Module Contents --------------- .. py:class:: ContinuousScatteringHandler Bases: :py:obj:`_ScatteringHandler` No scattering. The surface stays continuous across floes edges. .. py:method:: compute_edge_amplitudes(edge_amplitudes, c_wavenumbers, xf) Determine post-breakup wave amplitudes at the edge of new floes. The wave propagates and is attenuated underneath the floe. For the current timestep, for each wave component, the complex wave amplitude is fully determined at all the coordinates where fracture is about to occur. After fractures have occured, the complex amplitudes at these coordinates become the complex amplitudes at the left edges of new fragments. Further pseudo-scattering rules can be used if it is not desirable to keep the wave surface in phase on both sides of a floe edge. :param edge_amplitudes: The complex wave amplitudes at the edge of a breaking floe, in m :type edge_amplitudes: np.ndarray of complex :param c_wavenumbers: The complex wavenumbers stressing the floe, in m^-1 :type c_wavenumbers: np.ndarray of complex :param xf: The coordinates of fractures, in m :type xf: np.ndarray of float :rtype: np.ndarray of complex .. py:class:: UniformScatteringHandler Bases: :py:obj:`_RandomScatteringHandler` Scattering with uniformly sampled new phases. The wave phase at the edge of a new floe is sampled from the uniform distribution on :math:`[0; 2\pi)`. :param rng: Random generator used to sample phases :type rng: numpy.random.Generator .. py:method:: from_seed(seed) :classmethod: Instantiate self with an RNG seeded by an integer. :param seed: A seed passed to `numpy.random.default_rng` :type seed: int :rtype: UniformScatteringHandler .. py:method:: compute_edge_amplitudes(edge_amplitudes, c_wavenumbers, xf) Determine post-breakup wave amplitudes at the edge of new floes. The wave propagates and is attenuated underneath the floe. For the current timestep, for each wave component, the complex wave amplitude is fully determined at all the coordinates where fracture is about to occur. After fractures have occured, the complex amplitudes at these coordinates become the complex amplitudes at the left edges of new fragments. Further pseudo-scattering rules can be used if it is not desirable to keep the wave surface in phase on both sides of a floe edge. :param edge_amplitudes: The complex wave amplitudes at the edge of a breaking floe, in m :type edge_amplitudes: np.ndarray of complex :param c_wavenumbers: The complex wavenumbers stressing the floe, in m^-1 :type c_wavenumbers: np.ndarray of complex :param xf: The coordinates of fractures, in m :type xf: np.ndarray of float :rtype: np.ndarray of complex .. py:class:: PerturbationScatteringHandler Bases: :py:obj:`_RandomScatteringHandler` Scattering with phases perturbated around the continuous solution. The wave phase at the left edge of a new floe is computed to maintain continuity of the surface across the edge. Then, a random perturbation sampled from a normal distribution, is added to the phase. .. attribute:: rng Random generator used to sample perturbations :type: numpy.random.Generator .. attribute:: loc The mean of the normal distribution used to sample perturbations, in rad :type: float .. attribute:: scale The standard deviation of the normal distribution used to sample perturbations, in rad :type: float .. rubric:: Notes Perturbations are always added to an existing phase. The expectation of the resulting phase is thus the sum of `loc` and the phase of the continuous solution. .. py:method:: from_seed(seed, loc = 0, scale = 1) :classmethod: Instantiate with an RNG seeded with an integer. :param seed: A seed passed to `numpy.random.default_rng` :type seed: int :param loc: Mean of a normal distribution, in rad :type loc: float :param scale: Standard deviation of a normal distribution, in rad :type scale: float :rtype: PerturbationScatteringHandler .. py:method:: compute_edge_amplitudes(edge_amplitudes, c_wavenumbers, xf) Determine post-breakup wave amplitudes at the edge of new floes. The wave propagates and is attenuated underneath the floe. For the current timestep, for each wave component, the complex wave amplitude is fully determined at all the coordinates where fracture is about to occur. After fractures have occured, the complex amplitudes at these coordinates become the complex amplitudes at the left edges of new fragments. Further pseudo-scattering rules can be used if it is not desirable to keep the wave surface in phase on both sides of a floe edge. :param edge_amplitudes: The complex wave amplitudes at the edge of a breaking floe, in m :type edge_amplitudes: np.ndarray of complex :param c_wavenumbers: The complex wavenumbers stressing the floe, in m^-1 :type c_wavenumbers: np.ndarray of complex :param xf: The coordinates of fractures, in m :type xf: np.ndarray of float :rtype: np.ndarray of complex