Exemple #1
0
def omega_cj(q_e=None, m=None, B=None, plasma=None, varidx='j'):
    from scipy.constants import e
    from sympy import Abs

    if all(v is not None for v in [q_e, m, B]):
        return Abs(q_e) * e * B / m
    else:
        from .mediums import MagnetizedPlasma
        p = plasma
        if isinstance(p, MagnetizedPlasma) or p is None:
            pass
        else:
            print(
                "Make sure you have arg: plasma the right class -- MagnetizedPlasma, or its derived class."
            )
        return _Symbol('\omega_{cj}'.format(cj=f'c{varidx}'), negative=False)
Exemple #2
0
def numeric_symbol(name: str, assumptions: dict = None):
    """Helper utility for creating a numeric symbol with default
    assumptions from the sympy.diffgeom subpackage

    Args:
        name:
            str, the name
        assumptions:
            dict, the assumptions. If None use DEFAULT_NUMERIC_ASSUMPTIONS

    Returns:
        Symbol
    """
    if assumptions is None:
        assumptions = DEFAULT_NUMERIC_ASSUMPTIONS
    return _Symbol(name, **assumptions)
Exemple #3
0
    def __init__(self, varidx='', k=None, w=None):
        self.varidx = varidx
        if k is None:
            k_x, k_y, k_z = _symbols(
                'k_x_{varidx}, k_y_{varidx}, k_z_{varidx}'.format(
                    varidx=self.varidx),
                complex=True)
            self.k = _Array([k_x, k_y, k_z])
        else:
            self.k = k

        if w is None:
            self.w = _Symbol('omega_{varidx}'.format(varidx=self.varidx),
                             complex=True)
        else:
            self.w = w
Exemple #4
0
def omega_pj(n_0=None, q_e=None, m=None, plasma=None, varidx='j'):
    from scipy.constants import epsilon_0, e
    from sympy import sqrt

    if all(v is not None for v in [n_0, q_e, m]):
        return (q_e * e) * sqrt(
            n_0 /
            (epsilon_0 *
             m))  # Split the square of q_e * e, avoid it being too little
    else:
        from .mediums import Plasma
        if isinstance(plasma, Plasma) or plasma is None:
            pass
        else:
            print(
                "Make sure you have arg: plasma the right class -- Plasma, or its derived class."
            )
        return _Symbol('\omega_{pj}'.format(pj=f'p{varidx}'), negative=False)
Exemple #5
0
def kappa_perp(plasma=None):
    return _Symbol('kappa_\perp', real=True)
Exemple #6
0
def kappa_times(plasma=None):
    return _Symbol('\kappa_{\\times}', real=True)
Exemple #7
0
def kappa_para(plasma=None):
    return _Symbol('kappa_\parallel', real=True)
Exemple #8
0
def theta_btwn_B_and_k(wave_eq):
    from ..mediums import MagnetizedPlasma
    assert (isinstance(wave_eq.medium, MagnetizedPlasma))
    return _Symbol('theta', nonnegative=True)
Exemple #9
0
def c():  # light speed in vacuum
    return _Symbol('c', positive=True)
Exemple #10
0
 def relative_refraction_N(self):
     return _Symbol('N_{varidx}'.format(varidx=self.varidx))
Exemple #11
0
 def B_amp(self):
     return _Symbol('B_{amp}_{varidx}'.format(amp='amp',
                                              varidx=self.varidx),
                    negative=False)