WarpX
SpeciesPhysicalProperties.H
Go to the documentation of this file.
1 /* Copyright 2020 Maxence Thevenet
2  *
3  * This file is part of WarpX.
4  *
5  * License: BSD-3-Clause-LBNL
6  */
7 
8 #ifndef WARPX_SPECIESPHYSICALPROPERTIES_H_
9 #define WARPX_SPECIESPHYSICALPROPERTIES_H_
10 
11 #include "Utils/WarpXConst.H"
12 
13 #include <AMReX_REAL.H>
14 #include <AMReX_AmrCore.H>
15 
16 #include <map>
17 #include <limits>
18 
20 
21 namespace species
22 {
23  AMREX_FORCE_INLINE
25  {
26  if( species=="unspecified" )
28  if( species=="electron" )
30  if( species=="positron" )
32  if( species=="photon" )
34  if( species=="hydrogen" )
36  amrex::Abort("unknown PhysicalSpecies");
38  }
39 
40  AMREX_FORCE_INLINE
41  amrex::Real get_charge (PhysicalSpecies ps)
42  {
43  switch(ps) {
45  return std::numeric_limits<amrex::Real>::quiet_NaN();
47  return -PhysConst::q_e;
49  return PhysConst::q_e;
51  return 0.;
53  return PhysConst::q_e;
54  default:
55  amrex::Abort("unknown PhysicalSpecies");
56  return 0.;
57  }
58  }
59 
60  AMREX_FORCE_INLINE
61  amrex::Real get_mass (PhysicalSpecies ps)
62  {
63  switch(ps) {
65  return std::numeric_limits<amrex::Real>::quiet_NaN();
67  return PhysConst::m_e;
69  return PhysConst::m_e;
71  return 0.;
73  return PhysConst::m_p;
74  default:
75  amrex::Abort("unknown PhysicalSpecies");
76  return 0.;
77  }
78  }
79 }
80 
81 #endif // WARPX_SPECIESPHYSICALPROPERTIES_H_
AMREX_FORCE_INLINE PhysicalSpecies from_string(std::string species)
Definition: SpeciesPhysicalProperties.H:24
PhysicalSpecies
Definition: SpeciesPhysicalProperties.H:19
AMREX_FORCE_INLINE amrex::Real get_mass(PhysicalSpecies ps)
Definition: SpeciesPhysicalProperties.H:61
AMREX_FORCE_INLINE amrex::Real get_charge(PhysicalSpecies ps)
Definition: SpeciesPhysicalProperties.H:41
Definition: SpeciesPhysicalProperties.H:21