8 #ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_CYLINDRICAL_YEE_H_ 9 #define WARPX_FINITE_DIFFERENCE_ALGORITHM_CYLINDRICAL_YEE_H_ 13 #include <AMReX_REAL.H> 14 #include <AMReX_Array4.H> 15 #include <AMReX_Gpu.H> 30 amrex::Vector<amrex::Real>& stencil_coefs_r,
31 amrex::Vector<amrex::Real>& stencil_coefs_z ) {
33 using namespace amrex;
35 stencil_coefs_r.resize(1);
36 stencil_coefs_r[0] = 1._rt/cell_size[0];
37 stencil_coefs_z.resize(1);
38 stencil_coefs_z[0] = 1._rt/cell_size[2];
47 int const n_rz_azimuthal_modes ) {
52 std::array< amrex::Real, 6 >
const multimode_coeffs = {{ 0.2105, 1.0, 3.5234, 8.5104, 15.5059, 24.5037 }};
53 amrex::Real multimode_alpha;
54 if (n_rz_azimuthal_modes < 7) {
56 multimode_alpha = multimode_coeffs[n_rz_azimuthal_modes-1];
59 multimode_alpha = (n_rz_azimuthal_modes - 1._rt)*(n_rz_azimuthal_modes - 1._rt) - 0.4_rt;
61 amrex::Real delta_t = 1._rt / ( std::sqrt(
62 (1._rt + multimode_alpha) / (dx[0]*dx[0])
63 + 1._rt / (dx[1]*dx[1])
72 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
74 amrex::Array4<amrex::Real>
const& F,
75 amrex::Real
const r, amrex::Real
const dr,
76 amrex::Real
const *
const coefs_r,
int const n_coefs_r,
77 int const i,
int const j,
int const k,
int const comp ) {
79 using namespace amrex;
80 ignore_unused(n_coefs_r);
82 Real
const inv_dr = coefs_r[0];
83 return 1._rt/r * inv_dr*( (r+0.5_rt*dr)*F(i+1,j,k,comp) - (r-0.5_rt*dr)*F(i,j,k,comp) );
90 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
92 amrex::Array4<amrex::Real>
const& F,
93 amrex::Real
const r, amrex::Real
const dr,
94 amrex::Real
const *
const coefs_r,
int const n_coefs_r,
95 int const i,
int const j,
int const k,
int const comp ) {
97 using namespace amrex;
98 ignore_unused(n_coefs_r);
100 Real
const inv_dr = coefs_r[0];
101 return 1._rt/r * inv_dr*( (r+0.5_rt*dr)*F(i,j,k,comp) - (r-0.5_rt*dr)*F(i-1,j,k,comp) );
106 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
108 amrex::Array4<amrex::Real>
const& F,
109 amrex::Real
const *
const coefs_r,
int const n_coefs_r,
110 int const i,
int const j,
int const k,
int const comp ) {
112 using namespace amrex;
113 ignore_unused(n_coefs_r);
115 Real
const inv_dr = coefs_r[0];
116 return inv_dr*( F(i+1,j,k,comp) - F(i,j,k,comp) );
121 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
123 amrex::Array4<amrex::Real>
const& F,
124 amrex::Real
const *
const coefs_r,
int const n_coefs_r,
125 int const i,
int const j,
int const k,
int const comp ) {
127 using namespace amrex;
128 ignore_unused(n_coefs_r);
130 Real
const inv_dr = coefs_r[0];
131 return inv_dr*( F(i,j,k,comp) - F(i-1,j,k,comp) );
136 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
138 amrex::Array4<amrex::Real>
const& F,
139 amrex::Real
const *
const coefs_z,
int const n_coefs_z,
140 int const i,
int const j,
int const k,
int const comp ) {
142 amrex::ignore_unused(n_coefs_z);
144 amrex::Real
const inv_dz = coefs_z[0];
145 return inv_dz*( F(i,j+1,k,comp) - F(i,j,k,comp) );
150 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
152 amrex::Array4<amrex::Real>
const& F,
153 amrex::Real
const *
const coefs_z,
int const n_coefs_z,
154 int const i,
int const j,
int const k,
int const comp ) {
156 amrex::ignore_unused(n_coefs_z);
158 amrex::Real
const inv_dz = coefs_z[0];
159 return inv_dz*( F(i,j,k,comp) - F(i,j-1,k,comp) );
164 #endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_CYLINDRICAL_YEE_H_ AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real DownwardDz(amrex::Array4< amrex::Real > const &F, amrex::Real const *const coefs_z, int const n_coefs_z, int const i, int const j, int const k, int const comp)
Definition: CylindricalYeeAlgorithm.H:151
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real DownwardDr(amrex::Array4< amrex::Real > const &F, amrex::Real const *const coefs_r, int const n_coefs_r, int const i, int const j, int const k, int const comp)
Definition: CylindricalYeeAlgorithm.H:122
int dx
Definition: compute_domain.py:35
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real DownwardDrr_over_r(amrex::Array4< amrex::Real > const &F, amrex::Real const r, amrex::Real const dr, amrex::Real const *const coefs_r, int const n_coefs_r, int const i, int const j, int const k, int const comp)
Definition: CylindricalYeeAlgorithm.H:91
cell_size
Definition: compute_domain.py:37
static amrex::Real ComputeMaxDt(amrex::Real const *const dx, int const n_rz_azimuthal_modes)
Definition: CylindricalYeeAlgorithm.H:46
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real UpwardDrr_over_r(amrex::Array4< amrex::Real > const &F, amrex::Real const r, amrex::Real const dr, amrex::Real const *const coefs_r, int const n_coefs_r, int const i, int const j, int const k, int const comp)
Definition: CylindricalYeeAlgorithm.H:73
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real UpwardDz(amrex::Array4< amrex::Real > const &F, amrex::Real const *const coefs_z, int const n_coefs_z, int const i, int const j, int const k, int const comp)
Definition: CylindricalYeeAlgorithm.H:137
i
Definition: check_interp_points_and_weights.py:171
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real UpwardDr(amrex::Array4< amrex::Real > const &F, amrex::Real const *const coefs_r, int const n_coefs_r, int const i, int const j, int const k, int const comp)
Definition: CylindricalYeeAlgorithm.H:107
static void InitializeStencilCoefficients(std::array< amrex::Real, 3 > &cell_size, amrex::Vector< amrex::Real > &stencil_coefs_r, amrex::Vector< amrex::Real > &stencil_coefs_z)
Definition: CylindricalYeeAlgorithm.H:28
Definition: CylindricalYeeAlgorithm.H:26