LCOV - code coverage report
Current view: top level - src/bcs - ModeISurfingDirichletBC.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 40 30.0 %
Date: 2025-02-21 01:06:12 Functions: 1 3 33.3 %

          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 "ModeISurfingDirichletBC.h"
       6             : 
       7             : registerMooseObject("raccoonApp", ModeISurfingDirichletBC);
       8             : 
       9             : InputParameters
      10         138 : ModeISurfingDirichletBC::validParams()
      11             : {
      12         138 :   InputParameters params = NodalBC::validParams();
      13         138 :   params.addClassDescription(
      14             :       "This class applies the Dirichlet BC conforming with the analytical solution of a Mode-I "
      15             :       "crack. The crack is assumed to be emanating from the origin. For $t \\in [0, 1]$ the BC "
      16             :       "ramps up linearly to match the initial crack tip position, and for $t \\in [1, \\infty)$, "
      17             :       "the crack tip advances to the right with a velocity of v");
      18         138 :   params.addParam<Point>(
      19         138 :       "initial_crack_tip_position", RealVectorValue(0, 0, 0), "Initial crack tip position");
      20         138 :   params.addParam<RealVectorValue>("crack_propagation_velocity",
      21         138 :                                    RealVectorValue(1, 0, 0),
      22             :                                    "Velocity of the crack tip, crack starts to propagate at t = 1");
      23         276 :   params.addRequiredParam<unsigned int>("component", "0 for x, 1 for y");
      24         276 :   params.addRequiredParam<Real>("Gc", "Fracture toughness");
      25         276 :   params.addRequiredParam<Real>("K", "Bulk modulus");
      26         276 :   params.addRequiredParam<Real>("G", "Shear modulus");
      27         138 :   return params;
      28           0 : }
      29             : 
      30           0 : ModeISurfingDirichletBC::ModeISurfingDirichletBC(const InputParameters & parameters)
      31             :   : NodalBC(parameters),
      32           0 :     _c(getParam<Point>("initial_crack_tip_position")),
      33           0 :     _v(getParam<RealVectorValue>("crack_propagation_velocity")),
      34           0 :     _component(getParam<unsigned int>("component")),
      35           0 :     _Gc(getParam<Real>("Gc")),
      36           0 :     _K(getParam<Real>("K")),
      37           0 :     _G(getParam<Real>("G"))
      38             : {
      39           0 : }
      40             : 
      41             : Real
      42           0 : ModeISurfingDirichletBC::computeQpResidual()
      43             : {
      44           0 :   Real E = 9 * _K * _G / (3 * _K + _G);
      45           0 :   Real nu = (3 * _K - 2 * _G) / 2 / (3 * _K + _G);
      46           0 :   Real Kolosov = (3 - 4 * nu);
      47             : 
      48           0 :   Point c = _c;
      49           0 :   if (_t > 1)
      50           0 :     c += _v * (_t - 1);
      51           0 :   Real x = (*_current_node)(0) - c(0);
      52           0 :   Real y = (*_current_node)(1) - c(1);
      53           0 :   Real theta = std::atan2(y, x);
      54           0 :   Real r = std::sqrt(x * x + y * y);
      55           0 :   Real K1 = std::sqrt(E * _Gc / (1 - nu * nu));
      56           0 :   K1 *= _t < 1 ? _t : 1;
      57             : 
      58           0 :   Real u = K1 / 2 / _G * std::sqrt(r / 2 / M_PI) * (Kolosov - std::cos(theta));
      59           0 :   if (_component == 0)
      60           0 :     u *= std::cos(theta / 2);
      61           0 :   if (_component == 1)
      62           0 :     u *= std::sin(theta / 2);
      63           0 :   return _u[_qp] - u;
      64             : }

Generated by: LCOV version 1.16