OGS
CreateLubby2.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "Lubby2.h"
15#include "ParameterLib/Utils.h"
16
17namespace MaterialLib
18{
19namespace Solids
20{
21namespace Lubby2
22{
23template <int DisplacementDim>
24std::unique_ptr<Lubby2<DisplacementDim>> createLubby2(
25 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
26 BaseLib::ConfigTree const& config)
27{
29 config.checkConfigParameter("type", "Lubby2");
30 DBUG("Create Lubby2 material");
31
32 // Kelvin shear modulus.
33 auto& kelvin_shear_modulus = ParameterLib::findParameter<double>(
35 config, "kelvin_shear_modulus", parameters, 1);
36
37 DBUG("Use '{:s}' as kelvin shear modulus parameter.",
38 kelvin_shear_modulus.name);
39
40 // Kelvin viscosity.
41 auto& kelvin_viscosity = ParameterLib::findParameter<double>(
43 config, "kelvin_viscosity", parameters, 1);
44
45 DBUG("Use '{:s}' as kelvin viscosity parameter.", kelvin_viscosity.name);
46
47 // Maxwell shear modulus.
48 auto& maxwell_shear_modulus = ParameterLib::findParameter<double>(
50 config, "maxwell_shear_modulus", parameters, 1);
51
52 DBUG("Use '{:s}' as maxwell shear modulus parameter.",
53 maxwell_shear_modulus.name);
54
55 // Maxwell bulk modulus.
56 auto& maxwell_bulk_modulus = ParameterLib::findParameter<double>(
58 config, "maxwell_bulk_modulus", parameters, 1);
59
60 DBUG("Use '{:s}' as maxwell bulk modulus parameter.",
61 maxwell_bulk_modulus.name);
62
63 // Maxwell viscosity.
64 auto& maxwell_viscosity = ParameterLib::findParameter<double>(
66 config, "maxwell_viscosity", parameters, 1);
67
68 DBUG("Use '{:s}' as maxwell viscosity parameter.", maxwell_viscosity.name);
69
70 // Dependency parameter for mK.
71 auto& dependency_parameter_mK = ParameterLib::findParameter<double>(
73 config, "dependency_parameter_mk", parameters, 1);
74
75 DBUG("Use '{:s}' as dependency parameter mK.",
76 dependency_parameter_mK.name);
77
78 // Dependency parameter for mvK.
79 auto& dependency_parameter_mvK = ParameterLib::findParameter<double>(
81 config, "dependency_parameter_mvk", parameters, 1);
82
83 DBUG("Use '{:s}' as dependency parameter mvK.",
84 dependency_parameter_mvK.name);
85
86 // Dependency parameter for mvM.
87 auto& dependency_parameter_mvM = ParameterLib::findParameter<double>(
89 config, "dependency_parameter_mvm", parameters, 1);
90
91 DBUG("Use '{:s}' as dependency parameter mvM.",
92 dependency_parameter_mvM.name);
93
95 kelvin_shear_modulus, maxwell_shear_modulus,
96 maxwell_bulk_modulus, kelvin_viscosity,
97 maxwell_viscosity, dependency_parameter_mK,
98 dependency_parameter_mvK, dependency_parameter_mvM};
99
100 auto const& nonlinear_solver_config =
102 config.getConfigSubtree("nonlinear_solver");
103 auto const nonlinear_solver_parameters =
104 NumLib::createNewtonRaphsonSolverParameters(nonlinear_solver_config);
105
106 return std::unique_ptr<Lubby2<DisplacementDim>>{
107 new Lubby2<DisplacementDim>{nonlinear_solver_parameters, mp}};
108}
109
110} // namespace Lubby2
111} // namespace Solids
112} // namespace MaterialLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
ConfigTree getConfigSubtree(std::string const &root) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< Lubby2< DisplacementDim > > createLubby2(std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, BaseLib::ConfigTree const &config)
NewtonRaphsonSolverParameters createNewtonRaphsonSolverParameters(BaseLib::ConfigTree const &config)