LCOV - code coverage report
Current view: top level - src/auxkernels - WeightedGapVelAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose contact: #32971 (54bef8) with base c6cf66 Lines: 44 47 93.6 %
Date: 2026-05-29 20:36:03 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 "WeightedGapVelAux.h"
      11             : #include "MooseVariableFE.h"
      12             : #include "FEProblemBase.h"
      13             : #include "Assembly.h"
      14             : 
      15             : registerMooseObject("ContactApp", WeightedGapVelAux);
      16             : 
      17             : InputParameters
      18          82 : WeightedGapVelAux::validParams()
      19             : {
      20          82 :   InputParameters params = MortarNodalAuxKernel::validParams();
      21          82 :   params.addClassDescription(
      22             :       "Returns the weighted gap velocity at a node. This quantity is useful for mortar contact, "
      23             :       "particularly when dual basis functions are used in contact mechanics");
      24         164 :   params.addCoupledVar("v",
      25             :                        "Optional variable to take the value of. If omitted the value of the "
      26             :                        "`variable` itself is returned.");
      27         164 :   params.addRequiredCoupledVar("disp_x", "The x displacement variable");
      28         164 :   params.addRequiredCoupledVar("disp_y", "The y displacement variable");
      29         164 :   params.addCoupledVar("disp_z", "The z displacement variable");
      30          82 :   params.set<bool>("interpolate_normals") = false;
      31         164 :   params.addParam<bool>("use_displaced_mesh",
      32         164 :                         true,
      33             :                         "Whether to use the displaced mesh to compute the auxiliary kernel value.");
      34          82 :   return params;
      35           0 : }
      36             : 
      37          44 : WeightedGapVelAux::WeightedGapVelAux(const InputParameters & parameters)
      38             :   : MortarNodalAuxKernel(parameters),
      39          44 :     _has_disp_z(isCoupled("disp_z")),
      40          44 :     _disp_x(*getVar("disp_x", 0)),
      41          44 :     _disp_y(*getVar("disp_y", 0)),
      42          44 :     _disp_z(getVar("disp_z", 0)),
      43          44 :     _secondary_x_dot(_disp_x.adUDot()),
      44          44 :     _primary_x_dot(_disp_x.adUDotNeighbor()),
      45          44 :     _secondary_y_dot(_disp_y.adUDot()),
      46          44 :     _primary_y_dot(_disp_y.adUDotNeighbor()),
      47          44 :     _secondary_z_dot(_has_disp_z ? &_disp_z->adUDot() : nullptr),
      48          44 :     _primary_z_dot(_has_disp_z ? &_disp_z->adUDotNeighbor() : nullptr),
      49          44 :     _weighted_gap_velocity(0),
      50          44 :     _qp_gap_velocity(0),
      51          44 :     _qp_gap_velocity_nodal(0)
      52             : {
      53          44 :   if (!_displaced)
      54           0 :     paramWarning(
      55             :         "use_displaced_mesh",
      56             :         "This auxiliary kernel typically requires the use of displaced meshes to compute the "
      57             :         "weighted gap velocity.");
      58          44 : }
      59             : 
      60             : Real
      61       27200 : WeightedGapVelAux::computeValue()
      62             : {
      63       27200 :   _weighted_gap_velocity = 0;
      64       81600 :   for (_qp = 0; _qp < _qrule_msm->n_points(); _qp++)
      65             :   {
      66       54400 :     computeQpProperties();
      67      163200 :     for (_i = 0; _i < _test_lower.size(); ++_i)
      68      108800 :       computeQpIProperties();
      69             :   }
      70             : 
      71       27200 :   return _weighted_gap_velocity;
      72             : }
      73             : 
      74             : void
      75       54400 : WeightedGapVelAux::computeQpProperties()
      76             : {
      77             :   RealVectorValue gap_velocity_vec;
      78       54400 :   gap_velocity_vec(0) = MetaPhysicL::raw_value(_secondary_x_dot[_qp] - _primary_x_dot[_qp]);
      79       54400 :   gap_velocity_vec(1) = MetaPhysicL::raw_value(_secondary_y_dot[_qp] - _primary_y_dot[_qp]);
      80             : 
      81       54400 :   if (_has_disp_z)
      82           0 :     gap_velocity_vec(2) = MetaPhysicL::raw_value((*_secondary_z_dot)[_qp] - (*_primary_z_dot)[_qp]);
      83             : 
      84       54400 :   _qp_gap_velocity_nodal = gap_velocity_vec * (_JxW_msm[_qp] * _coord_msm[_qp]);
      85             : 
      86       54400 :   _msm_volume += _JxW_msm[_qp] * _coord_msm[_qp];
      87       54400 : }
      88             : 
      89             : void
      90      108800 : WeightedGapVelAux::computeQpIProperties()
      91             : {
      92      108800 :   _weighted_gap_velocity += _test_lower[_i][_qp] * _qp_gap_velocity_nodal * _normals[_i];
      93      108800 : }

Generated by: LCOV version 1.14