Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 : #ifdef NEML2_ENABLED 13 : #include "neml2/tensors/LabeledVector.h" 14 : #include "neml2/tensors/LabeledMatrix.h" 15 : #include "neml2/models/Model.h" 16 : #endif 17 : 18 : #include "NEML2SolidMechanicsInterface.h" 19 : 20 : #include "BatchMaterial.h" 21 : #include "RankTwoTensor.h" 22 : #include "RankFourTensor.h" 23 : #include "SymmetricRankTwoTensor.h" 24 : #include "SymmetricRankFourTensor.h" 25 : 26 : typedef BatchMaterial<BatchMaterialUtils::TupleStd, 27 : // Outputs: stress, internal variables, dstress/dstrain 28 : std::tuple<RankTwoTensor, RankFourTensor>, 29 : // Inputs: 30 : // strain 31 : // temperature 32 : BatchMaterialUtils::GatherMatProp<RankTwoTensor>, 33 : BatchMaterialUtils::GatherVariable> 34 : CauchyStressFromNEML2UOParent; 35 : 36 : /** 37 : * This user object gathers input variables required for an objective stress integration from all 38 : * quadrature points. The batched input vector is sent through a NEML2 material model to perform the 39 : * constitutive update. 40 : */ 41 : class CauchyStressFromNEML2UO : public NEML2SolidMechanicsInterface<CauchyStressFromNEML2UOParent> 42 : { 43 : public: 44 : static InputParameters validParams(); 45 : 46 : CauchyStressFromNEML2UO(const InputParameters & params); 47 : 48 : #ifndef NEML2_ENABLED 49 : 50 0 : virtual void batchCompute() override {} 51 : 52 : #else 53 : 54 : virtual void batchCompute() override; 55 : virtual void timestepSetup() override; 56 : 57 : protected: 58 : /// Advance state and forces in time 59 : virtual void advanceStep(); 60 : 61 : /// Update the forces driving the material model update 62 : virtual void updateForces(); 63 : 64 : /// Apply the predictor to set current trial state 65 : virtual void applyPredictor(); 66 : 67 : /// Perform the material update 68 : virtual void solve(); 69 : 70 : /// The input vector of the material model 71 : neml2::LabeledVector _in; 72 : 73 : /// The output vector of the material model 74 : neml2::LabeledVector _out; 75 : 76 : /// The derivative of the output vector w.r.t. the input vector 77 : neml2::LabeledMatrix _dout_din; 78 : 79 : #endif // NEML2_ENABLED 80 : };