https://mooseframework.inl.gov
CubicTransitionFunction.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 
11 
12 registerMooseObject("ThermalHydraulicsApp", CubicTransitionFunction);
13 
16 {
18 
19  params.addRequiredParam<Real>("function1_derivative_end_point", "First function");
20  params.addRequiredParam<Real>("function2_derivative_end_point", "Second function");
21 
22  params.addClassDescription("Computes a cubic polynomial transition between two functions");
23 
24  return params;
25 }
26 
28  : SmoothTransitionFunction(parameters),
29 
30  _df1dx_end_point(getParam<Real>("function1_derivative_end_point")),
31  _df2dx_end_point(getParam<Real>("function2_derivative_end_point")),
32 
33  _transition(_x_center, _transition_width)
34 {
35  Point p1, p2;
36  Real t1 = 0.0, t2 = 0.0;
37  if (_use_time)
38  {
39  t1 = _transition.leftEnd();
40  t2 = _transition.rightEnd();
41  }
42  else
43  {
46  }
47 
50 }
51 
52 Real
53 CubicTransitionFunction::value(Real t, const Point & p) const
54 {
55  const Real x = _use_time ? t : p(_component);
56 
57  return _transition.value(x, _function1.value(t, p), _function2.value(t, p));
58 }
59 
61 CubicTransitionFunction::gradient(Real /*t*/, const Point & /*p*/) const
62 {
63  mooseError(name(), ": ", __PRETTY_FUNCTION__, " is not implemented.");
64 }
void initialize(const Real &f1_end_value, const Real &f2_end_value, const Real &df1dx_end_value, const Real &df2dx_end_value)
Initializes the polynomial coefficients.
static InputParameters validParams()
CubicTransitionFunction(const InputParameters &parameters)
registerMooseObject("ThermalHydraulicsApp", CubicTransitionFunction)
const Function & _function1
First function.
Base class for functions to smoothly transition from one function to another.
const Function & _function2
Second function.
virtual RealVectorValue gradient(Real t, const Point &p) const
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
const std::vector< double > x
const Real & leftEnd() const
Returns the coordinate of the left end of the transition.
static InputParameters validParams()
virtual Real value(const Real &x, const Real &f1, const Real &f2) const override
Computes the transition value.
const Real & rightEnd() const
Returns the coordinate of the right end of the transition.
virtual Real value(Real t, const Point &p) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const bool _use_time
Use the time axis for transition?
const unsigned int _component
Component index of axis on which transition occurs.
void mooseError(Args &&... args) const
CubicTransition _transition
Transition object.
void addClassDescription(const std::string &doc_string)
Computes a cubic polynomial transition between two functions.
virtual Real value(Real t, const Point &p) const
const Real & _df2dx_end_point
Derivative of second function at end point.
const Real & _df1dx_end_point
Derivative of first function at end point.