19 "Define a bicubic spline function from interpolated data defined by input parameters.");
21 MooseEnum normal_component(
"x=0 y=1 z=2",
"z");
25 "The component of the geometry that is normal to the spline x1/x2 values");
26 params.
addRequiredParam<std::vector<Real>>(
"x1",
"The first independent coordinate.");
27 params.
addRequiredParam<std::vector<Real>>(
"x2",
"The second independent coordinate.");
30 "yx11",
"The values of the derivative wrt x1 on the lower interpolation grid points.");
32 "yx1n",
"The values of the derivative wrt x1 on the upper interpolation grid points.");
34 "yx21",
"The values of the derivative wrt x2 on the lower interpolation grid points.");
36 "yx2n",
"The values of the derivative wrt x2 on the upper interpolation grid points.");
38 "yx1",
"1e30",
"The functional form of the derivative with respect to x1.");
40 "yx2",
"1e30",
"The functional form of the derivative with respect to x2.");
48 _normal_component(getParam<
MooseEnum>(
"normal_component")),
49 _yx1(getFunction(
"yx1")),
50 _yx2(getFunction(
"yx2"))
52 _x1 = getParam<std::vector<Real>>(
"x1");
53 _x2 = getParam<std::vector<Real>>(
"x2");
54 std::vector<Real> yvec = getParam<std::vector<Real>>(
"y");
64 unsigned int m =
_x1.size(), n =
_x2.size(), mn = yvec.size();
66 mooseError(
"The length of the supplied y must be equal to the lengths of x1 and x2 multiplied " 69 std::vector<std::vector<Real>> y(m, std::vector<Real>(n));
71 for (
unsigned int i = 0; i < m; ++i)
72 for (
unsigned int j = 0; j < n; ++j)
76 _yx11.resize(n, 1e30);
77 else if (
_yx11.size() != n)
78 mooseError(
"The length of the vectors holding the first derivatives of y with respect to x1 " 79 "must match the length of x2.");
82 _yx1n.resize(n, 1e30);
83 else if (
_yx1n.size() != n)
84 mooseError(
"The length of the vectors holding the first derivatives of y with respect to x1 " 85 "must match the length of x2.");
88 _yx21.resize(m, 1e30);
89 else if (
_yx21.size() != m)
90 mooseError(
"The length of the vectors holding the first derivatives of y with respect to x2 " 91 "must match the length of x1.");
94 _yx2n.resize(m, 1e30);
95 else if (
_yx2n.size() != m)
96 mooseError(
"The length of the vectors holding the first derivatives of y with respect to x2 " 97 "must match the length of x1.");
166 else if (deriv_var == 2)
224 else if (deriv_var == 2)
Real sample(Real x1, Real x2, Real yx11=_deriv_bound, Real yx1n=_deriv_bound)
Samples value at point (x1, x2)
Base class for function objects.
virtual RealGradient gradient(Real t, const Point &p) const override
Function objects can optionally provide a gradient at a point.
BicubicSplineInterpolation _ipol
BicubicSplineFunction(const InputParameters ¶meters)
virtual Real secondDerivative(const Point &p, unsigned int deriv_var) const
registerMooseObject("MooseApp", BicubicSplineFunction)
Real sampleDerivative(Real x1, Real x2, unsigned int deriv_var, Real yp1=_deriv_bound, Real ypn=_deriv_bound)
Samples first derivative at point (x1, x2)
std::vector< Real > _yx2n
std::vector< Real > _yx1n
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
static InputParameters validParams()
virtual Real derivative(const Point &p, unsigned int deriv_var) const
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
unsigned int _normal_component
Function that uses spline interpolation.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< Real > _yx21
std::vector< Real > _yx11
Real sample2ndDerivative(Real x1, Real x2, unsigned int deriv_var, Real yp1=_deriv_bound, Real ypn=_deriv_bound)
Samples second derivative at point (x1, x2)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
static InputParameters validParams()
Class constructor.
Interface for objects that need to use functions.
virtual Real value(Real t, const Point &p) const override
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
void setData(const std::vector< Real > &x1, const std::vector< Real > &x2, const std::vector< std::vector< Real >> &y, const std::vector< Real > &yx11=std::vector< Real >(), const std::vector< Real > &yx1n=std::vector< Real >(), const std::vector< Real > &yx21=std::vector< Real >(), const std::vector< Real > &yx2n=std::vector< Real >())
Set the x1, x2 and y values, and first derivatives at the edges.