8 #ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_CYLINDRICAL_YEE_H_
9 #define WARPX_FINITE_DIFFERENCE_ALGORITHM_CYLINDRICAL_YEE_H_
33 using namespace amrex;
35 stencil_coefs_r.resize(1);
37 stencil_coefs_z.resize(1);
47 int const n_rz_azimuthal_modes ) {
48 using namespace amrex::literals;
52 std::array< amrex::Real, 6 >
const multimode_coeffs = {{ 0.2105_rt, 1.0_rt, 3.5234_rt, 8.5104_rt, 15.5059_rt, 24.5037_rt }};
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])
83 amrex::Real
const r, amrex::Real
const dr,
84 amrex::Real
const *
const coefs_r,
int const n_coefs_r,
85 int const i,
int const j,
int const k,
int const comp ) {
87 using namespace amrex;
90 Real
const inv_dr = coefs_r[0];
91 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) );
101 amrex::Real
const r, amrex::Real
const dr,
102 amrex::Real
const *
const coefs_r,
int const n_coefs_r,
103 int const i,
int const j,
int const k,
int const comp ) {
105 using namespace amrex;
108 Real
const inv_dr = coefs_r[0];
109 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) );
117 amrex::Real
const *
const coefs_r,
int const n_coefs_r,
118 int const i,
int const j,
int const k,
int const comp ) {
120 using namespace amrex;
123 Real
const inv_dr = coefs_r[0];
124 return inv_dr*(
F(
i+1,j,k,comp) -
F(
i,j,k,comp) );
132 amrex::Real
const *
const coefs_r,
int const n_coefs_r,
133 int const i,
int const j,
int const k,
int const comp ) {
135 using namespace amrex;
138 Real
const inv_dr = coefs_r[0];
139 return inv_dr*(
F(
i,j,k,comp) -
F(
i-1,j,k,comp) );
147 amrex::Real
const *
const coefs_z,
int const n_coefs_z,
148 int const i,
int const j,
int const k,
int const comp ) {
152 amrex::Real
const inv_dz = coefs_z[0];
153 return inv_dz*(
F(
i,j+1,k,comp) -
F(
i,j,k,comp) );
161 amrex::Real
const *
const coefs_z,
int const n_coefs_z,
162 int const i,
int const j,
int const k,
int const comp ) {
166 amrex::Real
const inv_dz = coefs_z[0];
167 return inv_dz*(
F(
i,j,k,comp) -
F(
i,j-1,k,comp) );
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
#define AMREX_D_DECL(a, b, c)
void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition: cnpy.cpp:17
static constexpr auto c
vacuum speed of light [m/s]
Definition: constant.H:44
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
i
Definition: check_interp_points_and_weights.py:174
cell_size
Definition: compute_domain.py:37
int dx
Definition: stencil.py:436
Definition: CylindricalYeeAlgorithm.H:26
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:145
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:115
static amrex::IntVect GetMaxGuardCell()
Returns maximum number of guard cells required by the field-solve.
Definition: CylindricalYeeAlgorithm.H:71
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:130
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:99
static amrex::Real ComputeMaxDt(amrex::Real const *const dx, int const n_rz_azimuthal_modes)
Definition: CylindricalYeeAlgorithm.H:46
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
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:159
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:81