1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/* Copyright 2021 Modern Electron
*
* This file is part of WarpX.
*
* License: BSD-3-Clause-LBNL
*/
#ifndef ELECTROSTATICSOLVER_H_
#define ELECTROSTATICSOLVER_H_
#include "Utils/WarpXUtil.H"
#include <AMReX_Array.H>
#include <AMReX_MLNodeTensorLaplacian.H>
#if defined(AMREX_USE_EB) || defined(WARPX_DIM_RZ)
# include <AMReX_MLEBNodeFDLaplacian.H>
#endif
#include <AMReX_Parser.H>
#include <AMReX_REAL.H>
namespace ElectrostaticSolver {
struct PhiCalculatorEB {
amrex::Real t;
amrex::ParserExecutor<4> potential_eb;
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
amrex::Real operator() (const amrex::Real x, const amrex::Real z) const noexcept
{
return potential_eb(x, 0.0, z, t);
}
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
amrex::Real operator() (const amrex::Real x, const amrex::Real y, const amrex::Real z) const noexcept
{
return potential_eb(x, y, z, t);
}
};
class BoundaryHandler {
public:
amrex::Array<amrex::LinOpBCType,AMREX_SPACEDIM> lobc, hibc;
bool bcs_set = false;
std::array<bool,AMREX_SPACEDIM*2> dirichlet_flag;
bool has_non_periodic = false;
bool phi_EB_only_t = true;
void definePhiBCs ();
void buildParsers ();
PhiCalculatorEB getPhiEB (amrex::Real t) const noexcept
{
return PhiCalculatorEB{t, potential_eb};
}
// set default potentials to zero in order for current tests to pass
// but forcing the user to specify a potential might be better
std::string potential_xlo_str = "0";
std::string potential_xhi_str = "0";
std::string potential_ylo_str = "0";
std::string potential_yhi_str = "0";
std::string potential_zlo_str = "0";
std::string potential_zhi_str = "0";
std::string potential_eb_str = "0";
amrex::ParserExecutor<1> potential_xlo;
amrex::ParserExecutor<1> potential_xhi;
amrex::ParserExecutor<1> potential_ylo;
amrex::ParserExecutor<1> potential_yhi;
amrex::ParserExecutor<1> potential_zlo;
amrex::ParserExecutor<1> potential_zhi;
amrex::ParserExecutor<1> potential_eb_t;
amrex::ParserExecutor<4> potential_eb;
private:
amrex::Parser potential_xlo_parser;
amrex::Parser potential_xhi_parser;
amrex::Parser potential_ylo_parser;
amrex::Parser potential_yhi_parser;
amrex::Parser potential_zlo_parser;
amrex::Parser potential_zhi_parser;
amrex::Parser potential_eb_parser;
};
}
#endif
|