aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2020-01-10 14:11:57 -0800
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2020-01-10 14:11:57 -0800
commitb178920da516e66a21a283c8b794a63b491d24a2 (patch)
tree8d20a64ad808662554c35b74f53c4f1c3df1c6ab /Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H
parent9035ee165054e25aedf98d97f16786d8d5f2965a (diff)
downloadWarpX-b178920da516e66a21a283c8b794a63b491d24a2.tar.gz
WarpX-b178920da516e66a21a283c8b794a63b491d24a2.tar.zst
WarpX-b178920da516e66a21a283c8b794a63b491d24a2.zip
Update Evolve B
Diffstat (limited to 'Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H')
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H22
1 files changed, 17 insertions, 5 deletions
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H
index 7c9572298..6ea2f440d 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H
+++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H
@@ -22,7 +22,7 @@ struct YeeAlgorithm {
Array4 const F, int const i, int const j, int const k,
Real const* coefs_x, int const n_coefs_x ) {
- amrex::Real inv_dx = coefs_x[0];
+ amrex::Real const inv_dx = coefs_x[0];
return inv_dx*( F(i+1,j,k) - F(i,j,k) );
};
@@ -31,7 +31,7 @@ struct YeeAlgorithm {
Array4 const F, int const i, int const j, int const k,
Real const* coefs_x, int const n_coefs_x ) {
- amrex::Real inv_dx = coefs_x[0];
+ amrex::Real const inv_dx = coefs_x[0];
return inv_dx*( F(i,j,k) - F(i-1,j,k) );
};
@@ -41,7 +41,7 @@ struct YeeAlgorithm {
Real const* coefs_y, int const n_coefs_y ) {
#if defined WARPX_DIM_3D
- amrex::Real inv_dy = coefs_y[0];
+ amrex::Real const inv_dy = coefs_y[0];
return inv_dy*( F(i,j+1,k) - F(i,j,k) );
#elif (defined WARPX_DIM_XZ)
return 0; // 2D Cartesian: derivative along y is 0
@@ -54,7 +54,7 @@ struct YeeAlgorithm {
Real const* coefs_y, int const n_coefs_y ) {
#if defined WARPX_DIM_3D
- amrex::Real inv_dy = coefs_y[0];
+ amrex::Real const inv_dy = coefs_y[0];
return inv_dy*( F(i,j,k) - F(i,j-1,k) );
#elif (defined WARPX_DIM_XZ)
return 0; // 2D Cartesian: derivative along y is 0
@@ -66,7 +66,7 @@ struct YeeAlgorithm {
Array4 const F, int const i, int const j, int const k,
Real const* coefs_z, int const n_coefs_z ) {
- amrex::Real inv_dz = coefs_z[0];
+ amrex::Real const inv_dz = coefs_z[0];
#if defined WARPX_DIM_3D
return inv_dz*( F(i,j,k+1) - F(i,j,k) );
#elif (defined WARPX_DIM_XZ)
@@ -74,6 +74,18 @@ struct YeeAlgorithm {
#endif
};
+ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
+ amrex::Real DownwardDz(
+ Array4 const F, int const i, int const j, int const k,
+ Real const* coefs_z, int const n_coefs_z ) {
+
+ amrex::Real const inv_dz = coefs_z[0];
+ #if defined WARPX_DIM_3D
+ return inv_dz*( F(i,j,k) - F(i,j,k-1) );
+ #elif (defined WARPX_DIM_XZ)
+ return inv_dz*( F(i,j,k) - F(i,j-1,k) );
+ #endif
+ };
}