From 03e94a0d5d72b448545a15872c8a1974269f4073 Mon Sep 17 00:00:00 2001 From: MengnanLi91 <118846840+MengnanLi91@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:04:44 -0600 Subject: [PATCH 1/2] Remove unused label 'std' --- src/actions/ChemicalReactionsBase.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/actions/ChemicalReactionsBase.C b/src/actions/ChemicalReactionsBase.C index 2bee27a..753d77c 100644 --- a/src/actions/ChemicalReactionsBase.C +++ b/src/actions/ChemicalReactionsBase.C @@ -901,7 +901,7 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params) } if (unbalanced) { - std::string error_str; + string error_str; for (unsigned int i = 0; i < faulty_reaction.size(); ++i) { error_str.append(" "); @@ -909,7 +909,8 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params) error_str.append("\n"); } - mooseError("The following equations are unbalanced:\n", error_str, + mooseError("The following equations are unbalanced:\n", + error_str, "Fix unbalanced reactions or particle conservation will not be enforced."); } } From 7da886de8c8443cc9e1f180dd6f3c188d619f111 Mon Sep 17 00:00:00 2001 From: MengnanLi91 <118846840+MengnanLi91@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:11:14 -0600 Subject: [PATCH 2/2] Add default value for vector type input parameters #116 --- src/actions/ChemicalReactions.C | 10 +++++----- src/actions/ChemicalReactionsBase.C | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/actions/ChemicalReactions.C b/src/actions/ChemicalReactions.C index e1d4f56..832f91b 100644 --- a/src/actions/ChemicalReactions.C +++ b/src/actions/ChemicalReactions.C @@ -52,7 +52,7 @@ ChemicalReactions::validParams() InputParameters params = AddVariableAction::validParams(); params.addRequiredParam>( "species", "List of (tracked) species included in reactions (both products and reactants)"); - params.addParam>("reaction_coefficient", "The reaction coefficients."); + params.addParam>("reaction_coefficient", {}, "The reaction coefficients."); params.addParam( "include_electrons", false, "Whether or not electrons are being considered."); params.addParam("track_energy", false, "Whether or not to track gas energy/temperature."); @@ -64,7 +64,7 @@ ChemicalReactions::validParams() "List of (tracked) energy values. (Optional; requires 'track_energy' to be True.)"); params.addParam("electron_density", "The variable used for density of electrons."); params.addParam>( - "electron_energy", "Electron energy, used for energy-dependent reaction rates."); + "electron_energy", {}, "Electron energy, used for energy-dependent reaction rates."); params.addParam>("gas_species", "All of the background gas species in the system."); params.addParam>("gas_fraction", "The initial fraction of each gas species."); @@ -92,10 +92,10 @@ ChemicalReactions::validParams() "Sample rate constants with E/N (reduced_field) or Te (electron_energy)."); params.addParam( "scalar_problem", false, "The problem is scalar if it is a pure ODE problem (Global/0D)."); - params.addParam>("equation_constants", - "The constants included in the reaction equation(s)."); params.addParam>( - "equation_values", "The values of the constants included in the reaction equation(s)."); + "equation_constants", {}, "The constants included in the reaction equation(s)."); + params.addParam>( + "equation_values", {}, "The values of the constants included in the reaction equation(s)."); params.addParam>( "equation_variables", "Any nonlinear variables that appear in the equations."); params.addParam>( diff --git a/src/actions/ChemicalReactionsBase.C b/src/actions/ChemicalReactionsBase.C index 753d77c..639c626 100644 --- a/src/actions/ChemicalReactionsBase.C +++ b/src/actions/ChemicalReactionsBase.C @@ -56,7 +56,7 @@ ChemicalReactionsBase::validParams() "species", "List of (tracked) species included in reactions (both products and reactants)"); params.addParam>( "aux_species", "Auxiliary species that are not included in nonlinear solve."); - params.addParam>("reaction_coefficient", "The reaction coefficients."); + params.addParam>("reaction_coefficient", {}, "The reaction coefficients."); params.addParam( "include_electrons", false, "Whether or not electrons are being considered."); params.addParam( @@ -65,9 +65,9 @@ ChemicalReactionsBase::validParams() "track_rates", false, "Whether or not to track production rates for each reaction"); params.addParam("electron_density", "The variable used for density of electrons."); params.addParam>( - "electron_energy", "Electron energy, used for energy-dependent reaction rates."); + "electron_energy", {}, "Electron energy, used for energy-dependent reaction rates."); params.addParam>( - "gas_energy", "Gas energy, used for energy-dependent reaction rates."); + "gas_energy", {}, "Gas energy, used for energy-dependent reaction rates."); params.addParam>("gas_species", "All of the background gas species in the system."); params.addParam>("gas_fraction", "The initial fraction of each gas species."); @@ -81,10 +81,10 @@ ChemicalReactionsBase::validParams() "sampling_variable", "reduced_field", "Sample rate constants with E/N (reduced_field) or Te (electron_energy)."); - params.addParam>("equation_constants", - "The constants included in the reaction equation(s)."); params.addParam>( - "equation_values", "The values of the constants included in the reaction equation(s)."); + "equation_constants", {}, "The constants included in the reaction equation(s)."); + params.addParam>( + "equation_values", {}, "The values of the constants included in the reaction equation(s)."); params.addParam>( "equation_variables", "Any nonlinear variables that appear in the equations."); params.addParam>( @@ -93,8 +93,8 @@ ChemicalReactionsBase::validParams() false, "If true, the input file parser will look for a parameter denoting lumped " "species (NEUTRAL for now...eventually arbitrary?)."); - params.addParam>("lumped", - "The neutral species that will be lumped together."); + params.addParam>( + "lumped", {}, "The neutral species that will be lumped together."); params.addParam("lumped_name", "The name of the variable that will account for multiple species."); params.addParam( @@ -189,7 +189,7 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params) else _aux_species.push_back("none"); - if (getParam("lumped_species") && !isParamValid("lumped")) + if (getParam("lumped_species") && _lumped_species.size() == 0) mooseError("The lumped_species parameter is set to true, but vector of neutrals (lumped = " "'...') is not set."); @@ -832,17 +832,17 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params) if (_energy_change[i]) { - if (!isParamValid("electron_energy") && !isParamValid("gas_energy")) + if (_electron_energy.size() == 0 && _gas_energy.size() == 0) mooseError("Reactions have energy changes, but no electron or gas temperature variable is " "included!"); } } - if (isParamValid("electron_energy")) + if (_electron_energy.size() > 0) { _electron_energy_term.push_back(true); _energy_variable.push_back(_electron_energy[0]); } - if (isParamValid("gas_energy")) + if (_gas_energy.size() > 0) { _electron_energy_term.push_back(false); _energy_variable.push_back(_gas_energy[0]);