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 "Pressure.h" 11 : 12 : #include "Assembly.h" 13 : #include "Function.h" 14 : #include "MooseError.h" 15 : #include "FEProblemBase.h" 16 : 17 : registerMooseObject("SolidMechanicsApp", Pressure); 18 : registerMooseObject("SolidMechanicsApp", ADPressure); 19 : 20 3440 : registerMoosePressureAction("SolidMechanicsApp", Pressure, PressureAction); 21 : 22 : template <bool is_ad> 23 : InputParameters 24 8514 : PressureTempl<is_ad>::validParams() 25 : { 26 8514 : InputParameters params = PressureParent<is_ad>::validParams(); 27 8514 : params.addClassDescription("Applies a pressure on a given boundary in a given direction"); 28 8514 : params += actionParams(); 29 8514 : return params; 30 0 : } 31 : 32 : template <bool is_ad> 33 : InputParameters 34 9374 : PressureTempl<is_ad>::actionParams() 35 : { 36 9374 : InputParameters params = PressureParent<is_ad>::actionParams(); 37 18748 : params.addDeprecatedParam<Real>("constant", 38 : "The magnitude to use in computing the pressure", 39 : "Use 'factor' in place of 'constant'"); 40 18748 : params.addParam<Real>("factor", 1.0, "The magnitude to use in computing the pressure"); 41 18748 : params.addParam<FunctionName>("function", "The function that describes the pressure"); 42 18748 : params.addParam<PostprocessorName>("postprocessor", 43 : "Postprocessor that will supply the pressure value"); 44 : 45 18748 : params.addParam<Real>("hht_alpha", 46 18748 : 0, 47 : "alpha parameter for mass dependent numerical damping induced " 48 : "by HHT time integration scheme"); 49 9374 : return params; 50 0 : } 51 : 52 : template <bool is_ad> 53 3086 : PressureTempl<is_ad>::PressureTempl(const InputParameters & parameters) 54 : : PressureParent<is_ad>(parameters), 55 7290 : _factor(parameters.isParamSetByUser("factor") ? this->template getParam<Real>("factor") 56 5054 : : parameters.isParamSetByUser("constant") ? this->template getParam<Real>("constant") 57 : : 1.0), 58 8824 : _function(this->isParamValid("function") ? &this->getFunction("function") : NULL), 59 3086 : _postprocessor( 60 6172 : this->isParamValid("postprocessor") ? &this->getPostprocessorValue("postprocessor") : NULL), 61 9258 : _alpha(this->template getParam<Real>("hht_alpha")) 62 : { 63 4204 : if (parameters.isParamSetByUser("factor") && parameters.isParamSetByUser("constant")) 64 0 : mooseError("Cannot set 'factor' and 'constant'."); 65 3086 : } 66 : 67 : template <bool is_ad> 68 : GenericReal<is_ad> 69 54230664 : PressureTempl<is_ad>::computePressure() const 70 : { 71 54230664 : GenericReal<is_ad> factor = _factor; 72 : 73 54230664 : if (_function) 74 52101904 : factor *= _function->value(_t + _alpha * _dt, _q_point[_qp]); 75 : 76 54230664 : if (_postprocessor) 77 0 : factor *= *_postprocessor; 78 : 79 54230664 : return factor; 80 : } 81 : 82 : template class PressureTempl<false>; 83 : template class PressureTempl<true>;