LCOV - code coverage report
Current view: top level - src/postprocessors - PhaseFieldJIntegral.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 23 24 95.8 %
Date: 2025-07-01 01:12:18 Functions: 3 3 100.0 %

          Line data    Source code
       1             : //* This file is part of the RACCOON application
       2             : //* being developed at Dolbow lab at Duke University
       3             : //* http://dolbow.pratt.duke.edu
       4             : 
       5             : #include "PhaseFieldJIntegral.h"
       6             : 
       7             : registerMooseObject("raccoonApp", PhaseFieldJIntegral);
       8             : 
       9             : InputParameters
      10         148 : PhaseFieldJIntegral::validParams()
      11             : {
      12         148 :   InputParameters params = SideIntegralPostprocessor::validParams();
      13         148 :   params += BaseNameInterface::validParams();
      14         148 :   params.addClassDescription("Compute the J integral for a phase-field model of fracture");
      15         296 :   params.addRequiredParam<RealVectorValue>("J_direction", "direction of J integral");
      16         296 :   params.addParam<MaterialPropertyName>("strain_energy_density",
      17             :                                         "psie"
      18             :                                         "Name of the strain energy density");
      19         296 :   params.addRequiredCoupledVar(
      20             :       "displacements",
      21             :       "The displacements appropriate for the simulation geometry and coordinate system");
      22         148 :   return params;
      23           0 : }
      24             : 
      25           6 : PhaseFieldJIntegral::PhaseFieldJIntegral(const InputParameters & parameters)
      26             :   : SideIntegralPostprocessor(parameters),
      27             :     BaseNameInterface(parameters),
      28          18 :     _stress(getADMaterialPropertyByName<RankTwoTensor>(prependBaseName("stress"))),
      29          12 :     _psie(getADMaterialProperty<Real>(prependBaseName("strain_energy_density"))),
      30           6 :     _ndisp(coupledComponents("displacements")),
      31           6 :     _grad_disp(coupledGradients("displacements")),
      32          18 :     _t(getParam<RealVectorValue>("J_direction"))
      33             : {
      34             :   // set unused dimensions to zero
      35          12 :   for (unsigned i = _ndisp; i < 3; ++i)
      36           6 :     _grad_disp.push_back(&_grad_zero);
      37           6 : }
      38             : 
      39             : Real
      40       15624 : PhaseFieldJIntegral::computeQpIntegral()
      41             : {
      42             :   auto H = RankTwoTensor::initializeFromRows(
      43       15624 :       (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
      44       15624 :   RankTwoTensor I2(RankTwoTensor::initIdentity);
      45       31248 :   ADRankTwoTensor Sigma = _psie[_qp] * I2 - H.transpose() * _stress[_qp];
      46       15624 :   RealVectorValue n = _normals[_qp];
      47       15624 :   return raw_value(_t * Sigma * n);
      48             : }

Generated by: LCOV version 1.16