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