From a074014150d0b9183063469c8fdaf10bb72c741c Mon Sep 17 00:00:00 2001 From: Dave Grote Date: Mon, 30 Oct 2023 15:39:41 -0700 Subject: [PATCH] Allow the injection_style to be the same for all sources --- Docs/source/usage/parameters.rst | 6 +++--- Source/Initialization/PlasmaInjector.cpp | 10 +--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Docs/source/usage/parameters.rst b/Docs/source/usage/parameters.rst index ab6907055cd..38693dee25e 100644 --- a/Docs/source/usage/parameters.rst +++ b/Docs/source/usage/parameters.rst @@ -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 ``.injection_sources = source1 source2`` there will be two input + input parameters below. For instance, with ``.injection_sources = source1 source2`` there can be the two input parameters ``.source1.injection_style`` and ``.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 ``.uz_m`` instead of setting it for each source. Note that since by default ``.injection_style = none``, all injection sources can be input this way. diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp index ed7335ae42b..ba825d84458 100644 --- a/Source/Initialization/PlasmaInjector.cpp +++ b/Source/Initialization/PlasmaInjector.cpp @@ -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(),