Skip to content

Commit

Permalink
Allow the injection_style to be the same for all sources
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgrote committed Oct 30, 2023
1 parent 4049b1d commit a074014
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -673,10 +673,10 @@ Particle initialization
Names of additional injection sources. By default, WarpX assumes one injection source per species, hence all of the input
parameters below describing the injection are parameters directly of the species. However, this option allows
additional sources, the names of which are specified here. For each source, the name of the source is added to the
input parameters below. For instance, with ``<species_name>.injection_sources = source1 source2`` there will be two input
input parameters below. For instance, with ``<species_name>.injection_sources = source1 source2`` there can be the two input
parameters ``<species_name>.source1.injection_style`` and ``<species_name>.source2.injection_style``.
For each source listed, the ``injection_style`` must be specified. For the parameters of each source, the name with the source
will be read first. If it is not given, it will read the parameter without the source. This allows parameters used for all
For the parameters of each source, the parameter with the name of the source will be used.
If it is not given, the value of the parameter without the source name will be used. This allows parameters used for all
sources to be specified once. For example, if the ``source1`` and ``source2`` have the same value of ``uz_m``, then it can be
set using ``<species_name>.uz_m`` instead of setting it for each source.
Note that since by default ``<species_name>.injection_style = none``, all injection sources can be input this way.
Expand Down
10 changes: 1 addition & 9 deletions Source/Initialization/PlasmaInjector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,8 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name,
pp_species_dot_source.queryWithParser("density_min", density_min);
pp_species_dot_source.queryWithParser("density_max", density_max);

// Parse injection style
// Must be supplied for each source
std::string species_with_source = species_name;
if (!source_name.empty()) {
species_with_source = species_with_source + "." + source_name;
}
const amrex::ParmParse pp_species_with_source(species_with_source);

std::string injection_style = "none";
pp_species_with_source.query("injection_style", injection_style);
pp_species_dot_source.query("injection_style", injection_style);
std::transform(injection_style.begin(),
injection_style.end(),
injection_style.begin(),
Expand Down

0 comments on commit a074014

Please sign in to comment.