def test_max_langevin_fixed_point(self):
        """
        Estimating the intrinsic velocity of a dissipative soliton
        """
        default_params = {"m": 3, "r": 30}

        # active Brownian motion
        ds = velocity(tau=3.8, delta_t=0.05, R=3e-4, seed=0)
        v = ds.simulate(1000000, v0=np.zeros(1))
        v0 = max_langevin_fixed_point(v[:, 0], **default_params)
        self.assertTrue(abs(ds.deterministic - v0) < 0.0001)

        # Brownian motion
        ds = velocity(tau=2.0 / 0.3 - 3.8, delta_t=0.05, R=3e-4, seed=0)
        v = ds.simulate(1000000, v0=np.zeros(1))
        v0 = max_langevin_fixed_point(v[:, 0], **default_params)
        self.assertTrue(v0 < 0.001)
    def test_estimate_friedrich_coefficients(self):
        """
        Estimate friedrich coefficients
        """
        default_params = {"m": 3, "r": 30}

        # active Brownian motion
        ds = velocity(tau=3.8, delta_t=0.05, R=3e-4, seed=0)
        v = ds.simulate(1000000, v0=np.zeros(1))
        coeff = _estimate_friedrich_coefficients(v[:, 0], **default_params)
        self.assertTrue(abs(coeff[-1]) < 0.0001)

        # Brownian motion
        ds = velocity(tau=2.0 / 0.3 - 3.8, delta_t=0.05, R=3e-4, seed=0)
        v = ds.simulate(1000000, v0=np.zeros(1))
        coeff = _estimate_friedrich_coefficients(v[:, 0], **default_params)
        self.assertTrue(abs(coeff[-1]) < 0.0001)
    def test_dimensionality(self):
        ds = velocity(tau=1.0/0.3)
        Nt = 10
        v = ds.simulate(Nt)
        self.assertEqual(v.shape, (Nt, 2),
                         'The default configuration should return velocities from a two-dimensional dissipative soliton.')

        v = ds.simulate(Nt, v0=np.zeros(3))
        self.assertEqual(v.shape, (Nt, 3),
                         'The returned vector should reflect the dimension of the initial condition.')
    def test_equlibrium_velocity(self):
        """
        Test accuracy of integrating the deterministic dynamics for equilibrium velocity [6, p. 116]
        """
        ds = velocity(tau=1.01/0.3, R=0)
        v0 = ds.deterministic

        Nt = 100 # Number of time steps
        v = ds.simulate(Nt, v0=np.array([v0, 0.]))

        return np.testing.assert_array_almost_equal(v[:,0]-v0, np.zeros(Nt),
                                                    decimal=8)
Beispiel #5
0
    def test_equlibrium_velocity(self):
        """
        Test accuracy of integrating the deterministic dynamics for equilibrium velocity [6, p. 116]
        """
        ds = velocity(tau=1.01 / 0.3, R=0)
        v0 = ds.deterministic

        Nt = 100  # Number of time steps
        v = ds.simulate(Nt, v0=np.array([v0, 0.]))

        return np.testing.assert_array_almost_equal(v[:, 0] - v0,
                                                    np.zeros(Nt),
                                                    decimal=8)
Beispiel #6
0
    def test_dimensionality(self):
        ds = velocity(tau=1.0 / 0.3)
        Nt = 10
        v = ds.simulate(Nt)
        self.assertEqual(
            v.shape, (Nt, 2),
            'The default configuration should return velocities from a two-dimensional dissipative soliton.'
        )

        v = ds.simulate(Nt, v0=np.zeros(3))
        self.assertEqual(
            v.shape, (Nt, 3),
            'The returned vector should reflect the dimension of the initial condition.'
        )
    def test_relaxation_dynamics(self):
        """
        Test accuracy of integrating the deterministic dynamics [6, p. 116]
        """
        ds = velocity(tau=1.01/0.3, R=0)
        v0 = 1.01 * ds.deterministic

        Nt = 100 # Number of time steps
        v = ds.simulate(Nt, v0=np.array([v0, 0.]))

        k3t = ds.kappa_3 * ds.tau
        k3st = ds.kappa_3**2 * ds.tau
        a0 = v0 / ds.kappa_3
        acceleration = lambda t: ds.kappa_3 * (a0 * np.sqrt(k3t - 1) * np.exp(k3st * t) /
                                               np.sqrt(np.exp(2.0 * k3st * t) * ds.Q * a0**2 +
                                                       np.exp(2.0 * ds.kappa_3 * t) * (k3t - 1 - ds.Q * a0**2)))
        t = ds.delta_t * np.arange(Nt)
        return np.testing.assert_array_almost_equal(v[:,0], np.vectorize(acceleration)(t),
                                                    decimal=8)
Beispiel #8
0
    def test_relaxation_dynamics(self):
        """
        Test accuracy of integrating the deterministic dynamics [6, p. 116]
        """
        ds = velocity(tau=1.01 / 0.3, R=0)
        v0 = 1.01 * ds.deterministic

        Nt = 100  # Number of time steps
        v = ds.simulate(Nt, v0=np.array([v0, 0.]))

        k3t = ds.kappa_3 * ds.tau
        k3st = ds.kappa_3**2 * ds.tau
        a0 = v0 / ds.kappa_3
        acceleration = lambda t: ds.kappa_3 * (a0 * np.sqrt(k3t - 1) * np.exp(
            k3st * t) / np.sqrt(
                np.exp(2.0 * k3st * t) * ds.Q * a0**2 + np.exp(
                    2.0 * ds.kappa_3 * t) * (k3t - 1 - ds.Q * a0**2)))
        t = ds.delta_t * np.arange(Nt)
        return np.testing.assert_array_almost_equal(
            v[:, 0], np.vectorize(acceleration)(t), decimal=8)
Beispiel #9
0
 def test_intrinsic_velocity_at_default_bifurcation_point(self):
     """
     The intrinsic velocity of a dissipative soliton at the Drift bifurcation point is zero.
     """
     ds = velocity(tau=1.0 / 0.3)
     self.assertEqual(ds.deterministic, 0.0)
 def test_intrinsic_velocity_at_default_bifurcation_point(self):
     """
     The intrinsic velocity of a dissipative soliton at the Drift bifurcation point is zero.
     """
     ds = velocity(tau=1.0/0.3)
     self.assertEqual(ds.deterministic, 0.0)