CurrentModule = PlasmaSpecies
Species
A Species
is represented by the following struct
PlasmaSpecies.Species
— TypeSpecies(
gas <: Gas,
charge=Neutral(),
electronic_state=nothing,
vibrational_state=nothing,
rotational_state=nothing
)
Fields
gas <: Gas
: Label of the parent gas, e.g. a struct like Nitrogen <: Gas or the general StringGas(str:String).charge=Neutral()
: Charge of the species, e.g. Neutral(), Positive(n), Negative(n)electronic_state=nothing
: Optional, label for the electronic state.vibrational_state=nothing
: Optional, label for the vibrational state. If defined,electronic_state
cannot benothing
.rotational_state=nothing
: Optional, label for the rotational state. If defined,vibrational_state
cannot benothing
.
Usually, it is more convenient to define the species by a string in the format given defined by LoKI-B. For this purpose, PlasmaSpecies
supplies a convenience constructor:
PlasmaSpecies.Species
— MethodSpecies(str::String)
Convenience constructor for the Species
struct. It parses a string of the format defined by the LoKI-B Boltzmann solver and automatically fills in the fields of Species
.
With this the definition of a species is as easy as
using PlasmaSpecies
Species("N2(X,v=0,J=10)")
N2(X,v=0,J=10)
A valid string consists of a label for the gas (N2
) optionally more detailed information can be given in brackets separated by commas, starting with the charge as a variable number of +
or -
signs or a zero. If no charge is explicitly given the default (Neutral()
) is used. The charge is followed by an optional label for the electronic state. The labels for the vibrational and rotational states are prefixed by v=
or J=
, respectively. Some valid examples are:
julia> using PlasmaSpecies
julia> Species("e")
e
julia> Species("N3(+)")
N3(+)
julia> Species("N2(+,B)")
N2(+,B)
julia> Species("N2(-,X,v=2)")
N2(-,X,v=2)
julia> p"N4(+)"
N4(+)
The last repl command uses the p"..."
string macro which can be used to define species and reactions as well.
Methods
Various methods exist to query information from a Species
object. These include methods to obtain the fields of the struct:
julia> using PlasmaSpecies
julia> sp = Species("N2(+,B)")
N2(+,B)
julia> gas(sp)
N₂
julia> charge(sp)
Positive(1)
julia> electronic_state(sp)
"B"
julia> vibrational_state(sp) === nothing
true
julia> rotational_state(sp) === nothing
true
Further, the mass of a species (in kg) can be queried if its corresponding gas
has the corresponding method defined.PlasmaSpecies
contains a few registered gases which are automatically recognized in the species strings and have their masses defined. The masses of the missing or additional electrons corresponding to the charge of the species are accounted for.
julia> mass(sp)
4.6759089e-26
julia> mass(p"e")
9.11e-31
julia> mass(p"N2")
4.6760000000000004e-26
julia> mass(p"N2") - mass(p"e") ≈ mass(sp)
true
julia> mass(p"unknown_gas(+,X)")
ERROR: Mass needs to be defined. If you are using a p"" string, the gas seems to be unknown to plasma species. In this case either post an issue in the git repo or define a new Gas struct with corresponding mass(::Gas) function.
julia> struct UnknownGas <: Gas end
julia> PlasmaSpecies.mass(::UnknownGas) = π * 1e-26
julia> mass(Species(UnknownGas()))
3.1415926535897934e-26