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, "IdealGasLawBinaryMixture"))
102 {
103 return createIdealGasLawBinaryMixture(config);
104 }
105
106 if (boost::iequals(property_type, "StrainDependentPermeability"))
107 {
108 return createStrainDependentPermeability(
109 geometry_dimension, config, parameters, local_coordinate_system);
110 }
111
112 if (boost::iequals(property_type, "GasPressureDependentPermeability"))
113 {
114 return createGasPressureDependentPermeability(
115 geometry_dimension, config, parameters, local_coordinate_system);
116 }
117
118 if (boost::iequals(property_type, "EmbeddedFracturePermeability"))
119 {
120 return createEmbeddedFracturePermeability(geometry_dimension, config,
121 parameters);
122 }
123
124 if (boost::iequals(property_type,
125 "OrthotropicEmbeddedFracturePermeability"))
126 {
127 return createOrthotropicEmbeddedFracturePermeability(
128 geometry_dimension, config, parameters);
129 }
130
131 if (boost::iequals(property_type,
132 "PermeabilityMohrCoulombFailureIndexModel"))
133 {
134 return createPermeabilityMohrCoulombFailureIndexModel(
135 geometry_dimension, config, parameters, local_coordinate_system);
136 }
137
138 if (boost::iequals(property_type, "KozenyCarman"))
139 {
140 return createKozenyCarmanModel(config, parameters);
141 }
142
143 if (boost::iequals(property_type, "VermaPruess"))
144 {
145 return createVermaPruessModel(config, parameters);
146 }
147
148 if (boost::iequals(property_type, "PermeabilityOrthotropicPowerLaw"))
149 {
150 return createPermeabilityOrthotropicPowerLaw(config,
151 local_coordinate_system);
152 }
153
154 if (boost::iequals(property_type, "PorosityFromMassBalance"))
155 {
156 return createPorosityFromMassBalance(config, parameters);
157 }
158
159 if (boost::iequals(property_type, "TransportPorosityFromMassBalance"))
160 {
161 return createTransportPorosityFromMassBalance(config, parameters);
162 }
163
164 if (boost::iequals(property_type, "SaturationBrooksCorey"))
165 {
166 return createSaturationBrooksCorey(config);
167 }
168
169 if (boost::iequals(property_type, "RelPermBrooksCorey"))
170 {
171 return createRelPermBrooksCorey(config);
172 }
173
174 if (boost::iequals(property_type, "RelPermBrooksCoreyNonwettingPhase"))
175 {
176 return createRelPermBrooksCoreyNonwettingPhase(config);
177 }
178
179 if (boost::iequals(property_type, "SaturationLiakopoulos"))
180 {
181 return createSaturationLiakopoulos(config);
182 }
183
184 if (boost::iequals(property_type, "RelPermLiakopoulos"))
185 {
186 return createRelPermLiakopoulos(config);
187 }
188
189 if (boost::iequals(property_type, "SaturationExponential"))
190 {
191 return createSaturationExponential(config);
192 }
193 if (boost::iequals(property_type, "SaturationVanGenuchten"))
194 {
195 return createSaturationVanGenuchten(config);
196 }
197
198 if (boost::iequals(property_type,
199 "SaturationVanGenuchtenWithVolumetricStrain"))
200 {
201 return createSaturationVanGenuchtenWithVolumetricStrain(config);
202 }
203
204 if (boost::iequals(property_type, "CapillaryPressureVanGenuchten"))
205 {
206 return createCapillaryPressureVanGenuchten(config);
207 }
208
209 if (boost::iequals(property_type,
210 "CapillaryPressureRegularizedVanGenuchten"))
211 {
212 return createCapillaryPressureRegularizedVanGenuchten(config);
213 }
214
215 if (boost::iequals(property_type, "RelativePermeabilityVanGenuchten"))
216 {
217 return createRelPermVanGenuchten(config);
218 }
219
220 if (boost::iequals(property_type,
221 "RelativePermeabilityNonWettingPhaseVanGenuchtenMualem"))
222 {
223 return createRelPermNonWettingPhaseVanGenuchtenMualem(config);
224 }
225
226 if (boost::iequals(property_type, "RelativePermeabilityUdell"))
227 {
228 return createRelPermUdell(config);
229 }
230
231 if (boost::iequals(property_type,
232 "RelativePermeabilityUdellNonwettingPhase"))
233 {
234 return createRelPermUdellNonwettingPhase(config);
235 }
236
237 if (boost::iequals(property_type,
238 "RelativePermeabilityGeneralizedPowerNonwettingPhase"))
239 {
240 return createRelPermGeneralizedPowerNonwettingPhase(config);
241 }
242
243 if (boost::iequals(property_type, "RelativePermeabilityGeneralizedPower"))
244 {
245 return createRelPermGeneralizedPower(config);
246 }
247
248 if (boost::iequals(property_type, "SaturationDependentSwelling"))
249 {
250 return createSaturationDependentSwelling(config,
251 local_coordinate_system);
252 }
253
254 if (boost::iequals(property_type, "TemperatureDependentFraction"))
255 {
256 return createTemperatureDependentFraction(config);
257 }
258
259 if (boost::iequals(property_type, "SpecificHeatCapacityWithLatentHeat"))
260 {
261 return createSpecificHeatCapacityWithLatentHeat(config);
262 }
263
264 if (boost::iequals(property_type, "BishopsPowerLaw"))
265 {
266 return createBishopsPowerLaw(config);
267 }
268
269 if (boost::iequals(property_type, "BishopsSaturationCutoff"))
270 {
271 return createBishopsSaturationCutoff(config);
272 }
273
274 if (boost::iequals(property_type, "LinearSaturationSwellingStress"))
275 {
276 return createLinearSaturationSwellingStress(config);
277 }
278
279 if (boost::iequals(property_type, "SaturationWeightedThermalConductivity"))
280 {
281 return createSaturationWeightedThermalConductivity(geometry_dimension,
282 config, parameters);
283 }
284
285 if (boost::iequals(property_type, "WaterDensityIAPWSIF97Region1"))
286 {
287 return createWaterDensityIAPWSIF97Region1(config);
288 }
289
290 if (boost::iequals(property_type,
291 "WaterSaturationTemperatureIAPWSIF97Region4"))
292 {
293 return createWaterSaturationTemperatureIAPWSIF97Region4(config);
294 }
295
296 if (boost::iequals(property_type, "WaterEnthalpyIAPWSIF97Region1"))
297 {
298 return createWaterEnthalpyIAPWSIF97Region1(config);
299 }
300
301 if (boost::iequals(property_type, "WaterLiquidDensityIAPWSIF97Region4"))
302 {
303 return createWaterLiquidDensityIAPWSIF97Region4(config);
304 }
305
306 if (boost::iequals(property_type, "WaterVapourDensityIAPWSIF97Region4"))
307 {
308 return createWaterVapourDensityIAPWSIF97Region4(config);
309 }
310
311 if (boost::iequals(property_type, "WaterLiquidEnthalpyIAPWSIF97Region4"))
312 {
313 return createWaterLiquidEnthalpyIAPWSIF97Region4(config);
314 }
315
316 if (boost::iequals(property_type, "WaterVapourEnthalpyIAPWSIF97Region4"))
317 {
318 return createWaterVapourEnthalpyIAPWSIF97Region4(config);
319 }
320
321 if (boost::iequals(property_type, "WaterTemperatureIAPWSIF97Region1"))
322 {
323 return createWaterTemperatureIAPWSIF97Region1(config);
324 }
325
326 if (boost::iequals(property_type, "WaterVapourDensity"))
327 {
328 return createWaterVapourDensity(config);
329 }
330
331 if (boost::iequals(property_type, "VapourDiffusionFEBEX"))
332 {
333 return createVapourDiffusionFEBEX(config);
334 }
335
336 if (boost::iequals(property_type, "VapourDiffusionDeVries"))
337 {
338 return createVapourDiffusionDeVries(config);
339 }
340
341 if (boost::iequals(property_type, "VapourDiffusionPMQ"))
342 {
343 return createVapourDiffusionPMQ(config);
344 }
345
346 if (boost::iequals(property_type, "LinearWaterVapourLatentHeat"))
347 {
348 return createLinearWaterVapourLatentHeat(config);
349 }
350
351 if (boost::iequals(property_type,
352 "WaterVapourLatentHeatWithCriticalTemperature"))
353 {
354 return createWaterVapourLatentHeatWithCriticalTemperature(config);
355 }
356
357 if (boost::iequals(property_type, "TemperatureDependentDiffusion"))
358 {
359 return createTemperatureDependentDiffusion(config, parameters);
360 }
361
362 if (boost::iequals(property_type, "VolumeFractionAverage"))
363 {
364 return createVolumeFractionAverage(config);
365 }
366
367 if (boost::iequals(property_type, "WaterViscosityIAPWS"))
368 {
369 return createWaterViscosityIAPWS(config);
370 }
371
372 if (boost::iequals(property_type, "LiquidViscosityVogels"))
373 {
374 return createLiquidViscosityVogels(config);
375 }
376
377 if (boost::iequals(property_type, "WaterThermalConductivityIAPWS"))
378 {
379 return createWaterThermalConductivityIAPWS(config);
380 }
381
382 // If none of the above property types are found, OGS throws an error.
383 OGS_FATAL("The specified component property type '{:s}' was not recognized",
384 property_type);
385}
386} // namespace
387
388namespace MaterialPropertyLib
389{
390std::unique_ptr<PropertyArray> createProperties(
391 int const geometry_dimension,
392 std::optional<BaseLib::ConfigTree> const& config,
393 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
394 ParameterLib::CoordinateSystem const* const local_coordinate_system,
395 std::map<std::string,
396 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
397 curves)
398{
399 if (!config)
400 {
401 return nullptr;
402 }
403
405 auto const& property_configs = config->getConfigSubtreeList("property");
406 if (property_configs.empty())
407 {
408 return nullptr;
409 }
410
411 auto properties = std::make_unique<PropertyArray>();
412
413 for (auto property_config : property_configs)
414 {
415 // Parsing the property name:
416 auto const property_name =
418 property_config.getConfigParameter<std::string>("name");
419 // Create a new property based on the configuration subtree:
420 auto property =
421 createProperty(geometry_dimension, property_config, parameters,
422 local_coordinate_system, curves);
423
424 // Insert the new property at the right position into the components
425 // private PropertyArray:
426 (*properties)[convertStringToProperty(property_name)] =
427 std::move(property);
428 }
429 return properties;
430}
431
432} // 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.