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, "Dupuit"))
80 {
81 return createDupuitPermeability(config, parameters);
82 }
83
84 if (boost::iequals(property_type,
85 "EffectiveThermalConductivityPorosityMixing"))
86 {
88 geometry_dimension, config, local_coordinate_system);
89 }
90
91 if (boost::iequals(property_type, "IdealGasLaw"))
92 {
93 return createIdealGasLaw(config);
94 }
95
96 if (boost::iequals(property_type, "IdealGasLawBinaryMixture"))
97 {
98 return createIdealGasLawBinaryMixture(config);
99 }
100
101 if (boost::iequals(property_type, "StrainDependentPermeability"))
102 {
104 geometry_dimension, config, parameters, local_coordinate_system);
105 }
106
107 if (boost::iequals(property_type, "GasPressureDependentPermeability"))
108 {
110 geometry_dimension, config, parameters, local_coordinate_system);
111 }
112
113 if (boost::iequals(property_type, "EmbeddedFracturePermeability"))
114 {
115 return createEmbeddedFracturePermeability(geometry_dimension, config,
116 parameters);
117 }
118
119 if (boost::iequals(property_type,
120 "OrthotropicEmbeddedFracturePermeability"))
121 {
123 geometry_dimension, config, parameters);
124 }
125
126 if (boost::iequals(property_type,
127 "PermeabilityMohrCoulombFailureIndexModel"))
128 {
130 geometry_dimension, config, parameters, local_coordinate_system);
131 }
132
133 if (boost::iequals(property_type, "KozenyCarman"))
134 {
135 return createKozenyCarmanModel(config, parameters);
136 }
137
138 if (boost::iequals(property_type, "VermaPruess"))
139 {
140 return createVermaPruessModel(config, parameters);
141 }
142
143 if (boost::iequals(property_type, "PermeabilityOrthotropicPowerLaw"))
144 {
146 local_coordinate_system);
147 }
148
149 if (boost::iequals(property_type, "PorosityFromMassBalance"))
150 {
151 return createPorosityFromMassBalance(config, parameters);
152 }
153
154 if (boost::iequals(property_type, "TransportPorosityFromMassBalance"))
155 {
156 return createTransportPorosityFromMassBalance(config, parameters);
157 }
158
159 if (boost::iequals(property_type, "SaturationBrooksCorey"))
160 {
161 return createSaturationBrooksCorey(config);
162 }
163
164 if (boost::iequals(property_type, "RelPermBrooksCorey"))
165 {
166 return createRelPermBrooksCorey(config);
167 }
168
169 if (boost::iequals(property_type, "RelPermBrooksCoreyNonwettingPhase"))
170 {
172 }
173
174 if (boost::iequals(property_type, "SaturationLiakopoulos"))
175 {
176 return createSaturationLiakopoulos(config);
177 }
178
179 if (boost::iequals(property_type, "RelPermLiakopoulos"))
180 {
181 return createRelPermLiakopoulos(config);
182 }
183
184 if (boost::iequals(property_type, "SaturationExponential"))
185 {
186 return createSaturationExponential(config);
187 }
188 if (boost::iequals(property_type, "SaturationVanGenuchten"))
189 {
190 return createSaturationVanGenuchten(config);
191 }
192
193 if (boost::iequals(property_type, "CapillaryPressureVanGenuchten"))
194 {
196 }
197
198 if (boost::iequals(property_type,
199 "CapillaryPressureRegularizedVanGenuchten"))
200 {
202 }
203
204 if (boost::iequals(property_type, "RelativePermeabilityVanGenuchten"))
205 {
206 return createRelPermVanGenuchten(config);
207 }
208
209 if (boost::iequals(property_type,
210 "RelativePermeabilityNonWettingPhaseVanGenuchtenMualem"))
211 {
213 }
214
215 if (boost::iequals(property_type, "RelativePermeabilityUdell"))
216 {
217 return createRelPermUdell(config);
218 }
219
220 if (boost::iequals(property_type,
221 "RelativePermeabilityUdellNonwettingPhase"))
222 {
224 }
225
226 if (boost::iequals(property_type, "SaturationDependentThermalConductivity"))
227 {
229 }
230
231 if (boost::iequals(property_type, "SaturationDependentSwelling"))
232 {
234 local_coordinate_system);
235 }
236
237 if (boost::iequals(property_type, "BishopsPowerLaw"))
238 {
239 return createBishopsPowerLaw(config);
240 }
241
242 if (boost::iequals(property_type, "BishopsSaturationCutoff"))
243 {
244 return createBishopsSaturationCutoff(config);
245 }
246
247 if (boost::iequals(property_type, "LinearSaturationSwellingStress"))
248 {
250 }
251
252 if (boost::iequals(property_type, "SoilThermalConductivitySomerton"))
253 {
255 geometry_dimension, config, parameters, local_coordinate_system);
256 }
257
258 if (boost::iequals(property_type, "WaterVapourDensity"))
259 {
260 return createWaterVapourDensity(config);
261 }
262
263 if (boost::iequals(property_type, "VapourDiffusionFEBEX"))
264 {
265 return createVapourDiffusionFEBEX(config);
266 }
267
268 if (boost::iequals(property_type, "VapourDiffusionPMQ"))
269 {
270 return createVapourDiffusionPMQ(config);
271 }
272
273 if (boost::iequals(property_type, "LinearWaterVapourLatentHeat"))
274 {
276 }
277
278 if (boost::iequals(property_type,
279 "WaterVapourLatentHeatWithCriticalTemperature"))
280 {
282 }
283
284 if (boost::iequals(property_type, "TemperatureDependentDiffusion"))
285 {
286 return createTemperatureDependentDiffusion(config, parameters);
287 }
288
289 // If none of the above property types are found, OGS throws an error.
290 OGS_FATAL("The specified component property type '{:s}' was not recognized",
291 property_type);
292}
293} // namespace
294
295namespace MaterialPropertyLib
296{
297std::unique_ptr<PropertyArray> createProperties(
298 int const geometry_dimension,
299 std::optional<BaseLib::ConfigTree> const& config,
300 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
301 ParameterLib::CoordinateSystem const* const local_coordinate_system,
302 std::map<std::string,
303 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
304 curves)
305{
306 if (!config)
307 {
308 return nullptr;
309 }
310
312 auto const& property_configs = config->getConfigSubtreeList("property");
313 if (property_configs.empty())
314 {
315 return nullptr;
316 }
317
318 auto properties = std::make_unique<PropertyArray>();
319
320 for (auto property_config : property_configs)
321 {
322 // Parsing the property name:
323 auto const property_name =
325 property_config.getConfigParameter<std::string>("name");
326 // Create a new property based on the configuration subtree:
327 auto property =
328 createProperty(geometry_dimension, property_config, parameters,
329 local_coordinate_system, curves);
330
331 // Insert the new property at the right position into the components
332 // private PropertyArray:
333 (*properties)[convertStringToProperty(property_name)] =
334 std::move(property);
335 }
336 return properties;
337}
338
339} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition: Error.h:26
T peekConfigParameter(std::string const &param) const
std::unique_ptr< Function > createFunction(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 > createPermeabilityOrthotropicPowerLaw(BaseLib::ConfigTree const &config, ParameterLib::CoordinateSystem const *const local_coordinate_system)
std::unique_ptr< Property > createLinearSaturationSwellingStress(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< 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< 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 > 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 > createWaterVapourLatentHeatWithCriticalTemperature(BaseLib::ConfigTree const &config)
std::unique_ptr< SaturationDependentThermalConductivity > createSaturationDependentThermalConductivity(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< 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)
Definition: CreateCurve.cpp:21
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 > 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< Property > createRelPermNonWettingPhaseVanGenuchtenMualem(BaseLib::ConfigTree const &config)
std::unique_ptr< AverageMolarMass > createAverageMolarMass(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createCapillaryPressureRegularizedVanGenuchten(BaseLib::ConfigTree const &config)
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< Property > createSoilThermalConductivitySomerton(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< 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< Property > createWaterVapourDensity(BaseLib::ConfigTree const &config)
std::unique_ptr< IdealGasLaw > createIdealGasLaw(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermVanGenuchten > createRelPermVanGenuchten(BaseLib::ConfigTree const &config)
std::unique_ptr< Exponential > createExponential(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 > 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 > > const &parameters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)