LCOV - code coverage report
Current view: top level - src/auxkernels - CohesiveZoneMortarUserObjectAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose contact: 8601ad Lines: 29 33 87.9 %
Date: 2025-07-18 13:27:36 Functions: 7 7 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 "CohesiveZoneMortarUserObjectAux.h"
      11             : 
      12             : // supported user objects
      13             : #include "BilinearMixedModeCohesiveZoneModel.h"
      14             : 
      15             : registerMooseObject("ContactApp", CohesiveZoneMortarUserObjectAux);
      16             : 
      17             : const MooseEnum CohesiveZoneMortarUserObjectAux::_cohesive_zone_quantities(
      18             :     "mode_mixity_ratio cohesive_damage local_normal_jump local_tangential_jump");
      19             : 
      20             : InputParameters
      21         156 : CohesiveZoneMortarUserObjectAux::validParams()
      22             : {
      23         156 :   InputParameters params = AuxKernel::validParams();
      24         156 :   params.addClassDescription(
      25             :       "Populates an auxiliary variable with mortar cohesive zone model quantities.");
      26         312 :   params.addRequiredParam<MooseEnum>(
      27             :       "cohesive_zone_quantity",
      28             :       _cohesive_zone_quantities,
      29             :       "The desired cohesive zone model quantity to output as an auxiliary variable.");
      30         312 :   params.addRequiredParam<UserObjectName>("user_object",
      31             :                                           "The mortar cohesive zone modeling user object to get "
      32             :                                           "values from.  Note that the user object "
      33             :                                           "must implement the corresponding getter function.");
      34         468 :   params.set<ExecFlagEnum>("execute_on") = {EXEC_TIMESTEP_END};
      35         156 :   params.suppressParameter<ExecFlagEnum>("execute_on");
      36         156 :   return params;
      37         156 : }
      38             : 
      39          84 : CohesiveZoneMortarUserObjectAux::CohesiveZoneMortarUserObjectAux(const InputParameters & parameters)
      40             :   : AuxKernel(parameters),
      41          84 :     _cohesive_zone_quantity(
      42         168 :         getParam<MooseEnum>("cohesive_zone_quantity").getEnum<CohesiveQuantityEnum>()),
      43         168 :     _user_object(getUserObject<UserObject>("user_object")),
      44          84 :     _cohesive_zone_uo(dynamic_cast<const BilinearMixedModeCohesiveZoneModel *>(&_user_object)),
      45         420 :     _outputs({{CohesiveQuantityEnum::MODE_MIXITY_RATIO,
      46             :                {"BilinearMixedModeCohesiveZoneModel",
      47          84 :                 _cohesive_zone_uo,
      48        1044 :                 [&]() { return _cohesive_zone_uo->getModeMixityRatio(_current_node); }}},
      49             :               {CohesiveQuantityEnum::COHESIVE_DAMAGE,
      50             :                {"BilinearMixedModeCohesiveZoneModel",
      51             :                 _cohesive_zone_uo,
      52        1044 :                 [&]() { return _cohesive_zone_uo->getCohesiveDamage(_current_node); }}},
      53             :               {CohesiveQuantityEnum::LOCAL_NORMAL_JUMP,
      54             :                {"BilinearMixedModeCohesiveZoneModel",
      55             :                 _cohesive_zone_uo,
      56        1044 :                 [&]() { return _cohesive_zone_uo->getLocalDisplacementNormal(_current_node); }}},
      57             :               {CohesiveQuantityEnum::LOCAL_TANGENTIAL_JUMP,
      58          84 :                {"BilinearMixedModeCohesiveZoneModel", _cohesive_zone_uo, [&]() {
      59         960 :                   return _cohesive_zone_uo->getLocalDisplacementTangential(_current_node);
      60          84 :                 }}}})
      61             : {
      62          84 :   if (!isNodal())
      63           0 :     mooseError("This auxiliary kernel requires nodal variables to obtain contact pressure values");
      64             : 
      65             :   // error check
      66          84 :   const auto it = _outputs.find(_cohesive_zone_quantity);
      67          84 :   if (it == _outputs.end())
      68           0 :     mooseError("Internal error: Contact quantity request in PressureMortarUserObjectAux is not "
      69             :                "recognized.");
      70          84 :   if (!std::get<1>(it->second))
      71           0 :     paramError("user_object",
      72             :                "The '",
      73           0 :                _cohesive_zone_quantities.getNames()[static_cast<int>(it->first)],
      74             :                "' quantity is only provided by a '",
      75             :                std::get<0>(it->second),
      76             :                "' or derived object.");
      77         420 : }
      78             : 
      79             : Real
      80        3840 : CohesiveZoneMortarUserObjectAux::computeValue()
      81             : {
      82             :   // execute functional to retrieve selected quantity
      83        3840 :   return std::get<2>(_outputs[_cohesive_zone_quantity])();
      84             : }

Generated by: LCOV version 1.14