OGS
CreateLinearElasticIsotropicSoftening.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
8
9namespace MaterialLib
10{
11namespace Solids
12{
13template <int DisplacementDim>
14std::unique_ptr<LinearElasticIsotropicSoftening<DisplacementDim>>
16 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
17 BaseLib::ConfigTree const& config, const bool skip_type_checking)
18{
19 if (!skip_type_checking)
20 {
22 config.checkConfigParameter("type", "LinearElasticIsotropicSoftening");
23 DBUG("Create LinearElasticIsotropic material");
24 }
25
26 // Youngs modulus
27 auto& youngs_modulus = ParameterLib::findParameter<double>(
29 config, "youngs_modulus", parameters, 1);
30
31 DBUG("Use '{:s}' as youngs_modulus parameter.", youngs_modulus.name);
32
33 // Poissons ratio
34 auto& poissons_ratio = ParameterLib::findParameter<double>(
36 config, "poissons_ratio", parameters, 1);
37
38 DBUG("Use '{:s}' as poissons_ratio parameter.", poissons_ratio.name);
39
40 // Material strength factor
43 config, "strength", parameters, 1);
44
45 DBUG("Use '{:s}' as strength parameter.", strength.name);
46
48 DisplacementDim>::MaterialProperties mp{youngs_modulus, poissons_ratio};
49
50 return std::make_unique<LinearElasticIsotropicSoftening<DisplacementDim>>(
51 mp, strength);
52}
53
54} // namespace Solids
55} // namespace MaterialLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< LinearElasticIsotropicSoftening< DisplacementDim > > createLinearElasticIsotropicSoftening(std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, BaseLib::ConfigTree const &config, const bool skip_type_checking)
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)