www.mooseframework.org
RampIC.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 
8 #include "RampIC.h"
9 #include "FEProblem.h"
10 #include "MooseMesh.h"
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<InitialCondition>();
17  params.addClassDescription(
18  "Linear ramp along the x-axis with given values at the left and right extreme points.");
19  params.addRequiredParam<Real>("value_left", "The value on left (xmin) boundary.");
20  params.addRequiredParam<Real>("value_right", "The value on right (xmax) boundary.");
21  return params;
22 }
23 
24 RampIC::RampIC(const InputParameters & parameters)
25  : InitialCondition(parameters),
26  _xlength(_fe_problem.mesh().dimensionWidth(0)),
27  _xmin(_fe_problem.mesh().getMinInDimension(0)),
28  _value_left(getParam<Real>("value_left")),
29  _value_right(getParam<Real>("value_right"))
30 {
31 }
32 
33 Real
34 RampIC::value(const Point & p)
35 {
36  return (_value_right - _value_left) / _xlength * (p(0) - _xmin) + _value_left;
37 }
38 
39 RealGradient
40 RampIC::gradient(const Point & /*p*/)
41 {
42  return (_value_right - _value_left) / _xlength;
43 }
InputParameters validParams< RampIC >()
Definition: RampIC.C:14
const Real _value_left
Definition: RampIC.h:40
const Real _value_right
Definition: RampIC.h:41
const Real _xmin
Definition: RampIC.h:39
virtual RealGradient gradient(const Point &)
The value of the gradient at a point.
Definition: RampIC.C:40
virtual Real value(const Point &p)
The value of the variable at a point.
Definition: RampIC.C:34
const Real _xlength
Definition: RampIC.h:38
RampIC(const InputParameters &parameters)
Definition: RampIC.C:24