www.mooseframework.org
ComputeVolumetricEigenstrain.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 
11 #include "RankTwoTensor.h"
12 
14 
16 
17 InputParameters
19 {
20  InputParameters params = ComputeEigenstrainBase::validParams();
21  params.addClassDescription("Computes an eigenstrain that is defined by a set of scalar material "
22  "properties that summed together define the volumetric change. This "
23  "also computes the derivatives of that eigenstrain with respect to a "
24  "supplied set of variable dependencies.");
25  params.addRequiredParam<std::vector<MaterialPropertyName>>(
26  "volumetric_materials", "List of scalar materials defining the volumetric change");
27  params.addRequiredCoupledVar("args", "variable dependencies for the volumetric_expansion");
28  return params;
29 }
30 
32  : DerivativeMaterialInterface<ComputeEigenstrainBase>(parameters),
33  _num_args(coupledComponents("args")),
34  _volumetric_material_names(getParam<std::vector<MaterialPropertyName>>("volumetric_materials")),
35  _volumetric_materials(_volumetric_material_names.size()),
36  _dvolumetric_materials(_volumetric_material_names.size()),
37  _d2volumetric_materials(_volumetric_material_names.size()),
38  _delastic_strain(_num_args),
39  _d2elastic_strain(_num_args)
40 {
41  for (unsigned int i = 0; i < _volumetric_material_names.size(); ++i)
42  _volumetric_materials[i] = &getMaterialProperty<Real>(_volumetric_material_names[i]);
43 
44  // fetch prerequisite derivatives and build elastic_strain derivatives and cross-derivatives
45  for (unsigned int i = 0; i < _volumetric_material_names.size(); ++i)
46  {
47  const MaterialPropertyName & vol_matl_name = _volumetric_material_names[i];
50  for (unsigned int j = 0; j < _num_args; ++j)
51  {
52  const VariableName & jname = getVar("args", j)->name();
53  _dvolumetric_materials[i][j] = &getMaterialPropertyDerivative<Real>(vol_matl_name, jname);
54  _d2volumetric_materials[i][j].resize(_num_args);
55 
56  for (unsigned int k = j; k < _num_args; ++k)
57  {
58  const VariableName & kname = getVar("args", k)->name();
59  _d2volumetric_materials[i][j][k] =
60  &getMaterialPropertyDerivative<Real>("prefactor", jname, kname);
61  }
62  }
63  }
64 
65  for (unsigned int j = 0; j < _num_args; ++j)
66  {
67  const VariableName & jname = getVar("args", j)->name();
68  _delastic_strain[j] =
69  &declarePropertyDerivative<RankTwoTensor>(_base_name + "elastic_strain", jname);
70  _d2elastic_strain[j].resize(_num_args);
71 
72  for (unsigned int k = j; k < _num_args; ++k)
73  {
74  const VariableName & kname = getVar("args", k)->name();
75  _d2elastic_strain[j][k] =
76  &declarePropertyDerivative<RankTwoTensor>(_base_name + "elastic_strain", jname, kname);
77  }
78  }
79 }
80 
81 void
83 {
84  for (auto vmn : _volumetric_material_names)
85  validateCoupling<Real>(vmn);
86 
87  for (unsigned int i = 0; i < _num_args; ++i)
88  {
89  const VariableName & iname = getVar("args", i)->name();
90  if (_fe_problem.isMatPropRequested(
91  derivativePropertyNameFirst(_base_name + "elastic_strain", iname)))
92  mooseError("Derivative of elastic_strain requested, but not yet implemented");
93  else
94  _delastic_strain[i] = nullptr;
95  for (unsigned int j = 0; j < _num_args; ++j)
96  {
97  const VariableName & jname = getVar("args", j)->name();
98  if (_fe_problem.isMatPropRequested(
99  derivativePropertyNameSecond(_base_name + "elastic_strain", iname, jname)))
100  mooseError("Second Derivative of elastic_strain requested, but not yet implemented");
101  else
102  _d2elastic_strain[i][j] = nullptr;
103  }
104  }
105 }
106 
107 void
109 {
110  Real volumetric_strain = 0;
111  for (unsigned int i = 0; i < _volumetric_materials.size(); ++i)
112  volumetric_strain += (*_volumetric_materials[i])[_qp];
113 
114  const Real eigenstrain_comp = computeVolumetricStrainComponent(volumetric_strain);
115  _eigenstrain[_qp].zero();
116  _eigenstrain[_qp].addIa(eigenstrain_comp);
117 
118  // TODO: Compute derivatives of the elastic strain wrt the variables specified in args
119 }
defineLegacyParams
defineLegacyParams(ComputeVolumetricEigenstrain)
ComputeEigenstrainBase::validParams
static InputParameters validParams()
Definition: ComputeEigenstrainBase.C:17
ComputeVolumetricEigenstrain::_num_args
const unsigned int _num_args
number of variables the material depends on
Definition: ComputeVolumetricEigenstrain.h:38
ComputeVolumetricEigenstrain
ComputeVolumetricEigenstrain computes an eigenstrain that is defined by a set of scalar material prop...
Definition: ComputeVolumetricEigenstrain.h:26
ComputeVolumetricEigenstrain::_volumetric_materials
std::vector< const MaterialProperty< Real > * > _volumetric_materials
The material properties that define volumetric change.
Definition: ComputeVolumetricEigenstrain.h:43
ComputeVolumetricEigenstrain.h
ComputeVolumetricEigenstrain::computeQpEigenstrain
virtual void computeQpEigenstrain()
Definition: ComputeVolumetricEigenstrain.C:108
ComputeVolumetricEigenstrain::ComputeVolumetricEigenstrain
ComputeVolumetricEigenstrain(const InputParameters &parameters)
Definition: ComputeVolumetricEigenstrain.C:31
ComputeVolumetricEigenstrain::_dvolumetric_materials
std::vector< std::vector< const MaterialProperty< Real > * > > _dvolumetric_materials
first derivatives of the volumetric materials with respect to the args
Definition: ComputeVolumetricEigenstrain.h:46
ComputeVolumetricEigenstrain::_d2elastic_strain
std::vector< std::vector< MaterialProperty< RankTwoTensor > * > > _d2elastic_strain
second derivatives of the elastic strain with respect to the args
Definition: ComputeVolumetricEigenstrain.h:53
ComputeVolumetricEigenstrain::_delastic_strain
std::vector< MaterialProperty< RankTwoTensor > * > _delastic_strain
first derivatives of the elastic strain with respect to the args
Definition: ComputeVolumetricEigenstrain.h:51
ComputeVolumetricEigenstrain::validParams
static InputParameters validParams()
Definition: ComputeVolumetricEigenstrain.C:18
ComputeVolumetricEigenstrain::initialSetup
virtual void initialSetup()
Definition: ComputeVolumetricEigenstrain.C:82
ComputeVolumetricEigenstrain::_d2volumetric_materials
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _d2volumetric_materials
second derivatives of the volumetric materials with respect to the args
Definition: ComputeVolumetricEigenstrain.h:48
ComputeEigenstrainBase
ComputeEigenstrainBase is the base class for eigenstrain tensors.
Definition: ComputeEigenstrainBase.h:26
registerMooseObject
registerMooseObject("TensorMechanicsApp", ComputeVolumetricEigenstrain)
ComputeVolumetricEigenstrain::_volumetric_material_names
const std::vector< MaterialPropertyName > _volumetric_material_names
Names of the material properties that define volumetric change.
Definition: ComputeVolumetricEigenstrain.h:41