Interpolation functions

Throughout the code NEML uses interpolation functions to represent model parameters that depend on temperature or, occasionally, some other variable. A NEML interpolation function is a scalar function of a single variable f\left( x \right).

The interface must also provide the first derivative of the function with respect that the variable.

These interpolation functions are used throughout NEML in place of scalar parameters. Except where noted, currently only for the InterpolatedIsotrpicHardeningRule, interpolation functions are used to give the parameter as a function of temperature. A constant parameter, e.g. one that does not depend on temperature can be expressed by using a ConstantInterpolate object.

Interpolate

The interface for all interpolate objects.

class Interpolate : public neml::NEMLObject

Base class for interpolation functions.

Subclassed by neml::ConstantInterpolate, neml::ExpInterpolate, neml::GenericPiecewiseInterpolate, neml::MTSInterpolate, neml::MTSShearInterpolate, neml::PiecewiseLinearInterpolate, neml::PiecewiseLogLinearInterpolate, neml::PiecewiseSemiLogXLinearInterpolate, neml::PolynomialInterpolate, neml::PowerLawInterpolate

Public Functions

Interpolate(ParameterSet &params)
virtual double value(double x) const = 0

Returns the value of the function.

virtual double derivative(double x) const = 0

Returns the derivative of the function.

double operator()(double x) const

Nice wrapper for function call syntax.

bool valid() const

Is the interpolate valid?

ConstantInterpolate

Expresses a constant parameter

f\left( x \right) = C.

class ConstantInterpolate : public neml::Interpolate

A constant value.

Public Functions

ConstantInterpolate(ParameterSet &params)

The parameter is the constant value!

virtual double value(double x) const

Returns the value of the function.

virtual double derivative(double x) const

Returns the derivative of the function.

Public Static Functions

static std::string type()

Type for the object system.

static ParameterSet parameters()

Create parameters for the object system.

static std::unique_ptr<NEMLObject> initialize(ParameterSet &params)

Create object from a ParameterSet.

GenericPiecewiseInterpolate

A general piecewise interpolate. If x \le p_i then it calls interpolation function f_i. For x > p_i it calls interpolation function f_{i+1}.

class GenericPiecewiseInterpolate : public neml::Interpolate

Generic piecewise interpolation.

Public Functions

GenericPiecewiseInterpolate(ParameterSet &params)
virtual double value(double x) const

Returns the value of the function.

virtual double derivative(double x) const

Returns the derivative of the function.

Public Static Functions

static std::string type()

Type for the object system.

static ParameterSet parameters()

Create parameters for the object system.

static std::unique_ptr<NEMLObject> initialize(ParameterSet &params)

Create object from a ParameterSet.

PolynomialInterpolate

Polynomial interpolation of the type

f\left( x \right) = \sum_{i=1}^{n}c_{i}x^{i-1}.

The polynomial coefficients are given starting with the highest order, like in the numpy library.

class PolynomialInterpolate : public neml::Interpolate

Simple polynomial interpolation.

Public Functions

PolynomialInterpolate(ParameterSet &params)

Input is the coefficients of the polynomial, from highest to lowest order.

virtual double value(double x) const

Returns the value of the function.

virtual double derivative(double x) const

Returns the derivative of the function.

Public Static Functions

static std::string type()

Type for the object system.

static ParameterSet parameters()

Create parameters for the object system.

static std::unique_ptr<NEMLObject> initialize(ParameterSet &params)

Create object from a ParameterSet.

PiecewiseLinearInterpolate

Piecewise linear interpolation where parameters give the x and y coordinates of the endpoints of each linear segment. For x_{i} \le x \le x_{i+1}

f\left( x \right) = \frac{y_{i+1} - y_{i}}{x_{i+1} - x_{i}}
   \left(x - x_i \right) + y_i.

For x < x_1 the function returns y_1 and for x > x_n the function returns y_n.

class PiecewiseLinearInterpolate : public neml::Interpolate

Piecewise linear interpolation.

Public Functions

PiecewiseLinearInterpolate(ParameterSet &params)

Parameters are a list of x coordinates and a corresponding list of y coordinates

virtual double value(double x) const

Returns the value of the function.

virtual double derivative(double x) const

Returns the derivative of the function.

Public Static Functions

static std::string type()

Type for the object system.

static ParameterSet parameters()

Create parameters for the object system.

static std::unique_ptr<NEMLObject> initialize(ParameterSet &params)

Create object from a ParameterSet.

PiecewiseLogLinearInterpolate

Exactly like PiecewiseLinearInterpolate except the interpolation in y is done in log space. The input y values are given as y_i = \ln{v_i} where v_i is the actual value of the function at x_i. For x_{i} \le x \le x_{i+1}

f\left( x \right) = \exp{\left(\frac{y_{i+1} - y_{i}}{x_{i+1} - x_{i}}
   \left(x - x_i \right) + y_i\right)}.

For x < x_1 the function returns \exp{\left(y_1\right)} and for x > x_n the function returns \exp{\left(y_n\right)}.

class PiecewiseLogLinearInterpolate : public neml::Interpolate

Piecewise loglinear interpolation.

Public Functions

PiecewiseLogLinearInterpolate(ParameterSet &params)

Similar to piecewise linear interpolation except the y coordinates are given as ln(y) and the interpolation is done in log space

virtual double value(double x) const

Returns the value of the function.

virtual double derivative(double x) const

Returns the derivative of the function.

Public Static Functions

static std::string type()

Type for the object system.

static ParameterSet parameters()

Create parameters for the object system.

static std::unique_ptr<NEMLObject> initialize(ParameterSet &params)

Create object from a ParameterSet.

MTSShearInterpolate

The shear modulus interpolation used in the Mechanical Threshold Stress [MTS1999] flow stress model

f\left( x \right) = V_0 - \frac{D}{e^{T_0 / x} - 1}.

class MTSShearInterpolate : public neml::Interpolate

The MTS shear modulus function proposed in the original paper.

Public Functions

MTSShearInterpolate(ParameterSet &params)

Interpolation using the MTS model form f(x) = V0 - D / (exp(T0 / x) - 1)

virtual double value(double x) const

Returns the value of the function.

virtual double derivative(double x) const

Returns the derivative of the function.

Public Static Functions

static std::string type()

Type for the object system.

static ParameterSet parameters()

Create parameters for the object system.

static std::unique_ptr<NEMLObject> initialize(ParameterSet &params)

Create object from a ParameterSet.

Helper Functions

std::vector<std::shared_ptr<Interpolate>> neml::make_vector(const std::vector<double> &iv)

A helper to make a vector of constant interpolates from a vector.

std::vector<double> neml::eval_vector(const std::vector<std::shared_ptr<Interpolate>> &iv, double x)

A helper to evaluate a vector of interpolates.

std::vector<double> neml::eval_deriv_vector(const std::vector<std::shared_ptr<Interpolate>> &iv, double x)

A helper to evaluate the derivative of a vector of interpolates.