www.mooseframework.org
MaterialDerivativeTestKernelBase.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef MATERIALDERIVATIVETESTKERNELBASE_H
16 #define MATERIALDERIVATIVETESTKERNELBASE_H
17 
18 #include "Kernel.h"
19 #include "JvarMapInterface.h"
21 
25 template <typename T>
27  : public DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>
28 {
29 public:
31 
33 
34 protected:
36  const unsigned int _n_vars;
37 
39  std::vector<VariableName> _derivative;
40 
43 
45  std::vector<const MaterialProperty<T> *> _p_off_diag_derivatives;
46 
49 };
50 
51 template <typename T>
56  _derivative(getParam<std::vector<VariableName>>("derivative")),
57  _p(this->template getMaterialPropertyDerivative<T>("material_property", _derivative)),
60  "material_property", MooseUtils::concatenate(_derivative, VariableName(_var.name()))))
61 {
62  for (unsigned int m = 0; m < _n_vars; ++m)
63  _p_off_diag_derivatives[m] = &this->template getMaterialPropertyDerivative<T>(
64  "material_property",
66 }
67 
68 template <typename T>
71 {
73  params.addClassDescription("Class used for testing derivatives of a material property.");
74  params.addRequiredParam<MaterialPropertyName>(
75  "material_property", "Name of material property for which derivatives are to be tested.");
76  params.addRequiredCoupledVar("args", "List of variables the material property depends on");
77  params.addParam<std::vector<VariableName>>(
78  "derivative",
79  "Select derivative to test derivatives of (leave empty for checking "
80  "derivatives of the original material property)");
81  return params;
82 }
83 
84 #endif // MATERIALDERIVATIVETESTKERNELBASE_H
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:47
const unsigned int _n_vars
number of nonlinear variables
std::vector< MooseVariable * > _coupled_moose_vars
Vector of coupled variables.
Definition: Coupleable.h:324
const MaterialProperty< U > & getMaterialPropertyDerivative(const std::string &base, const std::vector< VariableName > &c)
Methods for retreiving derivative material properties.
std::vector< VariableName > _derivative
select material property derivative to test derivatives of
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
T concatenate(T c1, const T &c2)
Returns a container that contains the content of second passed in container inserted into the first p...
Definition: MooseUtils.h:407
Interface class ("Veneer") for Kernel to provide a mapping from &#39;jvar&#39; in computeQpOffDiagJacobian in...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
This kernel is used for testing derivatives of a material property.
const MaterialProperty< T > & _p
material property for which to test derivatives
const MaterialProperty< T > & _p_diag_derivative
material property for the diagonal derivative of the tested property
PetscInt m
MaterialDerivativeTestKernelBase(const InputParameters &parameters)
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseObject.h:122
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
InputParameters validParams< Kernel >()
Definition: Kernel.C:30
Interface class ("Veneer") to provide generator methods for derivative material property names...
Concrete definition of a parameter value for a specified type.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
Definition: Kernel.h:25
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
MooseVariable & _var
Reference to this Kernel&#39;s MooseVariable object.
Definition: KernelBase.h:120
std::vector< const MaterialProperty< T > * > _p_off_diag_derivatives
material properties for the off-diagonal derivatives of the tested property