Line data Source code
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 : #pragma once 11 : 12 : #include "FVElementalKernel.h" 13 : 14 : /** 15 : * Base class for implementing constraints on finite volume variable elemental values using scalar 16 : * Lagrange multipliers 17 : */ 18 : class FVScalarLagrangeMultiplierConstraint : public FVElementalKernel 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : FVScalarLagrangeMultiplierConstraint(const InputParameters & parameters); 24 : 25 126 : const MooseVariableScalar & lambdaVariable() const { return _lambda_var; } 26 : 27 : protected: 28 : /// The value that we want the average of the primal variable to be equal to 29 : const PostprocessorValue & _phi0; 30 : 31 : private: 32 : void computeResidual() override final; 33 : void computeJacobian() override final; 34 : using FVElementalKernel::computeOffDiagJacobian; 35 : void computeOffDiagJacobian() override final; 36 : void computeResidualAndJacobian() override final; 37 : ADReal computeQpResidual() override = 0; 38 : 39 : /// The Lagrange Multiplier variable 40 : const MooseVariableScalar & _lambda_var; 41 : 42 : /// The Lagrange Multiplier value 43 : const ADVariableValue & _lambda; 44 : };