https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MaterialDerivativeTestKernelBase.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
19template <typename T>
21 : public DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>
22{
23public:
25
27
28protected:
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
45template <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",
59 MooseUtils::concatenate(_derivative, SymbolName(_coupled_moose_vars[m]->name())));
60}
61
62template <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("coupled_variables",
71 "List of variables the material property depends on");
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}
Interface class ("Veneer") to provide generator methods for derivative material property names.
DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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...
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.
Interface class ("Veneer") for Kernel to provide a mapping from 'jvar' in computeQpOffDiagJacobian in...
static InputParameters validParams()
Definition Kernel.C:24
This kernel is used for testing derivatives of a material property.
const MaterialProperty< T > & _p
material property for which to test derivatives
const unsigned int _n_vars
number of nonlinear variables
const MaterialProperty< T > & _p_diag_derivative
material property for the diagonal derivative of the tested property
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
MaterialDerivativeTestKernelBase(const InputParameters &parameters)