https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MatBodyForce.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 "MatBodyForce.h"
11
14
15template <bool is_ad, class Parent>
18{
19 InputParameters params = Parent::validParams();
20 params.addClassDescription("Kernel that defines a body force modified by a material property");
21 params.addRequiredParam<MaterialPropertyName>("material_property",
22 "Material property defining the body force");
23 return params;
24}
25
26template <bool is_ad, class Parent>
28 : Parent(parameters),
29 _property(this->template getGenericMaterialProperty<Real, is_ad>("material_property"))
30{
31}
32
33template <bool is_ad, class Parent>
36{
37 return Parent::computeQpResidual() * _property[_qp];
38}
39
41 : MatBodyForceParent(parameters),
42 _dpropertydv(getMaterialPropertyDerivative<Real>("material_property", _var.name())),
43 _dpropertydarg(_n_args)
44{
45 // Get derivatives of property wrt coupled variables
46 for (unsigned int i = 0; i < _n_args; ++i)
47 _dpropertydarg[i] = &getMaterialPropertyDerivative<Real>("material_property", i);
48}
49
50void
52{
53 validateNonlinearCoupling<Real>("material_property");
54}
55
56Real
61
62Real
64{
65 const unsigned int cvar = mapJvarToCvar(jvar);
66 return (*_dpropertydarg[cvar])[_qp] * BodyForce::computeQpResidual() * _phi[_j][_qp];
67}
68
69template class MatBodyForceTempl<false,
registerMooseObject("MooseApp", MatBodyForce)
Moose::GenericType< Real, is_ad > GenericReal
Definition MooseTypes.h:698
virtual GenericReal< is_ad > computeQpResidual() override
Compute this Kernel's contribution to the residual at the current quadrature point.
Definition BodyForce.C:48
Interface class ("Veneer") to provide generator methods for derivative material property names.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
This kernel creates a body force that is modified by a mask defined as a material.
virtual GenericReal< is_ad > computeQpResidual() override
static InputParameters validParams()
MatBodyForceTempl(const InputParameters &parameters)
MatBodyForce(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual void initialSetup() override
std::vector< const MaterialProperty< Real > * > _dpropertydarg
Reaction rate derivatives w.r.t. other coupled variables.
virtual Real computeQpJacobian() override
const MaterialProperty< Real > & _dpropertydv
derivative of the property wrt the kernel's nonlinear variable