LCOV - code coverage report
Current view: top level - src/bcs - Pressure.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 30 34 88.2 %
Date: 2025-09-04 07:57:23 Functions: 10 10 100.0 %
Legend: Lines: hit not hit

          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        4032 : registerMoosePressureAction("SolidMechanicsApp", Pressure, PressureAction);
      21             : 
      22             : template <bool is_ad>
      23             : InputParameters
      24        9914 : PressureTempl<is_ad>::validParams()
      25             : {
      26        9914 :   InputParameters params = PressureParent<is_ad>::validParams();
      27        9914 :   params.addClassDescription("Applies a pressure on a given boundary in a given direction");
      28        9914 :   params += actionParams();
      29        9914 :   return params;
      30           0 : }
      31             : 
      32             : template <bool is_ad>
      33             : InputParameters
      34       10922 : PressureTempl<is_ad>::actionParams()
      35             : {
      36       10922 :   InputParameters params = PressureParent<is_ad>::actionParams();
      37       21844 :   params.addDeprecatedParam<Real>("constant",
      38             :                                   "The magnitude to use in computing the pressure",
      39             :                                   "Use 'factor' in place of 'constant'");
      40       21844 :   params.addParam<Real>("factor", 1.0, "The magnitude to use in computing the pressure");
      41       21844 :   params.addParam<FunctionName>("function", "The function that describes the pressure");
      42       21844 :   params.addParam<PostprocessorName>("postprocessor",
      43             :                                      "Postprocessor that will supply the pressure value");
      44             : 
      45       21844 :   params.addParam<Real>("hht_alpha",
      46       21844 :                         0,
      47             :                         "alpha parameter for mass dependent numerical damping induced "
      48             :                         "by HHT time integration scheme");
      49       10922 :   return params;
      50           0 : }
      51             : 
      52             : template <bool is_ad>
      53        3589 : PressureTempl<is_ad>::PressureTempl(const InputParameters & parameters)
      54             :   : PressureParent<is_ad>(parameters),
      55        8459 :     _factor(parameters.isParamSetByUser("factor")     ? this->template getParam<Real>("factor")
      56        5897 :             : parameters.isParamSetByUser("constant") ? this->template getParam<Real>("constant")
      57             :                                                       : 1.0),
      58       10271 :     _function(this->isParamValid("function") ? &this->getFunction("function") : NULL),
      59        3589 :     _postprocessor(
      60        7178 :         this->isParamValid("postprocessor") ? &this->getPostprocessorValue("postprocessor") : NULL),
      61       10767 :     _alpha(this->template getParam<Real>("hht_alpha"))
      62             : {
      63        4870 :   if (parameters.isParamSetByUser("factor") && parameters.isParamSetByUser("constant"))
      64           0 :     mooseError("Cannot set 'factor' and 'constant'.");
      65        3589 : }
      66             : 
      67             : template <bool is_ad>
      68             : GenericReal<is_ad>
      69    68621993 : PressureTempl<is_ad>::computePressure() const
      70             : {
      71    68621993 :   GenericReal<is_ad> factor = _factor;
      72             : 
      73    68621993 :   if (_function)
      74    65958032 :     factor *= _function->value(_t + _alpha * _dt, _q_point[_qp]);
      75             : 
      76    68621993 :   if (_postprocessor)
      77           0 :     factor *= *_postprocessor;
      78             : 
      79    68621993 :   return factor;
      80             : }
      81             : 
      82             : template class PressureTempl<false>;
      83             : template class PressureTempl<true>;

Generated by: LCOV version 1.14