https://mooseframework.inl.gov
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 
10 #include "MaterialPropertyValue.h"
11 
14 
15 template <bool is_ad>
18 {
20  params.addClassDescription(
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 
29 template <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 
37 template <>
38 Real
40 {
41  return _kernel_sign * (_prop[_qp] - _u[_qp]);
42 }
43 
44 template <>
45 ADReal
47 {
48  return _kernel_sign * (_prop[_qp] - _u[_qp]);
49 }
50 
51 template <>
52 Real
54 {
55  return -_kernel_sign * _phi[_j][_qp];
56 }
57 
58 template <>
59 Real
61 {
62  mooseError("This should never get called");
63 }
64 
static InputParameters validParams()
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
typename std::conditional< is_ad, ADKernelValue, KernelValue >::type KernelValueParent
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:47
InputParameters validParams()
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...
virtual Real precomputeQpJacobian()
virtual GenericReal< is_ad > precomputeQpResidual()
MaterialPropertyValueTempl(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("MooseApp", MaterialPropertyValue)
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 optional parameter and a documentation string to the InputParameters object...