diff options
author | 2016-11-16 12:58:52 -0800 | |
---|---|---|
committer | 2016-11-16 12:58:52 -0800 | |
commit | dabc81c4d499ef0b33d43e1dfb34ff352adab64b (patch) | |
tree | ec9a26e92f421f655f32b97863f257c50b0c2f5b /Exec/Langmuir/ParticleProb.cpp | |
parent | 388017fe0cf255257857052c01c08449411ea11c (diff) | |
download | WarpX-dabc81c4d499ef0b33d43e1dfb34ff352adab64b.tar.gz WarpX-dabc81c4d499ef0b33d43e1dfb34ff352adab64b.tar.zst WarpX-dabc81c4d499ef0b33d43e1dfb34ff352adab64b.zip |
update initialization of particles for 2d
Diffstat (limited to '')
-rw-r--r-- | Exec/Langmuir/ParticleProb.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Exec/Langmuir/ParticleProb.cpp b/Exec/Langmuir/ParticleProb.cpp index fc8cd0f71..a5ead8834 100644 --- a/Exec/Langmuir/ParticleProb.cpp +++ b/Exec/Langmuir/ParticleProb.cpp @@ -37,6 +37,8 @@ MyParticleContainer::InitData() pp.query("n_e", weight); weight *= dx[0]*dx[1]*dx[2]/n_part_per_cell; + particle_xmin = particle_ymin = particle_zmin = -2.e-5; + particle_xmax = particle_ymax = particle_zmax = 2.e-5; pp.query("particle_xmin", particle_xmin); pp.query("particle_xmax", particle_xmax); pp.query("particle_ymin", particle_ymin); @@ -68,17 +70,27 @@ MyParticleContainer::InitData() Box grid = ba[gid]; RealBox grid_box = RealBox(grid,dx,geom.ProbLo()); - int nx = grid.length(0), ny = grid.length(1), nz = grid.length(2); +#if (BL_SPACEDIM == 3) + int nx = grid.length(0), ny = grid.length(1), nz = grid.length(2); +#elif (BL_SPACEDIM == 2) + int nx = grid.length(0), ny = 1, nz = grid.length(1); +#endif for (int k = 0; k < nz; k++) { for (int j = 0; j < ny; j++) { for (int i = 0; i < nx; i++) { for (int i_part=0; i_part<n_part_per_cell;i_part++) { Real particle_shift = (0.5+i_part)/n_part_per_cell; +#if (BL_SPACEDIM == 3) Real x = grid_box.lo(0) + (i + particle_shift)*dx[0]; Real y = grid_box.lo(1) + (j + particle_shift)*dx[1]; Real z = grid_box.lo(2) + (k + particle_shift)*dx[2]; - +#elif (BL_SPACEDIM == 2) + Real x = grid_box.lo(0) + (i + particle_shift)*dx[0]; + Real y = 0.0; + Real z = grid_box.lo(2) + (k + particle_shift)*dx[2]; +#endif + if (x >= particle_xmax || x < particle_xmin || y >= particle_ymax || y < particle_ymin || z >= particle_zmax || z < particle_zmin ) continue; @@ -90,9 +102,14 @@ MyParticleContainer::InitData() p.m_lev = lev; p.m_grid = gid; +#if (BL_SPACEDIM == 3) p.m_pos[0] = x; p.m_pos[1] = y; p.m_pos[2] = z; +#elif (BL_SPACEDIM == 2) + p.m_pos[0] = x; + p.m_pos[1] = z; +#endif for (int i = 0; i < BL_SPACEDIM; i++) { BL_ASSERT(p.m_pos[i] < grid_box.hi(i)); |