www.mooseframework.org
ADPressure.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "ADPressure.h"
11 #include "Function.h"
12 #include "MooseError.h"
13 
14 registerADMooseObject("TensorMechanicsApp", ADPressure);
15 
17 
18 template <ComputeStage compute_stage>
19 InputParameters
21 {
22  InputParameters params = ADIntegratedBC<compute_stage>::validParams();
23  params.addClassDescription("Applies a pressure on a given boundary in a given direction");
24  params.addRequiredRangeCheckedParam<unsigned int>(
25  "component", "component <= 2", "The component for the pressure");
26  params.addParam<Real>("constant", 1.0, "The magnitude to use in computing the pressure");
27  params.addParam<FunctionName>("function", "The function that describes the pressure");
28  params.addParam<PostprocessorName>("postprocessor",
29  "Postprocessor that will supply the pressure value");
30  params.addParam<Real>("alpha", 0.0, "alpha parameter required for HHT time integration scheme");
31  params.set<bool>("use_displaced_mesh") = true;
32  return params;
33 }
34 
35 template <ComputeStage compute_stage>
36 ADPressure<compute_stage>::ADPressure(const InputParameters & parameters)
37  : ADIntegratedBC<compute_stage>(parameters),
38  _component(getParam<unsigned int>("component")),
39  _constant(getParam<Real>("constant")),
40  _function(isParamValid("function") ? &this->getFunction("function") : nullptr),
41  _postprocessor(isParamValid("postprocessor") ? &this->getPostprocessorValue("postprocessor")
42  : nullptr),
43  _alpha(getParam<Real>("alpha"))
44 {
45 }
46 
47 template <ComputeStage compute_stage>
48 ADReal
50 {
51  ADReal factor = _constant;
52 
53  if (_function)
54  factor *= _function->value(_t + _alpha * _dt, _q_point[_qp]);
55 
56  if (_postprocessor)
57  factor *= *_postprocessor;
58 
59  return factor * (_normals[_qp](_component) * _test[_i][_qp]);
60 }
ADPressure
ADPressure applies a pressure on a given boundary in the direction defined by component.
Definition: ADPressure.h:17
ADPressure.h
registerADMooseObject
registerADMooseObject("TensorMechanicsApp", ADPressure)
ADPressure::ADPressure
ADPressure(const InputParameters &parameters)
Definition: ADPressure.C:36
validParams
InputParameters validParams()
defineADLegacyParams
defineADLegacyParams(ADPressure)
ADPressure::validParams
static InputParameters validParams()
Definition: ADPressure.C:20
ADPressure::computeQpResidual
ADReal computeQpResidual() override
Definition: ADPressure.C:49