LCOV - code coverage report
Current view: top level - src/materials - ADComputeRSphericalFiniteStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 30 32 93.8 %
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 "ADComputeRSphericalFiniteStrain.h"
      11             : #include "Assembly.h"
      12             : #include "FEProblem.h"
      13             : #include "MooseMesh.h"
      14             : 
      15             : #include "libmesh/quadrature.h"
      16             : 
      17             : registerMooseObject("SolidMechanicsApp", ADComputeRSphericalFiniteStrain);
      18             : 
      19             : InputParameters
      20          96 : ADComputeRSphericalFiniteStrain::validParams()
      21             : {
      22          96 :   InputParameters params = ADComputeFiniteStrain::validParams();
      23          96 :   params.addClassDescription("Compute a strain increment and rotation increment for finite strains "
      24             :                              "in 1D spherical symmetry problems.");
      25          96 :   return params;
      26           0 : }
      27             : 
      28          72 : ADComputeRSphericalFiniteStrain::ADComputeRSphericalFiniteStrain(const InputParameters & parameters)
      29          72 :   : ADComputeFiniteStrain(parameters), _disp_old_0(coupledValueOld("displacements", 0))
      30             : {
      31          72 : }
      32             : 
      33             : void
      34          72 : ADComputeRSphericalFiniteStrain::initialSetup()
      35             : {
      36          72 :   ADComputeIncrementalStrainBase::initialSetup();
      37             : 
      38          72 :   const auto & subdomainIDs = _mesh.meshSubdomains();
      39         144 :   for (auto subdomainID : subdomainIDs)
      40          72 :     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          72 : }
      43             : 
      44             : void
      45        2208 : ADComputeRSphericalFiniteStrain::computeProperties()
      46             : {
      47        6476 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      48             :   {
      49             :     // Deformation gradient calculation in cylindrical coordinates
      50        4268 :     ADRankTwoTensor A;  // Deformation gradient
      51        4268 :     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        4268 :     A(0, 0) = (*_grad_disp[0])[_qp](0);
      57        4268 :     Fbar(0, 0) = (*_grad_disp_old[0])[_qp](0);
      58             : 
      59             :     // The polar and azimuthal strains are functions of radial displacement
      60        4268 :     if (!MooseUtils::relativeFuzzyEqual(_q_point[_qp](0), 0.0))
      61             :     {
      62        8536 :       A(1, 1) = (*_disp[0])[_qp] / _q_point[_qp](0);
      63        4268 :       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        4268 :     A(2, 2) = A(1, 1);
      68        4268 :     Fbar(2, 2) = Fbar(1, 1);
      69             : 
      70             :     // very nearly A = gradU - gradUold, adapted to cylindrical coords
      71        4268 :     A -= Fbar;
      72             : 
      73             :     // Fbar = ( I + gradUold)
      74        4268 :     Fbar.addIa(1.0);
      75             : 
      76             :     // Incremental deformation gradient _Fhat = I + A Fbar^-1
      77        4268 :     _Fhat[_qp] = A * Fbar.inverse();
      78        4268 :     _Fhat[_qp].addIa(1.0);
      79             : 
      80        4268 :     computeQpStrain();
      81             :   }
      82        2208 : }

Generated by: LCOV version 1.14