Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,12 @@ Particle initialization

* ``<species_name>.species_type`` (`string`) optional (default `unspecified`)
Type of physical species.
Currently, the accepted species are ``"electron"``, ``"positron"``, ``"photon"``, ``"hydrogen"`` (or equivalently ``"proton"``), ``"helium"`` (or equivalently ``"alpha"``), ``"boron"``, ``"carbon"``, ``"oxygen"``, ``"nitrogen"``, ``"argon"``, ``"copper"`` and ``"xenon"``.
Currently, the accepted species are ``"electron"``, ``"positron"``, ``"photon"``,
``"neutron"``, ``"hydrogen"`` (or equivalently ``"proton"``), ``"deuterium"``
(or equivalently ``"hydrogen2"``), ``"tritium"`` (or equivalently ``"hydrogen3"``),
``"helium"`` (or equivalently ``"alpha"``), ``"helium3"``, ``"helium4"``,
``"boron"``, ``"boron10"``, ``"boron11"``, ``"carbon"``, ``"oxygen"``,
``"nitrogen"``, ``"argon"``, ``"copper"`` and ``"xenon"``.
Either this or both ``mass`` and ``charge`` have to be specified.

* ``<species_name>.charge`` (`float`) optional (default `NaN`)
Expand Down
51 changes: 43 additions & 8 deletions Source/Particles/SpeciesPhysicalProperties.H
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
#include <map>
#include <string>

enum struct PhysicalSpecies{unspecified=0, electron, positron, photon, hydrogen, helium, boron,
boron10, boron11, carbon, nitrogen, oxygen, argon, copper, xenon};
enum struct PhysicalSpecies{unspecified=0, electron, positron, photon, neutron,
hydrogen, hydrogen2, hydrogen3, helium, helium3, helium4, boron, boron10,
boron11, carbon, nitrogen, oxygen, argon, copper, xenon};

namespace species
{
Expand All @@ -33,14 +34,20 @@ namespace species
return PhysicalSpecies::positron;
if( species=="photon" )
return PhysicalSpecies::photon;
if( species=="hydrogen" )
if( species=="neutron" )
return PhysicalSpecies::neutron;
if( (species=="hydrogen") || (species=="proton") )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is not very consistent with the way in which we treat "helium".
For consistency, we should distinguish:

  • hydrogen (includes the mass of the electron, averages over isotopes abundance)
  • proton/hydrogen1 (does not include the mass of the electron, does not average over isotopes)
    However, in order to preserve the code behavior, I did not introduce this change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Didn't we discuss this for #3090 that @lucafedeli88 has open? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes. Actually the present PR duplicates #3090. I will close it for now.

return PhysicalSpecies::hydrogen;
if( species=="proton" )
return PhysicalSpecies::hydrogen;
if( species=="helium" )
return PhysicalSpecies::helium;
if( species=="alpha" )
if( (species=="hydrogen2") || (species=="deuterium") )
return PhysicalSpecies::hydrogen2;
if( (species=="hydrogen3") || (species=="tritium") )
return PhysicalSpecies::hydrogen3;
if( (species=="helium") || (species=="alpha") )
return PhysicalSpecies::helium;
if( species=="helium3" )
return PhysicalSpecies::helium3;
if( species=="helium4" )
return PhysicalSpecies::helium4;
if( species=="boron" )
return PhysicalSpecies::boron;
if( species=="boron10" )
Expand Down Expand Up @@ -75,10 +82,20 @@ namespace species
return PhysConst::q_e;
case PhysicalSpecies::photon:
return 0.;
case PhysicalSpecies::neutron:
return 0.;
case PhysicalSpecies::hydrogen:
return PhysConst::q_e;
case PhysicalSpecies::hydrogen2:
return PhysConst::q_e;
case PhysicalSpecies::hydrogen3:
return PhysConst::q_e;
case PhysicalSpecies::helium:
return PhysConst::q_e * amrex::Real(2.0);
case PhysicalSpecies::helium3:
return PhysConst::q_e * amrex::Real(2.0);
case PhysicalSpecies::helium4:
return PhysConst::q_e * amrex::Real(2.0);
case PhysicalSpecies::boron:
return PhysConst::q_e * amrex::Real(5.0);
case PhysicalSpecies::boron10:
Expand Down Expand Up @@ -115,10 +132,20 @@ namespace species
return PhysConst::m_e;
case PhysicalSpecies::photon:
return 0.;
case PhysicalSpecies::neutron:
return PhysConst::m_p * amrex::Real(1.0013784193052508);
case PhysicalSpecies::hydrogen:
return PhysConst::m_p;
case PhysicalSpecies::hydrogen2:
return PhysConst::m_p * amrex::Real(1.99901);
case PhysicalSpecies::hydrogen3:
return PhysConst::m_p * amrex::Real(2.99372);
case PhysicalSpecies::helium:
return PhysConst::m_p * amrex::Real(3.97369);
case PhysicalSpecies::helium3:
return PhysConst::m_p * amrex::Real(2.99369);
case PhysicalSpecies::helium4:
return PhysConst::m_p * amrex::Real(3.97314);
case PhysicalSpecies::boron:
return PhysConst::m_p * amrex::Real(10.7319);
case PhysicalSpecies::boron10:
Expand Down Expand Up @@ -157,8 +184,16 @@ namespace species
return "photon";
case PhysicalSpecies::hydrogen:
return "hydrogen";
case PhysicalSpecies::hydrogen2:
return "hydrogen2";
case PhysicalSpecies::hydrogen3:
return "hydrogen3";
case PhysicalSpecies::helium:
return "helium";
case PhysicalSpecies::helium3:
return "helium3";
case PhysicalSpecies::helium4:
return "helium4";
case PhysicalSpecies::boron:
return "boron";
case PhysicalSpecies::boron10:
Expand Down