Skip to content

Commit

Permalink
call reflecting J/rho if particleBoundary is reflecting/field boundar…
Browse files Browse the repository at this point in the history
…y is PEC
  • Loading branch information
RevathiJambunathan committed Mar 19, 2024
1 parent cf00663 commit ec2b243
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Source/BoundaryConditions/WarpXFieldBoundaries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::ApplyReflectiveBoundarytoRhofield(rho, lev, patch_type); }
if (PEC::isAnyParticleBoundaryReflecting() || PEC::isAnyBoundaryPEC()) { 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::ApplyReflectiveBoundarytoJfield(Jx, Jy, Jz, lev, patch_type); }
if (PEC::isAnyParticleBoundaryReflecting() || PEC::isAnyBoundaryPEC()) { PEC::ApplyReflectiveBoundarytoJfield(Jx, Jy, Jz, lev, patch_type); }
}

#ifdef WARPX_DIM_RZ
Expand Down
12 changes: 8 additions & 4 deletions Source/BoundaryConditions/WarpX_PEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ PEC::ApplyReflectiveBoundarytoRhofield (amrex::MultiFab* rho, const int lev, Pat
amrex::GpuArray<GpuArray<amrex::Real,2>, AMREX_SPACEDIM> psign;
amrex::GpuArray<GpuArray<int,2>, AMREX_SPACEDIM> mirrorfac;
for (int idim=0; idim < AMREX_SPACEDIM; ++idim) {
is_reflective[idim][0] = ( WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting);
is_reflective[idim][1] = ( WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting);
is_reflective[idim][0] = ( WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting)
|| ( WarpX::field_boundary_lo[idim] == FieldBoundaryType::PEC);
is_reflective[idim][1] = ( WarpX::particle_boundary_hi[idim] == ParticleBoundaryType::Reflecting)
|| ( WarpX::field_boundary_hi[idim] == FieldBoundaryType::PEC)
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]); }

Expand Down Expand Up @@ -349,8 +351,10 @@ PEC::ApplyReflectiveBoundarytoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy,
amrex::GpuArray<GpuArray<GpuArray<amrex::Real, 2>, AMREX_SPACEDIM>, 3> psign;
amrex::GpuArray<GpuArray<GpuArray<int, 2>, AMREX_SPACEDIM>, 3> mirrorfac;
for (int idim=0; idim < AMREX_SPACEDIM; ++idim) {
is_reflective[idim][0] = ( WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting);
is_reflective[idim][1] = ( WarpX::particle_boundary_hi[idim] == ParticleBoundaryType::Reflecting);
is_reflective[idim][0] = ( WarpX::particle_boundary_lo[idim] == ParticleBoundaryType::Reflecting)
|| ( WarpX::field_boundary_lo[idim] == FieldBoundaryType::PEC);
is_reflective[idim][1] = ( WarpX::particle_boundary_hi[idim] == ParticleBoundaryType::Reflecting)
|| ( WarpX::field_boundary_hi[idim] == FieldBoundaryType::PEC)
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]); }

Expand Down

0 comments on commit ec2b243

Please sign in to comment.