https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DivField.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 "DivField.h"
11#include "Assembly.h"
12
14
17{
19 params.addClassDescription("The divergence operator optionally scaled by a constant scalar "
20 "coefficient. Weak form: $(\\psi_i, k \\nabla \\cdot \\vec{u})$.");
21 params.addRequiredCoupledVar("coupled_vector_variable", "The vector field");
22 params.addParam<Real>("coeff", 1.0, "The constant coefficient");
23 return params;
24}
25
27 : Kernel(parameters),
28 _u_var(*getVectorVar("coupled_vector_variable", 0)),
29 _u_var_num(coupled("coupled_vector_variable")),
30 _div_u(coupledDiv("coupled_vector_variable")),
31 _div_phi(_assembly.divPhi(_u_var)),
32 _coeff(getParam<Real>("coeff"))
33{
34}
35
36Real
41
42Real
44{
45 if (_u_var_num == jvar)
46 return _coeff * _div_phi[_j][_qp] * _test[_i][_qp];
47
48 return 0.0;
49}
registerMooseObject("MooseApp", DivField)
Weak form contribution corresponding to k*div(u)
Definition DivField.h:18
static InputParameters validParams()
Definition DivField.C:16
virtual Real computeQpResidual() override
Compute this Kernel's contribution to the residual at the current quadrature point.
Definition DivField.C:37
const VectorVariableDivergence & _div_u
div of the coupled vector variable
Definition DivField.h:33
virtual Real computeQpOffDiagJacobian(unsigned jvar) override
Definition DivField.C:43
unsigned int _u_var_num
Definition DivField.h:30
DivField(const InputParameters &parameters)
Definition DivField.C:26
Real _coeff
scalar coefficient
Definition DivField.h:39
const VectorVariablePhiDivergence & _div_phi
div of the shape function of the coupled vector variable
Definition DivField.h:36
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
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.
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.
unsigned int _qp
The current quadrature point index.
Definition KernelBase.h:43
unsigned int _j
current index for the shape function
Definition KernelBase.h:61
unsigned int _i
current index for the test function
Definition KernelBase.h:58
const VariableTestValue & _test
the current test function
Definition Kernel.h:75
static InputParameters validParams()
Definition Kernel.C:24