LCOV - code coverage report
Current view: top level - include/scalarkernels - AverageValueConstraint.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: fef103 Lines: 1 1 100.0 %
Date: 2025-09-03 20:01:23 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          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 "ScalarKernel.h"
      13             : 
      14             : /**
      15             :  * This Kernel implements part of the equation that enforces the constraint
      16             :  * of
      17             :  *
      18             :  * \int \phi = V_0
      19             :  *
      20             :  * where V_0 is a given constant, using a Lagrange multiplier
      21             :  * approach.
      22             :  *
      23             :  * In particular, this Kernel implements the residual contribution
      24             :  * corresponding to equation (6) in the detailed description [1] of
      25             :  * this problem.
      26             :  *
      27             :  * See also: test/src/kernels/ScalarLagrangeMultiplier.C
      28             :  * [0]: kernels/scalar_constraints/scalar_constraint_kernel.i
      29             :  * [1]: https://github.com/idaholab/large_media/blob/master/scalar_constraint_kernel.pdf
      30             :  */
      31             : class AverageValueConstraint : public ScalarKernel
      32             : {
      33             : public:
      34             :   static InputParameters validParams();
      35             : 
      36             :   AverageValueConstraint(const InputParameters & parameters);
      37             : 
      38             :   virtual void reinit() override;
      39             :   virtual void computeOffDiagJacobianScalar(unsigned int jvar) override;
      40         174 :   virtual bool computesJacobian() const override { return _add_jacobian; }
      41             : 
      42             : protected:
      43             :   virtual Real computeQpResidual() override;
      44             :   virtual Real computeQpJacobian() override;
      45             :   virtual Real computeQpOffDiagJacobianScalar(unsigned int jvar);
      46             : 
      47             :   /// Given (constant) which we want the integral of the solution variable to match
      48             :   Real _value;
      49             : 
      50             :   /// Name of the Postprocessor value we are trying to equate with 'value'
      51             :   const PostprocessorValue & _pp_value;
      52             : 
      53             :   /// Whether this object should add its zero Jacobian into matrices
      54             :   const bool _add_jacobian;
      55             : };

Generated by: LCOV version 1.14