https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeStrainBase.C
Go to the documentation of this file.
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#include "ComputeStrainBase.h"
11#include "MooseMesh.h"
12#include "Assembly.h"
13
16{
19 "displacements",
20 "The displacements appropriate for the simulation geometry and coordinate system");
21 params.addParam<std::string>("base_name",
22 "Optional parameter that allows the user to define "
23 "multiple mechanics material systems on the same "
24 "block, i.e. for multiple phases");
25 params.addParam<bool>(
26 "volumetric_locking_correction", false, "Flag to correct volumetric locking");
27 params.addParam<std::vector<MaterialPropertyName>>(
28 "eigenstrain_names", {}, "List of eigenstrains to be applied in this strain calculation");
29 params.addParam<MaterialPropertyName>("global_strain",
30 "Optional material property holding a global strain "
31 "tensor applied to the mesh as a whole");
32 params.suppressParameter<bool>("use_displaced_mesh");
33 return params;
34}
35
38 _ndisp(coupledComponents("displacements")),
39 _disp(coupledValues("displacements")),
40 _grad_disp(coupledGradients("displacements")),
41 _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
42 _mechanical_strain(declareProperty<RankTwoTensor>(_base_name + "mechanical_strain")),
43 _total_strain(declareProperty<RankTwoTensor>(_base_name + "total_strain")),
44 _eigenstrain_names(getParam<std::vector<MaterialPropertyName>>("eigenstrain_names")),
45 _eigenstrains(_eigenstrain_names.size()),
46 _global_strain(isParamValid("global_strain")
47 ? &getMaterialProperty<RankTwoTensor>(_base_name + "global_strain")
48 : nullptr),
49 _volumetric_locking_correction(getParam<bool>("volumetric_locking_correction") &&
50 !isBoundaryMaterial()),
51 _current_elem_volume(_assembly.elemVolume())
52{
53 for (unsigned int i = 0; i < _eigenstrains.size(); ++i)
54 {
56 _eigenstrains[i] = &getMaterialProperty<RankTwoTensor>(_eigenstrain_names[i]);
57 }
58
59 // set unused dimensions to zero
60 _disp.resize(3, &_zero);
61 _grad_disp.resize(3, &_grad_zero);
62
64 paramError("volumetric_locking_correction", "has to be set to false for 1-D problems.");
65
66 if (getParam<bool>("use_displaced_mesh"))
67 paramError("use_displaced_mesh", "The strain calculator needs to run on the undisplaced mesh.");
68
69 // Generate warning when volumetric locking correction is used with second order elements
70 if (_mesh.hasSecondOrderElements() && _volumetric_locking_correction)
71 mooseWarning("Volumetric locking correction is not required for second order elements. Using "
72 "volumetric locking with second order elements could cause zigzag patterns in "
73 "stresses and strains.");
74}
75
76void
81
82void
84{
85 // Checking for consistency between mesh size and length of the provided displacements vector
86 if (_ndisp != _mesh.dimension())
87 paramError(
88 "displacements",
89 "The number of variables supplied in 'displacements' must match the mesh dimension.");
90}
91
92void
void mooseWarning(Args &&... args)
std::vector< const VariableGradient * > _grad_disp
Gradient of displacements.
std::vector< const VariableValue * > _disp
Displacement variables.
MaterialProperty< RankTwoTensor > & _mechanical_strain
ComputeStrainBase(const InputParameters &parameters)
unsigned int _ndisp
Coupled displacement variables.
virtual void initQpStatefulProperties() override
void initialSetup() override
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains
std::vector< MaterialPropertyName > _eigenstrain_names
virtual void displacementIntegrityCheck()
const std::string _base_name
Base name of the material system.
MaterialProperty< RankTwoTensor > & _total_strain
static InputParameters validParams()
const bool _volumetric_locking_correction
void suppressParameter(const std::string &name)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()