def set_plasma(self, Bo, kTe, kTi, m_i, n_e, Z, gamma=None, **kwargs): # pragma: no cover """ Set :attr:`plasma` and add key frequency, length, and velocity parameters. (all quantities in cgs except temperature is in eV) :param float Bo: magnetic field (in Gauss) :param float kTe: electron temperature (in eV) :param float kTi: ion temperature (in eV) :param float m_i: ion mass (in g) :param float n_e: electron number density (in cm^-3) :param int Z: ion charge number :param float gamma: adiabatic index (arb.) """ # define base values self._plasma['Bo'] = core.FloatUnit(Bo, 'G') self._plasma['kTe'] = core.FloatUnit(kTe, 'eV') self._plasma['kTi'] = core.FloatUnit(kTi, 'eV') self._plasma['m_i'] = core.FloatUnit(m_i, 'g') self._plasma['n_e'] = core.FloatUnit(n_e, 'cm^-3') self._plasma['Z'] = core.IntUnit(Z, 'arb') # define ion number density self._plasma['n_i'] = core.FloatUnit( self._plasma['n_e'] / self._plasma['Z'], 'cm^-3') # define gamma (adiabatic index) # - default = 1.0 if gamma is not None: self._plasma['gamma'] = core.FloatUnit(gamma, 'arb') # define plasma temperature # - if omitted then assumed kTe # TODO: double check assumption if 'kT' in kwargs: self._plasma['kT'] = core.FloatUnit(kwargs['kT'], 'eV') else: self._plasma['kT'] = core.FloatUnit(kTe, 'eV') # define plasma number density # - if omitted then assumed n_e if 'n' in kwargs: self._plasma['n'] = core.FloatUnit(kwargs['n'], 'cm^-3') else: self._plasma['n'] = core.FloatUnit(n_e, 'cm^-3') # add key plasma constants self._update_plasma_constants()
def set_plasma(self, Bo, kTe, kTi, m_i, n_e, Z, gamma=None, **kwargs): # pragma: no cover """ Set :attr:`plasma` and add key frequency, length, and velocity parameters. (all quantities in cgs except temperature is in eV) :param float Bo: magnetic field (in Gauss) :param float kTe: electron temperature (in eV) :param float kTi: ion temperature (in eV) :param float m_i: ion mass (in g) :param float n_e: electron number density (in cm^-3) :param int Z: ion charge number :param float gamma: adiabatic index (arb.) """ # define base values self._plasma["Bo"] = core.FloatUnit(Bo, "G") self._plasma["kTe"] = core.FloatUnit(kTe, "eV") self._plasma["kTi"] = core.FloatUnit(kTi, "eV") self._plasma["m_i"] = core.FloatUnit(m_i, "g") self._plasma["n_e"] = core.FloatUnit(n_e, "cm^-3") self._plasma["Z"] = core.IntUnit(Z, "arb") # define ion number density self._plasma["n_i"] = core.FloatUnit( self._plasma["n_e"] / self._plasma["Z"], "cm^-3") # define gamma (adiabatic index) # - default = 1.0 if gamma is not None: self._plasma["gamma"] = core.FloatUnit(gamma, "arb") # define plasma temperature # - if omitted then assumed kTe # TODO: double check assumption if "kT" in kwargs: self._plasma["kT"] = core.FloatUnit(kwargs["kT"], "eV") else: self._plasma["kT"] = core.FloatUnit(kTe, "eV") # define plasma number density # - if omitted then assumed n_e if "n" in kwargs: self._plasma["n"] = core.FloatUnit(kwargs["n"], "cm^-3") else: self._plasma["n"] = core.FloatUnit(n_e, "cm^-3") # add key plasma constants self._update_plasma_constants()
def set_plasma_value(self, key, value): # pragma: no cover """ Re-define one of the base plasma values (Bo, gamma, kT, kTe, kTi, m_i, n, n_e, or Z) in the :attr:`plasma` dictionary. :param str key: one of the base plasma values :param value: value for key """ # set plasma value if key == 'Bo': self._plasma['Bo'] = core.FloatUnit(value, 'G') elif key == 'gamma': self._plasma['gamma'] = core.FloatUnit(value, 'arb') elif key in ['kT', 'kTe', 'kTi']: self._plasma[key] = core.FloatUnit(value, 'eV') if key == 'kTe' and self._plasma['kt'] is None: self._plasma['kT'] = self._plasma[key] elif key == 'm_i': self._plasma[key] = core.FloatUnit(value, 'g') elif key in ['n', 'n_e']: self._plasma[key] = core.FloatUnit(value, 'cm^-3') # re-calc n_i and n if key == 'n_e': self._plasma['n_i'] = core.FloatUnit( self._plasma['n_e'] / self._plasma['Z'], 'cm^-3') if self._plasma['n'] is None: self._plasma['n'] = self._plasma['n_e'] elif key == 'Z': self._plasma[key] = core.IntUnit(value, 'arb') # re-calc n_i self._plasma['n_i'] = \ core.FloatUnit(self._plasma['n_e'] / self._plasma['Z'], 'cm^-3') # update key plasma constants self._update_plasma_constants()
def set_plasma_value(self, key, value): # pragma: no cover """ Re-define one of the base plasma values (Bo, gamma, kT, kTe, kTi, m_i, n, n_e, or Z) in the :attr:`plasma` dictionary. :param str key: one of the base plasma values :param value: value for key """ # set plasma value if key == "Bo": self._plasma["Bo"] = core.FloatUnit(value, "G") elif key == "gamma": self._plasma["gamma"] = core.FloatUnit(value, "arb") elif key in ["kT", "kTe", "kTi"]: self._plasma[key] = core.FloatUnit(value, "eV") if key == "kTe" and self._plasma["kt"] is None: self._plasma["kT"] = self._plasma[key] elif key == "m_i": self._plasma[key] = core.FloatUnit(value, "g") elif key in ["n", "n_e"]: self._plasma[key] = core.FloatUnit(value, "cm^-3") # re-calc n_i and n if key == "n_e": self._plasma["n_i"] = core.FloatUnit( self._plasma["n_e"] / self._plasma["Z"], "cm^-3") if self._plasma["n"] is None: self._plasma["n"] = self._plasma["n_e"] elif key == "Z": self._plasma[key] = core.IntUnit(value, "arb") # re-calc n_i self._plasma["n_i"] = core.FloatUnit( self._plasma["n_e"] / self._plasma["Z"], "cm^-3") # update key plasma constants self._update_plasma_constants()