LCOV - code coverage report
Current view: top level - src/userobjects - GeneralizedPlaneStrainUserObjectBasePD.C (source / functions) Hit Total Coverage
Test: idaholab/moose peridynamics: #31405 (292dce) with base fef103 Lines: 33 33 100.0 %
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 "GeneralizedPlaneStrainUserObjectBasePD.h"
      11             : #include "RankFourTensor.h"
      12             : 
      13             : InputParameters
      14         127 : GeneralizedPlaneStrainUserObjectBasePD::validParams()
      15             : {
      16         127 :   InputParameters params = ElementUserObjectBasePD::validParams();
      17         127 :   params.addClassDescription("Base class for calculating the scalar residual and diagonal Jacobian "
      18             :                              "entry for generalized plane strain formulation");
      19             : 
      20         254 :   MooseEnum strainType("SMALL", "SMALL");
      21         254 :   params.addParam<MooseEnum>("strain", strainType, "Strain formulation");
      22         254 :   params.addParam<FunctionName>(
      23             :       "out_of_plane_pressure",
      24             :       "0",
      25             :       "Function used to prescribe pressure in the out-of-plane direction");
      26         254 :   params.addParam<Real>("factor", 1.0, "Scale factor applied to prescribed pressure");
      27         127 :   params.set<ExecFlagEnum>("execute_on") = EXEC_LINEAR;
      28             : 
      29         127 :   return params;
      30         127 : }
      31             : 
      32          70 : GeneralizedPlaneStrainUserObjectBasePD::GeneralizedPlaneStrainUserObjectBasePD(
      33          70 :     const InputParameters & parameters)
      34             :   : ElementUserObjectBasePD(parameters),
      35          70 :     _strain(getParam<MooseEnum>("strain")),
      36         140 :     _Cijkl(getMaterialProperty<RankFourTensor>("elasticity_tensor")),
      37          70 :     _pressure(getFunction("out_of_plane_pressure")),
      38         210 :     _factor(getParam<Real>("factor"))
      39             : {
      40          70 : }
      41             : 
      42             : void
      43        4016 : GeneralizedPlaneStrainUserObjectBasePD::initialize()
      44             : {
      45        4016 :   _residual = 0;
      46        4016 :   _jacobian = 0;
      47        4016 : }
      48             : 
      49             : void
      50         651 : GeneralizedPlaneStrainUserObjectBasePD::threadJoin(const UserObject & uo)
      51             : {
      52             :   const auto & gpsuo = static_cast<const GeneralizedPlaneStrainUserObjectBasePD &>(uo);
      53         651 :   _residual += gpsuo._residual;
      54         651 :   _jacobian += gpsuo._jacobian;
      55         651 : }
      56             : 
      57             : void
      58        3365 : GeneralizedPlaneStrainUserObjectBasePD::finalize()
      59             : {
      60        3365 :   gatherSum(_residual);
      61        3365 :   gatherSum(_jacobian);
      62        3365 : }
      63             : 
      64             : Real
      65        2623 : GeneralizedPlaneStrainUserObjectBasePD::returnResidual() const
      66             : {
      67        2623 :   return _residual;
      68             : }
      69             : 
      70             : Real
      71         154 : GeneralizedPlaneStrainUserObjectBasePD::returnJacobian() const
      72             : {
      73         154 :   return _jacobian;
      74             : }

Generated by: LCOV version 1.14