www.mooseframework.org
SinDirichletBC.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "SinDirichletBC.h"
16 
17 template <>
20 {
22  params.set<Real>("initial") = 0.0;
23  params.set<Real>("final") = 0.0;
24  params.set<Real>("duration") = 0.0;
25  params.addClassDescription(
26  "Imposes a time-varying essential boundary condition $u=g(t)$, where $g(t)$ "
27  "varies from an given initial value at time $t=0$ to a given final value over a specified "
28  "duration.");
29  return params;
30 }
31 
33  : NodalBC(parameters),
34  _initial(getParam<Real>("initial")),
35  _final(getParam<Real>("final")),
36  _duration(getParam<Real>("duration"))
37 {
38 }
39 
40 Real
42 {
43  Real value;
44 
45  if (_t < _duration)
46  value = _initial + (_final - _initial) * std::sin((0.5 / _duration) * libMesh::pi * _t);
47  else
48  value = _final;
49 
50  return _u[_qp] - value;
51 }
virtual Real computeQpResidual() override
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< SinDirichletBC >()
Base class for deriving any boundary condition that works at nodes.
Definition: NodalBC.h:38
InputParameters validParams< NodalBC >()
Definition: NodalBC.C:23
SinDirichletBC(const InputParameters &parameters)
virtual const VariableValue & value()
The value of the variable this object is operating on.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
const VariableValue & _u
Value of the unknown variable this BC is acting on.
Definition: NodalBC.h:58
unsigned int _qp
Quadrature point index.
Definition: NodalBC.h:56