OGS
anonymous_namespace{PhaseTransition.cpp} Namespace Reference

Functions

int numberOfComponents (std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media, std::string const &phase_name)
int findComponentIndex (std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media, std::string const &phase_name, MaterialPropertyLib::PropertyType property_type)

Function Documentation

◆ findComponentIndex()

int anonymous_namespace{PhaseTransition.cpp}::findComponentIndex ( std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media,
std::string const & phase_name,
MaterialPropertyLib::PropertyType property_type )

Definition at line 19 of file PhaseTransition.cpp.

23{
24 // It is always the first (begin) medium that holds fluid phases.
25 auto const& medium = media.begin()->second;
26 auto const& phase = medium->phase(phase_name);
27
28 // find the component for which the property 'property_type' is defined
29 for (std::size_t c = 0; c < phase.numberOfComponents(); c++)
30 {
31 if (phase.component(c).hasProperty(property_type))
32 {
33 return c;
34 }
35 }
36
37 // A lot of checks can (and should) be done to make sure that the right
38 // components with the right properties are used. For example, the names
39 // of the components can be compared to check that the name of the
40 // evaporable component does not also correspond to the name of the
41 // solute.
42
44 "PhaseTransitionModel: findComponentIndex() could not find the "
45 "specified property type '{:s}' in phase '{:s}'.",
47 phase_name);
48}
#define OGS_FATAL(...)
Definition Error.h:19
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string

References OGS_FATAL, and MaterialPropertyLib::property_enum_to_string.

◆ numberOfComponents()

int anonymous_namespace{PhaseTransition.cpp}::numberOfComponents ( std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media,
std::string const & phase_name )

Definition at line 10 of file PhaseTransition.cpp.

13{
14 // Always the first (begin) medium that holds fluid phases.
15 auto const& medium = media.begin()->second;
16 return medium->phase(phase_name).numberOfComponents();
17}