OGS
PhaseTransitionModel.cpp
Go to the documentation of this file.
1 
10 #include "PhaseTransitionModel.h"
11 
12 namespace ProcessLib
13 {
14 namespace TH2M
15 {
17  std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media,
18  std::string phase_name)
19 {
20  // Always the first (begin) medium that holds fluid phases.
21  auto const medium = media.begin()->second;
22  return medium->phase(phase_name).numberOfComponents();
23 }
24 
26  std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media,
27  std::string phase_name, MaterialPropertyLib::PropertyType property_type)
28 {
29  // It is always the first (begin) medium that holds fluid phases.
30  auto const medium = media.begin()->second;
31  auto const& phase = medium->phase(phase_name);
32 
33  // find the component for which the property 'property_type' is defined
34  for (std::size_t c = 0; c < phase.numberOfComponents(); c++)
35  {
36  if (phase.component(c).hasProperty(property_type))
37  {
38  return c;
39  }
40  }
41 
42  // A lot of checks can (and should) be done to make sure that the right
43  // components with the right properties are used. For example, the names
44  // of the components can be compared to check that the name of the
45  // evaporable component does not also correspond to the name of the
46  // solvate.
47 
48  OGS_FATAL(
49  "PhaseTransitionModel: findComponentIndex() could not find the "
50  "specified property type '{:s}' in phase '{:s}'.",
52  phase_name);
53 }
54 } // namespace TH2M
55 } // namespace ProcessLib
#define OGS_FATAL(...)
Definition: Error.h:26
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string
Definition: PropertyType.h:111
int numberOfComponents(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media, std::string phase_name)
int findComponentIndex(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media, std::string phase_name, MaterialPropertyLib::PropertyType property_type)