Skip to content
Snippets Groups Projects
Commit bce5b83d authored by Norbert Grunwald's avatar Norbert Grunwald
Browse files

removed auxiliary functions from PTM-class

parent cdbe2d83
No related branches found
No related tags found
No related merge requests found
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#include "PhaseTransitionModel.h"
namespace ProcessLib
{
namespace TH2M
{
int numberOfComponents(
std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media,
std::string phase_name)
{
// Always the first (begin) medium that holds fluid phases.
auto const medium = media.begin()->second;
return medium->phase(phase_name).numberOfComponents();
}
int findComponentIndex(
std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media,
std::string phase_name, MaterialPropertyLib::PropertyType property_type)
{
// It is always the first (begin) medium that holds fluid phases.
auto const medium = media.begin()->second;
auto const& phase = medium->phase(phase_name);
// find the component for which the property 'property_type' is defined
for (std::size_t c = 0; c < phase.numberOfComponents(); c++)
{
if (phase.component(c).hasProperty(property_type))
{
return c;
}
}
// A lot of checks can (and should) be done to make sure that the right
// components with the right properties are used. For example, the names
// of the components can be compared to check that the name of the
// evaporable component does not also correspond to the name of the
// solvate.
OGS_FATAL(
"PhaseTransitionModel::findComponentIndex could not find the "
"specified property type in the phase.");
}
} // namespace TH2M
} // namespace ProcessLib
\ No newline at end of file
......@@ -118,48 +118,17 @@ struct PhaseTransitionModel
ParameterLib::SpatialPosition pos, double const t,
double const dt) const = 0;
int numberOfComponents(
std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const&
media,
std::string phase_name)
{
// Always the first (begin) medium that holds fluid phases.
auto const medium = media.begin()->second;
return medium->phase(phase_name).numberOfComponents();
}
int findComponentIndex(
std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const&
media,
std::string phase_name, MaterialPropertyLib::PropertyType property_type)
{
// It is always the first (begin) medium that holds fluid phases.
auto const medium = media.begin()->second;
auto const& phase = medium->phase(phase_name);
// find the component for which the property 'property_type' is defined
for (std::size_t c = 0; c < phase.numberOfComponents(); c++)
{
if (phase.component(c).hasProperty(property_type))
{
return c;
}
}
// A lot of checks can (and should) be done to make sure that the right
// components with the right properties are used. For example, the names
// of the components can be compared to check that the name of the
// evaporable component does not also correspond to the name of the
// solvate.
OGS_FATAL(
"PhaseTransitionModel::findComponentIndex could not find the "
"specified property type in the phase.");
}
// constitutive variables
PhaseTransitionModelVariables cv;
};
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);
} // namespace TH2M
} // namespace ProcessLib
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment