aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp
diff options
context:
space:
mode:
authorGravatar Lorenzo Giacomel <47607756+lgiacome@users.noreply.github.com> 2022-01-13 20:05:19 +0100
committerGravatar GitHub <noreply@github.com> 2022-01-13 11:05:19 -0800
commitca67ae0700d1f56e7921da9283d42184149cb15b (patch)
tree6ee96802136c95bf7fbbbebbf19a871516ea697a /Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp
parent726a9d85b951cf26f936ef0dd600a342657f4106 (diff)
downloadWarpX-ca67ae0700d1f56e7921da9283d42184149cb15b.tar.gz
WarpX-ca67ae0700d1f56e7921da9283d42184149cb15b.tar.zst
WarpX-ca67ae0700d1f56e7921da9283d42184149cb15b.zip
Fixing staircased EM solver (#2739)
* Fixing the staircase consistency * Removed the face_areas multifabs everywhere they're not needed * Bug fix * More fixes * Another fix * Another fix * Initialize areas anyways for the initialization * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: lgiacome <lorenzo.giacome@cern.ch> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp')
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp39
1 files changed, 13 insertions, 26 deletions
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp
index bfdb46863..9de1e8f8b 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp
+++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp
@@ -68,17 +68,21 @@ void FiniteDifferenceSolver::EvolveB (
ignore_unused(Gfield, face_areas);
EvolveBCylindrical <CylindricalYeeAlgorithm> ( Bfield, Efield, lev, dt );
#else
+ if(m_do_nodal or m_fdtd_algo != MaxwellSolverAlgo::ECT){
+ amrex::ignore_unused(face_areas);
+ }
+
if (m_do_nodal) {
- EvolveBCartesian <CartesianNodalAlgorithm> ( Bfield, Efield, Gfield, face_areas, lev, dt );
+ EvolveBCartesian <CartesianNodalAlgorithm> ( Bfield, Efield, Gfield, lev, dt );
} else if (m_fdtd_algo == MaxwellSolverAlgo::Yee) {
- EvolveBCartesian <CartesianYeeAlgorithm> ( Bfield, Efield, Gfield, face_areas, lev, dt );
+ EvolveBCartesian <CartesianYeeAlgorithm> ( Bfield, Efield, Gfield, lev, dt );
} else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) {
- EvolveBCartesian <CartesianCKCAlgorithm> ( Bfield, Efield, Gfield, face_areas, lev, dt );
+ EvolveBCartesian <CartesianCKCAlgorithm> ( Bfield, Efield, Gfield, lev, dt );
#ifdef AMREX_USE_EB
} else if (m_fdtd_algo == MaxwellSolverAlgo::ECT) {
@@ -99,13 +103,8 @@ void FiniteDifferenceSolver::EvolveBCartesian (
std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Bfield,
std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield,
std::unique_ptr<amrex::MultiFab> const& Gfield,
- std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& face_areas,
int lev, amrex::Real const dt ) {
-#ifndef AMREX_USE_EB
- amrex::ignore_unused(face_areas);
-#endif
-
amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(lev);
// Loop through the grids, and over the tiles within each grid
@@ -127,12 +126,6 @@ void FiniteDifferenceSolver::EvolveBCartesian (
Array4<Real> const& Ey = Efield[1]->array(mfi);
Array4<Real> const& Ez = Efield[2]->array(mfi);
-#ifdef AMREX_USE_EB
- amrex::Array4<amrex::Real> const& Sx = face_areas[0]->array(mfi);
- amrex::Array4<amrex::Real> const& Sy = face_areas[1]->array(mfi);
- amrex::Array4<amrex::Real> const& Sz = face_areas[2]->array(mfi);
-#endif
-
// Extract stencil coefficients
Real const * const AMREX_RESTRICT coefs_x = m_stencil_coefs_x.dataPtr();
int const n_coefs_x = m_stencil_coefs_x.size();
@@ -150,30 +143,24 @@ void FiniteDifferenceSolver::EvolveBCartesian (
amrex::ParallelFor(tbx, tby, tbz,
[=] AMREX_GPU_DEVICE (int i, int j, int k){
-#ifdef AMREX_USE_EB
- // Skip field push if this cell is fully covered by embedded boundaries
- if (Sx(i, j, k) <= 0) return;
-#endif
+
Bx(i, j, k) += dt * T_Algo::UpwardDz(Ey, coefs_z, n_coefs_z, i, j, k)
- dt * T_Algo::UpwardDy(Ez, coefs_y, n_coefs_y, i, j, k);
+
},
[=] AMREX_GPU_DEVICE (int i, int j, int k){
-#ifdef AMREX_USE_EB
- // Skip field push if this cell is fully covered by embedded boundaries
- if (Sy(i, j, k) <= 0) return;
-#endif
+
By(i, j, k) += dt * T_Algo::UpwardDx(Ez, coefs_x, n_coefs_x, i, j, k)
- dt * T_Algo::UpwardDz(Ex, coefs_z, n_coefs_z, i, j, k);
+
},
[=] AMREX_GPU_DEVICE (int i, int j, int k){
-#ifdef AMREX_USE_EB
- // Skip field push if this cell is fully covered by embedded boundaries
- if (Sz(i, j, k) <= 0) return;
-#endif
+
Bz(i, j, k) += dt * T_Algo::UpwardDy(Ex, coefs_y, n_coefs_y, i, j, k)
- dt * T_Algo::UpwardDx(Ey, coefs_x, n_coefs_x, i, j, k);
+
}
);