22 params.
addClassDescription(
"Compute a property using a piecewise linear interpolation to define " 23 "its dependence on a variable");
25 "The name of the property this material will compute");
28 "The name of the variable whose value is used as the abscissa in the interpolation");
29 params.
addParam<std::vector<Real>>(
"x",
"The abscissa values");
30 params.
addParam<std::vector<Real>>(
"y",
"The ordinate values");
31 params.
addParam<std::vector<Real>>(
"xy_data",
32 "All function data, supplied in abscissa, ordinate pairs");
33 params.
addParam<
Real>(
"scale_factor", 1.0,
"Scale factor to be applied to the ordinate values");
37 "Use linear extrapolation to evaluate points that lie outside given data set domain. ");
45 _prop_name(getParam<
std::string>(
"property")),
46 _coupled_var(coupledValue(
"variable")),
47 _scale_factor(getParam<
Real>(
"scale_factor")),
48 _extrap(getParam<bool>(
"extrapolation")),
49 _property(declareProperty<
Real>(_prop_name)),
50 _dproperty(isCoupledConstant(
"variable")
52 : &declarePropertyDerivative<
Real>(_prop_name, coupledName(
"variable", 0)))
60 mooseError(
"In PiecewiseLinearInterpolationMaterial ",
62 ": Both 'x' and 'y' must be specified if either one is specified.");
65 mooseError(
"In PiecewiseLinearInterpolationMaterial ",
67 ": Cannot specify 'x', 'y', and 'xy_data' together.");
69 x = getParam<std::vector<Real>>(
"x");
70 y = getParam<std::vector<Real>>(
"y");
74 std::vector<Real> xy = getParam<std::vector<Real>>(
"xy_data");
75 unsigned int xy_size = xy.size();
77 mooseError(
"In PiecewiseLinearInterpolationMaterial ",
79 ": Length of data provided in 'xy_data' must be a multiple of 2.");
81 unsigned int x_size = xy_size / 2;
84 for (
unsigned int i = 0; i < xy_size / 2; ++i)
86 x.push_back(xy[i * 2]);
87 y.push_back(xy[i * 2 + 1]);
95 catch (std::domain_error & e)
97 mooseError(
"In PiecewiseLinearInterpolationMaterial ",
_name,
": ", e.what());
PiecewiseLinearInterpolationMaterial(const InputParameters ¶meters)
const std::string & _name
The name of this class, reference to value stored in InputParameters.
const VariableValue & _coupled_var
Value of the coupled variable to be used as the abscissa in the piecewise linear interpolation.
static InputParameters validParams()
const Real & _scale_factor
Factor to scale the ordinate values by (default = 1)
std::unique_ptr< LinearInterpolation > _linear_interp
LinearInterpolation object.
Materials compute MaterialProperties.
This material uses a LinearInterpolation object to define the dependence of the material's value on a...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Interface class ("Veneer") to provide generator methods for derivative material property names...
MaterialProperty< Real > *const _dproperty
First derivative of the material property wrt the coupled variable.
MaterialProperty< Real > & _property
Material property to be calculated.
registerMooseObject("MooseApp", PiecewiseLinearInterpolationMaterial)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
virtual void computeQpProperties() override
Users must override this method.
const InputParameters & parameters() const
Get the parameters of the object.
const bool _extrap
use linear extrapolation
static InputParameters validParams()