LCOV - code coverage report
Current view: top level - src/materials - ComputeRSphericalIncrementalStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 29 31 93.5 %
Date: 2025-07-25 05:00:39 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 "ComputeRSphericalIncrementalStrain.h"
      11             : #include "Assembly.h"
      12             : #include "FEProblem.h"
      13             : #include "MooseMesh.h"
      14             : 
      15             : #include "libmesh/quadrature.h"
      16             : 
      17             : registerMooseObject("SolidMechanicsApp", ComputeRSphericalIncrementalStrain);
      18             : 
      19             : InputParameters
      20          96 : ComputeRSphericalIncrementalStrain::validParams()
      21             : {
      22          96 :   InputParameters params = ComputeIncrementalStrain::validParams();
      23          96 :   params.addClassDescription(
      24             :       "Compute a strain increment for incremental strains in 1D spherical symmetry problems.");
      25          96 :   return params;
      26           0 : }
      27             : 
      28          72 : ComputeRSphericalIncrementalStrain::ComputeRSphericalIncrementalStrain(
      29          72 :     const InputParameters & parameters)
      30          72 :   : ComputeIncrementalStrain(parameters), _disp_old_0(coupledValueOld("displacements", 0))
      31             : {
      32          72 : }
      33             : 
      34             : void
      35          72 : ComputeRSphericalIncrementalStrain::initialSetup()
      36             : {
      37          72 :   ComputeIncrementalStrainBase::initialSetup();
      38             : 
      39          72 :   const auto & subdomainIDs = _mesh.meshSubdomains();
      40         144 :   for (auto subdomainID : subdomainIDs)
      41          72 :     if (_fe_problem.getCoordSystem(subdomainID) != Moose::COORD_RSPHERICAL)
      42           0 :       mooseError("The coordinate system must be set to RSPHERICAL for 1D R spherical simulations.");
      43          72 : }
      44             : 
      45             : void
      46        1244 : ComputeRSphericalIncrementalStrain::computeTotalStrainIncrement(
      47             :     RankTwoTensor & total_strain_increment)
      48             : {
      49             :   // Deformation gradient calculation in cylindrical coordinates
      50        1244 :   RankTwoTensor A;    // Deformation gradient
      51        1244 :   RankTwoTensor Fbar; // Old Deformation gradient
      52             : 
      53             :   // Step through calculating the current and old deformation gradients
      54             :   // Only diagonal components are nonzero because this is a 1D material
      55             :   // Note: x_disp is the radial displacement
      56        1244 :   A(0, 0) = (*_grad_disp[0])[_qp](0);
      57        1244 :   Fbar(0, 0) = (*_grad_disp_old[0])[_qp](0);
      58             : 
      59             :   // The polar and azimuthal strains are functions of radial displacement
      60        1244 :   if (!MooseUtils::relativeFuzzyEqual(_q_point[_qp](0), 0.0))
      61             :   {
      62        1244 :     A(1, 1) = (*_disp[0])[_qp] / _q_point[_qp](0);
      63        1244 :     Fbar(1, 1) = _disp_old_0[_qp] / _q_point[_qp](0);
      64             :   }
      65             : 
      66             :   // The polar and azimuthal strains are equivalent in this 1D problem
      67        1244 :   A(2, 2) = A(1, 1);
      68        1244 :   Fbar(2, 2) = Fbar(1, 1);
      69             : 
      70             :   // Gauss point deformation gradient
      71        1244 :   _deformation_gradient[_qp] = A;
      72        1244 :   _deformation_gradient[_qp].addIa(1.0);
      73             : 
      74             :   // very nearly A = gradU - gradUold, adapted to cylindrical coords
      75        1244 :   A -= Fbar;
      76             : 
      77        1244 :   total_strain_increment = 0.5 * (A + A.transpose());
      78        1244 : }

Generated by: LCOV version 1.14