opm-simulators/opm/simulators/utils/BlackoilPhases.cpp
Bård Skaflestad 26cd7ab993 Move opm/core/props to opm/simulators/utils
The opm/core directory is no longer meaningful, and it contains only
components which might collectively be described as simulator
utilities.
2024-06-25 12:22:09 +02:00

59 lines
1.9 KiB
C++

/*
Copyright 2021 Equinor ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#include <opm/simulators/utils/BlackoilPhases.hpp>
#include <algorithm>
#include <vector>
Opm::PhaseUsage::PhaseUsage(std::vector<BlackoilPhases::PhaseIndex> phases)
{
std::sort(phases.begin(), phases.end());
this->phase_used.fill(0);
this->phase_pos.fill(-1);
std::size_t current_pos = 0;
for (const auto& phase : phases) {
this->phase_used[phase] = 1;
this->phase_pos[phase] = current_pos;
current_pos++;
}
this->num_phases = 0;
if (this->phase_used[BlackoilPhases::Aqua])
this->num_phases++;
if (this->phase_used[BlackoilPhases::Liquid])
this->num_phases++;
if (this->phase_used[BlackoilPhases::Vapour])
this->num_phases++;
this->has_solvent = this->phase_used[BlackoilPhases::Solvent];
this->has_polymer = this->phase_used[BlackoilPhases::Polymer];
this->has_energy = this->phase_used[BlackoilPhases::Energy];
this->has_polymermw = this->phase_used[BlackoilPhases::PolymerMW];
this->has_foam = this->phase_used[BlackoilPhases::Foam];
this->has_brine = this->phase_used[BlackoilPhases::Brine];
this->has_zFraction = this->phase_used[BlackoilPhases::ZFraction];
}