13#include "libmesh/dense_matrix.h"
14#include "libmesh/dense_vector.h"
30 const Real & f2_end_value,
31 const Real & df1dx_end_value,
32 const Real & df2dx_end_value)
36 DenseMatrix<Real> mat(4, 4);
38 mat(0, 0) = std::pow(
_x1, 3);
39 mat(0, 1) = std::pow(
_x1, 2);
43 mat(1, 0) = std::pow(
_x2, 3);
44 mat(1, 1) = std::pow(
_x2, 2);
48 mat(2, 0) = 3.0 * std::pow(
_x1, 2);
49 mat(2, 1) = 2.0 *
_x1;
53 mat(3, 0) = 3.0 * std::pow(
_x2, 2);
54 mat(3, 1) = 2.0 *
_x2;
58 DenseVector<Real> rhs(4);
59 rhs(0) = f1_end_value;
60 rhs(1) = f2_end_value;
61 rhs(2) = df1dx_end_value;
62 rhs(3) = df2dx_end_value;
64 DenseVector<Real> coefs(4);
65 mat.lu_solve(rhs, coefs);
78 mooseAssert(
_initialized,
"initialize() must be called.");
85 return _A * std::pow(
x, 3) +
_B * std::pow(
x, 2) +
_C *
x +
_D;
91 mooseAssert(
_initialized,
"initialize() must be called.");
98 return 3.0 *
_A * std::pow(
x, 2) + 2.0 *
_B *
x +
_C;
const std::vector< double > x
CubicTransition(const Real &x_center, const Real &transition_width)
Constructor.
Real derivative(const Real &x, const Real &df1dx, const Real &df2dx) const
Computes the derivative of the transition value.
virtual Real value(const Real &x, const Real &f1, const Real &f2) const override
Computes the transition value.
bool _initialized
Flag that transition has been initialized.
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.
Base class for smooth transitions between two functions of one variable.
const Real _x1
Left end point of transition.
const Real _x2
Right end point of transition.