www.mooseframework.org
SinNeumannBC.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 "SinNeumannBC.h"
16 
17 template <>
20 {
22  params.addParam<Real>("initial", 0.0, "The initial value of the gradient on the boundary");
23  params.addParam<Real>("final", 0.0, "The final value of the gradient on the boundary");
24  params.addParam<Real>("duration", 0.0, "The duration of the ramp");
25  params.addClassDescription("Imposes a time-varying flux boundary condition $\\frac{\\partial "
26  "u}{\\partial n}=g(t)$, where $g(t)$ "
27  "varies from an given initial value at time $t=0$ to a given final "
28  "value over a specified duration.");
29  return params;
30 }
31 
33  : IntegratedBC(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 -_test[_i][_qp] * value;
51 }
const VariableTestValue & _test
test function values (in QPs)
Definition: IntegratedBC.h:105
InputParameters validParams< IntegratedBC >()
Definition: IntegratedBC.C:28
virtual Real computeQpResidual() override
Definition: SinNeumannBC.C:41
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< SinNeumannBC >()
Definition: SinNeumannBC.C:19
SinNeumannBC(const InputParameters &parameters)
Definition: SinNeumannBC.C:32
Base class for deriving any boundary condition of a integrated type.
Definition: IntegratedBC.h:33
virtual const VariableValue & value()
The value of the variable this object is operating on.
unsigned int _qp
quadrature point index
Definition: IntegratedBC.h:83
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...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
unsigned int _i
i-th, j-th index for enumerating test and shape functions
Definition: IntegratedBC.h:93