www.mooseframework.org
Pressure.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 "Pressure.h"
11 #include "Function.h"
12 #include "MooseError.h"
13 
14 registerMooseObject("TensorMechanicsApp", Pressure);
15 
17 
18 InputParameters
20 {
21  InputParameters params = IntegratedBC::validParams();
22  params.addClassDescription("Applies a pressure on a given boundary in a given direction");
23  params.addRequiredParam<unsigned int>("component", "The component for the pressure");
24  params.addParam<Real>("factor", 1.0, "The magnitude to use in computing the pressure");
25  params.addParam<FunctionName>("function", "The function that describes the pressure");
26  params.addParam<PostprocessorName>("postprocessor",
27  "Postprocessor that will supply the pressure value");
28  params.addParam<Real>("alpha", 0.0, "alpha parameter required for HHT time integration scheme");
29  params.set<bool>("use_displaced_mesh") = true;
30  return params;
31 }
32 
33 Pressure::Pressure(const InputParameters & parameters)
34  : IntegratedBC(parameters),
35  _component(getParam<unsigned int>("component")),
36  _factor(getParam<Real>("factor")),
37  _function(isParamValid("function") ? &getFunction("function") : NULL),
38  _postprocessor(isParamValid("postprocessor") ? &getPostprocessorValue("postprocessor") : NULL),
39  _alpha(getParam<Real>("alpha"))
40 {
41  if (_component > 2)
42  mooseError("Invalid component given for ", name(), ": ", _component, ".\n");
43 }
44 
45 Real
47 {
48  Real factor = _factor;
49 
50  if (_function)
51  factor *= _function->value(_t + _alpha * _dt, _q_point[_qp]);
52 
53  if (_postprocessor)
54  factor *= *_postprocessor;
55 
56  return factor * (_normals[_qp](_component) * _test[_i][_qp]);
57 }
Pressure
Pressure applies a pressure on a given boundary in the direction defined by component.
Definition: Pressure.h:23
Pressure::computeQpResidual
virtual Real computeQpResidual()
Definition: Pressure.C:46
Pressure::_alpha
const Real _alpha
_alpha Parameter for HHT time integration scheme
Definition: Pressure.h:42
Pressure::Pressure
Pressure(const InputParameters &parameters)
Definition: Pressure.C:33
Pressure::_factor
const Real _factor
Definition: Pressure.h:35
Pressure.h
registerMooseObject
registerMooseObject("TensorMechanicsApp", Pressure)
validParams
InputParameters validParams()
defineLegacyParams
defineLegacyParams(Pressure)
name
const std::string name
Definition: Setup.h:21
Pressure::_function
const Function *const _function
Definition: Pressure.h:37
Pressure::validParams
static InputParameters validParams()
Definition: Pressure.C:19
Pressure::_component
const int _component
Definition: Pressure.h:33
Pressure::_postprocessor
const PostprocessorValue *const _postprocessor
Definition: Pressure.h:39