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 20 of file PhaseTransition.cpp.

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

References MaterialPropertyLib::fromString(), 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(MaterialPropertyLib::fromString(phase_name))
17 .numberOfComponents();
18}

References MaterialPropertyLib::fromString().