From 059ec774d4dc18b8e52842a9d89f43c5bfed3083 Mon Sep 17 00:00:00 2001 From: MengnanLi91 <118846840+MengnanLi91@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:45:57 -0600 Subject: [PATCH] Add default value for vector type input parameters #207 --- src/actions/AddDriftDiffusionAction.C | 59 ++++++++++++++++----------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/src/actions/AddDriftDiffusionAction.C b/src/actions/AddDriftDiffusionAction.C index bf4191bec48..64a0097b3eb 100644 --- a/src/actions/AddDriftDiffusionAction.C +++ b/src/actions/AddDriftDiffusionAction.C @@ -40,14 +40,15 @@ registerMooseAction("ZapdosApp", AddDriftDiffusionAction, "add_kernel"); registerMooseAction("ZapdosApp", AddDriftDiffusionAction, "add_aux_kernel"); registerMooseAction("ZapdosApp", AddDriftDiffusionAction, "add_material"); -namespace DriftDiffusionActionEnums { - // Setup comparison enum (less overhead than string comparison, when necessary) - enum ComparisonEnum - { - ELECTROSTATIC, - ELECTROMAGNETIC - }; -} +namespace DriftDiffusionActionEnums +{ +// Setup comparison enum (less overhead than string comparison, when necessary) +enum ComparisonEnum +{ + ELECTROSTATIC, + ELECTROMAGNETIC +}; +} // namespace DriftDiffusionActionEnums InputParameters AddDriftDiffusionAction::validParams() @@ -74,15 +75,19 @@ AddDriftDiffusionAction::validParams() params.addParam("field", "The gives the field a variable name"); MooseEnum field_solver("electrostatic electromagnetic", "electrostatic"); params.addParam( - "field_solver", field_solver, "Electrostatic or electromagnetic field solver (default = electrostatic)."); - params.addParam("field_property_name", "field_solver_interface_property", + "field_solver", + field_solver, + "Electrostatic or electromagnetic field solver (default = electrostatic)."); + params.addParam("field_property_name", + "field_solver_interface_property", "Name of the solver interface material property."); - params.addParam>("eff_fields_property_names", "Name of the solver interface material property for the effective fields."); - params.addParam( - "Is_field_unique", - false, - "Is the field unique to this block?" - "If not, then the field variable should be defined in the Variable Block."); + params.addParam>( + "eff_fields_property_names", + "Name of the solver interface material property for the effective fields."); + params.addParam("Is_field_unique", + false, + "Is the field unique to this block?" + "If not, then the field variable should be defined in the Variable Block."); params.addParam("First_DriftDiffusionAction_in_block", true, "Is this the first DriftDiffusionAction for this block?" @@ -148,21 +153,22 @@ AddDriftDiffusionAction::act() unsigned int number_neutrals = Neutrals.size(); if (!field_present && (em_present || (number_ions > 0))) - mooseError("There are electrons or charged_particles that are missing their electric field! Please " - "check your input."); + mooseError( + "There are electrons or charged_particles that are missing their electric field! Please " + "check your input."); std::vector sec_particle = getParam>("secondary_charged_particles"); std::vector eff_fields = getParam>("eff_fields"); - std::vector eff_fields_property_names = getParam>("eff_fields_property_names"); - + std::vector eff_fields_property_names = + getParam>("eff_fields_property_names"); unsigned int number_sec_particle = sec_particle.size(); unsigned int number_eff_fields = eff_fields.size(); -// TODO: add another != for this for the property names list + // TODO: add another != for this for the property names list if (number_sec_particle != number_eff_fields) mooseError("There are secondary_charged_particles that are missing their corresponding " "effective fields (eff_fields)! Please check your input."); @@ -372,7 +378,8 @@ AddDriftDiffusionAction::act() } if (field_present && First_Action && field_solver == DriftDiffusionActionEnums::ELECTROMAGNETIC) { - mooseWarning("Setting up EM field equations has not yet been setup in DriftDiffusionAction, and must be set up manually!"); + mooseWarning("Setting up EM field equations has not yet been setup in DriftDiffusionAction, " + "and must be set up manually!"); } // Adding Kernels for the neutrals @@ -520,7 +527,8 @@ AddDriftDiffusionAction::act() // Adding potentials charge sources void AddDriftDiffusionAction::addChargeSourceKernels(const std::string & field_name, - const std::string & charged_particle_name, const MooseEnum & field_solver) + const std::string & charged_particle_name, + const MooseEnum & field_solver) { // Add charge source contribution to electrostatic problem only if (field_solver == DriftDiffusionActionEnums::ELECTROSTATIC) @@ -665,7 +673,10 @@ AddDriftDiffusionAction::addEfield(const std::string & Efield_name, // Adding the material interface for FieldSolverMaterial void -AddDriftDiffusionAction::addFieldSolverMaterial(const std::string & field_name, const std::string & field_property_name, const MooseEnum & field_solver, const bool & effective_field) +AddDriftDiffusionAction::addFieldSolverMaterial(const std::string & field_name, + const std::string & field_property_name, + const MooseEnum & field_solver, + const bool & effective_field) { InputParameters params = _factory.getValidParams("FieldSolverMaterial"); params.set("solver") = {field_solver};