diff options
author | 2020-01-13 08:46:38 -0800 | |
---|---|---|
committer | 2020-01-13 11:44:06 -0800 | |
commit | c55c6188ea2dafdc72764fabb35f01d0431f12ce (patch) | |
tree | a475bb3c782cdd503ac927784ebefcfb491871d9 /Source/FieldSolver/FiniteDifferenceSolver | |
parent | 6166de191d0a2b468ea56bacec481e1ff27fcae1 (diff) | |
download | WarpX-c55c6188ea2dafdc72764fabb35f01d0431f12ce.tar.gz WarpX-c55c6188ea2dafdc72764fabb35f01d0431f12ce.tar.zst WarpX-c55c6188ea2dafdc72764fabb35f01d0431f12ce.zip |
Correct compilation errors
Diffstat (limited to 'Source/FieldSolver/FiniteDifferenceSolver')
-rw-r--r-- | Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp | 21 | ||||
-rw-r--r-- | Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H | 52 |
2 files changed, 45 insertions, 28 deletions
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp index a70548817..9252237bd 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp @@ -40,30 +40,33 @@ void FiniteDifferenceSolver::EvolveBwithAlgo ( VectorField& Bfield, // Extract stencil coefficients Real const* AMREX_RESTRICT coefs_x = stencil_coefs_x.dataPtr(); + int const n_coefs_x = stencil_coefs_x.size(); Real const* AMREX_RESTRICT coefs_y = stencil_coefs_y.dataPtr(); + int const n_coefs_y = stencil_coefs_y.size(); Real const* AMREX_RESTRICT coefs_z = stencil_coefs_z.dataPtr(); + int const n_coefs_z = stencil_coefs_z.size(); // Extract tileboxes for which to loop - const Box& tbx = mfi.tilebox(Bx_nodal_flag); - const Box& tby = mfi.tilebox(By_nodal_flag); - const Box& tbz = mfi.tilebox(Bz_nodal_flag); + const Box& tbx = mfi.tilebox(Bfield[0]->ixType().ixType()); + const Box& tby = mfi.tilebox(Bfield[1]->ixType().ixType()); + const Box& tbz = mfi.tilebox(Bfield[2]->ixType().ixType()); // Loop over the cells and update the fields amrex::ParallelFor(tbx, tby, tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k){ - Bx(i, j, k) += dt * algo::UpwardDz(Ey, i, j, k, coefs_z) - - dt * algo::UpwardDy(Ez, i, j, k, coefs_y); + Bx(i, j, k) += dt * algo::UpwardDz(Ey, coefs_z, n_coefs_z, i, j, k) + - dt * algo::UpwardDy(Ez, coefs_y, n_coefs_y, i, j, k); }, [=] AMREX_GPU_DEVICE (int i, int j, int k){ - By(i, j, k) += dt * algo::UpwardDx(Ez, i, j, k, coefs_x) - - dt * algo::UpwardDz(Ex, i, j, k, coefs_z); + By(i, j, k) += dt * algo::UpwardDx(Ez, coefs_x, n_coefs_x, i, j, k) + - dt * algo::UpwardDz(Ex, coefs_z, n_coefs_z, i, j, k); }, [=] AMREX_GPU_DEVICE (int i, int j, int k){ - Bz(i, j, k) += dt * algo::UpwardDy(Ex, i, j, k, coefs_y) - - dt * algo::UpwardDx(Ey, i, j, k, coefs_x); + Bz(i, j, k) += dt * algo::UpwardDy(Ex, coefs_y, n_coefs_y, i, j, k) + - dt * algo::UpwardDx(Ey, coefs_x, n_coefs_x, i, j, k); } ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H index 7e32aebb4..54057091d 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H @@ -8,10 +8,10 @@ struct YeeAlgorithm { static void InitializeStencilCoefficients( - std::array<amrex::Real,3> cell_size, - amrex::Gpu::ManagedVector<amrex::Real> stencil_coefs_x, - amrex::Gpu::ManagedVector<amrex::Real> stencil_coefs_y, - amrex::Gpu::ManagedVector<amrex::Real> stencil_coefs_z ) { + std::array<amrex::Real,3>& cell_size, + amrex::Gpu::ManagedVector<amrex::Real>& stencil_coefs_x, + amrex::Gpu::ManagedVector<amrex::Real>& stencil_coefs_y, + amrex::Gpu::ManagedVector<amrex::Real>& stencil_coefs_z ) { // Store the inverse cell size along each direction in the coefficients stencil_coefs_x.resize(1); @@ -24,9 +24,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDx( - amrex::Array4<amrex::Real> const F, - int const i, int const j, int const k, - amrex::Real const* coefs_x, int const n_coefs_x ) { + amrex::Array4<amrex::Real> const& F, + amrex::Real const* coefs_x, int const n_coefs_x, + int const i, int const j, int const k ) { amrex::Real inv_dx = coefs_x[0]; return inv_dx*( F(i+1,j,k) - F(i,j,k) ); @@ -34,9 +34,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real DownwardDx( - amrex::Array4<amrex::Real> const F, - int const i, int const j, int const k, - amrex::Real const* coefs_x, int const n_coefs_x ) { + amrex::Array4<amrex::Real> const& F, + amrex::Real const* coefs_x, int const n_coefs_x, + int const i, int const j, int const k ) { amrex::Real inv_dx = coefs_x[0]; return inv_dx*( F(i,j,k) - F(i-1,j,k) ); @@ -44,9 +44,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDy( - amrex::Array4<amrex::Real> const F, - int const i, int const j, int const k, - amrex::Real const* coefs_y, int const n_coefs_y ) { + amrex::Array4<amrex::Real> const& F, + amrex::Real const* coefs_y, int const n_coefs_y, + int const i, int const j, int const k ) { #if defined WARPX_DIM_3D amrex::Real inv_dy = coefs_y[0]; @@ -58,9 +58,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real DownwardDy( - amrex::Array4<amrex::Real> const F, - int const i, int const j, int const k, - amrex::Real const* coefs_y, int const n_coefs_y ) { + amrex::Array4<amrex::Real> const& F, + amrex::Real const* coefs_y, int const n_coefs_y, + int const i, int const j, int const k ) { #if defined WARPX_DIM_3D amrex::Real inv_dy = coefs_y[0]; @@ -72,9 +72,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDz( - amrex::Array4<amrex::Real> const F, - int const i, int const j, int const k, - amrex::Real const* coefs_z, int const n_coefs_z ) { + amrex::Array4<amrex::Real> const& F, + amrex::Real const* coefs_z, int const n_coefs_z, + int const i, int const j, int const k ) { amrex::Real inv_dz = coefs_z[0]; #if defined WARPX_DIM_3D @@ -84,6 +84,20 @@ struct YeeAlgorithm { #endif }; + AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::Real DownwardDz( + amrex::Array4<amrex::Real> const& F, + amrex::Real const* coefs_z, int const n_coefs_z, + int const i, int const j, int const k ) { + + amrex::Real 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 + }; + }; #endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_YEE_H_ |