Hipace
Constants.H
Go to the documentation of this file.
1 /* Copyright 2020
2  *
3  * This file is part of HiPACE++.
4  *
5  * Authors: Axel Huebl, MaxThevenet, Remi Lehe
6  * License: BSD-3-Clause-LBNL
7  */
8 #ifndef HIPACE_Constants_H_
9 #define HIPACE_Constants_H_
10 
11 #include <AMReX_REAL.H>
12 #include <AMReX_GpuQualifiers.H>
13 #include <cmath>
14 
15 namespace PhysConstSI
16 {
17  static constexpr auto c = static_cast<amrex::Real>( 299'792'458. );
18  static constexpr auto ep0 = static_cast<amrex::Real>( 8.8541878128e-12 );
19  static constexpr auto mu0 = static_cast<amrex::Real>( 1.25663706212e-06 );
20  static constexpr auto q_e = static_cast<amrex::Real>( 1.602176634e-19 );
21  static constexpr auto m_e = static_cast<amrex::Real>( 9.1093837015e-31 );
22  static constexpr auto m_p = static_cast<amrex::Real>( 1.67262192369e-27 );
23  static constexpr auto hbar = static_cast<amrex::Real>( 1.054571817e-34 );
24  static constexpr auto r_e = static_cast<amrex::Real>( 2.817940326204929e-15 );
25 }
26 
28 namespace MathConst
29 {
30  static constexpr amrex::Real pi = 3.14159265358979323846;
31 }
32 
39 struct PhysConst
40 {
41  amrex::Real c;
42  amrex::Real ep0;
43  amrex::Real mu0;
44  amrex::Real q_e;
45  amrex::Real m_e;
46  amrex::Real m_p;
47 };
48 
56 {
57  PhysConst const constants = {
58  /* c */ PhysConstSI::c,
59  /* ep0 */ PhysConstSI::ep0,
60  /* mu0 */ PhysConstSI::mu0,
61  /* q_e */ PhysConstSI::q_e,
62  /* m_e */ PhysConstSI::m_e,
63  /* m_p */ PhysConstSI::m_p
64  };
65  return constants;
66 }
67 
71 {
72  PhysConst const constants = {
73  /* c */ 1.,
74  /* ep0 */ 1.,
75  /* mu0 */ 1.,
76  /* q_e */ 1.,
77  /* m_e */ 1.,
78  /* m_p */ 1836.15267343
79  };
80  return constants;
81 }
84 #endif
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE PhysConst make_constants_SI()
SI Physical constants.
Definition: Constants.H:55
PhysConst get_phys_const()
Return the PhysConst object, which is a member of class Hipace.
Definition: Constants.cpp:11
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE PhysConst make_constants_normalized()
Physical constants in normalized units.
Definition: Constants.H:70
Namespace containing math constants.
Definition: Constants.H:29
static constexpr amrex::Real pi
Definition: Constants.H:30
Definition: Constants.H:16
static constexpr auto m_p
Definition: Constants.H:22
static constexpr auto r_e
Definition: Constants.H:24
static constexpr auto mu0
Definition: Constants.H:19
static constexpr auto q_e
Definition: Constants.H:20
static constexpr auto hbar
Definition: Constants.H:23
static constexpr auto m_e
Definition: Constants.H:21
static constexpr auto c
Definition: Constants.H:17
static constexpr auto ep0
Definition: Constants.H:18
Struct containing physical constants, our main strategy to handle both SI and normalized units.
Definition: Constants.H:40
amrex::Real c
Definition: Constants.H:41
amrex::Real mu0
Definition: Constants.H:43
amrex::Real q_e
Definition: Constants.H:44
amrex::Real m_p
Definition: Constants.H:46
amrex::Real ep0
Definition: Constants.H:42
amrex::Real m_e
Definition: Constants.H:45