https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LMDiffusion.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 "LMDiffusion.h"
11
12registerMooseObject("ScalarTransportApp", LMDiffusion);
13
16{
18 params.addRequiredCoupledVar("primal_variable",
19 "The coupled primal variable from which to pull the Laplacian");
20 params.addParam<bool>(
21 "lm_sign_positive",
22 true,
23 "Whether to use a positive sign when adding this object's residual to the Lagrange "
24 "multiplier constraint equation. Positive or negative sign should be chosen such that the "
25 "diagonals for the LM block of the matrix are positive");
26 params.addParam<Real>("diffusivity", 1, "The value of the diffusivity");
28 "Adds a diffusion term to a Lagrange multiplier constrained primal equation");
29 return params;
30}
31
33 : Kernel(parameters),
34 _primal_var(coupled("primal_variable")),
35 _second_primal(coupledSecond("primal_variable")),
36 _second_primal_phi(getVar("primal_variable", 0)->secondPhi()),
37 _lm_sign(getParam<bool>("lm_sign_positive") ? 1. : -1),
38 _diffusivity(getParam<Real>("diffusivity"))
39{
40 if (_var.number() == _primal_var)
42 "primal_variable",
43 "Coupled variable 'primal_variable' needs to be different from 'variable' with "
44 "LMDiffusion. It is expected in general that 'variable' should be a Lagrange multiplier "
45 "variable, and that 'primal_variable' be the primal variable on which the Lagrange "
46 "multiplier is acting");
47}
48
49Real
54
55Real
57{
58 return 0;
59}
60
61Real
63{
64 if (jvar == _primal_var)
66
67 return 0;
68}
registerMooseObject("ScalarTransportApp", LMDiffusion)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
unsigned int _j
unsigned int _i
MooseVariable & _var
const VariableTestValue & _test
static InputParameters validParams()
Adds the strong diffusive term of the primal equation to stabilization of the Lagrange multiplier equ...
Definition LMDiffusion.h:19
Real computeQpOffDiagJacobian(unsigned int jvar) override
Definition LMDiffusion.C:62
const VariableSecond & _second_primal
The matrix of second spatial derivatives of the primal variable.
Definition LMDiffusion.h:35
const Real _diffusivity
The primal variable diffusivity.
Definition LMDiffusion.h:44
Real computeQpResidual() override
Definition LMDiffusion.C:50
static InputParameters validParams()
Definition LMDiffusion.C:15
LMDiffusion(const InputParameters &parameters)
Definition LMDiffusion.C:32
const unsigned int _primal_var
The primal variable number.
Definition LMDiffusion.h:32
Real computeQpJacobian() override
Definition LMDiffusion.C:56
const VariablePhiSecond & _second_primal_phi
The matrix of second spatial derivatives of the basis functions of the primal variable.
Definition LMDiffusion.h:38
const Real _lm_sign
The sign of the Lagrange multiplier (the 'variable' of this kernel) in the primal equation.
Definition LMDiffusion.h:41
void paramError(const std::string &param, Args... args) const
unsigned int number() const