https://mooseframework.inl.gov
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 
10 #include "CombinedScalarDamage.h"
11 
12 registerMooseObject("SolidMechanicsApp", CombinedScalarDamage);
13 registerMooseObject("SolidMechanicsApp", ADCombinedScalarDamage);
14 
15 template <bool is_ad>
18 {
20 
21  params.addClassDescription(
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 
35 template <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 
44 template <bool is_ad>
45 void
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 
62 template <bool is_ad>
63 void
65 {
66  switch (_combination_type)
67  {
68  case CombinationType::Maximum:
69  _damage_index[_qp] = _damage_index_old[_qp];
70  for (unsigned int i = 0; i < _damage_models.size(); ++i)
71  _damage_index[_qp] = std::max(_damage_index[_qp], _damage_models[i]->getQpDamageIndex(_qp));
72  break;
73  case CombinationType::Product:
74  _damage_index[_qp] = 1.0;
75  for (unsigned int i = 0; i < _damage_models.size(); ++i)
76  _damage_index[_qp] *= 1.0 - _damage_models[i]->getQpDamageIndex(_qp);
77  _damage_index[_qp] = 1.0 - _damage_index[_qp];
78  break;
79  }
80 
81  _damage_index[_qp] =
82  std::max(_damage_index_old[_qp], std::max(0.0, std::min(1.0, _damage_index[_qp])));
83 }
Scalar damage model computed as the combination of multiple damage models.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
CombinedScalarDamageTempl(const InputParameters &parameters)
static InputParameters validParams()
registerMooseObject("SolidMechanicsApp", CombinedScalarDamage)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
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-")
void addClassDescription(const std::string &doc_string)
virtual void updateQpDamageIndex() override
Update the damage index at the current qpoint.
Base class for scalar damage models.