Ejemplo n.º 1
0
    def test_both_fermi_and_thermal_energy_important(self):
        r"""
        Method to test for degeneracy parameter for a plasma.

        Tests against expected value for degeneracy parameter for a
        plasma whose both Fermi and thermal energy are important.

        The input values in this case have no special significance
        and are just to get the desired output.
        """

        T_e = 5 * 15e3 * u.K
        n_e = 1e25 * u.cm**-3
        Z = 2.0
        particle = "p"
        blob = plasmablob.PlasmaBlob(T_e=T_e, n_e=n_e, Z=Z, particle=particle)

        # expect_regime = 'Both Fermi and thermal energy important: Theta = 0.03818537605355442'
        expect_regime = (
            f"Both Fermi and thermal energy important: Theta = {blob.quantum_theta()}"
        )

        _, regime = blob.regimes()
        testTrue = regime == expect_regime

        errStr = f"Regime should be {expect_regime}, but got {regime} instead."
        assert testTrue, errStr
Ejemplo n.º 2
0
    def test_fermi_quantum_energy_dominant(self):
        r"""
        Method to test for degeneracy parameter for a plasma.

        Tests against expected value for degeneracy parameter for a
        plasma in the Fermi degenerate regime.

        The input values in this case have no special significance
        and are just to get the desired output.
        """

        T_e = 6 * 15e3 * u.K
        n_e = 1e26 * u.cm**-3
        Z = 3.0
        particle = "p"
        blob = plasmablob.PlasmaBlob(T_e=T_e, n_e=n_e, Z=Z, particle=particle)

        # expect_regime = 'Fermi quantum energy dominant: Theta = 0.009872147858602853'
        expect_regime = f"Fermi quantum energy dominant: Theta = {blob.quantum_theta()}"

        _, regime = blob.regimes()
        testTrue = regime == expect_regime

        errStr = f"Regime should be {expect_regime}, but got {regime} instead."
        assert testTrue, errStr
Ejemplo n.º 3
0
    def test_thermal_kinetic_energy_dominant(self):
        r"""
        Method to test for degeneracy parameter for a plasma.

        Tests against expected value for degeneracy parameter for a
        plasma in the thermal degenerate regime.

        The input values in this case have no special significance
        and are just to get the desired output.
        """

        T_e = 10 * 11e3 * u.K
        n_e = 1e20 * u.cm**-3
        Z = 2.5
        particle = "p"
        blob = plasmablob.PlasmaBlob(T_e=T_e, n_e=n_e, Z=Z, particle=particle)

        # expect_regime = 'Thermal kinetic energy dominant: Theta = 120.65958493847927'
        expect_regime = (
            f"Thermal kinetic energy dominant: Theta = {blob.quantum_theta()}")

        _, regime = blob.regimes()
        testTrue = regime == expect_regime

        errStr = f"Regime should be {expect_regime}, but got {regime} instead."
        assert testTrue, errStr
Ejemplo n.º 4
0
    def test_weakly_coupled(self):
        r"""
        Method to test for coupling parameter for a plasma.

        Tests against expected value for coupling parameter for a
        plasma in the weakly coupled regime.

        The input values in this case have no special significance
        and are just to get the desired output.
        """

        T_e = 15 * 11e3 * u.K
        n_e = 1e15 * u.cm**-3
        Z = 2.5
        particle = "p"
        blob = plasmablob.PlasmaBlob(T_e=T_e, n_e=n_e, Z=Z, particle=particle)

        # expect_regime = 'Weakly coupled regime: Gamma = 0.0075178096952688445.'
        expect_regime = f"Weakly coupled regime: Gamma = {blob.coupling()}."

        with pytest.warns(CouplingWarning):
            regime, _ = blob.regimes()
        testTrue = regime == expect_regime

        errStr = f"Regime should be {expect_regime}, but got {regime} instead."
        assert testTrue, errStr
Ejemplo n.º 5
0
    def test_strongly_coupled(self):
        r"""
        Method to test for coupling parameter for a plasma.

        Tests against expected value for coupling parameter for a
        plasma in the strongly coupled regime.

        The input values in this case have no special significance
        and are just to get the desired output.
        """

        T_e = 5 * 15e3 * u.K
        n_e = 1e26 * u.cm**-3
        Z = 3.0
        particle = "p"
        blob = plasmablob.PlasmaBlob(T_e=T_e, n_e=n_e, Z=Z, particle=particle)

        # expect_regime = 'Strongly coupled regime: Gamma = 104.02780112828943.'
        expect_regime = f"Strongly coupled regime: Gamma = {blob.coupling()}."

        regime, _ = blob.regimes()
        testTrue = regime == expect_regime

        errStr = f"Regime should be {expect_regime}, but got {regime} instead."
        assert testTrue, errStr
Ejemplo n.º 6
0
    def test_intermediate_coupling(self):
        r"""
        Method to test for coupling parameter for a plasma.

        Tests against expected value for coupling parameter for a
        plasma in the intermediate coupling regime.

        The input values in this case have no special significance
        and are just to get the desired output.
        """

        T_e = 25 * 15e3 * u.K
        n_e = 1e26 * u.cm ** -3
        Z = 2.0
        particle = 'p'
        blob = plasmablob.PlasmaBlob(T_e=T_e,
                                     n_e=n_e,
                                     Z=Z,
                                     particle=particle)

        expect_regime = 'Intermediate coupling regime: Gamma = 10.585076050938532.'
        regime, _ = blob.regimes()
        testTrue = regime == expect_regime

        errStr = f"Regime should be {expect_regime}, but got {regime} instead."
        assert testTrue, errStr
Ejemplo n.º 7
0
 def test_invalid_particle(self):
     """
     Checks if function raises error for invalid particle.
     """
     with pytest.raises(InvalidParticleError):
         plasmablob.PlasmaBlob(T_e=self.T_e,
                               n_e=self.n_e,
                               Z=self.Z,
                               particle="cupcakes")
Ejemplo n.º 8
0
 def setup_class(self):
     """initializing parameters for tests """
     self.T_e = 5 * 11e3 * u.K
     self.n_e = 1e23 * u.cm**-3
     self.Z = 2.5
     self.particle = "p"
     self.blob = plasmablob.PlasmaBlob(T_e=self.T_e,
                                       n_e=self.n_e,
                                       Z=self.Z,
                                       particle=self.particle)
     self.couplingVal = 10.468374460435724
     self.thetaVal = 0.6032979246923964