26 template <
class T,
class U>
63 std::vector<MaterialProperty<T> *>
_dM;
64 std::vector<std::vector<MaterialProperty<T> *>>
_d2M;
68 std::vector<const MaterialProperty<T> *>
_tensors;
69 std::vector<std::vector<const MaterialProperty<T> *>>
_dtensors;
70 std::vector<std::vector<std::vector<const MaterialProperty<T> *>>>
_d2tensors;
74 std::vector<const MaterialProperty<Real> *>
_weights;
75 std::vector<std::vector<const MaterialProperty<Real> *>>
_dweights;
76 std::vector<std::vector<std::vector<const MaterialProperty<Real> *>>>
_d2weights;
80 template <
class T,
class U>
83 _tensor_names(this->template getParam<
std::vector<MaterialPropertyName>>(
"tensors")),
84 _weight_names(this->template getParam<
std::vector<MaterialPropertyName>>(
"weights")),
88 _num_comp(_tensor_names.size()),
93 _d2tensors(_num_comp),
99 mooseError(
"The number of supplied 'tensors' and 'weights' must match.");
102 template <
class T,
class U>
107 params.
addRequiredParam<std::vector<MaterialPropertyName>>(
"tensors",
"Component tensors");
108 params.
addRequiredParam<std::vector<MaterialPropertyName>>(
"weights",
"Component weights");
114 template <
class T,
class U>
119 for (
unsigned int j = 0; j < _num_args; ++j)
121 const VariableName & jname =
123 _dM[j] = &this->
template declarePropertyDerivative<T>(
name, jname);
124 _d2M[j].resize(j + 1);
126 for (
unsigned int k = 0; k <= j; ++k)
128 const VariableName & kname =
131 _d2M[j][k] = &this->
template declarePropertyDerivative<T>(
name, jname, kname);
136 for (
unsigned int i = 0; i < _num_comp; ++i)
138 _tensors[i] = &this->
template getMaterialPropertyByName<T>(_tensor_names[i]);
139 _weights[i] = &this->
template getMaterialPropertyByName<Real>(_weight_names[i]);
141 _dtensors[i].resize(_num_args);
142 _dweights[i].resize(_num_args);
143 _d2tensors[i].resize(_num_args);
144 _d2weights[i].resize(_num_args);
146 for (
unsigned int j = 0; j < _num_args; ++j)
148 const VariableName & jname =
152 &this->
template getMaterialPropertyDerivativeByName<T>(_tensor_names[i], jname);
154 &this->
template getMaterialPropertyDerivativeByName<Real>(_weight_names[i], jname);
156 _d2tensors[i][j].resize(j + 1);
157 _d2weights[i][j].resize(j + 1);
159 for (
unsigned int k = 0; k <= j; ++k)
161 const VariableName & kname =
164 _d2tensors[i][j][k] =
165 &this->
template getMaterialPropertyDerivativeByName<T>(_tensor_names[i], jname, kname);
166 _d2weights[i][j][k] = &this->
template getMaterialPropertyDerivativeByName<Real>(
167 _weight_names[i], jname, kname);
173 template <
class T,
class U>
176 Real derivative_prefactor)
181 for (
unsigned int i = 0; i < _num_comp; ++i)
183 M[qp] += (*_tensors[i])[qp] * (*_weights[i])[qp];
185 for (
unsigned int j = 0; j < _num_args; ++j)
188 (*_dM[j])[qp].
zero();
190 (*_dM[j])[qp] += derivative_prefactor * ((*_tensors[i])[qp] * (*_dweights[i][j])[qp] +
191 (*_dtensors[i][j])[qp] * (*_weights[i])[qp]);
193 for (
unsigned int k = 0; k <= j; ++k)
196 (*_d2M[j][k])[qp].
zero();
199 derivative_prefactor * (2.0 * (*_dtensors[i][j])[qp] * (*_dweights[i][j])[qp] +
200 (*_tensors[i])[qp] * (*_d2weights[i][j][k])[qp] +
201 (*_d2tensors[i][j][k])[qp] * (*_weights[i])[qp]);
std::string name(const ElemQuality q)
CompositeTensorBase computes a simple T type MaterialProperty that is summed up from a list of other...
std::vector< const MaterialProperty< Real > * > _weights
component weights and their derivatives w.r.t. the args
std::vector< MaterialProperty< T > * > _dM
Composed tensor and its derivatives.
static InputParameters validParams()
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
std::vector< MaterialPropertyName > _weight_names
component weight names
virtual void computeQpTensorProperties(MaterialProperty< T > &M, Real derivative_prefactor=1.0)
Fill in the.
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _d2weights
InputParameters validParams()
void initializeDerivativeProperties(const std::string name)
Output material properties are initialized here so that derived classes can modify the name...
std::vector< const MaterialProperty< T > * > _tensors
component tensors and their derivatives w.r.t. the args
CompositeTensorBase(const InputParameters ¶meters)
std::vector< std::vector< const MaterialProperty< T > * > > _dtensors
unsigned int _num_comp
number of compomemt tensors and weights
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Interface class ("Veneer") to provide generator methods for derivative material property names...
std::vector< std::vector< const MaterialProperty< Real > * > > _dweights
unsigned int _num_args
number of dependent variables
std::vector< std::vector< MaterialProperty< T > * > > _d2M
std::vector< MaterialPropertyName > _tensor_names
component tensor names
std::vector< std::vector< std::vector< const MaterialProperty< T > * > > > _d2tensors