www.mooseframework.org
Pressure.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "Pressure.h"
8 #include "Function.h"
9 #include "MooseError.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<IntegratedBC>();
16  params.addClassDescription("Applies a pressure on a given boundary in a given direction");
17  params.addRequiredParam<unsigned int>("component", "The component for the pressure");
18  params.addParam<Real>("factor", 1.0, "The magnitude to use in computing the pressure");
19  params.addParam<FunctionName>("function", "The function that describes the pressure");
20  params.addParam<PostprocessorName>("postprocessor",
21  "Postprocessor that will supply the pressure value");
22  params.addParam<Real>("alpha", 0.0, "alpha parameter required for HHT time integration scheme");
23  params.set<bool>("use_displaced_mesh") = true;
24  return params;
25 }
26 
27 Pressure::Pressure(const InputParameters & parameters)
28  : IntegratedBC(parameters),
29  _component(getParam<unsigned int>("component")),
30  _factor(getParam<Real>("factor")),
31  _function(isParamValid("function") ? &getFunction("function") : NULL),
32  _postprocessor(isParamValid("postprocessor") ? &getPostprocessorValue("postprocessor") : NULL),
33  _alpha(getParam<Real>("alpha"))
34 {
35  if (_component > 2)
36  mooseError("Invalid component given for ", name(), ": ", _component, ".\n");
37 }
38 
39 Real
41 {
42  Real factor = _factor;
43 
44  if (_function)
45  factor *= _function->value(_t + _alpha * _dt, _q_point[_qp]);
46 
47  if (_postprocessor)
48  factor *= *_postprocessor;
49 
50  return factor * (_normals[_qp](_component) * _test[_i][_qp]);
51 }
virtual Real computeQpResidual()
Definition: Pressure.C:40
const Real _factor
Definition: Pressure.h:31
InputParameters validParams< Pressure >()
Definition: Pressure.C:13
Pressure(const InputParameters &parameters)
Definition: Pressure.C:27
const int _component
Definition: Pressure.h:29
const Real _alpha
_alpha Parameter for HHT time integration scheme
Definition: Pressure.h:38
Function *const _function
Definition: Pressure.h:33
const PostprocessorValue *const _postprocessor
Definition: Pressure.h:35