8 #ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_NODAL_H_
9 #define WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_NODAL_H_
34 using namespace amrex;
37 stencil_coefs_x.resize(1);
39 stencil_coefs_y.resize(1);
41 stencil_coefs_z.resize(1);
49 using namespace amrex::literals;
50 amrex::Real
const delta_t = 1._rt / ( std::sqrt(
AMREX_D_TERM(
52 + 1._rt/(
dx[1]*
dx[1]),
73 amrex::Real
const *
const coefs_x,
int const ,
74 int const i,
int const j,
int const k,
int const ncomp=0 ) {
76 using namespace amrex;
77 #if (defined WARPX_DIM_1D_Z)
81 Real
const inv_dx = coefs_x[0];
82 return 0.5_rt*inv_dx*( F(
i+1,j,k,ncomp) - F(
i-1,j,k,ncomp) );
93 amrex::Real
const *
const coefs_x,
int const n_coefs_x,
94 int const i,
int const j,
int const k,
int const ncomp=0 ) {
96 using namespace amrex;
97 #if (defined WARPX_DIM_1D_Z)
101 return UpwardDx( F, coefs_x, n_coefs_x,
i, j, k ,ncomp);
113 amrex::Real
const *
const coefs_y,
int const ,
114 int const i,
int const j,
int const k,
int const ncomp=0 ) {
116 using namespace amrex;
117 #if defined WARPX_DIM_3D
118 Real
const inv_dy = coefs_y[0];
119 return 0.5_rt*inv_dy*( F(
i,j+1,k,ncomp) - F(
i,j-1,k,ncomp) );
120 #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_1D_Z)
133 amrex::Real
const *
const coefs_y,
int const n_coefs_y,
134 int const i,
int const j,
int const k,
int const ncomp=0 ) {
136 return UpwardDy( F, coefs_y, n_coefs_y,
i, j, k ,ncomp);
147 amrex::Real
const *
const coefs_z,
int const ,
148 int const i,
int const j,
int const k,
int const ncomp=0 ) {
150 using namespace amrex;
151 Real
const inv_dz = coefs_z[0];
152 #if defined WARPX_DIM_3D
153 return 0.5_rt*inv_dz*( F(
i,j,k+1,ncomp) - F(
i,j,k-1,ncomp) );
154 #elif (defined WARPX_DIM_XZ)
155 return 0.5_rt*inv_dz*( F(
i,j+1,k,ncomp) - F(
i,j-1,k,ncomp) );
156 #elif (defined WARPX_DIM_1D_Z)
157 return 0.5_rt*inv_dz*( F(
i+1,j,k,ncomp) - F(
i-1,j,k,ncomp) );
168 amrex::Real
const *
const coefs_z,
int const n_coefs_z,
169 int const i,
int const j,
int const k,
int const ncomp=0 ) {
171 return UpwardDz( F, coefs_z, n_coefs_z,
i, j, k ,ncomp);
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
#define AMREX_D_TERM(a, b, c)
#define AMREX_D_DECL(a, b, c)
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
tuple dx
lab frame
Definition: stencil.py:429
Definition: CartesianNodalAlgorithm.H:26
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real DownwardDy(amrex::Array4< amrex::Real > const &F, amrex::Real const *const coefs_y, int const n_coefs_y, int const i, int const j, int const k, int const ncomp=0)
Definition: CartesianNodalAlgorithm.H:131
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real DownwardDx(amrex::Array4< amrex::Real > const &F, amrex::Real const *const coefs_x, int const n_coefs_x, int const i, int const j, int const k, int const ncomp=0)
Definition: CartesianNodalAlgorithm.H:91
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, int const i, int const j, int const k, int const ncomp=0)
Definition: CartesianNodalAlgorithm.H:145
static amrex::Real ComputeMaxDt(amrex::Real const *const dx)
Definition: CartesianNodalAlgorithm.H:48
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 ncomp=0)
Definition: CartesianNodalAlgorithm.H:166
static void InitializeStencilCoefficients(std::array< amrex::Real, 3 > &cell_size, amrex::Vector< amrex::Real > &stencil_coefs_x, amrex::Vector< amrex::Real > &stencil_coefs_y, amrex::Vector< amrex::Real > &stencil_coefs_z)
Definition: CartesianNodalAlgorithm.H:28
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real UpwardDy(amrex::Array4< amrex::Real > const &F, amrex::Real const *const coefs_y, int const, int const i, int const j, int const k, int const ncomp=0)
Definition: CartesianNodalAlgorithm.H:111
static amrex::IntVect GetMaxGuardCell()
Returns maximum number of guard cells required by the field-solve.
Definition: CartesianNodalAlgorithm.H:61
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real UpwardDx(amrex::Array4< amrex::Real > const &F, amrex::Real const *const coefs_x, int const, int const i, int const j, int const k, int const ncomp=0)
Definition: CartesianNodalAlgorithm.H:71