LCOV - code coverage report
Current view: top level - src/materials - ComputeRSphericalFiniteStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 37 39 94.9 %
Date: 2025-09-04 07:57:23 Functions: 5 5 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 "ComputeRSphericalFiniteStrain.h"
      11             : #include "Assembly.h"
      12             : #include "FEProblem.h"
      13             : #include "MooseMesh.h"
      14             : 
      15             : #include "libmesh/quadrature.h"
      16             : 
      17             : registerMooseObject("SolidMechanicsApp", ComputeRSphericalFiniteStrain);
      18             : 
      19             : InputParameters
      20          92 : ComputeRSphericalFiniteStrain::validParams()
      21             : {
      22          92 :   InputParameters params = ComputeFiniteStrain::validParams();
      23          92 :   params.addClassDescription("Compute a strain increment and rotation increment for finite strains "
      24             :                              "in 1D spherical symmetry problems.");
      25          92 :   return params;
      26           0 : }
      27             : 
      28          69 : ComputeRSphericalFiniteStrain::ComputeRSphericalFiniteStrain(const InputParameters & parameters)
      29          69 :   : ComputeFiniteStrain(parameters), _disp_old_0(coupledValueOld("displacements", 0))
      30             : {
      31          69 : }
      32             : 
      33             : void
      34          63 : ComputeRSphericalFiniteStrain::initialSetup()
      35             : {
      36          63 :   ComputeIncrementalStrainBase::initialSetup();
      37             : 
      38          63 :   const auto & subdomainIDs = _mesh.meshSubdomains();
      39         126 :   for (auto subdomainID : subdomainIDs)
      40          63 :     if (_fe_problem.getCoordSystem(subdomainID) != Moose::COORD_RSPHERICAL)
      41           0 :       mooseError("The coordinate system must be set to RSPHERICAL for 1D R spherical simulations.");
      42          63 : }
      43             : 
      44             : void
      45        1454 : ComputeRSphericalFiniteStrain::computeProperties()
      46             : {
      47             :   // Method from Rashid, 1993
      48             : 
      49        5052 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      50             :   {
      51             :     // Deformation gradient calculation in spherical coordinates
      52        3598 :     RankTwoTensor A;    // Deformation gradient
      53        3598 :     RankTwoTensor Fbar; // Old Deformation gradient
      54             : 
      55             :     // Step through calculating the current and old deformation gradients
      56             :     // Only diagonal components are nonzero because this is a 1D material
      57             :     // Note: x_disp is the radial displacement
      58        3598 :     A(0, 0) = (*_grad_disp[0])[_qp](0);
      59        3598 :     Fbar(0, 0) = (*_grad_disp_old[0])[_qp](0);
      60             : 
      61             :     // The polar and azimuthal strains are functions of radial displacement
      62        3598 :     if (!MooseUtils::relativeFuzzyEqual(_q_point[_qp](0), 0.0))
      63             :     {
      64        3598 :       A(1, 1) = (*_disp[0])[_qp] / _q_point[_qp](0);
      65        3598 :       Fbar(1, 1) = _disp_old_0[_qp] / _q_point[_qp](0);
      66             :     }
      67             : 
      68             :     // The polar and azimuthal strains are equivalent in this 1D problem
      69        3598 :     A(2, 2) = A(1, 1);
      70        3598 :     Fbar(2, 2) = Fbar(1, 1);
      71             : 
      72             :     // Gauss point deformation gradient
      73        3598 :     _deformation_gradient[_qp] = A;
      74        3598 :     _deformation_gradient[_qp].addIa(1.0);
      75             : 
      76             :     // very nearly A = gradU - gradUold, adapted to spherical coords
      77        3598 :     A -= Fbar;
      78             : 
      79             :     // Fbar = ( I + gradUold)
      80        3598 :     Fbar.addIa(1.0);
      81             : 
      82             :     // Incremental deformation gradient _Fhat = I + A Fbar^-1
      83        3598 :     _Fhat[_qp] = A * Fbar.inverse();
      84        3598 :     _Fhat[_qp].addIa(1.0);
      85             : 
      86        3598 :     computeQpStrain();
      87             :   }
      88        1454 : }
      89             : 
      90             : void
      91        3598 : ComputeRSphericalFiniteStrain::computeQpIncrements(RankTwoTensor & total_strain_increment,
      92             :                                                    RankTwoTensor & rotation_increment)
      93             : {
      94       14392 :   for (unsigned int i = 0; i < 3; ++i)
      95       10794 :     total_strain_increment(i, i) = std::log(_Fhat[_qp](i, i));
      96             : 
      97        3598 :   rotation_increment.setToIdentity();
      98        3598 : }

Generated by: LCOV version 1.14