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 : #pragma once 11 : 12 : #include "ActionFactory.h" 13 : #include "ActionWarehouse.h" 14 : #include "InputParameters.h" 15 : #include "MooseApp.h" 16 : #include "MooseTypes.h" 17 : 18 : /** 19 : * Base helper class to provide interfaces to common flow model setup functions 20 : */ 21 : class FlowModelSetup 22 : { 23 : public: 24 : FlowModelSetup(const InputParameters & params); 25 : 26 : protected: 27 : virtual void addInitialConditions() = 0; 28 : virtual void addSolutionVariables() = 0; 29 : virtual void addNonConstantAuxVariables() = 0; 30 : virtual void addMaterials(); 31 : virtual void addUserObjects() = 0; 32 : 33 : /** 34 : * Adds a solution variable 35 : * 36 : * @param[in] var_name name of the variable to add 37 : * @param[in] scaling scaling factor to apply to variable 38 : */ 39 : void addSolutionVariable(const VariableName & var_name, const Real & scaling = 1.0); 40 : 41 : /** 42 : * Adds an aux variable 43 : * 44 : * @param[in] var_name name of the variable to add 45 : */ 46 : void addAuxVariable(const VariableName & var_name); 47 : 48 : /** 49 : * Adds a function initial condition 50 : * 51 : * @param[in] var_name name of the variable for which to add initial condition 52 : * @param[in] function_name names of the IC function 53 : */ 54 : void addFunctionIC(const VariableName & var_name, const FunctionName & function_name); 55 : 56 : /** 57 : * Retrieves a parameter 58 : * 59 : * @param[in] name name of the parameter 60 : * @return value of the parameter 61 : */ 62 : template <typename T> 63 : const T & getParam(const std::string & name) const; 64 : 65 : const InputParameters & _this_params; 66 : MooseApp & _this_app; 67 : ActionFactory & _this_action_factory; 68 : ActionWarehouse & _this_action_warehouse; 69 : 70 : MooseEnum _fe_family; 71 : MooseEnum _fe_order; 72 : 73 : /// Gravitational acceleration magnitude 74 : const Real & _gravity_magnitude; 75 : 76 : public: 77 : static InputParameters validParams(); 78 : }; 79 : 80 : template <typename T> 81 : const T & 82 : FlowModelSetup::getParam(const std::string & name) const 83 : { 84 600 : return InputParameters::getParamHelper(name, _this_params, static_cast<T *>(0)); 85 : }