aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms')
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H (renamed from Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CKCAlgorithm.H)8
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H (renamed from Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/NodalAlgorithm.H)40
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H (renamed from Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H)8
3 files changed, 24 insertions, 32 deletions
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CKCAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H
index 40314547a..eb804927c 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CKCAlgorithm.H
+++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H
@@ -5,14 +5,14 @@
* License: BSD-3-Clause-LBNL
*/
-#ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_CKC_H_
-#define WARPX_FINITE_DIFFERENCE_ALGORITHM_CKC_H_
+#ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_CKC_H_
+#define WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_CKC_H_
#include <AMReX_REAL.H>
#include <AMReX_Array4.H>
#include <AMReX_Gpu.H>
-struct CKCAlgorithm {
+struct CartesianCKCAlgorithm {
static void InitializeStencilCoefficients (
std::array<amrex::Real,3>& cell_size,
@@ -208,4 +208,4 @@ struct CKCAlgorithm {
};
-#endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_CKC_H_
+#endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_CKC_H_
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/NodalAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H
index 9b8e094e9..ed75dedc1 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/NodalAlgorithm.H
+++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H
@@ -5,14 +5,14 @@
* License: BSD-3-Clause-LBNL
*/
-#ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_NODAL_H_
-#define WARPX_FINITE_DIFFERENCE_ALGORITHM_NODAL_H_
+#ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_NODAL_H_
+#define WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_NODAL_H_
#include <AMReX_REAL.H>
#include <AMReX_Array4.H>
#include <AMReX_Gpu.H>
-struct NodalAlgorithm {
+struct CartesianNodalAlgorithm {
static void InitializeStencilCoefficients (
std::array<amrex::Real,3>& cell_size,
@@ -32,7 +32,7 @@ struct NodalAlgorithm {
/**
/* Perform derivative along x
/* (For a solver on a staggered grid, `UpwardDx` and `DownwardDx` take into
- /* account the staggering; but for `NodalAlgorithm`, they are equivalent) */
+ /* account the staggering; but for `CartesianNodalAlgorithm`, they are equivalent) */
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static amrex::Real UpwardDx (
amrex::Array4<amrex::Real> const& F,
@@ -46,21 +46,21 @@ struct NodalAlgorithm {
/**
/* Perform derivative along x
/* (For a solver on a staggered grid, `UpwardDx` and `DownwardDx` take into
- /* account the staggering; but for `NodalAlgorithm`, they are equivalent) */
+ /* account the staggering; but for `CartesianNodalAlgorithm`, they are equivalent) */
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static 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 ) {
- amrex::Real const inv_dx = coefs_x[0];
- return 0.5*inv_dx*( F(i+1,j,k) - F(i-1,j,k) );
+ return UpwardDx( F, coefs_x, n_coefs_x, i, j, k );
+ // For CartesianNodalAlgorithm, UpwardDx and DownwardDx are equivalent
};
/**
/* Perform derivative along y
/* (For a solver on a staggered grid, `UpwardDy` and `DownwardDy` take into
- /* account the staggering; but for `NodalAlgorithm`, they are equivalent) */
+ /* account the staggering; but for `CartesianNodalAlgorithm`, they are equivalent) */
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static amrex::Real UpwardDy (
amrex::Array4<amrex::Real> const& F,
@@ -78,25 +78,21 @@ struct NodalAlgorithm {
/**
/* Perform derivative along y
/* (For a solver on a staggered grid, `UpwardDy` and `DownwardDy` take into
- /* account the staggering; but for `NodalAlgorithm`, they are equivalent) */
+ /* account the staggering; but for `CartesianNodalAlgorithm`, they are equivalent) */
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static 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 ) {
-#if defined WARPX_DIM_3D
- amrex::Real const inv_dy = coefs_y[0];
- return 0.5*inv_dy*( F(i,j+1,k) - F(i,j-1,k) );
-#elif (defined WARPX_DIM_XZ)
- return 0; // 2D Cartesian: derivative along y is 0
-#endif
+ return UpwardDy( F, coefs_y, n_coefs_y, i, j, k );
+ // For CartesianNodalAlgorithm, UpwardDy and DownwardDy are equivalent
};
/**
/* Perform derivative along z
/* (For a solver on a staggered grid, `UpwardDz` and `DownwardDz` take into
- /* account the staggering; but for `NodalAlgorithm`, they are equivalent) */
+ /* account the staggering; but for `CartesianNodalAlgorithm`, they are equivalent) */
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static amrex::Real UpwardDz (
amrex::Array4<amrex::Real> const& F,
@@ -114,21 +110,17 @@ struct NodalAlgorithm {
/**
/* Perform derivative along z
/* (For a solver on a staggered grid, `UpwardDz` and `DownwardDz` take into
- /* account the staggering; but for `NodalAlgorithm`, they are equivalent) */
+ /* account the staggering; but for `CartesianNodalAlgorithm`, they are equivalent) */
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
static 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 ) {
- amrex::Real const inv_dz = coefs_z[0];
-#if defined WARPX_DIM_3D
- return 0.5*inv_dz*( F(i,j,k+1) - F(i,j,k-1) );
-#elif (defined WARPX_DIM_XZ)
- return 0.5*inv_dz*( F(i,j+1,k) - F(i,j-1,k) );
-#endif
+ return UpwardDz( F, coefs_z, n_coefs_z, i, j, k );
+ // For CartesianNodalAlgorithm, UpwardDz and DownwardDz are equivalent
};
};
-#endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_NODAL_H_
+#endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_NODAL_H_
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H
index a68a81fa0..838e3b0bb 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H
+++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H
@@ -5,14 +5,14 @@
* License: BSD-3-Clause-LBNL
*/
-#ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_YEE_H_
-#define WARPX_FINITE_DIFFERENCE_ALGORITHM_YEE_H_
+#ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_YEE_H_
+#define WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_YEE_H_
#include <AMReX_REAL.H>
#include <AMReX_Array4.H>
#include <AMReX_Gpu.H>
-struct YeeAlgorithm {
+struct CartesianYeeAlgorithm {
static void InitializeStencilCoefficients (
std::array<amrex::Real,3>& cell_size,
@@ -119,4 +119,4 @@ struct YeeAlgorithm {
};
-#endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_YEE_H_
+#endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_CARTESIAN_YEE_H_