https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MaterialPropertyValue.C
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
11
14
15template <bool is_ad>
18{
21 "Residual term (u - prop) to set variable u equal to a given material property prop");
22 params.addRequiredParam<MaterialPropertyName>(
23 "prop_name", "Name of material property to be used in the kernel");
24 params.addParam<bool>(
25 "positive", true, "If the kernel is positive, this is true, if negative, it is false");
26 return params;
27}
28
29template <bool is_ad>
31 : KernelValueParent<is_ad>(parameters),
32 _kernel_sign(this->template getParam<bool>("positive") ? 1.0 : -1.0),
33 _prop(this->template getGenericMaterialProperty<Real, is_ad>("prop_name"))
34{
35}
36
37template <>
38Real
40{
41 return _kernel_sign * (_prop[_qp] - _u[_qp]);
42}
43
44template <>
47{
48 return _kernel_sign * (_prop[_qp] - _u[_qp]);
49}
50
51template <>
52Real
54{
55 return -_kernel_sign * _phi[_j][_qp];
56}
57
58template <>
59Real
61{
62 mooseError("This should never get called");
63}
64
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("MooseApp", MaterialPropertyValue)
typename std::conditional< is_ad, ADKernelValue, KernelValue >::type KernelValueParent
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
virtual GenericReal< is_ad > precomputeQpResidual()
MaterialPropertyValueTempl(const InputParameters &parameters)
static InputParameters validParams()
virtual Real precomputeQpJacobian()