LCOV - code coverage report
Current view: top level - src/bcs - OneDEqualValueConstraintBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 21 24 87.5 %
Date: 2025-07-17 01:28:37 Functions: 5 5 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             : #include "OneDEqualValueConstraintBC.h"
      11             : 
      12             : registerMooseObject("MooseApp", OneDEqualValueConstraintBC);
      13             : 
      14             : InputParameters
      15       14349 : OneDEqualValueConstraintBC::validParams()
      16             : {
      17       14349 :   InputParameters params = IntegratedBC::validParams();
      18       14349 :   params.addClassDescription("Computes the integral of lambda times dg term from the mortar method"
      19             :                              " (for two 1D domains only).");
      20       14349 :   params.addRequiredCoupledVar("lambda", "Lagrange multiplier");
      21       14349 :   params.addRequiredParam<unsigned int>("component", "Component of the Lagrange multiplier");
      22       14349 :   params.addRequiredParam<Real>(
      23             :       "vg",
      24             :       "Variation of the constraint g wrt this surface (+1 or -1). Note: g = value1 - value2 = 0 ");
      25       14349 :   return params;
      26           0 : }
      27             : 
      28          44 : OneDEqualValueConstraintBC::OneDEqualValueConstraintBC(const InputParameters & parameters)
      29             :   : IntegratedBC(parameters),
      30          44 :     _lambda(coupledScalarValue("lambda")),
      31          44 :     _lambda_var_number(coupledScalar("lambda")),
      32          44 :     _component(getParam<unsigned int>("component")),
      33          88 :     _vg(getParam<Real>("vg"))
      34             : {
      35          44 : }
      36             : 
      37             : Real
      38          64 : OneDEqualValueConstraintBC::computeQpResidual()
      39             : {
      40          64 :   return _lambda[_component] * _vg * _test[_i][_qp];
      41             : }
      42             : 
      43             : Real
      44          64 : OneDEqualValueConstraintBC::computeQpJacobian()
      45             : {
      46          64 :   return 0.;
      47             : }
      48             : 
      49             : Real
      50          32 : OneDEqualValueConstraintBC::computeQpOffDiagJacobianScalar(unsigned int jvar)
      51             : {
      52          32 :   if (jvar == _lambda_var_number)
      53             :   {
      54          32 :     if (_j == _component)
      55          32 :       return _vg * _test[_i][_qp];
      56             :     else
      57           0 :       return 0.;
      58             :   }
      59             :   else
      60           0 :     return 0.;
      61             : }

Generated by: LCOV version 1.14