www.mooseframework.org
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 Member Functions

 MaskedBodyForce (const InputParameters &parameters)
 
virtual void initialSetup ()
 

Protected Member Functions

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

Protected Attributes

const MaterialProperty< Real > & _mask
 
const unsigned int _nvar
 number of coupled variables More...
 
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 29 of file MaskedBodyForce.h.

Constructor & Destructor Documentation

◆ MaskedBodyForce()

MaskedBodyForce::MaskedBodyForce ( const InputParameters &  parameters)

Definition at line 26 of file MaskedBodyForce.C.

27  : DerivativeMaterialInterface<JvarMapKernelInterface<BodyForce>>(parameters),
28  _mask(getMaterialProperty<Real>("mask")),
29  _nvar(_coupled_moose_vars.size()),
30  _v_name(_var.name()),
31  _dmaskdv(getMaterialPropertyDerivative<Real>("mask", _v_name)),
33 {
34  // Get derivatives of mask wrt coupled variables
35  for (unsigned int i = 0; i < _nvar; ++i)
36  {
37  MooseVariableFEBase * cvar = _coupled_moose_vars[i];
38  _dmaskdarg[i] = &getMaterialPropertyDerivative<Real>("mask", cvar->name());
39  }
40 }

Member Function Documentation

◆ computeQpJacobian()

Real MaskedBodyForce::computeQpJacobian ( )
protectedvirtual

Definition at line 55 of file MaskedBodyForce.C.

56 {
57  return _dmaskdv[_qp] * BodyForce::computeQpResidual() * _phi[_j][_qp];
58 }

◆ computeQpOffDiagJacobian()

Real MaskedBodyForce::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 61 of file MaskedBodyForce.C.

62 {
63  const unsigned int cvar = mapJvarToCvar(jvar);
64  return (*_dmaskdarg[cvar])[_qp] * BodyForce::computeQpResidual() * _phi[_j][_qp];
65 }

◆ computeQpResidual()

Real MaskedBodyForce::computeQpResidual ( )
protectedvirtual

Definition at line 49 of file MaskedBodyForce.C.

50 {
51  return BodyForce::computeQpResidual() * _mask[_qp];
52 }

◆ initialSetup()

void MaskedBodyForce::initialSetup ( )
virtual

Definition at line 43 of file MaskedBodyForce.C.

44 {
45  validateNonlinearCoupling<Real>("mask");
46 }

Member Data Documentation

◆ _dmaskdarg

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

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

Definition at line 52 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 49 of file MaskedBodyForce.h.

Referenced by computeQpJacobian().

◆ _mask

const MaterialProperty<Real>& MaskedBodyForce::_mask
protected

Definition at line 40 of file MaskedBodyForce.h.

Referenced by computeQpResidual().

◆ _nvar

const unsigned int MaskedBodyForce::_nvar
protected

number of coupled variables

Definition at line 43 of file MaskedBodyForce.h.

Referenced by MaskedBodyForce().

◆ _v_name

VariableName MaskedBodyForce::_v_name
protected

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

Definition at line 46 of file MaskedBodyForce.h.


The documentation for this class was generated from the following files:
MaskedBodyForce::_mask
const MaterialProperty< Real > & _mask
Definition: MaskedBodyForce.h:40
MaskedBodyForce::_dmaskdv
const MaterialProperty< Real > & _dmaskdv
derivative of the mask wrt the kernel's nonlinear variable
Definition: MaskedBodyForce.h:49
MaskedBodyForce::_dmaskdarg
std::vector< const MaterialProperty< Real > * > _dmaskdarg
Reaction rate derivatives w.r.t. other coupled variables.
Definition: MaskedBodyForce.h:52
MaskedBodyForce::_v_name
VariableName _v_name
name of the nonlinear variable (needed to retrieve the derivative material properties)
Definition: MaskedBodyForce.h:46
MaskedBodyForce::_nvar
const unsigned int _nvar
number of coupled variables
Definition: MaskedBodyForce.h:43