OGS
MaterialLib::Solids Namespace Reference

Namespaces

 Creep
 
 Ehlers
 
 Lubby2
 
 MFront
 
 Phasefield
 

Classes

struct  MechanicsBase
 
class  LinearElasticIsotropic
 
class  LinearElasticOrthotropic
 

Enumerations

enum class  ConstitutiveModel {
  Ehlers , LinearElasticIsotropic , Lubby2 , CreepBGRa ,
  Invalid
}
 

Functions

template<int DisplacementDim>
std::unique_ptr< MaterialLib::Solids::MechanicsBase< DisplacementDim > > createConstitutiveRelation (std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config)
 
template<int DisplacementDim>
std::map< int, std::unique_ptr< MaterialLib::Solids::MechanicsBase< DisplacementDim > > > createConstitutiveRelations (std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config)
 
template std::map< int, std::unique_ptr< MaterialLib::Solids::MechanicsBase< 2 > > > createConstitutiveRelations< 2 > (std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config)
 
template std::map< int, std::unique_ptr< MaterialLib::Solids::MechanicsBase< 3 > > > createConstitutiveRelations< 3 > (std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config)
 
template<int DisplacementDim>
std::unique_ptr< LinearElasticIsotropic< DisplacementDim > > createLinearElasticIsotropic (std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, BaseLib::ConfigTree const &config, const bool skip_type_checking)
 
template<int DisplacementDim>
std::unique_ptr< LinearElasticOrthotropic< DisplacementDim > > createLinearElasticOrthotropic (std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config, const bool skip_type_checking)
 
template<int DisplacementDim>
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > elasticTangentStiffness (double const first_lame_parameter, double const shear_modulus)
 
template<int DisplacementDim>
MechanicsBase< DisplacementDim > & selectSolidConstitutiveRelation (std::map< int, std::unique_ptr< MechanicsBase< DisplacementDim >>> const &constitutive_relations, MeshLib::PropertyVector< int > const *const material_ids, std::size_t const element_id)
 

Enumeration Type Documentation

◆ ConstitutiveModel

Function Documentation

◆ createConstitutiveRelation()

template<int DisplacementDim>
std::unique_ptr<MaterialLib::Solids::MechanicsBase<DisplacementDim> > MaterialLib::Solids::createConstitutiveRelation ( std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
std::optional< ParameterLib::CoordinateSystem > const &  local_coordinate_system,
BaseLib::ConfigTree const &  config 
)
Input File Parameter:
material__solid__constitutive_relation__type

Definition at line 34 of file CreateConstitutiveRelation.cpp.

39 {
40  auto const type =
42  config.peekConfigParameter<std::string>("type");
43 
44  if (type == "Ehlers")
45  {
46  return MaterialLib::Solids::Ehlers::createEhlers<DisplacementDim>(
47  parameters, config);
48  }
49  if (type == "LinearElasticIsotropic")
50  {
51  const bool skip_type_checking = false;
53  DisplacementDim>(parameters, config, skip_type_checking);
54  }
55  if (type == "LinearElasticOrthotropic")
56  {
57  const bool skip_type_checking = false;
59  DisplacementDim>(
60  parameters, local_coordinate_system, config, skip_type_checking);
61  }
62  if (type == "Lubby2")
63  {
64  return MaterialLib::Solids::Lubby2::createLubby2<DisplacementDim>(
65  parameters, config);
66  }
67  if (type == "CreepBGRa")
68  {
69  return MaterialLib::Solids::Creep::createCreepBGRa<DisplacementDim>(
70  parameters, config);
71  }
72  if (type == "MFront")
73  {
74 #ifdef OGS_USE_MFRONT
75  return MaterialLib::Solids::MFront::createMFront<DisplacementDim>(
76  parameters, local_coordinate_system, config);
77 #else // OGS_USE_MFRONT
78  OGS_FATAL(
79  "OGS is compiled without MFront support. See OGS_USE_MFRONT CMake "
80  "option.");
81 #endif // OGS_USE_MFRONT
82  }
83  OGS_FATAL("Cannot construct constitutive relation of given type '{:s}'.",
84  type);
85 }
#define OGS_FATAL(...)
Definition: Error.h:26
std::unique_ptr< LinearElasticIsotropic< DisplacementDim > > createLinearElasticIsotropic(std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, BaseLib::ConfigTree const &config, const bool skip_type_checking)
std::unique_ptr< LinearElasticOrthotropic< DisplacementDim > > createLinearElasticOrthotropic(std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config, const bool skip_type_checking)

References createLinearElasticIsotropic(), createLinearElasticOrthotropic(), OGS_FATAL, and BaseLib::ConfigTree::peekConfigParameter().

◆ createConstitutiveRelations()

template<int DisplacementDim>
std::map< int, std::unique_ptr< MaterialLib::Solids::MechanicsBase< DisplacementDim > > > MaterialLib::Solids::createConstitutiveRelations ( std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
std::optional< ParameterLib::CoordinateSystem > const &  local_coordinate_system,
BaseLib::ConfigTree const &  config 
)
Input File Parameter:
material__solid__constitutive_relation
Input File Parameter:
material__solid__constitutive_relation__id

Definition at line 90 of file CreateConstitutiveRelation.cpp.

95 {
96  auto const constitutive_relation_configs =
98  config.getConfigSubtreeList("constitutive_relation");
99 
100  std::map<int, std::unique_ptr<MechanicsBase<DisplacementDim>>>
101  constitutive_relations;
102 
103  for (auto const& constitutive_relation_config :
104  constitutive_relation_configs)
105  {
106  int const material_id =
108  constitutive_relation_config.getConfigAttribute<int>("id", 0);
109 
110  if (constitutive_relations.find(material_id) !=
111  constitutive_relations.end())
112  {
113  OGS_FATAL(
114  "Multiple constitutive relations were specified for the same "
115  "material id {:d}. Keep in mind, that if no material id is "
116  "specified, it is assumed to be 0 by default.",
117  material_id);
118  }
119 
120  constitutive_relations.emplace(
121  material_id,
122  createConstitutiveRelation<DisplacementDim>(
123  parameters,
124  local_coordinate_system,
125  constitutive_relation_config));
126  }
127 
128  DBUG("Found {:d} constitutive relations.", constitutive_relations.size());
129 
130  return constitutive_relations;
131 }
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:29

References DBUG(), BaseLib::ConfigTree::getConfigSubtreeList(), and OGS_FATAL.

◆ createConstitutiveRelations< 2 >()

template std::map< int, std::unique_ptr< MaterialLib::Solids::MechanicsBase< 2 > > > MaterialLib::Solids::createConstitutiveRelations< 2 > ( std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
std::optional< ParameterLib::CoordinateSystem > const &  local_coordinate_system,
BaseLib::ConfigTree const &  config 
)

◆ createConstitutiveRelations< 3 >()

template std::map< int, std::unique_ptr< MaterialLib::Solids::MechanicsBase< 3 > > > MaterialLib::Solids::createConstitutiveRelations< 3 > ( std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
std::optional< ParameterLib::CoordinateSystem > const &  local_coordinate_system,
BaseLib::ConfigTree const &  config 
)

◆ createLinearElasticIsotropic()

template<int DisplacementDim>
std::unique_ptr<LinearElasticIsotropic<DisplacementDim> > MaterialLib::Solids::createLinearElasticIsotropic ( std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
BaseLib::ConfigTree const &  config,
const bool  skip_type_checking 
)
Input File Parameter:
material__solid__constitutive_relation__type
Input File Parameter:
material__solid__constitutive_relation__LinearElasticIsotropic__youngs_modulus
Input File Parameter:
material__solid__constitutive_relation__LinearElasticIsotropic__poissons_ratio

Definition at line 23 of file CreateLinearElasticIsotropic.h.

26 {
27  if (!skip_type_checking)
28  {
30  config.checkConfigParameter("type", "LinearElasticIsotropic");
31  DBUG("Create LinearElasticIsotropic material");
32  }
33 
34  // Youngs modulus
35  auto& youngs_modulus = ParameterLib::findParameter<double>(
37  config, "youngs_modulus", parameters, 1);
38 
39  DBUG("Use '{:s}' as youngs_modulus parameter.", youngs_modulus.name);
40 
41  // Poissons ratio
42  auto& poissons_ratio = ParameterLib::findParameter<double>(
44  config, "poissons_ratio", parameters, 1);
45 
46  DBUG("Use '{:s}' as poissons_ratio parameter.", poissons_ratio.name);
47 
48  typename LinearElasticIsotropic<DisplacementDim>::MaterialProperties mp{
50 
51  return std::make_unique<LinearElasticIsotropic<DisplacementDim>>(mp);
52 }

References BaseLib::ConfigTree::checkConfigParameter(), DBUG(), MaterialPropertyLib::poissons_ratio, and MaterialPropertyLib::youngs_modulus.

Referenced by createConstitutiveRelation().

◆ createLinearElasticOrthotropic()

template<int DisplacementDim>
template std::unique_ptr< LinearElasticOrthotropic< 3 > > MaterialLib::Solids::createLinearElasticOrthotropic ( std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
std::optional< ParameterLib::CoordinateSystem > const &  local_coordinate_system,
BaseLib::ConfigTree const &  config,
const bool  skip_type_checking 
)
Input File Parameter:
material__solid__constitutive_relation__type
Input File Parameter:
material__solid__constitutive_relation__LinearElasticOrthotropic__youngs_moduli
Input File Parameter:
material__solid__constitutive_relation__LinearElasticOrthotropic__shear_moduli
Input File Parameter:
material__solid__constitutive_relation__LinearElasticOrthotropic__poissons_ratios

Definition at line 20 of file CreateLinearElasticOrthotropic.cpp.

25 {
26  if (!skip_type_checking)
27  {
29  config.checkConfigParameter("type", "LinearElasticOrthotropic");
30  DBUG("Create LinearElasticOrthotropic material");
31  }
32 
33  // The three Youngs moduli are required even in two-dimensional case. Same
34  // for the shear moduli and the Poissons ratios.
35  auto& youngs_moduli = ParameterLib::findParameter<double>(
37  config, "youngs_moduli", parameters, 3);
38  DBUG("Use '{:s}' as youngs_moduli parameter.", youngs_moduli.name);
39 
40  // Shear moduli
41  auto& shear_moduli = ParameterLib::findParameter<double>(
43  config, "shear_moduli", parameters, 3);
44  DBUG("Use '{:s}' as shear_moduli parameter.", shear_moduli.name);
45 
46  // Poissons ratios
47  auto& poissons_ratios = ParameterLib::findParameter<double>(
49  config, "poissons_ratios", parameters, 3);
50  DBUG("Use '{:s}' as poissons_ratios parameter.", poissons_ratios.name);
51 
52  typename LinearElasticOrthotropic<DisplacementDim>::MaterialProperties mp{
53  youngs_moduli, shear_moduli, poissons_ratios};
54 
55  return std::make_unique<LinearElasticOrthotropic<DisplacementDim>>(
56  mp, local_coordinate_system);
57 }

References BaseLib::ConfigTree::checkConfigParameter(), and DBUG().

Referenced by createConstitutiveRelation().

◆ elasticTangentStiffness()

template<int DisplacementDim>
MathLib::KelvinVector::KelvinMatrixType<DisplacementDim> MaterialLib::Solids::elasticTangentStiffness ( double const  first_lame_parameter,
double const  shear_modulus 
)

Definition at line 125 of file LinearElasticIsotropic.h.

127 {
128  using KelvinMatrix =
130 
131  KelvinMatrix tangentStiffness = KelvinMatrix::Zero();
132  tangentStiffness.template topLeftCorner<3, 3>().setConstant(
133  first_lame_parameter);
134  tangentStiffness.noalias() += 2 * shear_modulus * KelvinMatrix::Identity();
135  return tangentStiffness;
136 }
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), kelvin_vector_dimensions(DisplacementDim), Eigen::RowMajor > KelvinMatrixType
Definition: KelvinVector.h:57
MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > KelvinMatrix
Definition: Base.h:23

◆ selectSolidConstitutiveRelation()

template<int DisplacementDim>
MechanicsBase<DisplacementDim>& MaterialLib::Solids::selectSolidConstitutiveRelation ( std::map< int, std::unique_ptr< MechanicsBase< DisplacementDim >>> const &  constitutive_relations,
MeshLib::PropertyVector< int > const *const  material_ids,
std::size_t const  element_id 
)

Choose solid material model for given element id out of a set of models, possibly using the material ids.

Only two possibilities yield a valid result and result in OGS_FATAL call otherwise.

  1. There is only one constitutive relation in the set of constitutive_relations, then the material and element ids are ignored and the only constitutive relation (under id 0) is returned.
  2. For each material id chosen for the given element id there exists a constitutive relation in the set.

Definition at line 33 of file SelectSolidConstitutiveRelation.h.

38 {
39  int material_id;
40  if (constitutive_relations.size() == 1 || material_ids == nullptr)
41  {
42  material_id = 0;
43  }
44  else
45  {
46  material_id = (*material_ids)[element_id];
47  }
48 
49  auto const constitutive_relation = constitutive_relations.find(material_id);
50  if (constitutive_relation == end(constitutive_relations))
51  {
52  OGS_FATAL(
53  "No constitutive relation found for material id {:d} and element "
54  "{:d}. There are {:d} constitutive relations available.",
55  material_id, element_id, constitutive_relations.size());
56  }
57 
58  if (constitutive_relation->second == nullptr)
59  {
60  OGS_FATAL(
61  "The constitutive relation found for material id {:d} and element "
62  "{:d} is a nullptr, which is impossible.",
63  material_id, element_id);
64  }
65 
66  return *constitutive_relation->second;
67 }

References OGS_FATAL.

Referenced by ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::HydroMechanicsLocalAssembler(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, GlobalDim >::HydroMechanicsLocalAssemblerMatrix(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::PhaseFieldLocalAssembler(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::RichardsMechanicsLocalAssembler(), ProcessLib::SmallDeformation::SmallDeformationLocalAssembler< ShapeFunction, DisplacementDim >::SmallDeformationLocalAssembler(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, DisplacementDim >::SmallDeformationLocalAssemblerMatrix(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, DisplacementDim >::SmallDeformationLocalAssemblerMatrixNearFracture(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, DisplacementDim >::SmallDeformationNonlocalLocalAssembler(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::TH2MLocalAssembler(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::ThermoHydroMechanicsLocalAssembler(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::ThermoMechanicalPhaseFieldLocalAssembler(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::ThermoMechanicsLocalAssembler(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), and ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobianForPressureEquations().