LCOV - code coverage report
Current view: top level - src/materials - ComputeFiniteBeamStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 29 30 96.7 %
Date: 2025-09-04 07:57:23 Functions: 3 3 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 "ComputeFiniteBeamStrain.h"
      11             : #include "Assembly.h"
      12             : #include "NonlinearSystem.h"
      13             : #include "MooseVariable.h"
      14             : 
      15             : #include "libmesh/quadrature.h"
      16             : #include "libmesh/utility.h"
      17             : 
      18             : registerMooseObject("SolidMechanicsApp", ComputeFiniteBeamStrain);
      19             : 
      20             : InputParameters
      21          84 : ComputeFiniteBeamStrain::validParams()
      22             : {
      23          84 :   InputParameters params = ComputeIncrementalBeamStrain::validParams();
      24          84 :   params.addClassDescription("Compute a rotation increment for finite rotations of the beam and "
      25             :                              "computes the small/large strain increments in the current rotated "
      26             :                              "configuration of the beam.");
      27          84 :   return params;
      28           0 : }
      29             : 
      30          63 : ComputeFiniteBeamStrain::ComputeFiniteBeamStrain(const InputParameters & parameters)
      31             :   : ComputeIncrementalBeamStrain(parameters),
      32         126 :     _total_rotation_old(getMaterialPropertyOld<RankTwoTensor>("total_rotation"))
      33             : {
      34          63 : }
      35             : 
      36             : void
      37      111578 : ComputeFiniteBeamStrain::computeRotation()
      38             : {
      39             :   // First - convert the differential beam displacement to the beam configuration at previous time
      40             :   // step
      41      111578 :   const RealVectorValue delta_disp_local(_total_rotation_old[0] * (_disp1 - _disp0));
      42             : 
      43             :   // Second - calculate the incremental rotation matrix using Euler angles
      44             :   const Real intermediate_length_1 =
      45      111578 :       std::sqrt(Utility::pow<2>(_original_length[0] + delta_disp_local(0)) +
      46             :                 Utility::pow<2>(delta_disp_local(2)));
      47      111578 :   const Real cos_alpha = (_original_length[0] + delta_disp_local(0)) / intermediate_length_1;
      48      111578 :   const Real sin_alpha = std::sqrt(1.0 - Utility::pow<2>(cos_alpha));
      49             : 
      50             :   const Real intermediate_length_2 =
      51      111578 :       std::sqrt(Utility::pow<2>(intermediate_length_1) + Utility::pow<2>(delta_disp_local(1)));
      52      111578 :   const Real sin_beta = delta_disp_local(1) / intermediate_length_2;
      53      111578 :   const Real cos_beta = std::sqrt(1.0 - Utility::pow<2>(sin_beta));
      54             : 
      55      111578 :   const RealVectorValue rotation_d_1(cos_alpha * cos_beta, sin_beta, sin_alpha * cos_beta);
      56      111578 :   const RealVectorValue rotation_d_2(-cos_alpha * sin_beta, cos_beta, -sin_alpha * sin_beta);
      57             :   const RealVectorValue rotation_d_3(-sin_alpha, 0.0, cos_alpha);
      58             : 
      59             :   const auto rotation_d =
      60      111578 :       RankTwoTensor ::initializeFromRows(rotation_d_1, rotation_d_2, rotation_d_3);
      61             : 
      62             :   // Convert average rotational displacement to the beam configuration at previous time step
      63      111578 :   const RealVectorValue avg_rot_local(_total_rotation_old[0] * (_rot0 + _rot1));
      64             : 
      65             :   const Real gamma_increment =
      66      111578 :       0.5 * (rotation_d_1(0) * avg_rot_local(0) + rotation_d_1(1) * avg_rot_local(1) +
      67      111578 :              rotation_d_1(2) * avg_rot_local(2));
      68             : 
      69      111578 :   RankTwoTensor rotation_a;
      70      111578 :   rotation_a(0, 0) = 1.0;
      71      111578 :   rotation_a(1, 1) = std::cos(gamma_increment);
      72      111578 :   rotation_a(1, 2) = std::sin(gamma_increment);
      73      111578 :   rotation_a(2, 1) = -rotation_a(1, 2);
      74      111578 :   rotation_a(2, 2) = rotation_a(1, 1);
      75             : 
      76             :   // Total rotation matrix from global configuration to beam local config at current time
      77      111578 :   _total_rotation[0] = rotation_a * rotation_d * _total_rotation_old[0];
      78      111578 : }

Generated by: LCOV version 1.14