OGS
CreateFluidProperties.cpp
Go to the documentation of this file.
1
14
15#include <string>
16
17#include "BaseLib/ConfigTree.h"
18#include "FluidProperties.h"
24
25namespace MaterialLib
26{
27namespace Fluid
28{
29std::unique_ptr<FluidProperties> createFluidProperties(
30 BaseLib::ConfigTree const& config)
31{
33 auto const& rho_conf = config.getConfigSubtree("density");
34 auto liquid_density = MaterialLib::Fluid::createFluidDensityModel(rho_conf);
35
37 auto const& mu_conf = config.getConfigSubtree("viscosity");
38 auto viscosity = MaterialLib::Fluid::createViscosityModel(mu_conf);
39 const bool is_mu_density_dependent =
40 (viscosity->getName().find("density dependent") != std::string::npos);
41
42 bool is_cp_density_dependent = false;
43 std::unique_ptr<MaterialLib::Fluid::FluidProperty> specific_heat_capacity =
44 nullptr;
45 auto heat_capacity__opt_conf =
47 config.getConfigSubtreeOptional("specific_heat_capacity");
48 if (heat_capacity__opt_conf)
49 {
50 const auto& heat_capacity_conf = *heat_capacity__opt_conf;
51 specific_heat_capacity =
52 createSpecificFluidHeatCapacityModel(heat_capacity_conf);
53 is_cp_density_dependent =
54 (specific_heat_capacity->getName().find("density dependent") !=
55 std::string::npos);
56 }
57
58 bool is_KT_density_dependent = false;
59 std::unique_ptr<MaterialLib::Fluid::FluidProperty> thermal_conductivity =
60 nullptr;
61 auto const& thermal_conductivity_opt_conf =
63 config.getConfigSubtreeOptional("thermal_conductivity");
64 if (thermal_conductivity_opt_conf)
65 {
66 auto const& thermal_conductivity_conf = *thermal_conductivity_opt_conf;
67 thermal_conductivity =
69 thermal_conductivity_conf);
70 is_KT_density_dependent =
71 (specific_heat_capacity->getName().find("density dependent") !=
72 std::string::npos);
73 }
74
75 if (is_mu_density_dependent || is_cp_density_dependent ||
76 is_KT_density_dependent)
77 {
78 return std::make_unique<
80 std::move(liquid_density), std::move(viscosity),
81 std::move(specific_heat_capacity), std::move(thermal_conductivity),
82 is_mu_density_dependent, is_cp_density_dependent,
83 is_KT_density_dependent);
84 }
85
86 return std::make_unique<
88 std::move(liquid_density), std::move(viscosity),
89 std::move(specific_heat_capacity), std::move(thermal_conductivity));
90}
91
92} // namespace Fluid
93} // namespace MaterialLib
A function for creating a thermal conductivity model for fluid.
A function for creating a specific heat capacity model for fluid.
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
ConfigTree getConfigSubtree(std::string const &root) const
std::unique_ptr< FluidProperty > createFluidDensityModel(BaseLib::ConfigTree const &config)
std::unique_ptr< FluidProperties > createFluidProperties(BaseLib::ConfigTree const &config)
std::unique_ptr< FluidProperty > createSpecificFluidHeatCapacityModel(BaseLib::ConfigTree const &config)
std::unique_ptr< FluidProperty > createFluidThermalConductivityModel(BaseLib::ConfigTree const &config)
std::unique_ptr< FluidProperty > createViscosityModel(BaseLib::ConfigTree const &config)