www.mooseframework.org
MaterialDerivativeTestKernelBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "Kernel.h"
13 #include "JvarMapInterface.h"
15 
19 template <typename T>
21  : public DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>
22 {
23 public:
25 
27 
28 protected:
30  const unsigned int _n_vars;
31 
33  std::vector<VariableName> _derivative;
34 
37 
39  std::vector<const MaterialProperty<T> *> _p_off_diag_derivatives;
40 
43 };
44 
45 template <typename T>
47  const InputParameters & parameters)
49  _n_vars(_coupled_moose_vars.size()),
50  _derivative(getParam<std::vector<VariableName>>("derivative")),
51  _p(this->template getMaterialPropertyDerivative<T>("material_property", _derivative)),
52  _p_off_diag_derivatives(_n_vars),
53  _p_diag_derivative(this->template getMaterialPropertyDerivative<T>(
54  "material_property", MooseUtils::concatenate(_derivative, VariableName(_var.name()))))
55 {
56  for (unsigned int m = 0; m < _n_vars; ++m)
57  _p_off_diag_derivatives[m] = &this->template getMaterialPropertyDerivative<T>(
58  "material_property",
60 }
61 
62 template <typename T>
65 {
67  params.addClassDescription("Class used for testing derivatives of a material property.");
68  params.addRequiredParam<MaterialPropertyName>(
69  "material_property", "Name of material property for which derivatives are to be tested.");
70  params.addRequiredCoupledVar("args", "List of variables the material property depends on");
71  params.addParam<std::vector<VariableName>>(
72  "derivative",
73  "Select derivative to test derivatives of (leave empty for checking "
74  "derivatives of the original material property)");
75  return params;
76 }
77 
const unsigned int _n_vars
number of nonlinear variables
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:655
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
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
MaterialDerivativeTestKernelBase(const InputParameters &parameters)
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:24
Interface class ("Veneer") to provide generator methods for derivative material property names...
std::vector< MooseVariableFEBase * > _coupled_moose_vars
Vector of all coupled variables.
Definition: Coupleable.h:740
Concrete definition of a parameter value for a specified type.
Definition: Kernel.h:20
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
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...
std::vector< const MaterialProperty< T > * > _p_off_diag_derivatives
material properties for the off-diagonal derivatives of the tested property