From cf006636e08ae386fe207d8025e6733e871f8032 Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Mon, 18 Mar 2024 16:53:26 -0700 Subject: [PATCH] rename functions --- .../WarpXFieldBoundaries.cpp | 4 +-- Source/BoundaryConditions/WarpX_PEC.H | 16 ++++----- Source/BoundaryConditions/WarpX_PEC.cpp | 36 +++++++++---------- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/Source/BoundaryConditions/WarpXFieldBoundaries.cpp b/Source/BoundaryConditions/WarpXFieldBoundaries.cpp index 69c379ecbe6..802c9214b57 100644 --- a/Source/BoundaryConditions/WarpXFieldBoundaries.cpp +++ b/Source/BoundaryConditions/WarpXFieldBoundaries.cpp @@ -106,14 +106,14 @@ void WarpX::ApplyBfieldBoundary (const int lev, PatchType patch_type, DtType a_d void WarpX::ApplyRhofieldBoundary (const int lev, MultiFab* rho, PatchType patch_type) { - if (PEC::isAnyParticleBoundaryReflecting()) { PEC::ApplyPECtoRhofield(rho, lev, patch_type); } + if (PEC::isAnyParticleBoundaryReflecting()) { PEC::ApplyReflectiveBoundarytoRhofield(rho, lev, patch_type); } } void WarpX::ApplyJfieldBoundary (const int lev, amrex::MultiFab* Jx, amrex::MultiFab* Jy, amrex::MultiFab* Jz, PatchType patch_type) { - if (PEC::isAnyParticleBoundaryReflecting()) { PEC::ApplyPECtoJfield(Jx, Jy, Jz, lev, patch_type); } + if (PEC::isAnyParticleBoundaryReflecting()) { PEC::ApplyReflectiveBoundarytoJfield(Jx, Jy, Jz, lev, patch_type); } } #ifdef WARPX_DIM_RZ diff --git a/Source/BoundaryConditions/WarpX_PEC.H b/Source/BoundaryConditions/WarpX_PEC.H index 50e05833e35..d04c52ef3e0 100644 --- a/Source/BoundaryConditions/WarpX_PEC.H +++ b/Source/BoundaryConditions/WarpX_PEC.H @@ -355,12 +355,12 @@ using namespace amrex; /** - * \brief Sets the rho or J field value in cells close to and on a PEC boundary. The + * \brief Sets the rho or J field value in cells close to and on reflecting particle boundary. The * charge/current density deposited in the guard cells are either reflected * back into the simulation domain (if a reflecting particle * boundary is used), or the opposite charge/current density is deposited * back in the domain to capture the effect of an image charge. - * The charge/current density on the PEC boundary is set to 0 while values + * The charge/current density on the reflecting boundary is set to 0 while values * in the guard cells are set equal (and opposite) to their mirror * location inside the domain - representing image charges - in the * normal (tangential) direction. @@ -370,7 +370,7 @@ using namespace amrex; * \param[in out] field field data to be updated * \param[in] mirrorfac mirror cell is given by mirrorfac - ijk_vec * \param[in] psign Whether the field value should be flipped across the boundary - * \param[in] is_pec Whether the given boundary is PEC + * \param[in] is_reflective Whether the given particle boundary is reflecting * \param[in] tangent_to_bndy Whether a given direction is perpendicular to the boundary * \param[in] fabbox multifab box including ghost cells */ @@ -380,7 +380,7 @@ using namespace amrex; amrex::Array4 const& field, amrex::GpuArray, AMREX_SPACEDIM> const& mirrorfac, amrex::GpuArray, AMREX_SPACEDIM> const& psign, - amrex::GpuArray, AMREX_SPACEDIM> const& is_pec, + amrex::GpuArray, AMREX_SPACEDIM> const& is_reflective, amrex::GpuArray const& tangent_to_bndy, amrex::Box const& fabbox) { @@ -391,7 +391,7 @@ using namespace amrex; { for (int iside = 0; iside < 2; ++iside) { - if (!is_pec[idim][iside]) { continue; } + if (!is_reflective[idim][iside]) { continue; } // Get the mirror guard cell index amrex::IntVect iv_mirror = ijk_vec; @@ -412,7 +412,7 @@ using namespace amrex; { for (int iside = 0; iside < 2; ++iside) { - if (!is_pec[idim][iside]) { continue; } + if (!is_reflective[idim][iside]) { continue; } amrex::IntVect iv_mirror = ijk_vec; iv_mirror[idim] = mirrorfac[idim][iside] - ijk_vec[idim]; @@ -516,7 +516,7 @@ using namespace amrex; * \param[in] lev level of the Multifab * \param[in] patch_type coarse or fine */ - void ApplyPECtoRhofield(amrex::MultiFab* rho, int lev, + void ApplyReflectiveBoundarytoRhofield(amrex::MultiFab* rho, int lev, PatchType patch_type); /** @@ -527,7 +527,7 @@ using namespace amrex; * \param[in] lev level of the Multifab * \param[in] patch_type coarse or fine */ - void ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, + void ApplyReflectiveBoundarytoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, amrex::MultiFab* Jz, int lev, PatchType patch_type); diff --git a/Source/BoundaryConditions/WarpX_PEC.cpp b/Source/BoundaryConditions/WarpX_PEC.cpp index 977b43e587a..7bb0e58dbef 100644 --- a/Source/BoundaryConditions/WarpX_PEC.cpp +++ b/Source/BoundaryConditions/WarpX_PEC.cpp @@ -231,7 +231,7 @@ PEC::ApplyPECtoBfield (std::array Bfield, const int lev, * location inside the domain - representing image charges. **/ void -PEC::ApplyPECtoRhofield (amrex::MultiFab* rho, const int lev, PatchType patch_type) +PEC::ApplyReflectiveBoundarytoRhofield (amrex::MultiFab* rho, const int lev, PatchType patch_type) { auto& warpx = WarpX::GetInstance(); @@ -252,17 +252,15 @@ PEC::ApplyPECtoRhofield (amrex::MultiFab* rho, const int lev, PatchType patch_ty // cells for boundaries that are NOT PEC amrex::Box grown_domain_box = domain_box; - amrex::GpuArray, AMREX_SPACEDIM> is_pec; + amrex::GpuArray, AMREX_SPACEDIM> is_reflective; amrex::GpuArray is_tangent_to_bndy; amrex::GpuArray, AMREX_SPACEDIM> psign; amrex::GpuArray, AMREX_SPACEDIM> mirrorfac; for (int idim=0; idim < AMREX_SPACEDIM; ++idim) { - is_pec[idim][0] = ( WarpX::field_boundary_lo[idim] == FieldBoundaryType::PEC - || WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting); - is_pec[idim][1] = ( WarpX::field_boundary_hi[idim] == FieldBoundaryType::PEC - || WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting); - if (!is_pec[idim][0]) { grown_domain_box.growLo(idim, ng_fieldgather[idim]); } - if (!is_pec[idim][1]) { grown_domain_box.growHi(idim, ng_fieldgather[idim]); } + is_reflective[idim][0] = ( WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting); + is_reflective[idim][1] = ( WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting); + if (!is_reflective[idim][0]) { grown_domain_box.growLo(idim, ng_fieldgather[idim]); } + if (!is_reflective[idim][1]) { grown_domain_box.growHi(idim, ng_fieldgather[idim]); } // rho values inside guard cells are updated the same as tangential // components of the current density @@ -304,7 +302,7 @@ PEC::ApplyPECtoRhofield (amrex::MultiFab* rho, const int lev, PatchType patch_ty const amrex::IntVect iv(AMREX_D_DECL(i,j,k)); PEC::SetRhoOrJfieldFromPEC( - n, iv, rho_array, mirrorfac, psign, is_pec, + n, iv, rho_array, mirrorfac, psign, is_reflective, is_tangent_to_bndy, fabbox ); }); @@ -313,7 +311,7 @@ PEC::ApplyPECtoRhofield (amrex::MultiFab* rho, const int lev, PatchType patch_ty void -PEC::ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, +PEC::ApplyReflectiveBoundarytoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, amrex::MultiFab* Jz, const int lev, PatchType patch_type) { @@ -346,17 +344,15 @@ PEC::ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, // directions of the current density multifab const amrex::IntVect ng_fieldgather = Jx->nGrowVect(); - amrex::GpuArray, AMREX_SPACEDIM> is_pec; + amrex::GpuArray, AMREX_SPACEDIM> is_reflective; amrex::GpuArray, 3> is_tangent_to_bndy; amrex::GpuArray, AMREX_SPACEDIM>, 3> psign; amrex::GpuArray, AMREX_SPACEDIM>, 3> mirrorfac; for (int idim=0; idim < AMREX_SPACEDIM; ++idim) { - is_pec[idim][0] = ( WarpX::field_boundary_lo[idim] == FieldBoundaryType::PEC - || WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting); - is_pec[idim][1] = ( WarpX::field_boundary_hi[idim] == FieldBoundaryType::PEC - || WarpX::particle_boundary_hi[idim] == ParticleBoundaryType::Reflecting); - if (!is_pec[idim][0]) { grown_domain_box.growLo(idim, ng_fieldgather[idim]); } - if (!is_pec[idim][1]) { grown_domain_box.growHi(idim, ng_fieldgather[idim]); } + is_reflective[idim][0] = ( WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting); + is_reflective[idim][1] = ( WarpX::particle_boundary_hi[idim] == ParticleBoundaryType::Reflecting); + if (!is_reflective[idim][0]) { grown_domain_box.growLo(idim, ng_fieldgather[idim]); } + if (!is_reflective[idim][1]) { grown_domain_box.growHi(idim, ng_fieldgather[idim]); } for (int icomp=0; icomp < 3; ++icomp) { // Set the psign value correctly for each current component for each @@ -428,7 +424,7 @@ PEC::ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, const amrex::IntVect iv(AMREX_D_DECL(i,j,k)); PEC::SetRhoOrJfieldFromPEC( - n, iv, Jx_array, mirrorfac[0], psign[0], is_pec, + n, iv, Jx_array, mirrorfac[0], psign[0], is_reflective, is_tangent_to_bndy[0], fabbox ); }); @@ -463,7 +459,7 @@ PEC::ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, const amrex::IntVect iv(AMREX_D_DECL(i,j,k)); PEC::SetRhoOrJfieldFromPEC( - n, iv, Jy_array, mirrorfac[1], psign[1], is_pec, + n, iv, Jy_array, mirrorfac[1], psign[1], is_reflective, is_tangent_to_bndy[1], fabbox ); }); @@ -498,7 +494,7 @@ PEC::ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, const amrex::IntVect iv(AMREX_D_DECL(i,j,k)); PEC::SetRhoOrJfieldFromPEC( - n, iv, Jz_array, mirrorfac[2], psign[2], is_pec, + n, iv, Jz_array, mirrorfac[2], psign[2], is_reflective, is_tangent_to_bndy[2], fabbox ); });