LCOV - code coverage report
Current view: top level - src/base - EnrichmentFunctionCalculation.C (source / functions) Hit Total Coverage
Test: idaholab/moose xfem: #31730 (e8b711) with base e0c998 Lines: 42 44 95.5 %
Date: 2025-10-29 16:56:32 Functions: 4 4 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 "EnrichmentFunctionCalculation.h"
      11             : 
      12         132 : EnrichmentFunctionCalculation::EnrichmentFunctionCalculation(
      13         132 :     const CrackFrontDefinition * crack_front_definition)
      14         132 :   : _crack_front_definition(*crack_front_definition)
      15             : {
      16         132 : }
      17             : 
      18             : unsigned int
      19    43256856 : EnrichmentFunctionCalculation::crackTipEnrichementFunctionAtPoint(const Point & point,
      20             :                                                                   std::vector<Real> & B)
      21             : {
      22             :   unsigned int crack_front_point_index =
      23    43256856 :       _crack_front_definition.calculateRThetaToCrackFront(point, _r, _theta);
      24             : 
      25    43256856 :   if (MooseUtils::absoluteFuzzyEqual(_r, 0.0))
      26           0 :     mooseError("EnrichmentFunctionCalculation: the distance between a point and the crack "
      27             :                "tip/front is zero.");
      28             : 
      29    43256856 :   Real st = std::sin(_theta);
      30    43256856 :   Real st2 = std::sin(_theta / 2.0);
      31    43256856 :   Real ct2 = std::cos(_theta / 2.0);
      32    43256856 :   Real sr = std::sqrt(_r);
      33             : 
      34    43256856 :   B[0] = sr * st2;
      35    43256856 :   B[1] = sr * ct2;
      36    43256856 :   B[2] = sr * st2 * st;
      37    43256856 :   B[3] = sr * ct2 * st;
      38             : 
      39    43256856 :   return crack_front_point_index;
      40             : }
      41             : 
      42             : unsigned int
      43    15751692 : EnrichmentFunctionCalculation::crackTipEnrichementFunctionDerivativeAtPoint(
      44             :     const Point & point, std::vector<RealVectorValue> & dB)
      45             : {
      46             :   unsigned int crack_front_point_index =
      47    15751692 :       _crack_front_definition.calculateRThetaToCrackFront(point, _r, _theta);
      48             : 
      49    15751692 :   if (MooseUtils::absoluteFuzzyEqual(_r, 0.0))
      50           0 :     mooseError("EnrichmentFunctionCalculation: the distance between a point and the crack "
      51             :                "tip/front is zero.");
      52             : 
      53    15751692 :   Real st = std::sin(_theta);
      54    15751692 :   Real ct = std::cos(_theta);
      55    15751692 :   Real st2 = std::sin(_theta / 2.0);
      56    15751692 :   Real ct2 = std::cos(_theta / 2.0);
      57    15751692 :   Real st15 = std::sin(1.5 * _theta);
      58    15751692 :   Real ct15 = std::cos(1.5 * _theta);
      59    15751692 :   Real sr = std::sqrt(_r);
      60             : 
      61    15751692 :   dB[0](0) = -0.5 / sr * st2;
      62    15751692 :   dB[0](1) = 0.5 / sr * ct2;
      63    15751692 :   dB[0](2) = 0.0;
      64    15751692 :   dB[1](0) = 0.5 / sr * ct2;
      65    15751692 :   dB[1](1) = 0.5 / sr * st2;
      66    15751692 :   dB[1](2) = 0.0;
      67    15751692 :   dB[2](0) = -0.5 / sr * st15 * st;
      68    15751692 :   dB[2](1) = 0.5 / sr * (st2 + st15 * ct);
      69    15751692 :   dB[2](2) = 0.0;
      70    15751692 :   dB[3](0) = -0.5 / sr * ct15 * st;
      71    15751692 :   dB[3](1) = 0.5 / sr * (ct2 + ct15 * ct);
      72    15751692 :   dB[3](2) = 0.0;
      73             : 
      74    15751692 :   return crack_front_point_index;
      75             : }
      76             : 
      77             : void
      78    63006768 : EnrichmentFunctionCalculation::rotateFromCrackFrontCoordsToGlobal(const RealVectorValue & vector,
      79             :                                                                   RealVectorValue & rotated_vector,
      80             :                                                                   const unsigned int point_index)
      81             : {
      82    63006768 :   rotated_vector = _crack_front_definition.rotateFromCrackFrontCoordsToGlobal(vector, point_index);
      83    63006768 : }

Generated by: LCOV version 1.14