https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ConstantsFromElasticityTensor.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
12
13#include "metaphysicl/raw_type.h"
14
17
18template <bool is_ad>
21{
23 params.addClassDescription("Calculate elastic constants from an isotropic elasticity tensor");
24 params.addParam<MaterialPropertyName>(
25 "elasticity_tensor", "elasticity_tensor", "The name of the elasticity tensor.");
26 params.addParam<std::string>("base_name",
27 "Optional parameter that allows the user to define "
28 "multiple mechanics material systems on the same "
29 "block, i.e. for multiple phases");
30
31 return params;
32}
33
34template <bool is_ad>
36 const InputParameters & parameters)
37 : Material(parameters),
39 _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
40 _youngs_modulus(this->template declareGenericProperty<Real, is_ad>(
41 _base_name + "youngs_modulus_from_tensor")),
42 _poissons_ratio(this->template declareGenericProperty<Real, is_ad>(
43 _base_name + "poissons_ratio_from_tensor")),
44 _shear_modulus(this->template declareGenericProperty<Real, is_ad>(_base_name +
45 "shear_modulus_from_tensor")),
46 _bulk_modulus(this->template declareGenericProperty<Real, is_ad>(_base_name +
47 "bulk_modulus_from_tensor")),
48 _elasticity_tensor_name(getParam<MaterialPropertyName>("elasticity_tensor")),
49 _elasticity_tensor(this->template getGenericMaterialPropertyByName<RankFourTensor, is_ad>(
50 _base_name + _elasticity_tensor_name))
51{
52}
53
54template <bool is_ad>
55void
57{
58 if (!hasGuaranteedMaterialProperty(_base_name + _elasticity_tensor_name, Guarantee::ISOTROPIC))
59 mooseError("ConstantsFromElasticityTensor requires that the elasticity tensor be "
60 "guaranteed isotropic");
61}
62
63template <bool is_ad>
64void
74
registerMooseObject("SolidMechanicsApp", ConstantsFromElasticityTensor)
void mooseError(Args &&... args)
This material computes the elastic constants such as Young's modulus from the elasticity tensor.
ConstantsFromElasticityTensorTempl(const InputParameters &parameters)
Add-on class that provides the functionality to check if guarantees for material properties are provi...
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
T getIsotropicYoungsModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the Young's modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must b...
T getIsotropicPoissonsRatio(const RankFourTensorTempl< T > &elasticity_tensor)
Get the Poisson's modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must...
T getIsotropicBulkModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the bulk modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be i...
T getIsotropicShearModulus(const RankFourTensorTempl< T > &elasticity_tensor)
Get the shear modulus for an isotropic elasticity tensor param elasticity_tensor the tensor (must be ...
auto raw_value(const Eigen::Map< T > &in)
Real elasticity_tensor(unsigned int i, unsigned int j, unsigned int k, unsigned int l)