WarpX
MacroscopicProperties.H
Go to the documentation of this file.
1 #ifndef WARPX_MACROSCOPICPROPERTIES_H_
2 #define WARPX_MACROSCOPICPROPERTIES_H_
3 
4 
6 #include "Utils/WarpXConst.H"
7 #include <AMReX_MultiFab.H>
8 
9 
10 
15 class
17 {
18 public:
19  MacroscopicProperties (); // constructor
21  void ReadParameters ();
23  void InitData ();
24 
26  amrex::MultiFab& getsigma_mf () {return (*m_sigma_mf);}
28  amrex::MultiFab& getepsilon_mf () {return (*m_eps_mf);}
30  amrex::MultiFab& getmu_mf () {return (*m_mu_mf);}
31 
35  void InitializeMacroMultiFabUsingParser (amrex::MultiFab *macro_mf,
36  HostDeviceParser<3> const& macro_parser, int lev);
38  amrex::GpuArray<int, 3> sigma_IndexType;
40  amrex::GpuArray<int, 3> epsilon_IndexType;
42  amrex::GpuArray<int, 3> mu_IndexType;
44  amrex::GpuArray<int, 3> Ex_IndexType;
46  amrex::GpuArray<int, 3> Ey_IndexType;
48  amrex::GpuArray<int, 3> Ez_IndexType;
50  amrex::GpuArray<int, 3> macro_cr_ratio;
51 
52 private:
54  amrex::Real m_sigma = 0.0;
56  amrex::Real m_epsilon = PhysConst::ep0;
58  amrex::Real m_mu = PhysConst::mu0;
60  std::unique_ptr<amrex::MultiFab> m_sigma_mf;
62  std::unique_ptr<amrex::MultiFab> m_eps_mf;
64  std::unique_ptr<amrex::MultiFab> m_mu_mf;
66  std::string m_sigma_s = "constant";
68  std::string m_epsilon_s = "constant";
70  std::string m_mu_s = "constant";
71 
73  std::string m_str_sigma_function;
75  std::string m_str_mu_function;
77  std::unique_ptr<ParserWrapper<3> > m_sigma_parser;
78  std::unique_ptr<ParserWrapper<3> > m_epsilon_parser;
79  std::unique_ptr<ParserWrapper<3> > m_mu_parser;
80 };
81 
91 
92  AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
93  static amrex::Real alpha (amrex::Real const sigma,
94  amrex::Real const epsilon,
95  amrex::Real dt) {
96  using namespace amrex;
97  amrex::Real fac1 = 0.5_rt * sigma * dt / epsilon;
98  amrex::Real alpha = (1._rt - fac1)/(1._rt + fac1);
99  return alpha;
100  }
101 
102  AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
103  static amrex::Real beta (amrex::Real const sigma,
104  amrex::Real const epsilon,
105  amrex::Real dt) {
106  using namespace amrex;
107  amrex::Real fac1 = 0.5_rt * sigma * dt / epsilon;
108  amrex::Real beta = dt / ( epsilon * (1._rt + fac1) );
109  return beta;
110  }
111 
112 };
113 
123 
124  AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
125  static amrex::Real alpha (amrex::Real const sigma,
126  amrex::Real const epsilon,
127  amrex::Real dt) {
128  using namespace amrex;
129  amrex::Real fac1 = sigma * dt / epsilon;
130  amrex::Real alpha = (1._rt)/(1._rt + fac1);
131  return alpha;
132  }
133 
134  AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
135  static amrex::Real beta (amrex::Real const sigma,
136  amrex::Real const epsilon,
137  amrex::Real dt) {
138  using namespace amrex;
139  amrex::Real fac1 = sigma * dt / epsilon;
140  amrex::Real beta = dt / ( epsilon * (1._rt + fac1) );
141  return beta;
142  }
143 
144 };
145 
146 #endif // WARPX_MACROSCOPIC_PROPERTIES_H_
amrex::GpuArray< int, 3 > mu_IndexType
Definition: MacroscopicProperties.H:42
This class contains the macroscopic properties of the medium needed to evaluate macroscopic Maxwell e...
Definition: MacroscopicProperties.H:15
std::unique_ptr< amrex::MultiFab > m_mu_mf
Definition: MacroscopicProperties.H:64
amrex::GpuArray< int, 3 > Ex_IndexType
Definition: MacroscopicProperties.H:44
std::unique_ptr< amrex::MultiFab > m_sigma_mf
Definition: MacroscopicProperties.H:60
amrex::GpuArray< int, 3 > sigma_IndexType
Definition: MacroscopicProperties.H:38
This struct contains only static functions to compute the co-efficients for the BackwardEuler scheme ...
Definition: MacroscopicProperties.H:122
std::unique_ptr< amrex::MultiFab > m_eps_mf
Definition: MacroscopicProperties.H:62
This struct contains only static functions to compute the co-efficients for the Lax-Wendroff scheme o...
Definition: MacroscopicProperties.H:90
amrex::GpuArray< int, 3 > macro_cr_ratio
Definition: MacroscopicProperties.H:50
std::unique_ptr< ParserWrapper< 3 > > m_epsilon_parser
Definition: MacroscopicProperties.H:78
amrex::GpuArray< int, 3 > epsilon_IndexType
Definition: MacroscopicProperties.H:40
std::unique_ptr< ParserWrapper< 3 > > m_mu_parser
Definition: MacroscopicProperties.H:79
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real alpha(amrex::Real const sigma, amrex::Real const epsilon, amrex::Real dt)
Definition: MacroscopicProperties.H:125
std::string m_str_mu_function
Definition: MacroscopicProperties.H:75
amrex::MultiFab & getepsilon_mf()
Definition: MacroscopicProperties.H:28
amrex::MultiFab & getmu_mf()
Definition: MacroscopicProperties.H:30
amrex::GpuArray< int, 3 > Ez_IndexType
Definition: MacroscopicProperties.H:48
amrex::MultiFab & getsigma_mf()
Definition: MacroscopicProperties.H:26
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real beta(amrex::Real const sigma, amrex::Real const epsilon, amrex::Real dt)
Definition: MacroscopicProperties.H:135
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real beta(amrex::Real const sigma, amrex::Real const epsilon, amrex::Real dt)
Definition: MacroscopicProperties.H:103
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real alpha(amrex::Real const sigma, amrex::Real const epsilon, amrex::Real dt)
Definition: MacroscopicProperties.H:93
std::string m_str_epsilon_function
Definition: MacroscopicProperties.H:74
std::unique_ptr< ParserWrapper< 3 > > m_sigma_parser
Definition: MacroscopicProperties.H:77
amrex::GpuArray< int, 3 > Ey_IndexType
Definition: MacroscopicProperties.H:46
std::string m_str_sigma_function
Definition: MacroscopicProperties.H:73
Definition: PML.H:52
The HostDeviceParser struct is non-owning and is suitable for being value captured by device lamba...
Definition: WarpXParserWrapper.H:24