diff options
Diffstat (limited to '')
-rw-r--r-- | Source/BoundaryConditions/PML.H | 1 | ||||
-rw-r--r-- | Source/BoundaryConditions/PML.cpp | 13 | ||||
-rw-r--r-- | Source/BoundaryConditions/WarpXEvolvePML.cpp | 38 | ||||
-rw-r--r-- | Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp | 39 | ||||
-rw-r--r-- | Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp | 29 | ||||
-rw-r--r-- | Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H | 3 | ||||
-rw-r--r-- | Source/FieldSolver/WarpXPushFieldsEM.cpp | 4 | ||||
-rw-r--r-- | Source/Initialization/WarpXInitData.cpp | 2 |
8 files changed, 26 insertions, 103 deletions
diff --git a/Source/BoundaryConditions/PML.H b/Source/BoundaryConditions/PML.H index 7624bdba0..1529db387 100644 --- a/Source/BoundaryConditions/PML.H +++ b/Source/BoundaryConditions/PML.H @@ -216,7 +216,6 @@ private: std::array<std::unique_ptr<amrex::MultiFab>,3> pml_j_fp; std::array<std::unique_ptr<amrex::MultiFab>,3> pml_edge_lengths; - std::array<std::unique_ptr<amrex::MultiFab>,3> pml_face_areas; std::array<std::unique_ptr<amrex::MultiFab>,3> pml_E_cp; std::array<std::unique_ptr<amrex::MultiFab>,3> pml_B_cp; diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index 6be5dbc1b..1241c864e 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -681,12 +681,6 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri WarpX::GetInstance().getEfield_fp(0,1).ixType().toIntVect() ), dm, WarpX::ncomps, max_guard_EB ); pml_edge_lengths[2] = std::make_unique<MultiFab>(amrex::convert( ba, WarpX::GetInstance().getEfield_fp(0,2).ixType().toIntVect() ), dm, WarpX::ncomps, max_guard_EB ); - pml_face_areas[0] = std::make_unique<MultiFab>(amrex::convert( ba, - WarpX::GetInstance().getBfield_fp(0,0).ixType().toIntVect() ), dm, WarpX::ncomps, max_guard_EB ); - pml_face_areas[1] = std::make_unique<MultiFab>(amrex::convert( ba, - WarpX::GetInstance().getBfield_fp(0,1).ixType().toIntVect() ), dm, WarpX::ncomps, max_guard_EB ); - pml_face_areas[2] = std::make_unique<MultiFab>(amrex::convert( ba, - WarpX::GetInstance().getBfield_fp(0,2).ixType().toIntVect() ), dm, WarpX::ncomps, max_guard_EB ); if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::Yee || WarpX::maxwell_solver_id == MaxwellSolverAlgo::CKC || @@ -695,10 +689,8 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri auto const eb_fact = fieldEBFactory(); WarpX::ComputeEdgeLengths(pml_edge_lengths, eb_fact); - WarpX::ComputeFaceAreas(pml_face_areas, eb_fact); std::array<amrex::Real,3> cellsize = {AMREX_D_DECL(geom->CellSize()[0],geom->CellSize()[1],geom->CellSize()[2])}; WarpX::ScaleEdges(pml_edge_lengths, cellsize); - WarpX::ScaleAreas(pml_face_areas, cellsize); } #endif @@ -1056,11 +1048,6 @@ PML::Get_edge_lengths() return {pml_edge_lengths[0].get(), pml_edge_lengths[1].get(), pml_edge_lengths[2].get()}; } -std::array<MultiFab*,3> -PML::Get_face_areas() -{ - return {pml_face_areas[0].get(), pml_face_areas[1].get(), pml_face_areas[2].get()}; -} MultiFab* PML::GetF_fp () diff --git a/Source/BoundaryConditions/WarpXEvolvePML.cpp b/Source/BoundaryConditions/WarpXEvolvePML.cpp index fce75d21e..55f1b8d41 100644 --- a/Source/BoundaryConditions/WarpXEvolvePML.cpp +++ b/Source/BoundaryConditions/WarpXEvolvePML.cpp @@ -70,11 +70,6 @@ WarpX::DampPML (int lev, PatchType patch_type) const auto& sigba = (patch_type == PatchType::fine) ? pml[lev]->GetMultiSigmaBox_fp() : pml[lev]->GetMultiSigmaBox_cp(); -#ifdef AMREX_USE_EB - const auto& pml_edge_lenghts = pml[lev]->Get_edge_lengths(); - const auto& pml_face_areas = pml[lev]->Get_face_areas(); -#endif - const amrex::IntVect Ex_stag = pml_E[0]->ixType().toIntVect(); const amrex::IntVect Ey_stag = pml_E[1]->ixType().toIntVect(); const amrex::IntVect Ez_stag = pml_E[2]->ixType().toIntVect(); @@ -112,15 +107,6 @@ WarpX::DampPML (int lev, PatchType patch_type) auto const& pml_Byfab = pml_B[1]->array(mfi); auto const& pml_Bzfab = pml_B[2]->array(mfi); -#ifdef AMREX_USE_EB - auto const& pml_lxfab = pml_edge_lenghts[0]->array(mfi); - auto const& pml_lyfab = pml_edge_lenghts[1]->array(mfi); - auto const& pml_lzfab = pml_edge_lenghts[2]->array(mfi); - auto const& pml_Sxfab = pml_face_areas[0]->array(mfi); - auto const& pml_Syfab = pml_face_areas[1]->array(mfi); - auto const& pml_Szfab = pml_face_areas[2]->array(mfi); -#endif - amrex::Real const * AMREX_RESTRICT sigma_fac_x = sigba[mfi].sigma_fac[0].data(); #if defined(WARPX_DIM_3D) amrex::Real const * AMREX_RESTRICT sigma_fac_y = sigba[mfi].sigma_fac[1].data(); @@ -148,25 +134,19 @@ WarpX::DampPML (int lev, PatchType patch_type) amrex::ParallelFor(tex, tey, tez, [=] AMREX_GPU_DEVICE (int i, int j, int k) { -#ifdef AMREX_USE_EB - if(pml_lxfab(i, j, k) <= 0) return; -#endif + warpx_damp_pml_ex(i, j, k, pml_Exfab, Ex_stag, sigma_fac_x, sigma_fac_y, sigma_fac_z, sigma_star_fac_x, sigma_star_fac_y, sigma_star_fac_z, x_lo, y_lo, z_lo, dive_cleaning); }, [=] AMREX_GPU_DEVICE (int i, int j, int k) { -#ifdef AMREX_USE_EB - if(pml_lyfab(i, j, k) <= 0) return; -#endif + warpx_damp_pml_ey(i, j, k, pml_Eyfab, Ey_stag, sigma_fac_x, sigma_fac_y, sigma_fac_z, sigma_star_fac_x, sigma_star_fac_y, sigma_star_fac_z, x_lo, y_lo, z_lo, dive_cleaning); }, [=] AMREX_GPU_DEVICE (int i, int j, int k) { -#ifdef AMREX_USE_EB - if(pml_lzfab(i, j, k) <= 0) return; -#endif + warpx_damp_pml_ez(i, j, k, pml_Ezfab, Ez_stag, sigma_fac_x, sigma_fac_y, sigma_fac_z, sigma_star_fac_x, sigma_star_fac_y, sigma_star_fac_z, x_lo, y_lo, z_lo, dive_cleaning); @@ -174,25 +154,19 @@ WarpX::DampPML (int lev, PatchType patch_type) amrex::ParallelFor(tbx, tby, tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) { -#ifdef AMREX_USE_EB - if(pml_Sxfab(i, j, k) <= 0) return; -#endif + warpx_damp_pml_bx(i, j, k, pml_Bxfab, Bx_stag, sigma_fac_x, sigma_fac_y, sigma_fac_z, sigma_star_fac_x, sigma_star_fac_y, sigma_star_fac_z, x_lo, y_lo, z_lo, divb_cleaning); }, [=] AMREX_GPU_DEVICE (int i, int j, int k) { -#ifdef AMREX_USE_EB - if(pml_Syfab(i, j, k) <= 0) return; -#endif + warpx_damp_pml_by(i, j, k, pml_Byfab, By_stag, sigma_fac_x, sigma_fac_y, sigma_fac_z, sigma_star_fac_x, sigma_star_fac_y, sigma_star_fac_z, x_lo, y_lo, z_lo, divb_cleaning); }, [=] AMREX_GPU_DEVICE (int i, int j, int k) { -#ifdef AMREX_USE_EB - if(pml_Szfab(i, j, k) <= 0) return; -#endif + warpx_damp_pml_bz(i, j, k, pml_Bzfab, Bz_stag, sigma_fac_x, sigma_fac_y, sigma_fac_z, sigma_star_fac_x, sigma_star_fac_y, sigma_star_fac_z, x_lo, y_lo, z_lo, divb_cleaning); 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); + } ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp index f2eb555e1..5b182812a 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp @@ -42,27 +42,26 @@ using namespace amrex; void FiniteDifferenceSolver::EvolveBPML ( std::array< amrex::MultiFab*, 3 > Bfield, std::array< amrex::MultiFab*, 3 > const Efield, - std::array< amrex::MultiFab*, 3 > const face_areas, amrex::Real const dt, const bool dive_cleaning) { // Select algorithm (The choice of algorithm is a runtime option, // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ - amrex::ignore_unused(Bfield, Efield, dt, dive_cleaning, face_areas); + amrex::ignore_unused(Bfield, Efield, dt, dive_cleaning); amrex::Abort("PML are not implemented in cylindrical geometry."); #else if (m_do_nodal) { - EvolveBPMLCartesian <CartesianNodalAlgorithm> (Bfield, Efield, face_areas, dt, dive_cleaning); + EvolveBPMLCartesian <CartesianNodalAlgorithm> (Bfield, Efield, dt, dive_cleaning); } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee || m_fdtd_algo == MaxwellSolverAlgo::ECT) { - EvolveBPMLCartesian <CartesianYeeAlgorithm> (Bfield, Efield, face_areas, dt, dive_cleaning); + EvolveBPMLCartesian <CartesianYeeAlgorithm> (Bfield, Efield, dt, dive_cleaning); } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { - EvolveBPMLCartesian <CartesianCKCAlgorithm> (Bfield, Efield, face_areas, dt, dive_cleaning); + EvolveBPMLCartesian <CartesianCKCAlgorithm> (Bfield, Efield, dt, dive_cleaning); } else { amrex::Abort("EvolveBPML: Unknown algorithm"); @@ -77,7 +76,6 @@ template<typename T_Algo> void FiniteDifferenceSolver::EvolveBPMLCartesian ( std::array< amrex::MultiFab*, 3 > Bfield, std::array< amrex::MultiFab*, 3 > const Efield, - std::array< amrex::MultiFab*, 3 > const face_areas, amrex::Real const dt, const bool dive_cleaning) { @@ -95,12 +93,6 @@ void FiniteDifferenceSolver::EvolveBPMLCartesian ( Array4<Real> const& Ey = Efield[1]->array(mfi); Array4<Real> const& Ez = Efield[2]->array(mfi); -#ifdef AMREX_USE_EB - Array4<Real> const& Sx = face_areas[0]->array(mfi); - Array4<Real> const& Sy = face_areas[1]->array(mfi); - Array4<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(); @@ -118,9 +110,6 @@ void FiniteDifferenceSolver::EvolveBPMLCartesian ( amrex::ParallelFor(tbx, tby, tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k){ -#ifdef AMREX_USE_EB - if(Sx(i, j, k) <= 0) return; -#endif amrex::Real UpwardDz_Ey_yy = 0._rt; amrex::Real UpwardDy_Ez_zz = 0._rt; @@ -142,9 +131,6 @@ void FiniteDifferenceSolver::EvolveBPMLCartesian ( }, [=] AMREX_GPU_DEVICE (int i, int j, int k){ -#ifdef AMREX_USE_EB - if(Sy(i, j, k) <= 0) return; -#endif amrex::Real UpwardDx_Ez_zz = 0._rt; amrex::Real UpwardDz_Ex_xx = 0._rt; @@ -166,9 +152,6 @@ void FiniteDifferenceSolver::EvolveBPMLCartesian ( }, [=] AMREX_GPU_DEVICE (int i, int j, int k){ -#ifdef AMREX_USE_EB - if(Sz(i, j, k) <= 0) return; -#endif amrex::Real UpwardDy_Ex_xx = 0._rt; amrex::Real UpwardDx_Ey_yy = 0._rt; @@ -193,10 +176,6 @@ void FiniteDifferenceSolver::EvolveBPMLCartesian ( } -#ifndef AMREX_USE_EB - amrex::ignore_unused(face_areas); -#endif - } #endif // corresponds to ifndef WARPX_DIM_RZ diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H index f1f9b4837..178f81e8c 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H @@ -107,7 +107,6 @@ class FiniteDifferenceSolver void EvolveBPML ( std::array< amrex::MultiFab*, 3 > Bfield, std::array< amrex::MultiFab*, 3 > const Efield, - std::array< amrex::MultiFab*, 3 > const face_areas, amrex::Real const dt, const bool dive_cleaning); @@ -184,7 +183,6 @@ class FiniteDifferenceSolver 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 ); template< typename T_Algo > @@ -244,7 +242,6 @@ class FiniteDifferenceSolver void EvolveBPMLCartesian ( std::array< amrex::MultiFab*, 3 > Bfield, std::array< amrex::MultiFab*, 3 > const Efield, - std::array< amrex::MultiFab*, 3 > const face_areas, amrex::Real const dt, const bool dive_cleaning); diff --git a/Source/FieldSolver/WarpXPushFieldsEM.cpp b/Source/FieldSolver/WarpXPushFieldsEM.cpp index a096401bc..555d39049 100644 --- a/Source/FieldSolver/WarpXPushFieldsEM.cpp +++ b/Source/FieldSolver/WarpXPushFieldsEM.cpp @@ -481,10 +481,10 @@ WarpX::EvolveB (int lev, PatchType patch_type, amrex::Real a_dt, DtType a_dt_typ if (do_pml && pml[lev]->ok()) { if (patch_type == PatchType::fine) { m_fdtd_solver_fp[lev]->EvolveBPML( - pml[lev]->GetB_fp(), pml[lev]->GetE_fp(), pml[lev]->Get_face_areas(), a_dt, WarpX::do_dive_cleaning); + pml[lev]->GetB_fp(), pml[lev]->GetE_fp(), a_dt, WarpX::do_dive_cleaning); } else { m_fdtd_solver_cp[lev]->EvolveBPML( - pml[lev]->GetB_cp(), pml[lev]->GetE_cp(), pml[lev]->Get_face_areas(), a_dt, WarpX::do_dive_cleaning); + pml[lev]->GetB_cp(), pml[lev]->GetE_cp(), a_dt, WarpX::do_dive_cleaning); } } diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index be810d21e..95efa48aa 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -888,8 +888,8 @@ void WarpX::InitializeEBGridData (int lev) auto const eb_fact = fieldEBFactory(lev); ComputeEdgeLengths(m_edge_lengths[lev], eb_fact); - ComputeFaceAreas(m_face_areas[lev], eb_fact); ScaleEdges(m_edge_lengths[lev], CellSize(lev)); + ComputeFaceAreas(m_face_areas[lev], eb_fact); ScaleAreas(m_face_areas[lev], CellSize(lev)); if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { |