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<SymbolName> _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<SymbolName>>("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, SymbolName(_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.deprecateCoupledVar("args", "coupled_variables", "02/07/2024");
72  params.addParam<std::vector<SymbolName>>(
73  "derivative",
74  {},
75  "Select derivative to test derivatives of (leave empty for checking "
76  "derivatives of the original material property)");
77  return params;
78 }
std::string name(const ElemQuality q)
const unsigned int _n_vars
number of nonlinear variables
static InputParameters validParams()
Definition: Kernel.C:23
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:902
Interface class ("Veneer") for Kernel to provide a mapping from &#39;jvar&#39; in computeQpOffDiagJacobian in...
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:56
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
MaterialDerivativeTestKernelBase(const InputParameters &parameters)
void deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
std::vector< MooseVariableFieldBase * > _coupled_moose_vars
Vector of all coupled variables.
Definition: Coupleable.h:1327
Interface class ("Veneer") to provide generator methods for derivative material property names...
Definition: Kernel.h:15
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...
const InputParameters & parameters() const
Get the parameters of the object.
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< SymbolName > _derivative
select material property derivative to test derivatives of
std::vector< const MaterialProperty< T > * > _p_off_diag_derivatives
material properties for the off-diagonal derivatives of the tested property