Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "CavityPressurePPAction.h" 11 : #include "Factory.h" 12 : #include "FEProblem.h" 13 : 14 : registerMooseAction("SolidMechanicsApp", CavityPressurePPAction, "add_postprocessor"); 15 : 16 : InputParameters 17 0 : CavityPressurePPAction::validParams() 18 : { 19 0 : InputParameters params = Action::validParams(); 20 0 : params.addClassDescription("This Action creates a CavityPressurePostprocessor."); 21 0 : params.addParam<std::string>("output", "The name to use for the cavity pressure value"); 22 0 : params.addParam<std::string>("output_initial_moles", 23 : "The name to use when reporting the initial moles of gas"); 24 0 : return params; 25 0 : } 26 : 27 0 : CavityPressurePPAction::CavityPressurePPAction(const InputParameters & params) : Action(params) {} 28 : 29 : void 30 0 : CavityPressurePPAction::act() 31 : { 32 0 : InputParameters params = _factory.getValidParams("CavityPressurePostprocessor"); 33 : 34 0 : params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_LINEAR}; 35 0 : params.set<UserObjectName>("cavity_pressure_uo") = _name + "UserObject"; 36 0 : params.set<MooseEnum>("quantity") = "cavity_pressure"; 37 : 38 0 : _problem->addPostprocessor("CavityPressurePostprocessor", 39 0 : isParamValid("output") ? getParam<std::string>("output") : _name, 40 : params); 41 : 42 0 : if (isParamValid("output_initial_moles")) 43 : { 44 0 : params.set<MooseEnum>("quantity") = "initial_moles"; 45 0 : _problem->addPostprocessor( 46 0 : "CavityPressurePostprocessor", getParam<std::string>("output_initial_moles"), params); 47 : } 48 0 : }