OGS 6.2.1-499-g3b941532c.dirty.20191012113459
MaterialPropertyLib Namespace Reference

Classes

class  Component
 This class defines components (substances). More...
 
class  Constant
 
struct  ExponentData
 
class  ExponentialProperty
 
struct  FormEigenTensor
 
class  IdealGasLaw
 Density function for ideal gases. More...
 
struct  IndependentVariable
 
class  LinearProperty
 
class  MaterialSpatialDistributionMap
 
class  Medium
 
class  ParameterProperty
 
class  Phase
 
class  Property
 
class  RelPermBrooksCorey
 Relative permeability function proposed by Brooks&Corey. More...
 
class  RelPermLiakopoulos
 Relative permeability function for Liakopoulos Benchmark. More...
 
class  SaturationBrooksCorey
 A well known soil characteristics function. More...
 
class  SaturationLiakopoulos
 A well known soil characteristics function. More...
 
struct  Water
 

Typedefs

using PropertyArray = std::array< std::unique_ptr< Property >, PropertyType::number_of_properties >
 
using PropertyDataType = std::variant< double, Pair, Vector, Tensor2d, SymmTensor, Tensor, std::string >
 
using Pair = std::array< double, 2 >
 
using Vector = std::array< double, 3 >
 
using SymmTensor = std::array< double, 6 >
 
using Tensor2d = std::array< double, 4 >
 Very simple 2d tensor data type for holding tensor components. More...
 
using Tensor = std::array< double, 9 >
 
using VariableType = std::variant< double, Vector >
 
using VariableArray = std::array< VariableType, static_cast< int >(Variable::number_of_variables)>
 

Enumerations

enum  PropertyDataTypeName {
  nScalar, nPair, nVector, nSymmTensor,
  nTensor
}
 
enum  PropertyType : int {
  acentric_factor, binary_interaction_coefficient, biot_coefficient, brooks_corey_exponent,
  bulk_modulus, critical_density, critical_pressure, critical_temperature,
  compressibility, decay_rate, density, drhodT,
  effective_stress, entry_pressure, fredlund_parameters, heat_capacity,
  longitudinal_dispersivity, molar_mass, mole_fraction, molecular_diffusion,
  name, permeability, phase_velocity, porosity,
  reference_density, reference_temperature, reference_pressure, relative_permeability,
  residual_gas_saturation, residual_liquid_saturation, retardation_factor, saturation,
  specific_heat_capacity, storage, thermal_conductivity, thermal_expansivity,
  thermal_longitudinal_dispersivity, thermal_transversal_dispersivity, transversal_dispersivity, viscosity,
  number_of_properties
}
 
enum  Variable : int {
  Variable::concentration, Variable::phase_pressure, Variable::capillary_pressure, Variable::density,
  Variable::temperature, Variable::liquid_saturation, Variable::displacement, Variable::number_of_variables
}
 

Functions

std::unique_ptr< ComponentnewComponent (std::string const &component_name, bool &isCustomComponent)
 
double getThermalExpansivity (Phase const &phase, VariableArray const &vars, const double density, ParameterLib::SpatialPosition const &pos, double const t)
 
std::vector< std::unique_ptr< Component > > createComponents (boost::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< MaterialSpatialDistributionMapcreateMaterialSpatialDistributionMap (std::map< int, std::unique_ptr< Medium >> const &media, MeshLib::Mesh const &mesh)
 
std::unique_ptr< MediumcreateMedium (BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::vector< std::unique_ptr< Phase > > createPhases (boost::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< PropertyArraycreateProperties (boost::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< ConstantcreateConstant (BaseLib::ConfigTree const &config)
 
std::unique_ptr< ExponentialPropertycreateExponentialProperty (BaseLib::ConfigTree const &config)
 
std::unique_ptr< IdealGasLawcreateIdealGasLaw (BaseLib::ConfigTree const &config)
 
std::unique_ptr< LinearPropertycreateLinearProperty (BaseLib::ConfigTree const &config)
 
std::unique_ptr< ParameterPropertycreateParameterProperty (BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< RelPermBrooksCoreycreateRelPermBrooksCorey (BaseLib::ConfigTree const &config)
 
std::unique_ptr< RelPermLiakopouloscreateRelPermLiakopoulos (BaseLib::ConfigTree const &config)
 
std::unique_ptr< SaturationBrooksCoreycreateSaturationBrooksCorey (BaseLib::ConfigTree const &config)
 
std::unique_ptr< SaturationLiakopouloscreateSaturationLiakopoulos (BaseLib::ConfigTree const &config)
 
double molarMass (Phase *_phase, Component *_component, VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t)
 
void overwriteExistingProperties (PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component *> scale_pointer)
 
PropertyType convertStringToProperty (std::string const &inString)
 
template<int GlobalDim>
Eigen::Matrix< double, GlobalDim, GlobalDim > formEffectiveThermalConductivity (MaterialPropertyLib::PropertyDataType const &solid_thermal_conductivity, const double fluid_thermal_conductivity, const double porosity)
 
template Eigen::Matrix< double, 1, 1 > formEffectiveThermalConductivity< 1 > (MaterialPropertyLib::PropertyDataType const &solid_thermal_conductivity, const double fluid_thermal_conductivity, const double porosity)
 
template Eigen::Matrix< double, 2, 2 > formEffectiveThermalConductivity< 2 > (MaterialPropertyLib::PropertyDataType const &solid_thermal_conductivity, const double fluid_thermal_conductivity, const double porosity)
 
template Eigen::Matrix< double, 3, 3 > formEffectiveThermalConductivity< 3 > (MaterialPropertyLib::PropertyDataType const &solid_thermal_conductivity, const double fluid_thermal_conductivity, const double porosity)
 
template<int GlobalDim>
Eigen::Matrix< double, GlobalDim, GlobalDim > formEigenTensor (MaterialPropertyLib::PropertyDataType const &values)
 
template Eigen::Matrix< double, 1, 1 > formEigenTensor< 1 > (MaterialPropertyLib::PropertyDataType const &values)
 
template Eigen::Matrix< double, 2, 2 > formEigenTensor< 2 > (MaterialPropertyLib::PropertyDataType const &values)
 
template Eigen::Matrix< double, 3, 3 > formEigenTensor< 3 > (MaterialPropertyLib::PropertyDataType const &values)
 
Variable convertStringToVariable (std::string const &input)
 
double getScalar (VariableType pv)
 This method returns a value of type double from the variables array. More...
 

Variables

static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string
 

Typedef Documentation

◆ Pair

using MaterialPropertyLib::Pair = typedef std::array<double, 2>

Very simple vector data type for holding a pair of values.

Definition at line 22 of file VariableType.h.

◆ PropertyArray

typedef std::array< std::unique_ptr< Property >, PropertyType::number_of_properties > MaterialPropertyLib::PropertyArray

This data type is based on a std::array. It can hold pointers to objects of class Property or its inheritors. The size of this array is determined by the number of entries of the PropertyType enumerator.

Definition at line 35 of file CreateProperty.h.

◆ PropertyDataType

using MaterialPropertyLib::PropertyDataType = typedef std::variant<double, Pair, Vector, Tensor2d, SymmTensor, Tensor, std::string>

Definition at line 42 of file Property.h.

◆ SymmTensor

using MaterialPropertyLib::SymmTensor = typedef std::array<double, 6>

Simple symmetric tensor data type for holding xx, yy, zz, xy, xz, yz tensor components.

Definition at line 30 of file VariableType.h.

◆ Tensor

using MaterialPropertyLib::Tensor = typedef std::array<double, 9>

Very simple tensor data type for holding tensor components.

Definition at line 37 of file VariableType.h.

◆ Tensor2d

using MaterialPropertyLib::Tensor2d = typedef std::array<double, 4>

Very simple 2d tensor data type for holding tensor components.

Definition at line 33 of file VariableType.h.

◆ VariableArray

using MaterialPropertyLib::VariableArray = typedef std::array<VariableType, static_cast<int>(Variable::number_of_variables)>

The VariableArray is a std::array of fixed size. Its size is determined by the Variable enumerator list. Data type of that array is defined by the VariableType definition.

Definition at line 62 of file VariableType.h.

◆ VariableType

using MaterialPropertyLib::VariableType = typedef std::variant<double, Vector>

Data type for primary variables, designed to contain both scalar and vector data.

Definition at line 56 of file VariableType.h.

◆ Vector

using MaterialPropertyLib::Vector = typedef std::array<double, 3>

Very simple vector data type for holding vector components.

Definition at line 26 of file VariableType.h.

Enumeration Type Documentation

◆ PropertyDataTypeName

This is a custom data type for arbitrary properties, based on the std::variant container. It can hold scalars, vectors, tensors, and so forth.

Enumerator
nScalar 
nPair 
nVector 
nSymmTensor 
nTensor 

Definition at line 32 of file Property.h.

◆ PropertyType

PropertyType is an enumerator list of all known properties of a substance. This includes all properties on all scales (i.e. component, phase, and medium scales). It is used as an index for the PropertyArray of the materials. If a necessary property is not in the list, simply add a new one in alphabetical order (of course, except for the last entry). Please note that any of these entries must also appear in below convert functions.

Enumerator
acentric_factor 
binary_interaction_coefficient 
biot_coefficient 
brooks_corey_exponent 
bulk_modulus 
critical_density 
critical_pressure 
critical_temperature 
compressibility 
decay_rate 

used to specify decay rate of a substance.

density 
drhodT 
effective_stress 
entry_pressure 
fredlund_parameters 
heat_capacity 
longitudinal_dispersivity 

used to compute the hydrodynamic dispersion tensor.

molar_mass 
mole_fraction 
molecular_diffusion 

used to compute the hydrodynamic dispersion tensor.

name 
permeability 
phase_velocity 
porosity 
reference_density 
reference_temperature 
reference_pressure 
relative_permeability 
residual_gas_saturation 
residual_liquid_saturation 
retardation_factor 

specify retardation factor used in component transport process.

saturation 
specific_heat_capacity 
storage 
thermal_conductivity 
thermal_expansivity 
thermal_longitudinal_dispersivity 
thermal_transversal_dispersivity 
transversal_dispersivity 

used to compute the hydrodynamic dispersion tensor.

viscosity 
number_of_properties 

Definition at line 34 of file PropertyType.h.

34  : int
35 {
46  decay_rate,
47  density,
48  drhodT,
55  molar_mass,
59  name,
62  porosity,
71  saturation,
73  storage,
80  viscosity,
82 };
used to specify decay rate of a substance.
Definition: PropertyType.h:46
used to compute the hydrodynamic dispersion tensor.
Definition: PropertyType.h:58
specify retardation factor used in component transport process.
Definition: PropertyType.h:70
used to compute the hydrodynamic dispersion tensor.
Definition: PropertyType.h:54
used to compute the hydrodynamic dispersion tensor.
Definition: PropertyType.h:79

◆ Variable

enum MaterialPropertyLib::Variable : int
strong

Enum Variable is simply a list of all commonly used variables that are used to determine the size of the VariableArray. If the variable of your choice is missing, simply add it somewhere at the list, but above the last entry.

Enumerator
concentration 
phase_pressure 
capillary_pressure 
density 
temperature 
liquid_saturation 
displacement 
number_of_variables 

Definition at line 42 of file VariableType.h.

Function Documentation

◆ convertStringToProperty()

PropertyType MaterialPropertyLib::convertStringToProperty ( std::string const &  inString)
inline

This function converts a string (e.g. a string from the configuration-tree) into one of the entries of the PropertyType enumerator. To avoid confusion, I suggest that the syntax of the properties in the input-files (i.e. the strings) have to be identical to the syntax of the entries in the enumerator.

Definition at line 89 of file PropertyType.h.

References acentric_factor, binary_interaction_coefficient, biot_coefficient, brooks_corey_exponent, bulk_modulus, compressibility, critical_density, critical_pressure, critical_temperature, decay_rate, density, drhodT, effective_stress, entry_pressure, fredlund_parameters, heat_capacity, longitudinal_dispersivity, molar_mass, mole_fraction, molecular_diffusion, name, number_of_properties, OGS_FATAL, permeability, phase_velocity, porosity, reference_density, reference_pressure, reference_temperature, relative_permeability, residual_gas_saturation, residual_liquid_saturation, retardation_factor, saturation, specific_heat_capacity, storage, thermal_conductivity, thermal_expansivity, thermal_longitudinal_dispersivity, thermal_transversal_dispersivity, transversal_dispersivity, and viscosity.

Referenced by createProperties().

90 {
91  if (boost::iequals(inString, "acentric_factor"))
92  {
94  }
95  if (boost::iequals(inString, "binary_interaction_coefficient"))
96  {
98  }
99  if (boost::iequals(inString, "biot_coefficient"))
100  {
102  }
103  if (boost::iequals(inString, "brooks_corey_exponent"))
104  {
106  }
107  if (boost::iequals(inString, "bulk_modulus"))
108  {
110  }
111  if (boost::iequals(inString, "critical_density"))
112  {
114  }
115  if (boost::iequals(inString, "critical_pressure"))
116  {
118  }
119  if (boost::iequals(inString, "critical_temperature"))
120  {
122  }
123  if (boost::iequals(inString, "compressibility"))
124  {
126  }
127  if (boost::iequals(inString, "decay_rate"))
128  {
130  }
131  if (boost::iequals(inString, "density"))
132  {
133  return PropertyType::density;
134  }
135  if (boost::iequals(inString, "drhodT"))
136  {
137  return PropertyType::drhodT;
138  }
139  if (boost::iequals(inString, "effective_stress"))
140  {
142  }
143  if (boost::iequals(inString, "entry_pressure"))
144  {
146  }
147  if (boost::iequals(inString, "fredlund_parameters"))
148  {
150  }
151  if (boost::iequals(inString, "heat_capacity"))
152  {
154  }
155  if (boost::iequals(inString, "longitudinal_dispersivity"))
156  {
158  }
159  if (boost::iequals(inString, "molar_mass"))
160  {
162  }
163  if (boost::iequals(inString, "mole_fraction"))
164  {
166  }
167  if (boost::iequals(inString, "molecular_diffusion"))
168  {
170  }
171  if (boost::iequals(inString, "name"))
172  {
173  return PropertyType::name;
174  }
175  if (boost::iequals(inString, "permeability"))
176  {
178  }
179  if (boost::iequals(inString, "porosity"))
180  {
181  return PropertyType::porosity;
182  }
183  if (boost::iequals(inString, "phase_velocity"))
184  {
186  }
187  if (boost::iequals(inString, "reference_density"))
188  {
190  }
191  if (boost::iequals(inString, "reference_temperature"))
192  {
194  }
195  if (boost::iequals(inString, "reference_pressure"))
196  {
198  }
199  if (boost::iequals(inString, "relative_permeability"))
200  {
202  }
203  if (boost::iequals(inString, "residual_gas_saturation"))
204  {
206  }
207  if (boost::iequals(inString, "residual_liquid_saturation"))
208  {
210  }
211  if (boost::iequals(inString, "retardation_factor"))
212  {
214  }
215  if (boost::iequals(inString, "saturation"))
216  {
218  }
219  if (boost::iequals(inString, "specific_heat_capacity"))
220  {
222  }
223  if (boost::iequals(inString, "storage"))
224  {
225  return PropertyType::storage;
226  }
227  if (boost::iequals(inString, "thermal_conductivity"))
228  {
230  }
231  if (boost::iequals(inString, "thermal_expansivity"))
232  {
234  }
235  if (boost::iequals(inString, "thermal_longitudinal_dispersivity"))
236  {
238  }
239  if (boost::iequals(inString, "thermal_transversal_dispersivity"))
240  {
242  }
243  if (boost::iequals(inString, "transversal_dispersivity"))
244  {
246  }
247  if (boost::iequals(inString, "viscosity"))
248  {
250  }
251 
252  OGS_FATAL(
253  "The property name '%s' does not correspond to any known property",
254  inString.c_str());
255 
256  return PropertyType::number_of_properties; // to avoid the 'no return'
257  // warning
258 }
used to specify decay rate of a substance.
Definition: PropertyType.h:46
used to compute the hydrodynamic dispersion tensor.
Definition: PropertyType.h:58
specify retardation factor used in component transport process.
Definition: PropertyType.h:70
used to compute the hydrodynamic dispersion tensor.
Definition: PropertyType.h:54
used to compute the hydrodynamic dispersion tensor.
Definition: PropertyType.h:79
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ convertStringToVariable()

Variable MaterialPropertyLib::convertStringToVariable ( std::string const &  input)

Definition at line 17 of file VariableType.cpp.

References capillary_pressure, concentration, density, displacement, liquid_saturation, number_of_variables, OGS_FATAL, phase_pressure, and temperature.

Referenced by createExponentialProperty(), createLinearProperty(), and getScalar().

18 {
19  if (boost::iequals(input, "concentration"))
20  {
21  return Variable::concentration;
22  }
23  if (boost::iequals(input, "phase_pressure"))
24  {
25  return Variable::phase_pressure;
26  }
27  if (boost::iequals(input, "capillary_pressure"))
28  {
29  return Variable::capillary_pressure;
30  }
31  if (boost::iequals(input, "density"))
32  {
33  return Variable::density;
34  }
35  if (boost::iequals(input, "temperature"))
36  {
37  return Variable::temperature;
38  }
39  if (boost::iequals(input, "liquid_saturation"))
40  {
41  return Variable::liquid_saturation;
42  }
43  if (boost::iequals(input, "displacement"))
44  {
45  return Variable::displacement;
46  }
47 
48  OGS_FATAL(
49  "The variable name '%s' does not correspond to any known variable",
50  input.c_str());
51 
52  return Variable::number_of_variables; // to avoid the 'no return' warning
53 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ createComponents()

std::vector< std::unique_ptr< Component > > MaterialPropertyLib::createComponents ( boost::optional< BaseLib::ConfigTree > const &  config,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)

The method creates components based on config subtree.

Just like a phase, a component can have a name. But, in this case, the name has an important task. If a name is given, a specific component class referring to that name with corresponding physical material properties is created. Assigning a name is optional; If no name is given, a custom component without predefined properties is created.

Input File Parameter:
prj__media__medium__phases__phase__components__component

Definition at line 68 of file CreateComponent.cpp.

References anonymous_namespace{Density100MPa.cpp}::c, anonymous_namespace{CreateComponent.cpp}::createComponent(), and OGS_FATAL.

Referenced by anonymous_namespace{CreatePhase.cpp}::createPhase().

71 {
72  if (!config)
73  {
74  return {};
75  }
76 
77  std::vector<std::unique_ptr<Component>> components;
78  for (
79  auto const& component_config :
81  config->getConfigSubtreeList("component"))
82  {
83  auto component = createComponent(component_config, parameters);
84 
85  if (std::find_if(components.begin(),
86  components.end(),
87  [component_name = component->name()](auto const& c) {
88  return c->name() == component_name;
89  }) != components.end())
90  {
91  OGS_FATAL("Found duplicates with the same component name tag '%s'.",
92  component->name().c_str());
93  }
94 
95  components.push_back(std::move(component));
96  }
97 
98  return components;
99 }
std::unique_ptr< MaterialPropertyLib::Component > createComponent(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ createConstant()

std::unique_ptr< Constant > MaterialPropertyLib::createConstant ( BaseLib::ConfigTree const &  config)
Input File Parameter:
properties__property__type
Input File Parameter:
properties__property__Constant__value

Definition at line 18 of file CreateConstant.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), and OGS_FATAL.

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

19 {
21  config.checkConfigParameter("type", "Constant");
22  DBUG("Create Constant property");
23  std::vector<double> const values =
25  config.getConfigParameter<std::vector<double>>("value");
26 
27  switch (values.size())
28  {
29  case 1:
30  {
31  // scalar
32  PropertyDataType property_value = values[0];
33  return std::make_unique<Constant>(property_value);
34  }
35  case 2:
36  {
37  // Pair
38  PropertyDataType property_value = Pair{values[0], values[1]};
39  return std::make_unique<Constant>(property_value);
40  }
41  case 3:
42  {
43  // Vector
44  PropertyDataType property_value =
45  Vector{values[0], values[1], values[2]};
46  return std::make_unique<Constant>(property_value);
47  }
48  case 4:
49  {
50  // Tensor
51  PropertyDataType property_value =
52  Tensor2d{values[0], values[1], values[2], values[3]};
53  return std::make_unique<Constant>(property_value);
54  }
55  case 6:
56  {
57  // Symmetric Tensor - xx, yy, zz, xy, xz, yz
58  PropertyDataType property_value =
59  SymmTensor{values[0], values[1], values[2],
60  values[3], values[4], values[5]};
61  return std::make_unique<Constant>(property_value);
62  }
63  case 9:
64  {
65  // Tensor
66  PropertyDataType property_value =
67  Tensor{values[0], values[1], values[2], values[3], values[4],
68  values[5], values[6], values[7], values[8]};
69  return std::make_unique<Constant>(property_value);
70  }
71 
72  default:
73  {
74  OGS_FATAL(
75  "Creation of a constant property with %i components is not "
76  "implemented.",
77  values.size());
78  }
79  }
80 
81  PropertyDataType property_value;
82  return std::make_unique<Constant>(property_value);
83 }
std::variant< double, Pair, Vector, Tensor2d, SymmTensor, Tensor, std::string > PropertyDataType
Definition: Property.h:42
std::array< double, 6 > SymmTensor
Definition: VariableType.h:30
std::array< double, 2 > Pair
Definition: VariableType.h:22
#define OGS_FATAL(fmt,...)
Definition: Error.h:64
std::array< double, 3 > Vector
Definition: VariableType.h:26
std::array< double, 9 > Tensor
Definition: VariableType.h:37
std::array< double, 4 > Tensor2d
Very simple 2d tensor data type for holding tensor components.
Definition: VariableType.h:33

◆ createExponentialProperty()

std::unique_ptr< ExponentialProperty > MaterialPropertyLib::createExponentialProperty ( BaseLib::ConfigTree const &  config)
Input File Parameter:
properties__property__type
Input File Parameter:
properties__property__ExponentialProperty__reference_value
Input File Parameter:
properties__property__ExponentialProperty__exponent
Input File Parameter:
properties__property__ExponentialProperty__exponent__variable_name
Input File Parameter:
properties__property__ExponentialProperty__exponent__reference_condition
Input File Parameter:
properties__property__ExponentialProperty__exponent__factor

Definition at line 18 of file CreateExponentialProperty.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), convertStringToVariable(), BaseLib::ConfigTree::getConfigParameter(), and BaseLib::ConfigTree::getConfigSubtree().

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

20 {
22  config.checkConfigParameter("type", "Exponential");
23  DBUG("Create Exponential property");
24  auto const reference_value =
26  config.getConfigParameter<double>("reference_value");
27 
28  auto const& exponent_data_config =
30  config.getConfigSubtree("exponent");
31 
32  auto const& variable_name =
34  exponent_data_config.getConfigParameter<std::string>("variable_name");
35  auto const reference_condition =
37  exponent_data_config.getConfigParameter<double>("reference_condition");
38  auto const factor =
40  exponent_data_config.getConfigParameter<double>("factor");
41 
42  MaterialPropertyLib::Variable exp_data_type =
44 
45  MaterialPropertyLib::ExponentData const exp_data{
46  exp_data_type, reference_condition, factor};
47 
48  return std::make_unique<MaterialPropertyLib::ExponentialProperty>(
49  reference_value, exp_data);
50 }
Variable convertStringToVariable(std::string const &input)

◆ createIdealGasLaw()

std::unique_ptr< IdealGasLaw > MaterialPropertyLib::createIdealGasLaw ( BaseLib::ConfigTree const &  config)
Input File Parameter:
properties__property__type

Definition at line 18 of file CreateIdealGasLaw.cpp.

References BaseLib::ConfigTree::checkConfigParameter().

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

20 {
22  config.checkConfigParameter("type", "IdealGasLaw");
23  DBUG("Create IdealGasLaw medium property");
24  return std::make_unique<IdealGasLaw>();
25 }

◆ createLinearProperty()

std::unique_ptr< LinearProperty > MaterialPropertyLib::createLinearProperty ( BaseLib::ConfigTree const &  config)
Input File Parameter:
properties__property__type
Input File Parameter:
properties__property__LinearProperty__reference_value
Input File Parameter:
properties__property__LinearProperty__independent_variable
Input File Parameter:
properties__property__LinearProperty__independent_variable__variable_name
Input File Parameter:
properties__property__LinearProperty__independent_variable__reference_condition
Input File Parameter:
properties__property__LinearProperty__independent_variable__slope

Definition at line 18 of file CreateLinearProperty.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), convertStringToVariable(), BaseLib::ConfigTree::getConfigParameter(), and BaseLib::ConfigTree::getConfigSubtreeList().

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

20 {
22  config.checkConfigParameter("type", "Linear");
23  DBUG("Create Linear property");
24 
25  auto const reference_value =
27  config.getConfigParameter<double>("reference_value");
28 
29  std::vector<MaterialPropertyLib::IndependentVariable> ivs;
30  for (
31  auto const& independent_variable_config :
33  config.getConfigSubtreeList("independent_variable"))
34  {
35  auto const& variable_name =
37  independent_variable_config.getConfigParameter<std::string>(
38  "variable_name");
39  auto const reference_condition =
41  independent_variable_config.getConfigParameter<double>(
42  "reference_condition");
43  auto const slope =
45  independent_variable_config.getConfigParameter<double>("slope");
46 
49 
50  MaterialPropertyLib::IndependentVariable iv{ivt, reference_condition,
51  slope};
52 
53  ivs.push_back(std::move(iv));
54  }
55 
56  return std::make_unique<MaterialPropertyLib::LinearProperty>(
57  reference_value, ivs);
58 }
Variable convertStringToVariable(std::string const &input)

◆ createMaterialSpatialDistributionMap()

std::unique_ptr< MaterialSpatialDistributionMap > MaterialPropertyLib::createMaterialSpatialDistributionMap ( std::map< int, std::unique_ptr< Medium >> const &  media,
MeshLib::Mesh const &  mesh 
)

Definition at line 18 of file CreateMaterialSpatialDistributionMap.cpp.

References MeshLib::materialIDs().

Referenced by ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), and ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess().

21 {
22  auto const material_ids = materialIDs(mesh);
23 
24  int const max_material_id =
25  !material_ids
26  ? 0
27  : *std::max_element(begin(*material_ids), end(*material_ids));
28 
29  if (max_material_id > static_cast<int>(media.size() - 1))
30  {
31  WARN(
32  "The maximum value of MaterialIDs in mesh is %d. As the given "
33  "number of porous media definitions in the project file is %d, the "
34  "maximum value of MaterialIDs in mesh must be %d (index starts "
35  "with zero).",
36  max_material_id, media.size(), max_material_id - 1);
37  }
38 
39  if (max_material_id < static_cast<int>(media.size() - 1))
40  WARN(
41  "There are %d porous medium definitions in the project file but "
42  "only %d different values in the MaterialIDs vector/data_array in "
43  "the mesh.",
44  media.size(), max_material_id - 1);
45 
46  return std::make_unique<MaterialSpatialDistributionMap>(media,
47  material_ids);
48 }
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:403

◆ createMedium()

std::unique_ptr< Medium > MaterialPropertyLib::createMedium ( BaseLib::ConfigTree const &  config,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)

This function parses the "phases" and "properties" subtrees of the config tree and calls create methods for the phase vector and the properties array. Medium properties are optional. If not defined, default properties are assigned.

Input File Parameter:
prj__media__medium__phases
Input File Parameter:
prj__media__medium__properties

Definition at line 26 of file CreateMedium.cpp.

References createPhases(), createProperties(), BaseLib::ConfigTree::getConfigSubtreeOptional(), and OGS_FATAL.

Referenced by ProjectData::parseMedia().

29 {
30  // Parsing the phases
31  // Properties of phases may be not required in all the cases.
32  auto&& phases =
34  createPhases(config.getConfigSubtreeOptional("phases"), parameters);
35 
36  // Parsing medium properties, overwriting the defaults.
37  auto&& properties =
39  createProperties(config.getConfigSubtreeOptional("properties"),
40  parameters);
41 
42  if (phases.empty() && !properties)
43  {
44  OGS_FATAL("Neither tag <phases> nor tag <properties> has been found.");
45  }
46 
47  return std::make_unique<Medium>(std::move(phases), std::move(properties));
48 }
std::unique_ptr< PropertyArray > createProperties(boost::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
std::vector< std::unique_ptr< Phase > > createPhases(boost::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
Definition: CreatePhase.cpp:85
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ createParameterProperty()

std::unique_ptr< ParameterProperty > MaterialPropertyLib::createParameterProperty ( BaseLib::ConfigTree const &  config,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)
Input File Parameter:
properties__property__type
Input File Parameter:
properties__property__Parameter__parameter_name

Definition at line 21 of file CreateParameterProperty.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), and BaseLib::ConfigTree::getConfigParameter().

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

24 {
26  config.checkConfigParameter("type", "Parameter");
27  DBUG("Create Parameter property");
28 
29  std::string const& parameter_name =
31  config.getConfigParameter<std::string>("parameter_name");
32  auto const& parameter = ParameterLib::findParameter<double>(
33  parameter_name, parameters, 0, nullptr);
34  return std::make_unique<MaterialPropertyLib::ParameterProperty>(parameter);
35 }

◆ createPhases()

std::vector< std::unique_ptr< Phase > > MaterialPropertyLib::createPhases ( boost::optional< BaseLib::ConfigTree > const &  config,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)

A method that parses the phase details and stores them in the private _phases member.

This method creates the phases of the medium. Unlike a medium, a phase may have a name. However, this is silly at the moment since this name still has no effect (except of some benefits in regard of readability). Phase components are required (a phase consists of at least one component). Phase properties are optional. If not given, default properties are assigned. These default properties average the component properties, weighted by mole fraction.

Input File Parameter:
prj__media__medium__phases__phase

Definition at line 85 of file CreatePhase.cpp.

References anonymous_namespace{CreatePhase.cpp}::createPhase(), and OGS_FATAL.

Referenced by createMedium().

88 {
89  if (!config)
90  {
91  return {};
92  }
93 
94  std::vector<std::unique_ptr<Phase>> phases;
95 
96  for (auto phase_config :
98  config->getConfigSubtreeList("phase"))
99  {
100  auto phase = createPhase(phase_config, parameters);
101 
102  if (std::find_if(phases.begin(),
103  phases.end(),
104  [phase_name = phase->name()](auto const& p) {
105  return p->name() == phase_name;
106  }) != phases.end())
107  {
108  OGS_FATAL("Found duplicates with the same phase name tag '%s'.",
109  phase->name().c_str());
110  }
111 
112  phases.push_back(std::move(phase));
113  }
114 
115  return phases;
116 }
std::unique_ptr< MaterialPropertyLib::Phase > createPhase(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
Definition: CreatePhase.cpp:27
static const double p
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ createProperties()

std::unique_ptr< PropertyArray > MaterialPropertyLib::createProperties ( boost::optional< BaseLib::ConfigTree > const &  config,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)

The method reads the 'properties' tag in the prj-file and creates component properties accordingly.

First, a new property iy created based on the specified property type. Then, the property name is evaluated and the property is copied into the properties array.

Input File Parameter:
properties__property
Input File Parameter:
properties__property__name

Definition at line 90 of file CreateProperty.cpp.

References convertStringToProperty(), and anonymous_namespace{CreateProperty.cpp}::createProperty().

Referenced by anonymous_namespace{CreateComponent.cpp}::createComponent(), createMedium(), anonymous_namespace{CreatePhase.cpp}::createPhase(), and ProcessLib::LIE::PostProcessTool::getOutputMesh().

93 {
94  if (!config)
95  {
96  return nullptr;
97  }
98 
100  auto const& property_configs = config->getConfigSubtreeList("property");
101  if (property_configs.empty())
102  {
103  return nullptr;
104  }
105 
106  auto properties = std::make_unique<PropertyArray>();
107 
108  for (auto property_config : property_configs)
109  {
110  // Parsing the property name:
111  auto const property_name =
113  property_config.getConfigParameter<std::string>("name");
114  // Create a new property based on the configuration subtree:
115  auto property = createProperty(property_config, parameters);
116 
117  // Insert the new property at the right position into the components
118  // private PropertyArray:
119  (*properties)[convertStringToProperty(property_name)] =
120  std::move(property);
121  }
122  return properties;
123 }
std::unique_ptr< MaterialPropertyLib::Property > createProperty(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
PropertyType convertStringToProperty(std::string const &inString)
Definition: PropertyType.h:89

◆ createRelPermBrooksCorey()

std::unique_ptr< RelPermBrooksCorey > MaterialPropertyLib::createRelPermBrooksCorey ( BaseLib::ConfigTree const &  config)
Input File Parameter:
properties__property__type
Input File Parameter:
properties__property__RelPermBrooksCorey__residual_liquid_saturation
Input File Parameter:
properties__property__RelPermBrooksCorey__residual_gas_saturation
Input File Parameter:
properties__property__RelPermBrooksCorey__min_relative_permeability_liquid
Input File Parameter:
properties__property__RelPermBrooksCorey__min_relative_permeability_gas
Input File Parameter:
properties__property__RelPermBrooksCorey__lambda

Definition at line 16 of file CreateRelPermBrooksCorey.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), OGS_FATAL, residual_gas_saturation, and residual_liquid_saturation.

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

18 {
20  config.checkConfigParameter("type", "RelPermBrooksCorey");
21  DBUG("Create RelPermBrooksCorey medium property");
22 
23  auto const residual_liquid_saturation =
25  config.getConfigParameter<double>("residual_liquid_saturation");
26  auto const residual_gas_saturation =
28  config.getConfigParameter<double>("residual_gas_saturation");
29  auto const min_relative_permeability_liquid =
31  config.getConfigParameter<double>("min_relative_permeability_liquid");
32  auto const min_relative_permeability_gas =
34  config.getConfigParameter<double>("min_relative_permeability_gas");
35  auto const exponent =
37  config.getConfigParameter<double>("lambda");
38  if (exponent <= 0.)
39  {
40  OGS_FATAL("Exponent 'lambda' must be positive.");
41  }
42 
43  return std::make_unique<RelPermBrooksCorey>(
46  min_relative_permeability_liquid,
47  min_relative_permeability_gas,
48  exponent);
49 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ createRelPermLiakopoulos()

std::unique_ptr< RelPermLiakopoulos > MaterialPropertyLib::createRelPermLiakopoulos ( BaseLib::ConfigTree const &  config)
Input File Parameter:
properties__property__type
Input File Parameter:
properties__property__RelPermLiakopoulos

Definition at line 16 of file CreateRelPermLiakopoulos.cpp.

References BaseLib::ConfigTree::checkConfigParameter().

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

18 {
20  config.checkConfigParameter("type", "RelPermLiakopoulos");
21  DBUG("Create RelPermLiakopoulos medium property");
22 
24  return std::make_unique<RelPermLiakopoulos>();
25 }

◆ createSaturationBrooksCorey()

std::unique_ptr< SaturationBrooksCorey > MaterialPropertyLib::createSaturationBrooksCorey ( BaseLib::ConfigTree const &  config)
Input File Parameter:
properties__property__type
Input File Parameter:
properties__property__SaturationBrooksCorey__residual_liquid_saturation
Input File Parameter:
properties__property__SaturationBrooksCorey__residual_gas_saturation
Input File Parameter:
properties__property__SaturationBrooksCorey__lambda
Input File Parameter:
properties__property__SaturationBrooksCorey__entry_pressure

Definition at line 16 of file CreateSaturationBrooksCorey.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), entry_pressure, BaseLib::ConfigTree::getConfigParameter(), residual_gas_saturation, and residual_liquid_saturation.

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

18 {
20  config.checkConfigParameter("type", "SaturationBrooksCorey");
21 
22  DBUG("Create SaturationBrooksCorey medium property");
23 
24  auto const residual_liquid_saturation =
26  config.getConfigParameter<double>("residual_liquid_saturation");
27  auto const residual_gas_saturation =
29  config.getConfigParameter<double>("residual_gas_saturation");
30  auto const exponent =
32  config.getConfigParameter<double>("lambda");
33  auto const entry_pressure =
35  config.getConfigParameter<double>("entry_pressure");
36 
37  return std::make_unique<SaturationBrooksCorey>(residual_liquid_saturation,
39  exponent, entry_pressure);
40 }

◆ createSaturationLiakopoulos()

std::unique_ptr< SaturationLiakopoulos > MaterialPropertyLib::createSaturationLiakopoulos ( BaseLib::ConfigTree const &  config)
Input File Parameter:
properties__property__type
Input File Parameter:
properties__property__SaturationLiakopoulos

Definition at line 16 of file CreateSaturationLiakopoulos.cpp.

References BaseLib::ConfigTree::checkConfigParameter().

Referenced by anonymous_namespace{CreateProperty.cpp}::createProperty().

18 {
20  config.checkConfigParameter("type", "SaturationLiakopoulos");
21  DBUG("Create SaturationLiakopoulos medium property");
22 
24  return std::make_unique<SaturationLiakopoulos>();
25 }

◆ formEffectiveThermalConductivity()

template<int GlobalDim>
Eigen::Matrix< double, GlobalDim, GlobalDim > MaterialPropertyLib::formEffectiveThermalConductivity ( MaterialPropertyLib::PropertyDataType const &  solid_thermal_conductivity,
const double  fluid_thermal_conductivity,
const double  porosity 
)

Definition at line 19 of file FormEffectiveThermalConductivity.cpp.

References formEffectiveThermalConductivity< 1 >(), formEffectiveThermalConductivity< 2 >(), formEffectiveThermalConductivity< 3 >(), and porosity.

Referenced by ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian().

22 {
23  return (1.0 - porosity) *
24  formEigenTensor<GlobalDim>(solid_thermal_conductivity) +
25  porosity * fluid_thermal_conductivity *
26  Eigen::Matrix<double, GlobalDim, GlobalDim>::Identity();
27 }

◆ formEffectiveThermalConductivity< 1 >()

template Eigen::Matrix<double, 1, 1> MaterialPropertyLib::formEffectiveThermalConductivity< 1 > ( MaterialPropertyLib::PropertyDataType const &  solid_thermal_conductivity,
const double  fluid_thermal_conductivity,
const double  porosity 
)

◆ formEffectiveThermalConductivity< 2 >()

template Eigen::Matrix<double, 2, 2> MaterialPropertyLib::formEffectiveThermalConductivity< 2 > ( MaterialPropertyLib::PropertyDataType const &  solid_thermal_conductivity,
const double  fluid_thermal_conductivity,
const double  porosity 
)

◆ formEffectiveThermalConductivity< 3 >()

template Eigen::Matrix<double, 3, 3> MaterialPropertyLib::formEffectiveThermalConductivity< 3 > ( MaterialPropertyLib::PropertyDataType const &  solid_thermal_conductivity,
const double  fluid_thermal_conductivity,
const double  porosity 
)

◆ formEigenTensor()

template<int GlobalDim>
Eigen::Matrix< double, GlobalDim, GlobalDim > MaterialPropertyLib::formEigenTensor ( MaterialPropertyLib::PropertyDataType const &  values)

Definition at line 71 of file FormEigenTensor.cpp.

References formEigenTensor< 1 >(), formEigenTensor< 2 >(), and formEigenTensor< 3 >().

73 {
74  return std::visit(FormEigenTensor<GlobalDim>(), values);
75 }

◆ formEigenTensor< 1 >()

template Eigen::Matrix<double, 1, 1> MaterialPropertyLib::formEigenTensor< 1 > ( MaterialPropertyLib::PropertyDataType const &  values)

Referenced by formEigenTensor().

◆ formEigenTensor< 2 >()

template Eigen::Matrix<double, 2, 2> MaterialPropertyLib::formEigenTensor< 2 > ( MaterialPropertyLib::PropertyDataType const &  values)

Referenced by formEigenTensor().

◆ formEigenTensor< 3 >()

template Eigen::Matrix<double, 3, 3> MaterialPropertyLib::formEigenTensor< 3 > ( MaterialPropertyLib::PropertyDataType const &  values)

Referenced by formEigenTensor().

◆ getScalar()

double MaterialPropertyLib::getScalar ( VariableType  pv)
inline

This method returns a value of type double from the variables array.

Definition at line 65 of file VariableType.h.

References convertStringToVariable().

66 {
67  return std::get<double>(pv);
68 }

◆ getThermalExpansivity()

double MaterialPropertyLib::getThermalExpansivity ( Phase const &  phase,
VariableArray const &  vars,
const double  density,
ParameterLib::SpatialPosition const &  pos,
double const  t 
)

It gets the thermal expansion coefficient.

If the the thermal expansion coefficient is given in the project file via the media property of thermal_expansivity, e.g

*     <property>
*       <name>thermal_expansivity</name>
*       <type>Constant</type>
*       <value>2.07e-4</value>
*     </property>
* 

it returns the value of the given property. Otherwise it returns the value computed from the density model by the following formula

\[ (\frac{\partial \rho}{\partial T})/\rho \]

where $\rho$ is the density, $T$ is the temperature.

Definition at line 21 of file GetThermalExpansivity.cpp.

References density, MaterialPropertyLib::Phase::property(), temperature, and thermal_expansivity.

Referenced by ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian().

25 {
26  auto const thermal_expansivity_ptr =
28 
29  // The thermal expansivity is explicitly given in the project file.
30  if (thermal_expansivity_ptr)
31  {
32  return (*thermal_expansivity_ptr).template value<double>(vars, pos, t);
33  }
34 
35  // The thermal expansivity calculated by the density model directly.
36  return (density == 0.0)
37  ? 0.0
39  .template dValue<double>(
41  pos, t) /
42  density;
43 }

◆ molarMass()

double MaterialPropertyLib::molarMass ( Phase _phase,
Component _component,
VariableArray const &  variable_array,
ParameterLib::SpatialPosition const &  pos,
double const  t 
)

Definition at line 22 of file IdealGasLaw.cpp.

References molar_mass, OGS_FATAL, MaterialPropertyLib::Component::property(), and MaterialPropertyLib::Phase::property().

Referenced by MaterialPropertyLib::IdealGasLaw::d2Value(), MaterialPropertyLib::IdealGasLaw::dValue(), and MaterialPropertyLib::IdealGasLaw::value().

25 {
26  if (_phase) // IdealGasLaw of an entire phase
27  {
28  return _phase->property(PropertyType::molar_mass)
29  .template value<double>(variable_array, pos, t);
30  }
31  if (_component) // IdealGasLaw of a single component
32  {
33  return _component->property(PropertyType::molar_mass)
34  .template value<double>(variable_array, pos, t);
35  }
36  OGS_FATAL(
37  "Neither a phase nor a component are set for retrieving molar "
38  "mass.");
39 
40  return 0.;
41 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ newComponent()

std::unique_ptr<Component> MaterialPropertyLib::newComponent ( std::string const &  component_name,
bool &  isCustomComponent 
)

Method for creating a new component based on the specified component name.

This function creates a new component based on the (optional) component name that is given in the prj-file.

The method evaluates the string in the 'name'-object and calls the constructors of the derived component classes (if found) or that of the base class (if no name is specified).

◆ overwriteExistingProperties()

void MaterialPropertyLib::overwriteExistingProperties ( PropertyArray properties,
PropertyArray new_properties,
std::variant< Medium *, Phase *, Component *>  scale_pointer 
)
inline

Definition at line 115 of file Property.h.

Referenced by MaterialPropertyLib::Component::Component(), MaterialPropertyLib::Medium::Medium(), MaterialPropertyLib::Phase::Phase(), and MaterialPropertyLib::Water::Water().

120 {
121  for (std::size_t i = 0; i < properties.size(); ++i)
122  {
123  if (new_properties[i] != nullptr)
124  {
125  properties[i] = std::move(new_properties[i]);
126  properties[i]->setScale(scale_pointer);
127  }
128  }
129 }

Variable Documentation

◆ property_enum_to_string

const std::array<std::string, PropertyType::number_of_properties> MaterialPropertyLib::property_enum_to_string
static

Definition at line 261 of file PropertyType.h.