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 
18 {
20  params.addClassDescription(
21  "Linear ramp along the x-axis with given values at the left and right extreme points.");
22  params.addRequiredParam<Real>("value_left", "The value on left (xmin) boundary.");
23  params.addRequiredParam<Real>("value_right", "The value on right (xmax) boundary.");
24  return params;
25 }
26 
27 RampIC::RampIC(const InputParameters & parameters)
28  : InitialCondition(parameters),
29  _xlength(_fe_problem.mesh().dimensionWidth(0)),
30  _xmin(_fe_problem.mesh().getMinInDimension(0)),
31  _value_left(getParam<Real>("value_left")),
32  _value_right(getParam<Real>("value_right"))
33 {
34 }
35 
36 Real
37 RampIC::value(const Point & p)
38 {
39  return (_value_right - _value_left) / _xlength * (p(0) - _xmin) + _value_left;
40 }
41 
43 RampIC::gradient(const Point & /*p*/)
44 {
45  return (_value_right - _value_left) / _xlength;
46 }
const Real _value_left
Definition: RampIC.h:31
const Real _value_right
Definition: RampIC.h:32
MeshBase & mesh
static InputParameters validParams()
const Real _xmin
Definition: RampIC.h:30
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual RealGradient gradient(const Point &)
Definition: RampIC.C:43
Makes initial condition which creates a linear ramp of the given variable on the x-axis with specifie...
Definition: RampIC.h:18
virtual Real value(const Point &p)
Definition: RampIC.C:37
registerMooseObject("PhaseFieldApp", RampIC)
static InputParameters validParams()
Definition: RampIC.C:17
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _xlength
Definition: RampIC.h:29
void addClassDescription(const std::string &doc_string)
RampIC(const InputParameters &parameters)
Definition: RampIC.C:27