https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
LinearTestMaterial Class Reference

Computes a material property that is linear with respect to a list of aux variables. More...

#include <LinearTestMaterial.h>

Inheritance diagram for LinearTestMaterial:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 LinearTestMaterial (const InputParameters &parameters)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual void computeQpProperties ()
 

Protected Attributes

const unsigned int _n_vars
 Number of aux variables the material property depends upon.
 
std::vector< const VariableValue * > _vars
 List of aux variables the material property depends upon.
 
const std::vector< Real > _slopes
 Slopes with respect to the nonlinear variables.
 
const Real _shift
 Shift constant: 'b' in 'y = m * x + b'.
 
const MaterialPropertyName _y_name
 Name of the new material property.
 
MaterialProperty< Real > & _y
 Linear material property.
 
std::vector< MaterialProperty< Real > * > _y_derivatives
 Derivatives of material property with respect to each aux variable.
 

Private Member Functions

bool haveMaterialProperty (const std::string &prop_name)
 
std::vector< VariableName > buildVariableVector (const VariableName &c1, const VariableName &c2, const VariableName &c3)
 
void validateCouplingHelper (const MaterialPropertyName &base, const std::vector< VariableName > &c, const System &system, std::vector< VariableName > &missing)
 
bool isNotObjectVariable (const VariableName &name)
 

Private Attributes

FEProblemBase_dmi_fe_problem
 

Detailed Description

Computes a material property that is linear with respect to a list of aux variables.

This material is not meant to represent anything physical; it is used for the testing of Jacobians of kernels, BCs, and materials where a material property is supplied to those objects. The property is computed as

\[ y = b + \sum\limits_i m_i x_i , \]

where \(y\) is the new material property, \(x_i\) are the aux variables, \(m_i\) are their slopes, and \(b\) is the shift constant.

Definition at line 26 of file LinearTestMaterial.h.

Constructor & Destructor Documentation

◆ LinearTestMaterial()

LinearTestMaterial::LinearTestMaterial ( const InputParameters parameters)

Definition at line 29 of file LinearTestMaterial.C.

31 _n_vars(coupledComponents("vars")),
32 _slopes(getParam<std::vector<Real>>("slopes")),
33 _shift(getParam<Real>("shift")),
34 _y_name(getParam<MaterialPropertyName>("name")),
35 _y(declareProperty<Real>(_y_name))
36{
37 // check that number of provided slopes is consistent with number of variables
38 if (_slopes.size() != _n_vars)
40 "LinearTestMaterial:", name(), ": Parameters 'vars' and 'slopes' must have same size.");
41
42 // get references to coupled variables and new material property derivatives
43 _vars.resize(_n_vars);
44 _y_derivatives.resize(_n_vars);
45 for (unsigned int i = 0; i < _n_vars; ++i)
46 {
47 _vars[i] = &coupledValue("vars", i);
48 if (!isCoupledConstant("vars"))
49 _y_derivatives[i] = &declarePropertyDerivative<Real>(_y_name, coupledName("vars", i));
50 }
51}
void mooseError(Args &&... args)
const std::string name
Definition Setup.h:21
const Real _shift
Shift constant: 'b' in 'y = m * x + b'.
std::vector< MaterialProperty< Real > * > _y_derivatives
Derivatives of material property with respect to each aux variable.
std::vector< const VariableValue * > _vars
List of aux variables the material property depends upon.
const std::vector< Real > _slopes
Slopes with respect to the nonlinear variables.
MaterialProperty< Real > & _y
Linear material property.
const MaterialPropertyName _y_name
Name of the new material property.
const unsigned int _n_vars
Number of aux variables the material property depends upon.

Member Function Documentation

◆ computeQpProperties()

void LinearTestMaterial::computeQpProperties ( )
protectedvirtual

Definition at line 54 of file LinearTestMaterial.C.

55{
56 _y[_qp] = _shift;
57 for (unsigned int i = 0; i < _n_vars; ++i)
58 {
59 _y[_qp] += _slopes[i] * (*_vars[i])[_qp];
60 if (_y_derivatives[i])
61 (*_y_derivatives[i])[_qp] = _slopes[i];
62 }
63}

◆ validParams()

InputParameters LinearTestMaterial::validParams ( )
static

Definition at line 15 of file LinearTestMaterial.C.

16{
18
19 params.addRequiredCoupledVar("vars",
20 "List of aux variables that the material property depends upon");
21 params.addRequiredParam<std::vector<Real>>(
22 "slopes", "Slopes of the material property with respect to each aux variable");
23 params.addParam<Real>("shift", 0, "Shift constant: 'b' in 'y = m * x + b'");
24 params.addRequiredParam<MaterialPropertyName>("name", "Name of the new material property");
25
26 return params;
27}
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Member Data Documentation

◆ _n_vars

const unsigned int LinearTestMaterial::_n_vars
protected

Number of aux variables the material property depends upon.

Definition at line 35 of file LinearTestMaterial.h.

Referenced by computeQpProperties(), and LinearTestMaterial().

◆ _shift

const Real LinearTestMaterial::_shift
protected

Shift constant: 'b' in 'y = m * x + b'.

Definition at line 44 of file LinearTestMaterial.h.

Referenced by computeQpProperties().

◆ _slopes

const std::vector<Real> LinearTestMaterial::_slopes
protected

Slopes with respect to the nonlinear variables.

Definition at line 41 of file LinearTestMaterial.h.

Referenced by computeQpProperties(), and LinearTestMaterial().

◆ _vars

std::vector<const VariableValue *> LinearTestMaterial::_vars
protected

List of aux variables the material property depends upon.

Definition at line 38 of file LinearTestMaterial.h.

Referenced by computeQpProperties(), and LinearTestMaterial().

◆ _y

MaterialProperty<Real>& LinearTestMaterial::_y
protected

Linear material property.

Definition at line 50 of file LinearTestMaterial.h.

Referenced by computeQpProperties().

◆ _y_derivatives

std::vector<MaterialProperty<Real> *> LinearTestMaterial::_y_derivatives
protected

Derivatives of material property with respect to each aux variable.

Definition at line 53 of file LinearTestMaterial.h.

Referenced by computeQpProperties(), and LinearTestMaterial().

◆ _y_name

const MaterialPropertyName LinearTestMaterial::_y_name
protected

Name of the new material property.

Definition at line 47 of file LinearTestMaterial.h.

Referenced by LinearTestMaterial().


The documentation for this class was generated from the following files: