LCOV - code coverage report
Current view: top level - src/bcs - Pressure.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #32971 (54bef8) with base c6cf66 Lines: 31 34 91.2 %
Date: 2026-05-29 20:40:07 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        2232 : registerMoosePressureAction("SolidMechanicsApp", Pressure, PressureAction);
      21             : 
      22             : template <bool is_ad>
      23             : InputParameters
      24        5505 : PressureTempl<is_ad>::validParams()
      25             : {
      26        5505 :   InputParameters params = PressureParent<is_ad>::validParams();
      27        5505 :   params.addClassDescription("Applies a pressure on a given boundary in a given direction");
      28        5505 :   params += actionParams();
      29        5505 :   return params;
      30           0 : }
      31             : 
      32             : template <bool is_ad>
      33             : InputParameters
      34        6063 : PressureTempl<is_ad>::actionParams()
      35             : {
      36        6063 :   InputParameters params = PressureParent<is_ad>::actionParams();
      37       12126 :   params.addDeprecatedParam<Real>("constant",
      38             :                                   "The magnitude to use in computing the pressure",
      39             :                                   "Use 'factor' in place of 'constant'");
      40       12126 :   params.addParam<Real>("factor", 1.0, "The magnitude to use in computing the pressure");
      41       12126 :   params.addParam<FunctionName>("function", "The function that describes the pressure");
      42       12126 :   params.addParam<PostprocessorName>("postprocessor",
      43             :                                      "Postprocessor that will supply the pressure value");
      44             : 
      45       12126 :   params.addParam<Real>("hht_alpha",
      46       12126 :                         0,
      47             :                         "alpha parameter for mass dependent numerical damping induced "
      48             :                         "by HHT time integration scheme");
      49        6063 :   return params;
      50           0 : }
      51             : 
      52             : template <bool is_ad>
      53        1995 : PressureTempl<is_ad>::PressureTempl(const InputParameters & parameters)
      54             :   : PressureParent<is_ad>(parameters),
      55        4708 :     _factor(parameters.isParamSetByUser("factor")     ? this->template getParam<Real>("factor")
      56        3272 :             : parameters.isParamSetByUser("constant") ? this->template getParam<Real>("constant")
      57             :                                                       : 1.0),
      58        5692 :     _function(this->isParamValid("function") ? &this->getFunction("function") : NULL),
      59        1995 :     _postprocessor(
      60        4008 :         this->isParamValid("postprocessor") ? &this->getPostprocessorValue("postprocessor") : NULL),
      61        5985 :     _alpha(this->template getParam<Real>("hht_alpha"))
      62             : {
      63        2713 :   if (parameters.isParamSetByUser("factor") && parameters.isParamSetByUser("constant"))
      64           0 :     mooseError("Cannot set 'factor' and 'constant'.");
      65        1995 : }
      66             : 
      67             : template <bool is_ad>
      68             : GenericReal<is_ad>
      69    39784130 : PressureTempl<is_ad>::computePressure() const
      70             : {
      71    39784130 :   GenericReal<is_ad> factor = _factor;
      72             : 
      73    39784130 :   if (_function)
      74    38464944 :     factor *= _function->value(_t + _alpha * _dt, _q_point[_qp]);
      75             : 
      76    39784130 :   if (_postprocessor)
      77         960 :     factor *= *_postprocessor;
      78             : 
      79    39784130 :   return factor;
      80             : }
      81             : 
      82             : template class PressureTempl<false>;
      83             : template class PressureTempl<true>;

Generated by: LCOV version 1.14