www.mooseframework.org
ADComputeStressBase.C
Go to the documentation of this file.
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 #include "ADComputeStressBase.h"
11 #include "RankTwoTensor.h"
12 #include "RankFourTensor.h"
13 
16  ADMaterial,
17  params.addParam<std::string>("base_name",
18  "Optional parameter that allows the user to define "
19  "multiple mechanics material systems on the same "
20  "block, i.e. for multiple phases");
21  params.suppressParameter<bool>("use_displaced_mesh"););
22 
23 template <ComputeStage compute_stage>
25  : ADMaterial<compute_stage>(parameters),
26  _base_name(isParamValid("base_name") ? adGetParam<std::string>("base_name") + "_" : ""),
27  _mechanical_strain(adGetADMaterialProperty<RankTwoTensor>(_base_name + "mechanical_strain")),
28  _stress(adDeclareADProperty<RankTwoTensor>(_base_name + "stress")),
29  _elastic_strain(adDeclareADProperty<RankTwoTensor>(_base_name + "elastic_strain"))
30 {
31 
32  if (adGetParam<bool>("use_displaced_mesh"))
33  mooseError("The stress calculator needs to run on the undisplaced mesh.");
34 }
35 
36 template <ComputeStage compute_stage>
37 void
39 {
40  _elastic_strain[_qp].zero();
41  _stress[_qp].zero();
42 }
43 
44 template <ComputeStage compute_stage>
45 void
47 {
48  computeQpStress();
49 
50  // TODO: Add in extra stress (using a list of extra_stress_names analogous to eigenstrain_names)
51 }
52 
53 // explicit instantiation is required for AD base classes
ADComputeStressBase is the base class for stress tensors.
adBaseClass(ADComputeStressBase)
virtual void initQpStatefulProperties() override
defineADValidParams(ADComputeStressBase, ADMaterial, params.addParam< std::string >("base_name", "Optional parameter that allows the user to define " "multiple mechanics material systems on the same " "block, i.e. for multiple phases");params.suppressParameter< bool >("use_displaced_mesh");)
ADComputeStressBase(const InputParameters &parameters)
virtual void computeQpProperties() override