Assign tracer data to SWEL
This commit is contained in:
parent
414b7c1946
commit
b00707ff84
@ -34,6 +34,7 @@ namespace Opm {
|
||||
class SummaryState;
|
||||
class UnitSystem;
|
||||
class WellTestState;
|
||||
class TracerConfig;
|
||||
namespace Action {
|
||||
class State;
|
||||
}
|
||||
@ -51,7 +52,7 @@ namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
explicit AggregateWellData(const std::vector<int>& inteHead);
|
||||
|
||||
void captureDeclaredWellData(const Schedule& sched,
|
||||
const UnitSystem& units,
|
||||
const TracerConfig& tracer,
|
||||
const std::size_t sim_step,
|
||||
const Opm::Action::State& action_state,
|
||||
const Opm::WellTestState& wtest_state,
|
||||
|
@ -183,6 +183,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
LOweightFac = 57, // Well's wighting factor for preferential allocation of lift gas
|
||||
LOminRate = 67, // Well's mimimum lift gas rate
|
||||
LOincFac =115,
|
||||
|
||||
TracerOffset = 122, // Tracer data start at this index
|
||||
};
|
||||
} // SWell
|
||||
|
||||
|
@ -40,10 +40,13 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/TracerConfig.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
@ -518,18 +521,36 @@ namespace {
|
||||
return rLimit;
|
||||
}
|
||||
|
||||
|
||||
template <class SWellArray>
|
||||
void assignTracerData(const Opm::TracerConfig& tracers,
|
||||
const Opm::SummaryState& smry,
|
||||
const std::string& wname,
|
||||
SWellArray &sWell)
|
||||
{
|
||||
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
|
||||
std::fill(sWell.begin() + Ix::TracerOffset, sWell.end(), 0);
|
||||
|
||||
std::size_t output_index = Ix::TracerOffset;
|
||||
for (const auto& tracer : tracers) {
|
||||
sWell[output_index] = smry.get_well_var(wname, fmt::format("WTIC{}", tracer.name), 0);
|
||||
output_index++;
|
||||
}
|
||||
}
|
||||
|
||||
template <class SWellArray>
|
||||
void staticContrib(const Opm::Well& well,
|
||||
const Opm::GasLiftOpt& glo,
|
||||
const Opm::UnitSystem& units,
|
||||
const std::size_t sim_step,
|
||||
const Opm::Schedule& sched,
|
||||
const Opm::TracerConfig& tracers,
|
||||
const Opm::WellTestState& wtest_state,
|
||||
const ::Opm::SummaryState& smry,
|
||||
SWellArray& sWell)
|
||||
{
|
||||
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
|
||||
using M = ::Opm::UnitSystem::measure;
|
||||
const auto& units = sched.getUnits();
|
||||
|
||||
auto swprop = [&units](const M u, const double x) -> float
|
||||
{
|
||||
@ -691,6 +712,8 @@ namespace {
|
||||
sWell[Ix::WTestInterval] = units.from_si(Opm::UnitSystem::measure::time, wtest_rst->test_interval);
|
||||
sWell[Ix::WTestStartupTime] = units.from_si(Opm::UnitSystem::measure::time, wtest_rst->startup_time);
|
||||
}
|
||||
|
||||
assignTracerData(tracers, smry, well.name(), sWell);
|
||||
}
|
||||
} // SWell
|
||||
|
||||
@ -980,7 +1003,7 @@ AggregateWellData(const std::vector<int>& inteHead)
|
||||
void
|
||||
Opm::RestartIO::Helpers::AggregateWellData::
|
||||
captureDeclaredWellData(const Schedule& sched,
|
||||
const UnitSystem& units,
|
||||
const TracerConfig& tracers,
|
||||
const std::size_t sim_step,
|
||||
const ::Opm::Action::State& action_state,
|
||||
const Opm::WellTestState& wtest_state,
|
||||
@ -1008,21 +1031,21 @@ captureDeclaredWellData(const Schedule& sched,
|
||||
}
|
||||
|
||||
// Static contributions to SWEL array.
|
||||
wellLoop(wells, sched, sim_step, [&units, &step_glo, &sim_step, &sched, &wtest_state, &smry, this]
|
||||
wellLoop(wells, sched, sim_step, [&step_glo, &sim_step, &sched, &tracers, &wtest_state, &smry, this]
|
||||
(const Well& well, const std::size_t wellID) -> void
|
||||
{
|
||||
auto sw = this->sWell_[wellID];
|
||||
|
||||
SWell::staticContrib(well, step_glo, units, sim_step, sched, wtest_state, smry, sw);
|
||||
SWell::staticContrib(well, step_glo, sim_step, sched, tracers, wtest_state, smry, sw);
|
||||
});
|
||||
|
||||
// Static contributions to XWEL array.
|
||||
wellLoop(wells, sched, sim_step, [&units, &smry, this]
|
||||
wellLoop(wells, sched, sim_step, [&sched, &smry, this]
|
||||
(const Well& well, const std::size_t wellID) -> void
|
||||
{
|
||||
auto xw = this->xWell_[wellID];
|
||||
|
||||
XWell::staticContrib(well, smry, units, xw);
|
||||
XWell::staticContrib(well, smry,sched.getUnits(), xw);
|
||||
});
|
||||
|
||||
{
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <opm/output/eclipse/AggregateMSWData.hpp>
|
||||
#include <opm/output/eclipse/AggregateUDQData.hpp>
|
||||
#include <opm/output/eclipse/AggregateActionxData.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/TracerConfig.hpp>
|
||||
|
||||
#include <opm/output/eclipse/WriteRestartHelpers.hpp>
|
||||
|
||||
@ -378,9 +379,9 @@ namespace {
|
||||
void writeWell(int sim_step,
|
||||
const bool ecl_compatible_rst,
|
||||
const Phases& phases,
|
||||
const UnitSystem& units,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
const TracerConfig& tracers,
|
||||
const std::vector<std::string>& well_names,
|
||||
const data::Wells& wells,
|
||||
const Opm::Action::State& action_state,
|
||||
@ -390,7 +391,7 @@ namespace {
|
||||
EclIO::OutputStream::Restart& rstFile)
|
||||
{
|
||||
auto wellData = Helpers::AggregateWellData(ih);
|
||||
wellData.captureDeclaredWellData(schedule, units, sim_step, action_state, wtest_state, sumState, ih);
|
||||
wellData.captureDeclaredWellData(schedule, tracers, sim_step, action_state, wtest_state, sumState, ih);
|
||||
wellData.captureDynamicWellData(schedule, sim_step, wells, sumState);
|
||||
|
||||
rstFile.write("IWEL", wellData.getIWell());
|
||||
@ -418,7 +419,7 @@ namespace {
|
||||
}
|
||||
|
||||
auto connectionData = Helpers::AggregateConnectionData(ih);
|
||||
connectionData.captureDeclaredConnData(schedule, grid, units,
|
||||
connectionData.captureDeclaredConnData(schedule, grid, schedule.getUnits(),
|
||||
wells, sumState, sim_step);
|
||||
|
||||
rstFile.write("ICON", connectionData.getIConn());
|
||||
@ -477,7 +478,6 @@ namespace {
|
||||
void writeDynamicData(const int sim_step,
|
||||
const bool ecl_compatible_rst,
|
||||
const Phases& phases,
|
||||
const UnitSystem& units,
|
||||
const EclipseGrid& grid,
|
||||
const EclipseState& es,
|
||||
const Schedule& schedule,
|
||||
@ -490,13 +490,13 @@ namespace {
|
||||
std::optional<Helpers::AggregateAquiferData>& aquiferData,
|
||||
EclIO::OutputStream::Restart& rstFile)
|
||||
{
|
||||
writeGroup(sim_step, units, schedule, sumState, inteHD, rstFile);
|
||||
writeGroup(sim_step, schedule.getUnits(), schedule, sumState, inteHD, rstFile);
|
||||
|
||||
// Write network data if the network option is used and network defined
|
||||
if ((es.runspec().networkDimensions().maxNONodes() >= 1) &&
|
||||
schedule[sim_step].network().active())
|
||||
{
|
||||
writeNetwork(es, sim_step, units, schedule, sumState, inteHD, rstFile);
|
||||
writeNetwork(es, sim_step, schedule.getUnits(), schedule, sumState, inteHD, rstFile);
|
||||
}
|
||||
|
||||
// Write well and MSW data only when applicable (i.e., when present)
|
||||
@ -511,11 +511,11 @@ namespace {
|
||||
});
|
||||
|
||||
if (haveMSW) {
|
||||
writeMSWData(sim_step, units, schedule, grid,
|
||||
writeMSWData(sim_step, schedule.getUnits(), schedule, grid,
|
||||
sumState, wellSol, inteHD, rstFile);
|
||||
}
|
||||
|
||||
writeWell(sim_step, ecl_compatible_rst, phases, units, grid, schedule,
|
||||
writeWell(sim_step, ecl_compatible_rst, phases, grid, schedule, es.tracer(),
|
||||
wells, wellSol, action_state, wtest_state, sumState, inteHD, rstFile);
|
||||
}
|
||||
|
||||
@ -523,7 +523,7 @@ namespace {
|
||||
aquiferData.has_value())
|
||||
{
|
||||
updateAndWriteAquiferData(es.aquifer(), aquDynData, sumState,
|
||||
units, aquiferData.value(), rstFile);
|
||||
schedule.getUnits(), aquiferData.value(), rstFile);
|
||||
}
|
||||
}
|
||||
|
||||
@ -815,7 +815,7 @@ void save(EclIO::OutputStream::Restart& rstFile,
|
||||
|
||||
if (report_step > 0) {
|
||||
writeDynamicData(sim_step, ecl_compatible_rst, es.runspec().phases(),
|
||||
units, grid, es, schedule, value.wells, action_state, wtest_state,
|
||||
grid, es, schedule, value.wells, action_state, wtest_state,
|
||||
sumState, inteHD, value.aquifer, aquiferData, rstFile);
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,6 @@ const Tracers& Runspec::tracers() const {
|
||||
return this->m_tracers;
|
||||
}
|
||||
|
||||
|
||||
Runspec::Runspec( const Deck& deck )
|
||||
: m_start_time( create_start_time(deck) )
|
||||
, active_phases( inferActivePhases(deck) )
|
||||
|
@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(Declared_Actionx_data)
|
||||
}
|
||||
{
|
||||
auto well_aggregator = Opm::RestartIO::Helpers::AggregateWellData(ih);
|
||||
well_aggregator.captureDeclaredWellData(sched, es.getUnits(), rptStep-1, {}, {}, st, ih);
|
||||
well_aggregator.captureDeclaredWellData(sched, es.tracer(), rptStep-1, {}, {}, st, ih);
|
||||
rstFile.write("IWEL", well_aggregator.getIWell());
|
||||
rstFile.write("SWEL", well_aggregator.getSWell());
|
||||
rstFile.write("XWEL", well_aggregator.getXWell());
|
||||
|
@ -259,7 +259,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data)
|
||||
auto action_state = Opm::Action::State {};
|
||||
auto wtest_state = Opm::WellTestState{};
|
||||
auto well_aggregator = Opm::RestartIO::Helpers::AggregateWellData(ih);
|
||||
well_aggregator.captureDeclaredWellData(sched, es.getUnits(), rptStep-1, action_state, wtest_state, st, ih);
|
||||
well_aggregator.captureDeclaredWellData(sched, es.tracer(), rptStep-1, action_state, wtest_state, st, ih);
|
||||
rstFile.write("IWEL", well_aggregator.getIWell());
|
||||
rstFile.write("SWEL", well_aggregator.getSWell());
|
||||
rstFile.write("XWEL", well_aggregator.getXWell());
|
||||
|
@ -628,7 +628,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data)
|
||||
BOOST_CHECK(tw == std::vector<std::string>{"OP_1"});
|
||||
|
||||
awd.captureDeclaredWellData(simCase.sched,
|
||||
simCase.es.getUnits(), rptStep, action_state, wtest_state, smry, ih.value);
|
||||
simCase.es.tracer(), rptStep, action_state, wtest_state, smry, ih.value);
|
||||
|
||||
// IWEL (OP_1)
|
||||
{
|
||||
@ -843,7 +843,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data)
|
||||
//smry = sim_state();
|
||||
awd = Opm::RestartIO::Helpers::AggregateWellData{ih_8.value};
|
||||
awd.captureDeclaredWellData(simCase.sched,
|
||||
simCase.es.getUnits(), rptStep_8, action_state, wtest_state, smry, ih_8.value);
|
||||
simCase.es.tracer(), rptStep_8, action_state, wtest_state, smry, ih_8.value);
|
||||
{
|
||||
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
|
||||
|
||||
@ -879,7 +879,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data_MSW_well_data)
|
||||
|
||||
auto awd = Opm::RestartIO::Helpers::AggregateWellData{ih.value};
|
||||
awd.captureDeclaredWellData(simCase.sched,
|
||||
simCase.es.getUnits(), rptStep, action_state, wtest_state, smry, ih.value);
|
||||
simCase.es.tracer(), rptStep, action_state, wtest_state, smry, ih.value);
|
||||
|
||||
// IWEL (PROD1)
|
||||
{
|
||||
@ -1278,7 +1278,7 @@ BOOST_AUTO_TEST_CASE(WELL_POD) {
|
||||
sim_step);
|
||||
|
||||
auto wellData = Opm::RestartIO::Helpers::AggregateWellData(ih);
|
||||
wellData.captureDeclaredWellData(simCase.sched, units, sim_step, action_state, wtest_state, sumState, ih);
|
||||
wellData.captureDeclaredWellData(simCase.sched, simCase.es.tracer(), sim_step, action_state, wtest_state, sumState, ih);
|
||||
wellData.captureDynamicWellData(simCase.sched, sim_step, xw , sumState);
|
||||
|
||||
auto connectionData = Opm::RestartIO::Helpers::AggregateConnectionData(ih);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/TracerConfig.hpp>
|
||||
|
||||
#include <opm/output/eclipse/AggregateWellData.hpp>
|
||||
#include <opm/output/eclipse/WriteRestartHelpers.hpp>
|
||||
@ -99,7 +100,7 @@ BOOST_AUTO_TEST_CASE(liftGasOptimzation_data)
|
||||
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, simStep, simStep+1, secs_elapsed, next_step_size);
|
||||
|
||||
auto wellData = Opm::RestartIO::Helpers::AggregateWellData(ih);
|
||||
wellData.captureDeclaredWellData(sched, es.getUnits(), simStep, action_state, {}, st, ih);
|
||||
wellData.captureDeclaredWellData(sched, Opm::TracerConfig{}, simStep, action_state, {}, st, ih);
|
||||
|
||||
// intehead data
|
||||
auto eachnc = Opm::RestartIO::Helpers::VectorItems::intehead::EACHNCITS;
|
||||
|
@ -297,7 +297,7 @@ BOOST_AUTO_TEST_CASE(State_test) {
|
||||
0, 0);
|
||||
|
||||
auto wellData = Opm::RestartIO::Helpers::AggregateWellData(ih);
|
||||
wellData.captureDeclaredWellData(simCase.sched, units, sim_step, action_state, wtest_state, sumState, ih);
|
||||
wellData.captureDeclaredWellData(simCase.sched, simCase.es.tracer(), sim_step, action_state, wtest_state, sumState, ih);
|
||||
wellData.captureDynamicWellData(simCase.sched, sim_step, {} , sumState);
|
||||
|
||||
auto connectionData = Opm::RestartIO::Helpers::AggregateConnectionData(ih);
|
||||
|
Loading…
Reference in New Issue
Block a user