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"
24 #include "Properties/Properties.h"
25 
26 namespace
27 {
28 std::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, "StrainDependentPermeability"))
97  {
99  geometry_dimension, config, parameters, local_coordinate_system);
100  }
101 
102  if (boost::iequals(property_type, "GasPressureDependentPermeability"))
103  {
105  geometry_dimension, config, parameters, local_coordinate_system);
106  }
107 
108  if (boost::iequals(property_type, "EmbeddedFracturePermeability"))
109  {
110  return createEmbeddedFracturePermeability(geometry_dimension, config);
111  }
112 
113  if (boost::iequals(property_type,
114  "OrthotropicEmbeddedFracturePermeability"))
115  {
117  geometry_dimension, config, parameters);
118  }
119 
120  if (boost::iequals(property_type,
121  "PermeabilityMohrCoulombFailureIndexModel"))
122  {
124  geometry_dimension, config, parameters, local_coordinate_system);
125  }
126 
127  if (boost::iequals(property_type, "KozenyCarman"))
128  {
129  return createKozenyCarmanModel(config, parameters);
130  }
131 
132  if (boost::iequals(property_type, "PermeabilityOrthotropicPowerLaw"))
133  {
135  local_coordinate_system);
136  }
137 
138  if (boost::iequals(property_type, "PorosityFromMassBalance"))
139  {
140  return createPorosityFromMassBalance(config, parameters);
141  }
142 
143  if (boost::iequals(property_type, "TransportPorosityFromMassBalance"))
144  {
145  return createTransportPorosityFromMassBalance(config, parameters);
146  }
147 
148  if (boost::iequals(property_type, "SaturationBrooksCorey"))
149  {
150  return createSaturationBrooksCorey(config);
151  }
152 
153  if (boost::iequals(property_type, "RelPermBrooksCorey"))
154  {
155  return createRelPermBrooksCorey(config);
156  }
157 
158  if (boost::iequals(property_type, "RelPermBrooksCoreyNonwettingPhase"))
159  {
161  }
162 
163  if (boost::iequals(property_type, "SaturationLiakopoulos"))
164  {
165  return createSaturationLiakopoulos(config);
166  }
167 
168  if (boost::iequals(property_type, "RelPermLiakopoulos"))
169  {
170  return createRelPermLiakopoulos(config);
171  }
172 
173  if (boost::iequals(property_type, "SaturationExponential"))
174  {
175  return createSaturationExponential(config);
176  }
177  if (boost::iequals(property_type, "SaturationVanGenuchten"))
178  {
179  return createSaturationVanGenuchten(config);
180  }
181 
182  if (boost::iequals(property_type, "CapillaryPressureVanGenuchten"))
183  {
185  }
186 
187  if (boost::iequals(property_type,
188  "CapillaryPressureRegularizedVanGenuchten"))
189  {
191  }
192 
193  if (boost::iequals(property_type, "RelativePermeabilityVanGenuchten"))
194  {
195  return createRelPermVanGenuchten(config);
196  }
197 
198  if (boost::iequals(property_type,
199  "RelativePermeabilityNonWettingPhaseVanGenuchtenMualem"))
200  {
202  }
203 
204  if (boost::iequals(property_type, "RelativePermeabilityUdell"))
205  {
206  return createRelPermUdell(config);
207  }
208 
209  if (boost::iequals(property_type,
210  "RelativePermeabilityUdellNonwettingPhase"))
211  {
212  return createRelPermUdellNonwettingPhase(config);
213  }
214 
215  if (boost::iequals(property_type, "SaturationDependentThermalConductivity"))
216  {
218  }
219 
220  if (boost::iequals(property_type, "SaturationDependentSwelling"))
221  {
222  return createSaturationDependentSwelling(config,
223  local_coordinate_system);
224  }
225 
226  if (boost::iequals(property_type, "BishopsPowerLaw"))
227  {
228  return createBishopsPowerLaw(config);
229  }
230 
231  if (boost::iequals(property_type, "BishopsSaturationCutoff"))
232  {
233  return createBishopsSaturationCutoff(config);
234  }
235 
236  if (boost::iequals(property_type, "LinearSaturationSwellingStress"))
237  {
239  }
240 
241  if (boost::iequals(property_type, "SoilThermalConductivitySomerton"))
242  {
244  geometry_dimension, config, parameters, local_coordinate_system);
245  }
246 
247  if (boost::iequals(property_type, "WaterVapourDensity"))
248  {
249  return createWaterVapourDensity(config);
250  }
251 
252  if (boost::iequals(property_type, "VapourDiffusionFEBEX"))
253  {
254  return createVapourDiffusionFEBEX(config);
255  }
256 
257  if (boost::iequals(property_type, "VapourDiffusionPMQ"))
258  {
259  return createVapourDiffusionPMQ(config);
260  }
261 
262  if (boost::iequals(property_type, "LinearWaterVapourLatentHeat"))
263  {
264  return createLinearWaterVapourLatentHeat(config);
265  }
266 
267  if (boost::iequals(property_type,
268  "WaterVapourLatentHeatWithCriticalTemperature"))
269  {
271  }
272 
273  if (boost::iequals(property_type, "TemperatureDependentDiffusion"))
274  {
275  return createTemperatureDependentDiffusion(config, parameters);
276  }
277 
278  // If none of the above property types are found, OGS throws an error.
279  OGS_FATAL("The specified component property type '{:s}' was not recognized",
280  property_type);
281 }
282 } // namespace
283 
284 namespace MaterialPropertyLib
285 {
286 std::unique_ptr<PropertyArray> createProperties(
287  int const geometry_dimension,
288  std::optional<BaseLib::ConfigTree> const& config,
289  std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
290  ParameterLib::CoordinateSystem const* const local_coordinate_system,
291  std::map<std::string,
292  std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
293  curves)
294 {
295  if (!config)
296  {
297  return nullptr;
298  }
299 
301  auto const& property_configs = config->getConfigSubtreeList("property");
302  if (property_configs.empty())
303  {
304  return nullptr;
305  }
306 
307  auto properties = std::make_unique<PropertyArray>();
308 
309  for (auto property_config : property_configs)
310  {
311  // Parsing the property name:
312  auto const property_name =
314  property_config.getConfigParameter<std::string>("name");
315  // Create a new property based on the configuration subtree:
316  auto property =
317  createProperty(geometry_dimension, property_config, parameters,
318  local_coordinate_system, curves);
319 
320  // Insert the new property at the right position into the components
321  // private PropertyArray:
322  (*properties)[convertStringToProperty(property_name)] =
323  std::move(property);
324  }
325  return properties;
326 }
327 
328 } // 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< 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 > createEmbeddedFracturePermeability(int const geometry_dimension, BaseLib::ConfigTree const &config)
std::unique_ptr< DupuitPermeability > createDupuitPermeability(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< TransportPorosityFromMassBalance > createTransportPorosityFromMassBalance(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
std::unique_ptr< ClausiusClapeyron > createClausiusClapeyron(BaseLib::ConfigTree const &config)
std::unique_ptr< BishopsPowerLaw > createBishopsPowerLaw(BaseLib::ConfigTree const &config)
std::unique_ptr< Property > createTemperatureDependentDiffusion(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 > createKozenyCarmanModel(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
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< Curve > createCurve(BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &curves)
Definition: CreateCurve.cpp:21
std::unique_ptr< Property > createWaterVapourLatentHeatWithCriticalTemperature(BaseLib::ConfigTree const &config)
std::unique_ptr< SaturationDependentThermalConductivity > createSaturationDependentThermalConductivity(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermUdellNonwettingPhase > createRelPermUdellNonwettingPhase(BaseLib::ConfigTree const &config)
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< RelPermBrooksCorey > createRelPermBrooksCorey(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 > 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< Property > createRelPermNonWettingPhaseVanGenuchtenMualem(BaseLib::ConfigTree const &config)
std::unique_ptr< AverageMolarMass > createAverageMolarMass(BaseLib::ConfigTree const &config)
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 > createCapillaryPressureRegularizedVanGenuchten(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermUdell > createRelPermUdell(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 > 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< 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 > createVapourDiffusionPMQ(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< RelPermLiakopoulos > createRelPermLiakopoulos(BaseLib::ConfigTree const &config)
std::unique_ptr< RelPermBrooksCoreyNonwettingPhase > createRelPermBrooksCoreyNonwettingPhase(BaseLib::ConfigTree const &config)
std::unique_ptr< Parameter > createParameterProperty(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
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< 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)