aboutsummaryrefslogtreecommitdiff
path: root/Source/BoundaryConditions/PML.cpp
diff options
context:
space:
mode:
authorGravatar Prabhat Kumar <89051199+prkkumar@users.noreply.github.com> 2021-11-19 00:31:18 -0800
committerGravatar GitHub <noreply@github.com> 2021-11-19 00:31:18 -0800
commit45ef533c39a55d05afbb9872659963d19b79f463 (patch)
tree65d7756277fd82059e8267b92a65e16d7865590f /Source/BoundaryConditions/PML.cpp
parentff8b73f58d71762e8d81be797c8afd1519d79c2a (diff)
downloadWarpX-45ef533c39a55d05afbb9872659963d19b79f463.tar.gz
WarpX-45ef533c39a55d05afbb9872659963d19b79f463.tar.zst
WarpX-45ef533c39a55d05afbb9872659963d19b79f463.zip
1D3V Cartesian Support (#2307)
* Build System: Add 1D Geometry * test PR * test PR * 1D cartesian yee algorithm * fixed typo * Fixes for PML * 1D support related multiple changes * Fix compilation * change 1D to 1D_Z * 1D Field Gather and typo fix * 1D Charge Deposition * Particle Pusher * multiple changes related to 1D * 1D diagnostics and initialization * PlasmaInjector and PEC fixes for 1D * clean-up delete diags file * mobility 1D laser particle and bilinear filter * deleted diags files * update laser particle weight formula * delete diags files * Azure: Add 1D Cartesian Runner * 1D fixes for FieldProbe * Update Docs/source/developers/dimensionality.rst Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * 1d laser injection and langmuir test input files * 1d tests * clean up : delete print statements * analyse simulation result for laser injection and Langmuir tests * EOL * delete input files for which there are no automated tests * delete input files for which there are no automated tests * add ignore_unused to remove warnings * remove space * Fix compilation issues * fix error : macro name must be an identifier * Small bug fix * cleanup Python script for analysis * bug fix * bug fix * Update ParticleProbe: Check 1D in-domain * Update Source/Make.WarpX * Update .azure-pipelines.yml * Add USE_OPENPMD=FALSE to .azure-pipeline.yml * resolve conflict * resolve conflict * fix typo * Correct out-of-bound access * Fix Particle BC in WarpXParticleContainer and correct path to checksumAPI in python analysis scripts * EOL * Fix bug : accessing out of bound index of cell in 1D * remove 1d test for cartesian3d * Fix CI check * Slight style change * Address review comments * Fix GPU compilation Filter.cpp * Fix CI * Fix Indentation * Address review comments * More consistent ifdef for dimension bigger than 1 * Update Examples/Tests/Langmuir/analysis_langmuir_multi_1d.py Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update GNUmakefile Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Regression/prepare_file_ci.py Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Filter/Filter.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Filter/Filter.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Filter/Filter.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Filter/Filter.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Initialization/PlasmaInjector.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Initialization/PlasmaInjector.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * add comment inline to explain twice push_back * Add amrex::Abort for NCIGodfreyFilter Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> Co-authored-by: Prabhat Kumar <prabhatkumar@kraken.dhcp.lbl.gov> Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> Co-authored-by: Remi Lehe <rlehe@lbl.gov>
Diffstat (limited to 'Source/BoundaryConditions/PML.cpp')
-rw-r--r--Source/BoundaryConditions/PML.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp
index 441acb743..47e4cce62 100644
--- a/Source/BoundaryConditions/PML.cpp
+++ b/Source/BoundaryConditions/PML.cpp
@@ -184,7 +184,9 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int n
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim)
{
+#if (AMREX_SPACEDIM >= 2)
int jdim = (idim+1) % AMREX_SPACEDIM;
+#endif
#if (AMREX_SPACEDIM == 3)
int kdim = (idim+2) % AMREX_SPACEDIM;
#endif
@@ -198,6 +200,7 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int n
{
direct_faces.push_back(kv.first);
}
+#if (AMREX_SPACEDIM >= 2)
else if (amrex::grow(grid_box, jdim, ncell).intersects(box))
{
side_faces.push_back(kv.first);
@@ -227,8 +230,10 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int n
{
corners.push_back(kv.first);
}
+#endif
}
+#if (AMREX_SPACEDIM >= 2)
for (auto gid : corners)
{
const Box& grid_box = grids[gid];
@@ -261,6 +266,7 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int n
amrex::Abort("SigmaBox::SigmaBox(): corners, how did this happen?\n");
}
}
+#endif
#if (AMREX_SPACEDIM == 3)
for (auto gid : side_side_edges)
@@ -302,6 +308,7 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int n
}
#endif
+#if (AMREX_SPACEDIM >= 2)
for (auto gid : side_faces)
{
const Box& grid_box = grids[gid];
@@ -317,6 +324,7 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int n
amrex::Abort("SigmaBox::SigmaBox(): side_faces, how did this happen?\n");
}
}
+#endif
for (auto gid : direct_faces)
{
@@ -369,7 +377,12 @@ SigmaBox::ComputePMLFactorsB (const Real* a_dx, Real dt)
N[idim] = sigma_star[idim].size();
dx[idim] = a_dx[idim];
}
- amrex::ParallelFor(amrex::max(AMREX_D_DECL(N[0],N[1],N[2])),
+ amrex::ParallelFor(
+#if (AMREX_SPACEDIM >= 2)
+ amrex::max(AMREX_D_DECL(N[0],N[1],N[2])),
+#else
+ N[0],
+#endif
[=] AMREX_GPU_DEVICE (int i) noexcept
{
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
@@ -398,7 +411,12 @@ SigmaBox::ComputePMLFactorsE (const Real* a_dx, Real dt)
N[idim] = sigma[idim].size();
dx[idim] = a_dx[idim];
}
- amrex::ParallelFor(amrex::max(AMREX_D_DECL(N[0],N[1],N[2])),
+ amrex::ParallelFor(
+#if (AMREX_SPACEDIM >= 2)
+ amrex::max(AMREX_D_DECL(N[0],N[1],N[2])),
+#else
+ N[0],
+#endif
[=] AMREX_GPU_DEVICE (int i) noexcept
{
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
@@ -524,6 +542,8 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& /*g
IntVect ngFFT = IntVect(ngFFt_x, ngFFt_y, ngFFt_z);
#elif (AMREX_SPACEDIM == 2)
IntVect ngFFT = IntVect(ngFFt_x, ngFFt_z);
+#elif (AMREX_SPACEDIM == 1)
+ IntVect ngFFT = IntVect(ngFFt_z);
#endif
// Set the number of guard cells to the maximum of each field