LCOV - code coverage report
Current view: top level - include/kernels/lagrangian - UpdatedLagrangianStressDivergence.h (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #33390 (250e9c) with base 846a5c Lines: 9 17 52.9 %
Date: 2026-07-31 18:20:40 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. F-bar stabilization is handled explicitly in
      71             :   /// computeQpJacobianDisplacement via the strain-calculator F-bar partials, so the UL kernel
      72             :   /// does not need a separate gradTrialStabilized helper.
      73             :   virtual RankTwoTensor gradTrialUnstabilized(unsigned int component);
      74             : };
      75             : 
      76             : template <>
      77             : inline InputParameters
      78        1188 : UpdatedLagrangianStressDivergenceBase<GradientOperatorCartesian>::validParams()
      79             : {
      80             :   InputParameters params = UpdatedLagrangianStressDivergenceBase::baseParams();
      81        1188 :   params.addClassDescription(
      82             :       "Enforce equilibrium with an updated Lagrangian formulation in Cartesian coordinates.");
      83        1188 :   return params;
      84           0 : }
      85             : 
      86             : template <>
      87             : inline void
      88         594 : UpdatedLagrangianStressDivergenceBase<GradientOperatorCartesian>::initialSetup()
      89             : {
      90             :   // Derives _large_kinematics from the strain calculator's LARGE_KINEMATICS guarantee.
      91         594 :   LagrangianStressDivergenceBase::initialSetup();
      92             : 
      93         594 :   if (getBlockCoordSystem() != Moose::COORD_XYZ)
      94           0 :     mooseError("This kernel should only act in Cartesian coordinates.");
      95             : 
      96             :   // The updated Lagrangian kernel integrates on the displaced mesh iff large kinematics is on;
      97             :   // large_kinematics is derived from the strain calculator, so validate the pairing here.
      98        1722 :   if (_large_kinematics && !getParam<bool>("use_displaced_mesh"))
      99           0 :     mooseError("The UpdatedLagrangianStressDivergence kernels require use_displaced_mesh = true "
     100             :                "for large_kinematics = true");
     101        1030 :   if (!_large_kinematics && getParam<bool>("use_displaced_mesh"))
     102           0 :     mooseError("The UpdatedLagrangianStressDivergence kernels require use_displaced_mesh = false "
     103             :                "for large_kinematics = false");
     104         594 : }
     105             : 
     106             : typedef UpdatedLagrangianStressDivergenceBase<GradientOperatorCartesian>
     107             :     UpdatedLagrangianStressDivergence;

Generated by: LCOV version 1.14