Skip to content

Commit

Permalink
Add updates from recent PR, to ProjectionDivCleaner.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgrote committed Aug 30, 2024
1 parent e09de43 commit 9cab923
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Source/Initialization/DivCleaner/ProjectionDivCleaner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include <AMReX_LO_BCTYPES.H>

#include <WarpX.H>
#if defined WARPX_DIM_RZ
#include <FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H>
#if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER)
#include <FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H>
#else
#include <FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H>
#include <FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H>
#endif
#include <FieldSolver/Fields.H>
#include <Initialization/ExternalField.H>
Expand Down Expand Up @@ -71,7 +71,7 @@ ProjectionDivCleaner::ProjectionDivCleaner(warpx::fields::FieldType a_field_type
}

auto cell_size = WarpX::CellSize(0);
#if defined(WARPX_DIM_RZ)
#if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER)
CylindricalYeeAlgorithm::InitializeStencilCoefficients( cell_size,
m_h_stencil_coefs_x, m_h_stencil_coefs_z );
#else
Expand All @@ -80,15 +80,15 @@ ProjectionDivCleaner::ProjectionDivCleaner(warpx::fields::FieldType a_field_type
#endif

m_stencil_coefs_x.resize(m_h_stencil_coefs_x.size());
#if !defined(WARPX_DIM_RZ)
#if !defined(WARPX_DIM_RZ) && !defined(WARPX_DIM_RCYLINDER)
m_stencil_coefs_y.resize(m_h_stencil_coefs_y.size());
#endif
m_stencil_coefs_z.resize(m_h_stencil_coefs_z.size());

amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice,
m_h_stencil_coefs_x.begin(), m_h_stencil_coefs_x.end(),
m_stencil_coefs_x.begin());
#if !defined(WARPX_DIM_RZ)
#if !defined(WARPX_DIM_RZ) && !defined(WARPX_DIM_RCYLINDER)
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice,
m_h_stencil_coefs_y.begin(), m_h_stencil_coefs_y.end(),
m_stencil_coefs_y.begin());
Expand Down Expand Up @@ -163,7 +163,7 @@ ProjectionDivCleaner::solve ()
info.setAgglomeration(m_agglomeration);
info.setConsolidation(m_consolidation);
info.setMaxCoarseningLevel(m_max_coarsening_level);
#ifdef WARPX_DIM_RZ
#if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER)
info.setMetricTerm(true);
#endif

Expand Down Expand Up @@ -247,30 +247,30 @@ ProjectionDivCleaner::correctBfield ()
{
// Grab references to B field arrays for this grid/tile
amrex::Array4<Real> const& Bx_arr = Bx->array(mfi);
#if !defined(WARPX_DIM_RZ)
#if !defined(WARPX_DIM_RZ) && !defined(WARPX_DIM_RCYLINDER)
amrex::Array4<Real> const& By_arr = By->array(mfi);
#endif
amrex::Array4<Real> const& Bz_arr = Bz->array(mfi);

// Extract stencil coefficients
Real const * const AMREX_RESTRICT coefs_x = m_stencil_coefs_x.dataPtr();
auto const n_coefs_x = static_cast<int>(m_stencil_coefs_x.size());
#if !defined(WARPX_DIM_RZ)
#if !defined(WARPX_DIM_RZ) && !defined(WARPX_DIM_RCYLINDER)
Real const * const AMREX_RESTRICT coefs_y = m_stencil_coefs_y.dataPtr();
auto const n_coefs_y = static_cast<int>(m_stencil_coefs_y.size());
#endif
Real const * const AMREX_RESTRICT coefs_z = m_stencil_coefs_z.dataPtr();
auto const n_coefs_z = static_cast<int>(m_stencil_coefs_z.size());

const Box& tbx = mfi.tilebox(Bx->ixType().toIntVect());
#if !defined(WARPX_DIM_RZ)
#if !defined(WARPX_DIM_RZ) && !defined(WARPX_DIM_RCYLINDER)
const Box& tby = mfi.tilebox(By->ixType().toIntVect());
#endif
const Box& tbz = mfi.tilebox(Bz->ixType().toIntVect());

amrex::Array4<Real> const& sol_arr = m_solution[ilev]->array(mfi);

#if defined(WARPX_DIM_RZ)
#if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER)
amrex::ParallelFor(tbx, tbz,
[=] AMREX_GPU_DEVICE (int i, int j, int /*k*/)
{
Expand Down

0 comments on commit 9cab923

Please sign in to comment.