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