LCOV - code coverage report
Current view: top level - src/postprocessors - BondStatusConvergedPostprocessorPD.C (source / functions) Hit Total Coverage
Test: idaholab/moose peridynamics: #31405 (292dce) with base fef103 Lines: 26 27 96.3 %
Date: 2025-09-04 07:55:08 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 "BondStatusConvergedPostprocessorPD.h"
      11             : 
      12             : registerMooseObject("PeridynamicsApp", BondStatusConvergedPostprocessorPD);
      13             : 
      14             : InputParameters
      15          11 : BondStatusConvergedPostprocessorPD::validParams()
      16             : {
      17          11 :   InputParameters params = ElementPostprocessor::validParams();
      18          11 :   params.addClassDescription(
      19             :       "Postprocessor to check whether the bond status is converged within a time step");
      20             : 
      21          11 :   return params;
      22           0 : }
      23             : 
      24           6 : BondStatusConvergedPostprocessorPD::BondStatusConvergedPostprocessorPD(
      25           6 :     const InputParameters & parameters)
      26             :   : ElementPostprocessor(parameters),
      27           6 :     _bond_status_var(&_subproblem.getStandardVariable(_tid, "bond_status")),
      28           6 :     _pdmesh(dynamic_cast<PeridynamicsMesh &>(_mesh)),
      29          12 :     _dim(_pdmesh.dimension())
      30             : {
      31           6 : }
      32             : 
      33             : void
      34          32 : BondStatusConvergedPostprocessorPD::initialize()
      35             : {
      36          32 :   _num_bond_status_updated = 0;
      37          32 : }
      38             : 
      39             : void
      40       12056 : BondStatusConvergedPostprocessorPD::execute()
      41             : {
      42       24112 :   if ((_bond_status_var->getElementalValueOld(_current_elem) -
      43       12056 :        _bond_status_var->getElementalValue(_current_elem)) > 0.5)
      44         572 :     _num_bond_status_updated += 1;
      45       12056 : }
      46             : 
      47             : Real
      48          27 : BondStatusConvergedPostprocessorPD::getValue() const
      49             : {
      50          27 :   return _num_bond_status_updated;
      51             : }
      52             : 
      53             : void
      54          27 : BondStatusConvergedPostprocessorPD::finalize()
      55             : {
      56          27 :   gatherSum(_num_bond_status_updated);
      57          27 : }
      58             : 
      59             : void
      60           5 : BondStatusConvergedPostprocessorPD::threadJoin(const UserObject & uo)
      61             : {
      62             :   const auto & pps = static_cast<const BondStatusConvergedPostprocessorPD &>(uo);
      63           5 :   _num_bond_status_updated += pps._num_bond_status_updated;
      64           5 : }

Generated by: LCOV version 1.14