add BlackoilWellModelRestart

start by moving loadRestartConnectionData
This commit is contained in:
Arne Morten Kvarving 2022-10-24 09:36:05 +02:00
parent 9b326f91c5
commit 0b32c1afd9
5 changed files with 118 additions and 31 deletions

View File

@ -81,6 +81,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/utils/ParallelRestart.cpp
opm/simulators/wells/ALQState.cpp
opm/simulators/wells/BlackoilWellModelGeneric.cpp
opm/simulators/wells/BlackoilWellModelRestart.cpp
opm/simulators/wells/GasLiftCommon.cpp
opm/simulators/wells/GasLiftGroupInfo.cpp
opm/simulators/wells/GasLiftSingleWellGeneric.cpp
@ -347,6 +348,8 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/wells/ALQState.hpp
opm/simulators/wells/BlackoilWellModel.hpp
opm/simulators/wells/BlackoilWellModel_impl.hpp
opm/simulators/wells/BlackoilWellModelGeneric.hpp
opm/simulators/wells/BlackoilWellModelRestart.hpp
opm/simulators/wells/GasLiftCommon.hpp
opm/simulators/wells/GasLiftGroupInfo.hpp
opm/simulators/wells/GasLiftSingleWellGeneric.hpp

View File

@ -36,6 +36,7 @@
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/simulators/utils/DeferredLogger.hpp>
#include <opm/simulators/wells/BlackoilWellModelRestart.hpp>
#include <opm/simulators/wells/GasLiftStage2.hpp>
#include <opm/simulators/wells/VFPProperties.hpp>
#include <opm/simulators/wells/WellGroupHelpers.hpp>
@ -414,31 +415,6 @@ getWellEcl(const std::string& well_name) const
return *well_ecl;
}
void
BlackoilWellModelGeneric::
loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
const std::vector<PerforationData>& old_perf_data,
SingleWellState& ws)
{
auto& perf_data = ws.perf_data;
auto perf_pressure = perf_data.pressure.begin();
auto perf_rates = perf_data.rates.begin();
auto perf_phase_rates = perf_data.phase_rates.begin();
for (const auto& pd : old_perf_data) {
const auto& rst_connection = rst_well.connections[pd.ecl_index];
*perf_pressure = rst_connection.pressure; ++perf_pressure;
*perf_rates = rst_connection.reservoir_rate; ++perf_rates;
for (const auto& phase : phs) {
*perf_phase_rates = rst_connection.rates.get(phase);
++perf_phase_rates;
}
}
}
void
BlackoilWellModelGeneric::
loadRestartSegmentData(const std::string& well_name,
@ -498,7 +474,7 @@ loadRestartWellData(const std::string& well_name,
ws.surface_rates[i] = rst_well.rates.get(phs[i]);
}
this->loadRestartConnectionData(phs, rst_well, old_perf_data, ws);
BlackoilWellModelRestart(*this).loadRestartConnectionData(phs, rst_well, old_perf_data, ws);
if (handle_ms_well && !rst_well.segments.empty()) {
this->loadRestartSegmentData(well_name, phs, rst_well, ws);

View File

@ -286,11 +286,6 @@ protected:
std::map<std::string, data::GroupData>& gvalues) const;
void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues) const;
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
const std::vector<PerforationData>& old_perf_data,
SingleWellState& ws);
void loadRestartSegmentData(const std::string& well_name,
const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,

View File

@ -0,0 +1,55 @@
/*
Copyright 2016 SINTEF ICT, Applied Mathematics.
Copyright 2016 - 2017 Statoil ASA.
Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
Copyright 2016 - 2018 IRIS AS
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/>.
*/
#include <config.h>
#include <opm/simulators/wells/BlackoilWellModelRestart.hpp>
#include <opm/simulators/wells/PerforationData.hpp>
#include <opm/simulators/wells/SingleWellState.hpp>
namespace Opm {
void BlackoilWellModelRestart::
loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
const std::vector<PerforationData>& old_perf_data,
SingleWellState& ws) const
{
auto& perf_data = ws.perf_data;
auto perf_pressure = perf_data.pressure.begin();
auto perf_rates = perf_data.rates.begin();
auto perf_phase_rates = perf_data.phase_rates.begin();
for (const auto& pd : old_perf_data) {
const auto& rst_connection = rst_well.connections[pd.ecl_index];
*perf_pressure = rst_connection.pressure; ++perf_pressure;
*perf_rates = rst_connection.reservoir_rate; ++perf_rates;
for (const auto& phase : phs) {
*perf_phase_rates = rst_connection.rates.get(phase);
++perf_phase_rates;
}
}
}
} // namespace Opm

View File

@ -0,0 +1,58 @@
/*
Copyright 2016 SINTEF ICT, Applied Mathematics.
Copyright 2016 - 2017 Statoil ASA.
Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
Copyright 2016 - 2018 IRIS AS
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/>.
*/
#ifndef OPM_BLACKOILWELLMODEL_RESTART_HEADER_INCLUDED
#define OPM_BLACKOILWELLMODEL_RESTART_HEADER_INCLUDED
#include <opm/output/data/Wells.hpp>
#include <vector>
namespace Opm {
class BlackoilWellModelGeneric;
struct PerforationData;
class SingleWellState;
/// Class for restarting the blackoil well model.
class BlackoilWellModelRestart
{
public:
//! \brief Constructor initializes reference to the well model.
BlackoilWellModelRestart(const BlackoilWellModelGeneric& wellModel)
: wellModel_(wellModel)
{}
//! \brief Loads per-connection data from restart structures.
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
const std::vector<PerforationData>& old_perf_data,
SingleWellState& ws) const;
private:
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
};
} // namespace Opm
#endif