LCOV - code coverage report
Current view: top level - include/kernels/lagrangian - UpdatedLagrangianStressDivergence.h (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 6 12 50.0 %
Date: 2025-07-25 05:00:39 Functions: 2 4 50.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             : #pragma once
      11             : 
      12             : #include "LagrangianStressDivergenceBase.h"
      13             : #include "GradientOperator.h"
      14             : #include "Assembly.h"
      15             : 
      16             : /// Enforce equilibrium with an updated Lagrangian formulation
      17             : ///
      18             : /// This class enforces equilibrium when  used in conjunction with
      19             : /// the corresponding strain calculator (CalculateStrainLagrangianKernel)
      20             : /// and with either a stress calculator that provides the
      21             : /// Cauchy stress ("stress") and the appropriate "cauchy_jacobian",
      22             : /// which needs to be the derivative of the increment in Cauchy stress
      23             : /// with respect to the increment in the spatial velocity gradient.
      24             : ///
      25             : /// This kernel should be used with the new "ComputeLagrangianStressBase"
      26             : /// stress update system and the "ComputeLagrangianStrain" system for strains.
      27             : ///
      28             : /// use_displaced_mesh must be true for large deformation kinematics
      29             : /// The kernel enforces this with an error
      30             : ///
      31             : template <class G>
      32             : class UpdatedLagrangianStressDivergenceBase : public LagrangianStressDivergenceBase, public G
      33             : {
      34             : public:
      35           0 :   static InputParameters baseParams()
      36             :   {
      37           0 :     InputParameters params = LagrangianStressDivergenceBase::validParams();
      38           0 :     return params;
      39             :   }
      40             :   static InputParameters validParams();
      41             :   UpdatedLagrangianStressDivergenceBase(const InputParameters & parameters);
      42             :   virtual void initialSetup() override;
      43             : 
      44             : protected:
      45             :   virtual RankTwoTensor gradTest(unsigned int component) override;
      46             :   virtual RankTwoTensor gradTrial(unsigned int component) override;
      47             :   virtual void precalculateJacobianDisplacement(unsigned int component) override;
      48             :   virtual Real computeQpResidual() override;
      49             :   virtual Real computeQpJacobianDisplacement(unsigned int alpha, unsigned int beta) override;
      50             :   virtual Real computeQpJacobianTemperature(unsigned int cvar) override;
      51           0 :   virtual Real computeQpJacobianOutOfPlaneStrain() override { return 0; }
      52             : 
      53             :   /// The Cauchy stress
      54             :   const MaterialProperty<RankTwoTensor> & _stress;
      55             : 
      56             :   // The derivative of the increment in Cauchy stress w.r.t. the increment in the spatial velocity
      57             :   // gradient
      58             :   const MaterialProperty<RankFourTensor> & _material_jacobian;
      59             : 
      60             :   // @{
      61             :   // The assembly quantities in the reference frame for stabilization
      62             :   Assembly & _assembly_undisplaced;
      63             :   const VariablePhiGradient & _grad_phi_undisplaced;
      64             :   const MooseArray<Real> & _JxW_undisplaced;
      65             :   const MooseArray<Real> & _coord_undisplaced;
      66             :   const MooseArray<Point> & _q_point_undisplaced;
      67             :   // @}
      68             : 
      69             : private:
      70             :   /// The unstabilized trial function gradient
      71             :   virtual RankTwoTensor gradTrialUnstabilized(unsigned int component);
      72             : 
      73             :   /// The stabilized trial function gradient
      74             :   virtual RankTwoTensor gradTrialStabilized(unsigned int component);
      75             : };
      76             : 
      77             : template <>
      78             : inline InputParameters
      79        1456 : UpdatedLagrangianStressDivergenceBase<GradientOperatorCartesian>::validParams()
      80             : {
      81             :   InputParameters params = UpdatedLagrangianStressDivergenceBase::baseParams();
      82        1456 :   params.addClassDescription(
      83             :       "Enforce equilibrium with an updated Lagrangian formulation in Cartesian coordinates.");
      84        1456 :   return params;
      85           0 : }
      86             : 
      87             : template <>
      88             : inline void
      89         728 : UpdatedLagrangianStressDivergenceBase<GradientOperatorCartesian>::initialSetup()
      90             : {
      91         728 :   if (getBlockCoordSystem() != Moose::COORD_XYZ)
      92           0 :     mooseError("This kernel should only act in Cartesian coordinates.");
      93         728 : }
      94             : 
      95             : typedef UpdatedLagrangianStressDivergenceBase<GradientOperatorCartesian>
      96             :     UpdatedLagrangianStressDivergence;

Generated by: LCOV version 1.14