https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Pressure.C
Go to the documentation of this file.
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
17registerMooseObject("SolidMechanicsApp", Pressure);
18registerMooseObject("SolidMechanicsApp", ADPressure);
19
20registerMoosePressureAction("SolidMechanicsApp", Pressure, PressureAction);
21
22template <bool is_ad>
25{
27 params.addClassDescription("Applies a pressure on a given boundary in a given direction");
28 params += actionParams();
29 return params;
30}
31
32template <bool is_ad>
35{
37 params.addDeprecatedParam<Real>("constant",
38 "The magnitude to use in computing the pressure",
39 "Use 'factor' in place of 'constant'");
40 params.addParam<Real>("factor", 1.0, "The magnitude to use in computing the pressure");
41 params.addParam<FunctionName>("function", "The function that describes the pressure");
42 params.addParam<PostprocessorName>("postprocessor",
43 "Postprocessor that will supply the pressure value");
44
45 params.addParam<Real>("hht_alpha",
46 0,
47 "alpha parameter for mass dependent numerical damping induced "
48 "by HHT time integration scheme");
49 return params;
50}
51
52template <bool is_ad>
54 : PressureParent<is_ad>(parameters),
55 _factor(parameters.isParamSetByUser("factor") ? this->template getParam<Real>("factor")
56 : parameters.isParamSetByUser("constant") ? this->template getParam<Real>("constant")
57 : 1.0),
58 _function(this->isParamValid("function") ? &this->getFunction("function") : NULL),
59 _postprocessor(
60 this->isParamValid("postprocessor") ? &this->getPostprocessorValue("postprocessor") : NULL),
61 _alpha(this->template getParam<Real>("hht_alpha"))
62{
63 if (parameters.isParamSetByUser("factor") && parameters.isParamSetByUser("constant"))
64 mooseError("Cannot set 'factor' and 'constant'.");
65}
66
67template <bool is_ad>
70{
71 GenericReal<is_ad> factor = _factor;
72
73 if (_function)
74 factor *= _function->value(_t + _alpha * _dt, _q_point[_qp]);
75
76 if (_postprocessor)
77 factor *= *_postprocessor;
78
79 return factor;
80}
81
82template class PressureTempl<false>;
83template class PressureTempl<true>;
void mooseError(Args &&... args)
Moose::GenericType< Real, is_ad > GenericReal
typename std::conditional< is_ad, ADPressureBase, PressureBase >::type PressureParent
registerMoosePressureAction("SolidMechanicsApp", Pressure, PressureAction)
registerMooseObject("SolidMechanicsApp", Pressure)
bool isParamSetByUser(const std::string &name) const
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Pressure applies a pressure on a given boundary in the direction defined by component.
Definition Pressure.h:27
static InputParameters validParams()
Definition Pressure.C:24
GenericReal< is_ad > computePressure() const override
Definition Pressure.C:69
static InputParameters actionParams()
Definition Pressure.C:34
PressureTempl(const InputParameters &parameters)
Definition Pressure.C:53