Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddPlasmaFromFile fix for periodic boundaries #1089

Merged
merged 41 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f02d842
Added description of singleparticle particle injection style
LDAmorim Apr 4, 2020
a6901c1
Revert "Added description of singleparticle particle injection style"
LDAmorim Apr 6, 2020
2a5adb2
Merge remote-tracking branch 'upstream/master'
LDAmorim Apr 8, 2020
6c47279
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Apr 20, 2020
24a131b
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Apr 22, 2020
2c243e1
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Apr 23, 2020
bbfbcf2
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Apr 27, 2020
06a7810
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Apr 27, 2020
2180838
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Apr 28, 2020
374671e
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Apr 30, 2020
75af55e
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim May 12, 2020
e15473d
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim May 13, 2020
2ed1c93
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim May 14, 2020
0d0d346
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim May 22, 2020
b84453a
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Jun 1, 2020
6bc431a
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX
LDAmorim Jun 12, 2020
85f1730
Tried to inject particles only in simulation Box
LDAmorim Jun 12, 2020
52edd94
Added Todo for multiple levels of mesh refinement
LDAmorim Jun 12, 2020
564a6f0
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX into opmd…
LDAmorim Jun 15, 2020
756faf3
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX into opmd…
LDAmorim Jun 15, 2020
8a404c9
Merge remote-tracking branch 'upstream/master' into opmd_periodic
LDAmorim Jun 16, 2020
adc7dff
Explain todo better
LDAmorim Jun 16, 2020
662b5de
Added x and y_shifts and replaced cascading ifs by bools and continue
LDAmorim Jun 16, 2020
8e5f9a1
Replaced cascading ifs by bools and continue
LDAmorim Jun 16, 2020
8226b87
Replaced TODO by FIXME as reviewer suggested
LDAmorim Jun 16, 2020
0be9125
Made the insidebounds function use box limits as defaults
LDAmorim Jun 17, 2020
eb3155a
Fixed identation issue
LDAmorim Jun 17, 2020
e853fd0
Fixed identation issue
LDAmorim Jun 17, 2020
e1f3b86
Fixed identation issue
LDAmorim Jun 17, 2020
adba576
Added to Docs the default for xmin,xmax and other dirs
LDAmorim Jun 17, 2020
6f1f0f9
Fix missing y and z dirs
LDAmorim Jun 17, 2020
7d49b3e
Merge branch 'master' of https://github.com/ECP-WarpX/WarpX into opmd…
LDAmorim Jun 17, 2020
c8eb2ed
Update Source/Initialization/PlasmaInjector.cpp
LDAmorim Jun 17, 2020
829b70f
Fixed PlasmaInjector limits with periodic condition
LDAmorim Jun 17, 2020
2327c64
Removed check if 3D because now ylims are +/-inf
LDAmorim Jun 17, 2020
dafbff6
Restored if to check for y velocity also in 2D/RZ
LDAmorim Jun 17, 2020
cfcc502
Fixed Docs to recent changes
LDAmorim Jun 17, 2020
35ad432
Update Source/Initialization/PlasmaInjector.cpp
LDAmorim Jun 17, 2020
30e9658
Fix extra bracket
LDAmorim Jun 17, 2020
c844d96
Merge remote-tracking branch 'upstream/development' into opmd_periodic
LDAmorim Jun 18, 2020
585e7b1
Tiny bool cleanup
ax3l Jun 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Docs/source/running_cpp/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ Particle initialization
The mass of one `physical` particle of this species.
If ``species_type`` is specified, the mass will be set to the physical value and ``mass`` is optional.

* ``<species_name>.xmin,ymin,zmin`` (`float`) optional (default unlimited)
When ``<species_name>.xmin`` and ``<species_name>.xmax`` (see below) are set, they delimit the region within which particles are injected.
The same is applicable in the other directions.
If periodic boundary conditions are used in direction ``i``, then the default (i.e. if the range is not specified) range will be the simulation box, ``[geometry.prob_hi[i], geometry.prob_lo[i]]``.

* ``<species_name>.xmax,ymax,zmax`` (`float`) optional (default unlimited)

* ``<species_name>.injection_style`` (`string`)
Determines how the particles will be injected in the simulation.
The options are:
Expand Down
26 changes: 25 additions & 1 deletion Source/Initialization/PlasmaInjector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name)
pp.query("radially_weighted", radially_weighted);
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(radially_weighted, "ERROR: Only radially_weighted=true is supported");

// parse plasma boundaries
// box boundaries
xmin = std::numeric_limits<amrex::Real>::lowest();
ymin = std::numeric_limits<amrex::Real>::lowest();
zmin = std::numeric_limits<amrex::Real>::lowest();
Expand All @@ -88,6 +88,30 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name)
ymax = std::numeric_limits<amrex::Real>::max();
zmax = std::numeric_limits<amrex::Real>::max();

// NOTE: When periodic boundaries are used, default injection range is set to mother grid dimensions.
const Geometry& geom = WarpX::GetInstance().Geom(0);
if( geom.isPeriodic(0)==1 ) {
xmin = geom.ProbLo(0);
xmax = geom.ProbHi(0);
}

if( geom.isPeriodic(1)==1 ) {
# ifndef WARPX_DIM_3D
zmin = geom.ProbLo(1);
zmax = geom.ProbHi(1);
# else
ymin = geom.ProbLo(1);
ymax = geom.ProbHi(1);
# endif
}

# ifdef WARPX_DIM_3D
if( geom.isPeriodic(2)==1 ) {
zmin = geom.ProbLo(2);
zmax = geom.ProbHi(2);
}
# endif

pp.query("xmin", xmin);
pp.query("ymin", ymin);
pp.query("zmin", zmin);
Expand Down
7 changes: 4 additions & 3 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ PhysicalParticleContainer::AddPlasmaFromFile(ParticleReal q_tot,
ParticleReal const z = ptr_z.get()[i]*position_unit_z+z_shift;
# ifndef WARPX_DIM_3D
ParticleReal const y = 0.0_prt;
}
# else
ParticleReal const y = ptr_y.get()[i]*position_unit_y;
# endif
Expand All @@ -374,9 +375,9 @@ PhysicalParticleContainer::AddPlasmaFromFile(ParticleReal q_tot,
uy = ptr_uy.get()[i]*momentum_unit_y/PhysConst::m_e;
}
CheckAndAddParticle(x, y, z, { ux, uy, uz}, weight,
particle_x, particle_y, particle_z,
particle_ux, particle_uy, particle_uz,
particle_w);
particle_x, particle_y, particle_z,
particle_ux, particle_uy, particle_uz,
particle_w);
}
}
auto const np = particle_z.size();
Expand Down