OGS
CreateProperty.cpp
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#include "CreateProperty.h"
5
6#include <boost/algorithm/string/predicate.hpp>
7#include <string>
8#include <vector>
9
10#include "BaseLib/ConfigTree.h"
11#include "Component.h"
12#include "Medium.h"
13#include "Phase.h"
16
17namespace
18{
19std::unique_ptr<MaterialPropertyLib::Property> createProperty(
20 int const geometry_dimension,
21 BaseLib::ConfigTree const& config,
22 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>& parameters,
23 ParameterLib::CoordinateSystem const* const local_coordinate_system,
24 std::map<std::string,
25 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
26 curves)
27{
28 using namespace MaterialPropertyLib;
29 // Parsing the property type:
31 auto const property_type = config.peekConfigParameter<std::string>("type");
32
33 if (property_type == "Constant")
34 {
35 return createConstant(config);
36 }
37 if (property_type == "Curve")
38 {
39 return createCurve(config, curves);
40 }
41 if (property_type == "Linear")
42 {
43 return createLinear(config);
44 }
45
46 if (property_type == "Exponential")
47 {
48 return createExponential(config);
49 }
50 if (property_type == "Function")
51 {
52 return createFunction(config, curves);
53 }
54
55 if (property_type == "Parameter")
56 {
57 return createParameterProperty(config, parameters);
58 }
59
60 if (boost::iequals(property_type, "AverageMolarMass"))
61 {
62 return createAverageMolarMass(config);
63 }
64
65 if (boost::iequals(property_type, "ClausiusClapeyron"))
66 {
67 return createClausiusClapeyron(config);
68 }
69
70 if (boost::iequals(property_type, "CubicLawPermeability"))
71 {
72 return createCubicLawPermeability(config, parameters);
73 }
74
75 if (boost::iequals(property_type, "Dupuit"))
76 {
77 return createDupuitPermeability(config, parameters);
78 }
79
80 if (boost::iequals(property_type,
81 "EffectiveThermalConductivityPorosityMixing"))
82 {
84 geometry_dimension, config, local_coordinate_system);
85 }
86
87 if (boost::iequals(property_type, "IdealGasLaw"))
88 {
89 return createIdealGasLaw(config);
90 }
91
92 if (boost::iequals(property_type, "PengRobinson"))
93 {
94 return createPengRobinson(config);
95 }
96
97 if (boost::iequals(property_type, "IdealGasLawBinaryMixture"))
98 {
99 return createIdealGasLawBinaryMixture(config);
100 }
101
102 if (boost::iequals(property_type, "StrainDependentPermeability"))
103 {
105 geometry_dimension, config, parameters, local_coordinate_system);
106 }
107
108 if (boost::iequals(property_type, "GasPressureDependentPermeability"))
109 {
111 geometry_dimension, config, parameters, local_coordinate_system);
112 }
113
114 if (boost::iequals(property_type, "EmbeddedFracturePermeability"))
115 {
116 return createEmbeddedFracturePermeability(geometry_dimension, config,
117 parameters);
118 }
119
120 if (boost::iequals(property_type,
121 "OrthotropicEmbeddedFracturePermeability"))
122 {
124 geometry_dimension, config, parameters);
125 }
126
127 if (boost::iequals(property_type,
128 "PermeabilityMohrCoulombFailureIndexModel"))
129 {
131 geometry_dimension, config, parameters, local_coordinate_system);
132 }
133
134 if (boost::iequals(property_type, "KozenyCarman"))
135 {
136 return createKozenyCarmanModel(config, parameters);
137 }
138
139 if (boost::iequals(property_type, "VermaPruess"))
140 {
141 return createVermaPruessModel(config, parameters);
142 }
143
144 if (boost::iequals(property_type, "PermeabilityOrthotropicPowerLaw"))
145 {
147 local_coordinate_system);
148 }
149
150 if (boost::iequals(property_type, "PorosityFromMassBalance"))
151 {
152 return createPorosityFromMassBalance(config, parameters);
153 }
154
155 if (boost::iequals(property_type, "TransportPorosityFromMassBalance"))
156 {
157 return createTransportPorosityFromMassBalance(config, parameters);
158 }
159
160 if (boost::iequals(property_type, "SaturationBrooksCorey"))
161 {
162 return createSaturationBrooksCorey(config);
163 }
164
165 if (boost::iequals(property_type, "RelPermBrooksCorey"))
166 {
167 return createRelPermBrooksCorey(config);
168 }
169
170 if (boost::iequals(property_type, "RelPermBrooksCoreyNonwettingPhase"))
171 {
173 }
174
175 if (boost::iequals(property_type, "SaturationLiakopoulos"))
176 {
177 return createSaturationLiakopoulos(config);
178 }
179
180 if (boost::iequals(property_type, "RelPermLiakopoulos"))
181 {
182 return createRelPermLiakopoulos(config);
183 }
184
185 if (boost::iequals(property_type, "SaturationExponential"))
186 {
187 return createSaturationExponential(config);
188 }
189 if (boost::iequals(property_type, "SaturationVanGenuchten"))
190 {
191 return createSaturationVanGenuchten(config);
192 }
193
194 if (boost::iequals(property_type,
195 "SaturationVanGenuchtenWithVolumetricStrain"))
196 {
198 }
199
200 if (boost::iequals(property_type, "CapillaryPressureVanGenuchten"))
201 {
203 }
204
205 if (boost::iequals(property_type,
206 "CapillaryPressureRegularizedVanGenuchten"))
207 {
209 }
210
211 if (boost::iequals(property_type, "RelativePermeabilityVanGenuchten"))
212 {
213 return createRelPermVanGenuchten(config);
214 }
215
216 if (boost::iequals(property_type,
217 "RelativePermeabilityNonWettingPhaseVanGenuchtenMualem"))
218 {
220 }
221
222 if (boost::iequals(property_type, "RelativePermeabilityUdell"))
223 {
224 return createRelPermUdell(config);
225 }
226
227 if (boost::iequals(property_type,
228 "RelativePermeabilityUdellNonwettingPhase"))
229 {
231 }
232
233 if (boost::iequals(property_type,
234 "RelativePermeabilityGeneralizedPowerNonwettingPhase"))
235 {
237 }
238
239 if (boost::iequals(property_type, "RelativePermeabilityGeneralizedPower"))
240 {
241 return createRelPermGeneralizedPower(config);
242 }
243
244 if (boost::iequals(property_type, "SaturationDependentSwelling"))
245 {
247 local_coordinate_system);
248 }
249
250 if (boost::iequals(property_type, "TemperatureDependentFraction"))
251 {
253 }
254
255 if (boost::iequals(property_type, "SpecificHeatCapacityWithLatentHeat"))
256 {
258 }
259
260 if (boost::iequals(property_type, "BishopsPowerLaw"))
261 {
262 return createBishopsPowerLaw(config);
263 }
264
265 if (boost::iequals(property_type, "BishopsSaturationCutoff"))
266 {
267 return createBishopsSaturationCutoff(config);
268 }
269
270 if (boost::iequals(property_type, "LinearSaturationSwellingStress"))
271 {
273 }
274
275 if (boost::iequals(property_type, "SaturationWeightedThermalConductivity"))
276 {
277 return createSaturationWeightedThermalConductivity(geometry_dimension,
278 config, parameters);
279 }
280
281 if (boost::iequals(property_type, "WaterDensityIAPWSIF97Region1"))
282 {
284 }
285
286 if (boost::iequals(property_type,
287 "WaterSaturationTemperatureIAPWSIF97Region4"))
288 {
290 }
291
292 if (boost::iequals(property_type, "WaterEnthalpyIAPWSIF97Region1"))
293 {
295 }
296
297 if (boost::iequals(property_type, "WaterLiquidDensityIAPWSIF97Region4"))
298 {
300 }
301
302 if (boost::iequals(property_type, "WaterVapourDensityIAPWSIF97Region4"))
303 {
305 }
306
307 if (boost::iequals(property_type, "WaterLiquidEnthalpyIAPWSIF97Region4"))
308 {
310 }
311
312 if (boost::iequals(property_type, "WaterVapourEnthalpyIAPWSIF97Region4"))
313 {
315 }
316
317 if (boost::iequals(property_type, "WaterTemperatureIAPWSIF97Region1"))
318 {
320 }
321
322 if (boost::iequals(property_type, "WaterVapourDensity"))
323 {
324 return createWaterVapourDensity(config);
325 }
326
327 if (boost::iequals(property_type, "VapourDiffusionFEBEX"))
328 {
329 return createVapourDiffusionFEBEX(config);
330 }
331
332 if (boost::iequals(property_type, "VapourDiffusionDeVries"))
333 {
334 return createVapourDiffusionDeVries(config);
335 }
336
337 if (boost::iequals(property_type, "VapourDiffusionPMQ"))
338 {
339 return createVapourDiffusionPMQ(config);
340 }
341
342 if (boost::iequals(property_type, "LinearWaterVapourLatentHeat"))
343 {
345 }
346
347 if (boost::iequals(property_type,
348 "WaterVapourLatentHeatWithCriticalTemperature"))
349 {
351 }
352
353 if (boost::iequals(property_type, "TemperatureDependentDiffusion"))
354 {
355 return createTemperatureDependentDiffusion(config, parameters);
356 }
357
358 if (boost::iequals(property_type, "VolumeFractionAverage"))
359 {
360 return createVolumeFractionAverage(config);
361 }
362
363 if (boost::iequals(property_type, "WaterViscosityIAPWS"))
364 {
365 return createWaterViscosityIAPWS(config);
366 }
367
368 if (boost::iequals(property_type, "LiquidViscosityVogels"))
369 {
370 return createLiquidViscosityVogels(config);
371 }
372
373 if (boost::iequals(property_type, "WaterThermalConductivityIAPWS"))
374 {
376 }
377
378 // If none of the above property types are found, OGS throws an error.
379 OGS_FATAL("The specified component property type '{:s}' was not recognized",
380 property_type);
381}
382} // namespace
383
384namespace MaterialPropertyLib
385{
386std::unique_ptr<PropertyArray> createProperties(
387 int const geometry_dimension,
388 std::optional<BaseLib::ConfigTree> const& config,
389 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>& parameters,
390 ParameterLib::CoordinateSystem const* const local_coordinate_system,
391 std::map<std::string,
392 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
393 curves)
394{
395 if (!config)
396 {
397 return nullptr;
398 }
399
401 auto const& property_configs = config->getConfigSubtreeList("property");
402 if (property_configs.empty())
403 {
404 return nullptr;
405 }
406
407 auto properties = std::make_unique<PropertyArray>();
408
409 for (auto property_config : property_configs)
410 {
411 // Parsing the property name:
412 auto const property_name =
414 property_config.getConfigParameter<std::string>("name");
415 // Create a new property based on the configuration subtree:
416 auto property =
417 createProperty(geometry_dimension, property_config, parameters,
418 local_coordinate_system, curves);
419
420 // Insert the new property at the right position into the components
421 // private PropertyArray:
422 (*properties)[convertStringToProperty(property_name)] =
423 std::move(property);
424 }
425 return properties;
426}
427
428} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:19
T peekConfigParameter(std::string const &param) const
std::unique_ptr< Property > createWaterEnthalpyIAPWSIF97Region1(BaseLib::ConfigTree const &config)
std::unique_ptr< TemperatureDependentFraction > createTemperatureDependentFraction(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterDensityIAPWSIF97Region1(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterViscosityIAPWS(BaseLib::ConfigTree const &config)
std::unique_ptr< IdealGasLawBinaryMixture > createIdealGasLawBinaryMixture(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createOrthotropicEmbeddedFracturePermeability(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< Property > createPengRobinson(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createPermeabilityOrthotropicPowerLaw(BaseLib::ConfigTree const &config, ParameterLib::CoordinateSystem const *const local_coordinate_system)
std::unique_ptr< Property > createLinearSaturationSwellingStress(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterLiquidEnthalpyIAPWSIF97Region4(BaseLib::ConfigTree const &config)
std::unique_ptr< TransportPorosityFromMassBalance > createTransportPorosityFromMassBalance(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
PropertyType convertStringToProperty(std::string const &string)
std::unique_ptr< SaturationDependentSwelling > createSaturationDependentSwelling(BaseLib::ConfigTree const &config, ParameterLib::CoordinateSystem const *const local_coordinate_system)
std::unique_ptr< PropertyArray > createProperties(int const geometry_dimension, std::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::unique_ptr< ClausiusClapeyron > createClausiusClapeyron(BaseLib::ConfigTree const &config)
std::unique_ptr< BishopsPowerLaw > createBishopsPowerLaw(BaseLib::ConfigTree const &config)
std::unique_ptr< PorosityFromMassBalance > createPorosityFromMassBalance(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< Parameter > createParameterProperty(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< Function > createFunction(BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::unique_ptr< SaturationLiakopoulos > createSaturationLiakopoulos(BaseLib::ConfigTree const &config)
std::unique_ptr< SaturationBrooksCorey > createSaturationBrooksCorey(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createVapourDiffusionFEBEX(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterTemperatureIAPWSIF97Region1(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createCapillaryPressureVanGenuchten(BaseLib::ConfigTree const &config)
std::unique_ptr< BishopsSaturationCutoff > createBishopsSaturationCutoff(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createPermeabilityMohrCoulombFailureIndexModel(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system)
std::unique_ptr< Property > createLiquidViscosityVogels(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterVapourLatentHeatWithCriticalTemperature(BaseLib::ConfigTree const &config)
std::unique_ptr< SaturationVanGenuchtenWithVolumetricStrain > createSaturationVanGenuchtenWithVolumetricStrain(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createGasPressureDependentPermeability(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system)
std::unique_ptr< Property > createStrainDependentPermeability(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system)
std::unique_ptr< Property > createWaterSaturationTemperatureIAPWSIF97Region4(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermUdellNonwettingPhase > createRelPermUdellNonwettingPhase(BaseLib::ConfigTree const &config)
std::unique_ptr< Curve > createCurve(BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::unique_ptr< SaturationVanGenuchten > createSaturationVanGenuchten(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createEffectiveThermalConductivityPorosityMixing(int const geometry_dimension, BaseLib::ConfigTree const &config, ParameterLib::CoordinateSystem const *const local_coordinate_system)
std::unique_ptr< Property > createCubicLawPermeability(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< Property > createTemperatureDependentDiffusion(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< RelPermBrooksCorey > createRelPermBrooksCorey(BaseLib::ConfigTree const &config)
std::unique_ptr< SpecificHeatCapacityWithLatentHeat > createSpecificHeatCapacityWithLatentHeat(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createRelPermNonWettingPhaseVanGenuchtenMualem(BaseLib::ConfigTree const &config)
std::unique_ptr< AverageMolarMass > createAverageMolarMass(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterLiquidDensityIAPWSIF97Region4(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createCapillaryPressureRegularizedVanGenuchten(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermGeneralizedPower > createRelPermGeneralizedPower(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterThermalConductivityIAPWS(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterVapourEnthalpyIAPWSIF97Region4(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermUdell > createRelPermUdell(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createKozenyCarmanModel(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< VolumeFractionAverage > createVolumeFractionAverage(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermGeneralizedPowerNonwettingPhase > createRelPermGeneralizedPowerNonwettingPhase(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterVapourDensity(BaseLib::ConfigTree const &config)
std::unique_ptr< IdealGasLaw > createIdealGasLaw(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createSaturationWeightedThermalConductivity(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters)
std::unique_ptr< RelPermVanGenuchten > createRelPermVanGenuchten(BaseLib::ConfigTree const &config)
std::unique_ptr< Exponential > createExponential(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createWaterVapourDensityIAPWSIF97Region4(BaseLib::ConfigTree const &config)
std::unique_ptr< Constant > createConstant(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createEmbeddedFracturePermeability(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< DupuitPermeability > createDupuitPermeability(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< Property > createVapourDiffusionPMQ(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermLiakopoulos > createRelPermLiakopoulos(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermBrooksCoreyNonwettingPhase > createRelPermBrooksCoreyNonwettingPhase(BaseLib::ConfigTree const &config)
std::unique_ptr< Linear > createLinear(BaseLib::ConfigTree const &config)
std::unique_ptr< SaturationExponential > createSaturationExponential(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createVapourDiffusionDeVries(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createLinearWaterVapourLatentHeat(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createVermaPruessModel(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< MaterialPropertyLib::Property > createProperty(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
A local coordinate system used for tensor transformations.