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 30 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 }
VariableName _v_name
name of the nonlinear variable (needed to retrieve the derivative material properties) ...
const MaterialProperty< Real > & _mask
const unsigned int _nvar
number of coupled variables
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 55 of file MaskedBodyForce.C.

56 {
57  return _dmaskdv[_qp] * BodyForce::computeQpResidual() * _phi[_j][_qp];
58 }
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 61 of file MaskedBodyForce.C.

62 {
63  const unsigned int cvar = mapJvarToCvar(jvar);
64  return (*_dmaskdarg[cvar])[_qp] * BodyForce::computeQpResidual() * _phi[_j][_qp];
65 }
std::vector< const MaterialProperty< Real > * > _dmaskdarg
Reaction rate derivatives w.r.t. other coupled variables.

◆ computeQpResidual()

Real MaskedBodyForce::computeQpResidual ( )
protectedvirtual

Definition at line 49 of file MaskedBodyForce.C.

50 {
51  return BodyForce::computeQpResidual() * _mask[_qp];
52 }
const MaterialProperty< Real > & _mask

◆ 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 53 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 50 of file MaskedBodyForce.h.

Referenced by computeQpJacobian().

◆ _mask

const MaterialProperty<Real>& MaskedBodyForce::_mask
protected

Definition at line 41 of file MaskedBodyForce.h.

Referenced by computeQpResidual().

◆ _nvar

const unsigned int MaskedBodyForce::_nvar
protected

number of coupled variables

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


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