https://mooseframework.inl.gov
Grad2ParsedFunction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 "Grad2ParsedFunction.h"
12 
14 
17 {
21  "direction",
22  "The direction in which to take the derivative. This must not be a zero-length "
23  "vector. This function returned a finite-difference approx to "
24  "(direction.nabla)^2 function");
25  return params;
26 }
27 
29  : MooseParsedFunction(parameters), _direction(getParam<RealVectorValue>("direction"))
30 {
32  if (_len2 == 0)
33  mooseError("The direction in the Grad2ParsedFunction must have positive length.");
34 }
35 
36 Real
37 Grad2ParsedFunction::value(Real t, const Point & p) const
38 {
39  return (_function_ptr->evaluate<Real>(t, p + _direction) -
40  2 * _function_ptr->evaluate<Real>(t, p) +
41  _function_ptr->evaluate<Real>(t, p - _direction)) /
42  _len2;
43 }
std::unique_ptr< MooseParsedFunctionWrapper > _function_ptr
Grad2ParsedFunction(const InputParameters &parameters)
registerMooseObject("RichardsApp", Grad2ParsedFunction)
returns the central difference approx to the derivative (direction.nabla)^2 function viz (f(t...
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
RealVectorValue _direction
central difference direction
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void mooseError(Args &&... args) const
virtual Real value(Real t, const Point &pt) const
Real _len2
|_direction|^2