diff options
author | 2020-02-06 09:28:59 -0800 | |
---|---|---|
committer | 2020-02-06 09:31:41 -0800 | |
commit | 95b88ae1ccb05ecc48ab4f93919cd43c7a8def59 (patch) | |
tree | 18a62a675da5a34f15af275dd9aab72f067963fc /Source/FieldSolver/FiniteDifferenceSolver | |
parent | 03b96216ae034bcf64312b8d8346a3f2c98e31b1 (diff) | |
download | WarpX-95b88ae1ccb05ecc48ab4f93919cd43c7a8def59.tar.gz WarpX-95b88ae1ccb05ecc48ab4f93919cd43c7a8def59.tar.zst WarpX-95b88ae1ccb05ecc48ab4f93919cd43c7a8def59.zip |
Explicitly use "Cartesian" in the name of algorithms
Diffstat (limited to 'Source/FieldSolver/FiniteDifferenceSolver')
-rw-r--r-- | Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp | 12 | ||||
-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 | ||||
-rw-r--r-- | Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp | 12 |
5 files changed, 36 insertions, 44 deletions
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp index 6fdd7705e..05a6d9659 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp @@ -10,9 +10,9 @@ #ifdef WARPX_DIM_RZ # include "FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H" #else -# include "FiniteDifferenceAlgorithms/YeeAlgorithm.H" -# include "FiniteDifferenceAlgorithms/CKCAlgorithm.H" -# include "FiniteDifferenceAlgorithms/NodalAlgorithm.H" +# include "FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H" +# include "FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H" +# include "FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H" #endif #include <AMReX_Gpu.H> @@ -36,15 +36,15 @@ void FiniteDifferenceSolver::EvolveB ( #else if (m_do_nodal) { - EvolveBCartesian <NodalAlgorithm> ( Bfield, Efield, dt ); + EvolveBCartesian <CartesianNodalAlgorithm> ( Bfield, Efield, dt ); } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee) { - EvolveBCartesian <YeeAlgorithm> ( Bfield, Efield, dt ); + EvolveBCartesian <CartesianYeeAlgorithm> ( Bfield, Efield, dt ); } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { - EvolveBCartesian <CKCAlgorithm> ( Bfield, Efield, dt ); + EvolveBCartesian <CartesianCKCAlgorithm> ( Bfield, Efield, dt ); #endif } else { 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_ diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp index 6992afad2..9566fcb5d 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp @@ -9,9 +9,9 @@ #ifdef WARPX_DIM_RZ # include "FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H" #else -# include "FiniteDifferenceAlgorithms/YeeAlgorithm.H" -# include "FiniteDifferenceAlgorithms/CKCAlgorithm.H" -# include "FiniteDifferenceAlgorithms/NodalAlgorithm.H" +# include "FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H" +# include "FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H" +# include "FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H" #endif #include "FiniteDifferenceSolver.H" #include "WarpX.H" @@ -45,17 +45,17 @@ FiniteDifferenceSolver::FiniteDifferenceSolver ( #else if (do_nodal) { - NodalAlgorithm::InitializeStencilCoefficients( cell_size, + CartesianNodalAlgorithm::InitializeStencilCoefficients( cell_size, stencil_coefs_x, stencil_coefs_y, stencil_coefs_z ); } else if (fdtd_algo == MaxwellSolverAlgo::Yee) { - YeeAlgorithm::InitializeStencilCoefficients( cell_size, + CartesianYeeAlgorithm::InitializeStencilCoefficients( cell_size, stencil_coefs_x, stencil_coefs_y, stencil_coefs_z ); } else if (fdtd_algo == MaxwellSolverAlgo::CKC) { - CKCAlgorithm::InitializeStencilCoefficients( cell_size, + CartesianCKCAlgorithm::InitializeStencilCoefficients( cell_size, stencil_coefs_x, stencil_coefs_y, stencil_coefs_z ); #endif |