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

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

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}