www.mooseframework.org
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MaskedBodyForce Class Reference

This kernel creates a body force that is modified by a mask defined as a material. More...

#include <MaskedBodyForce.h>

Inheritance diagram for MaskedBodyForce:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 MaskedBodyForce (const InputParameters &parameters)
 
virtual void initialSetup ()
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 

Protected Attributes

const MaterialProperty< Real > & _mask
 
VariableName _v_name
 name of the nonlinear variable (needed to retrieve the derivative material properties) More...
 
const MaterialProperty< Real > & _dmaskdv
 derivative of the mask wrt the kernel's nonlinear variable More...
 
std::vector< const MaterialProperty< Real > * > _dmaskdarg
 Reaction rate derivatives w.r.t. other coupled variables. More...
 

Detailed Description

This kernel creates a body force that is modified by a mask defined as a material.

Common uses of this would be to turn off or change the body force in certain regions of the mesh.

Definition at line 25 of file MaskedBodyForce.h.

Constructor & Destructor Documentation

◆ MaskedBodyForce()

MaskedBodyForce::MaskedBodyForce ( const InputParameters parameters)

Definition at line 26 of file MaskedBodyForce.C.

28  _mask(getMaterialProperty<Real>("mask")),
29  _v_name(_var.name()),
30  _dmaskdv(getMaterialPropertyDerivative<Real>("mask", _v_name)),
31  _dmaskdarg(_n_args)
32 {
33  // Get derivatives of mask wrt coupled variables
34  for (unsigned int i = 0; i < _n_args; ++i)
35  _dmaskdarg[i] = &getMaterialPropertyDerivative<Real>("mask", i);
36 }
VariableName _v_name
name of the nonlinear variable (needed to retrieve the derivative material properties) ...
const MaterialProperty< Real > & _mask
const MaterialProperty< Real > & _dmaskdv
derivative of the mask wrt the kernel&#39;s nonlinear variable
std::vector< const MaterialProperty< Real > * > _dmaskdarg
Reaction rate derivatives w.r.t. other coupled variables.

Member Function Documentation

◆ computeQpJacobian()

Real MaskedBodyForce::computeQpJacobian ( )
protectedvirtual

Definition at line 51 of file MaskedBodyForce.C.

52 {
53  return _dmaskdv[_qp] * BodyForce::computeQpResidual() * _phi[_j][_qp];
54 }
virtual GenericReal< is_ad > computeQpResidual() override
const MaterialProperty< Real > & _dmaskdv
derivative of the mask wrt the kernel&#39;s nonlinear variable

◆ computeQpOffDiagJacobian()

Real MaskedBodyForce::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 57 of file MaskedBodyForce.C.

58 {
59  const unsigned int cvar = mapJvarToCvar(jvar);
60  return (*_dmaskdarg[cvar])[_qp] * BodyForce::computeQpResidual() * _phi[_j][_qp];
61 }
virtual GenericReal< is_ad > computeQpResidual() override
std::vector< const MaterialProperty< Real > * > _dmaskdarg
Reaction rate derivatives w.r.t. other coupled variables.

◆ computeQpResidual()

Real MaskedBodyForce::computeQpResidual ( )
protectedvirtual

Definition at line 45 of file MaskedBodyForce.C.

46 {
47  return BodyForce::computeQpResidual() * _mask[_qp];
48 }
const MaterialProperty< Real > & _mask
virtual GenericReal< is_ad > computeQpResidual() override

◆ initialSetup()

void MaskedBodyForce::initialSetup ( )
virtual

Definition at line 39 of file MaskedBodyForce.C.

40 {
41  validateNonlinearCoupling<Real>("mask");
42 }

◆ validParams()

InputParameters MaskedBodyForce::validParams ( )
static

Definition at line 16 of file MaskedBodyForce.C.

17 {
19  params.addClassDescription("Kernel that defines a body force modified by a material mask");
20  params.addParam<MaterialPropertyName>("mask", "Material property defining the mask");
21  params.addCoupledVar("args", "Vector of nonlinear variable arguments this object depends on");
22  params.deprecateCoupledVar("args", "coupled_variables", "02/27/2024");
23  return params;
24 }
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _dmaskdarg

std::vector<const MaterialProperty<Real> *> MaskedBodyForce::_dmaskdarg
protected

Reaction rate derivatives w.r.t. other coupled variables.

Definition at line 47 of file MaskedBodyForce.h.

Referenced by computeQpOffDiagJacobian(), and MaskedBodyForce().

◆ _dmaskdv

const MaterialProperty<Real>& MaskedBodyForce::_dmaskdv
protected

derivative of the mask wrt the kernel's nonlinear variable

Definition at line 44 of file MaskedBodyForce.h.

Referenced by computeQpJacobian().

◆ _mask

const MaterialProperty<Real>& MaskedBodyForce::_mask
protected

Definition at line 38 of file MaskedBodyForce.h.

Referenced by computeQpResidual().

◆ _v_name

VariableName MaskedBodyForce::_v_name
protected

name of the nonlinear variable (needed to retrieve the derivative material properties)

Definition at line 41 of file MaskedBodyForce.h.


The documentation for this class was generated from the following files: