LCOV - code coverage report
Current view: top level - include/userobjects/lagrangian - HomogenizationConstraint.h (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 3 3 100.0 %
Date: 2025-07-25 05:00:39 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             : #pragma once
      11             : 
      12             : #include "ElementUserObject.h"
      13             : 
      14             : // Helpers common to the whole homogenization system
      15             : namespace Homogenization
      16             : {
      17             : /// Moose constraint type, for input
      18             : const MultiMooseEnum constraintType("strain stress none");
      19             : /// Constraint type: stress/PK stress or strain/deformation gradient
      20             : enum class ConstraintType
      21             : {
      22             :   Strain,
      23             :   Stress,
      24             :   None
      25             : };
      26             : typedef std::map<std::pair<unsigned int, unsigned int>, std::pair<ConstraintType, const Function *>>
      27             :     ConstraintMap;
      28             : }
      29             : 
      30             : /// Computes $\int_{V}\left(X_{ij}-\hat{X}_{ij}\right)dV$
      31             : ///
      32             : /// Calculates the volume integral of the difference between some
      33             : /// quantity and a target, given as a MOOSE function
      34             : ///
      35             : /// This is used by the HomogenizationConstraintScalarKernel
      36             : /// to enforce cell-average constraints on a simulation domain
      37             : ///
      38             : class HomogenizationConstraint : public ElementUserObject
      39             : {
      40             : public:
      41             :   static InputParameters validParams();
      42             : 
      43             :   HomogenizationConstraint(const InputParameters & parameters);
      44             : 
      45             :   virtual void initialize() override;
      46             :   virtual void execute() override;
      47             :   virtual void threadJoin(const UserObject & y) override;
      48             :   virtual void finalize() override;
      49             : 
      50         148 :   virtual const RankTwoTensor & getResidual() const { return _residual; }
      51         148 :   virtual const RankFourTensor & getJacobian() const { return _jacobian; }
      52         946 :   virtual const Homogenization::ConstraintMap & getConstraintMap() const { return _cmap; }
      53             : 
      54             : protected:
      55             :   /// Total residual assembled as a rank two tensor
      56             :   virtual RankTwoTensor computeResidual();
      57             :   /// Total Jacobian assembled as a rank two tensor
      58             :   virtual RankFourTensor computeJacobian();
      59             : 
      60             : protected:
      61             :   /// If true use large displacement kinematics
      62             :   const bool _large_kinematics;
      63             : 
      64             :   /// Prepend to the material properties
      65             :   const std::string _base_name;
      66             : 
      67             :   /// Deformation gradient
      68             :   const MaterialProperty<RankTwoTensor> & _F;
      69             :   /// 1st PK (or small) stress
      70             :   const MaterialProperty<RankTwoTensor> & _pk1_stress;
      71             :   /// PK derivative
      72             :   const MaterialProperty<RankFourTensor> & _pk1_jacobian;
      73             : 
      74             :   /// Type of each constraint (stress or strain) for each component
      75             :   Homogenization::ConstraintMap _cmap;
      76             : 
      77             : private:
      78             :   /// Used to loop through quadrature points
      79             :   unsigned int _qp;
      80             : 
      81             :   /// The assembled tensor residual
      82             :   RankTwoTensor _residual;
      83             :   /// The assembled tensor jacobian
      84             :   RankFourTensor _jacobian;
      85             : };

Generated by: LCOV version 1.14