https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CombinedScalarDamage.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
11
14
15template <bool is_ad>
18{
20
22 "Scalar damage model which is computed as a function of multiple scalar damage models");
23
24 params.addRequiredParam<std::vector<MaterialName>>("damage_models",
25 "Name of the damage models used to compute "
26 "the damage index");
27
28 MooseEnum combination_type("Maximum Product", "Maximum");
29 params.addParam<MooseEnum>(
30 "combination_type", combination_type, "How the damage models are combined");
31
32 return params;
33}
34
35template <bool is_ad>
37 : ScalarDamageBaseTempl<is_ad>(parameters),
38 _combination_type(
39 this->template getParam<MooseEnum>("combination_type").template getEnum<CombinationType>()),
40 _damage_models_names(this->template getParam<std::vector<MaterialName>>("damage_models"))
41{
42}
43
44template <bool is_ad>
45void
47{
48 for (unsigned int i = 0; i < _damage_models_names.size(); ++i)
49 {
51 &this->getMaterialByName(_damage_models_names[i]));
52
53 if (model)
54 _damage_models.push_back(model);
55 else
56 this->paramError("damage_model",
57 "Damage Model " + _damage_models_names[i] +
58 " is not compatible with CombinedScalarDamage");
59 }
60}
61
62template <bool is_ad>
63void
65{
66 using std::max, std::min;
67
68 switch (_combination_type)
69 {
70 case CombinationType::Maximum:
71 _damage_index[_qp] = _damage_index_old[_qp];
72 for (unsigned int i = 0; i < _damage_models.size(); ++i)
73 _damage_index[_qp] = max(_damage_index[_qp], _damage_models[i]->getQpDamageIndex(_qp));
74 break;
75 case CombinationType::Product:
76 _damage_index[_qp] = 1.0;
77 for (unsigned int i = 0; i < _damage_models.size(); ++i)
78 _damage_index[_qp] *= 1.0 - _damage_models[i]->getQpDamageIndex(_qp);
79 _damage_index[_qp] = 1.0 - _damage_index[_qp];
80 break;
81 }
82
83 _damage_index[_qp] = max(_damage_index_old[_qp], max(0.0, min(1.0, _damage_index[_qp])));
84}
registerMooseObject("SolidMechanicsApp", CombinedScalarDamage)
const PertinentGeochemicalSystem model(database, {"H2O", "H+", "HCO3-", "O2(aq)", "Ca++", ">(s)FeOH", "radius_neg1", "radius_neg1.5"}, {"Calcite"}, {}, {"Calcite_asdf"}, {"CH4(aq)"}, {">(s)FeOCa+"}, "O2(aq)", "e-")
Scalar damage model computed as the combination of multiple damage models.
static InputParameters validParams()
virtual void updateQpDamageIndex() override
Update the damage index at the current qpoint.
CombinedScalarDamageTempl(const InputParameters &parameters)
void addRequiredParam(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)
void addClassDescription(const std::string &doc_string)
Base class for scalar damage models.
static InputParameters validParams()