mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #5915 from akva2/serialize_glift_last_opt
BlackoilWellModelGasLift: serialize last_glift_opt_time
This commit is contained in:
commit
6bfb60ded0
@ -198,9 +198,10 @@ void SimulatorSerializer::checkSerializedCmdLine(const std::string& current,
|
||||
[](const std::string& line)
|
||||
{
|
||||
return line.compare(0, 11, "EclDeckFile") != 0 &&
|
||||
line.compare(0, 8, "LoadStep") != 0 &&
|
||||
line.compare(0, 9, "OutputDir") != 0 &&
|
||||
line.compare(0, 8, "LoadFile") != 0 &&
|
||||
line.compare(0, 8, "SaveFile") != 0 &&
|
||||
line.compare(0, 8, "LoadStep") != 0 &&
|
||||
line.compare(0, 8, "SaveStep") != 0;
|
||||
});
|
||||
return output;
|
||||
|
@ -57,6 +57,15 @@ public:
|
||||
|
||||
bool terminalOutput() const { return terminal_output_; }
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(last_glift_opt_time_);
|
||||
}
|
||||
|
||||
bool operator==(const BlackoilWellModelGasLiftGeneric& that) const
|
||||
{ return this->last_glift_opt_time_ == that.last_glift_opt_time_; }
|
||||
|
||||
protected:
|
||||
void gliftDebugShowALQ(const std::vector<WellInterfaceGeneric<Scalar>*>& well_container,
|
||||
const WellState<Scalar>& wellState,
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
#include <opm/simulators/utils/DeferredLogger.hpp>
|
||||
#include <opm/simulators/wells/BlackoilWellModelConstraints.hpp>
|
||||
#include <opm/simulators/wells/BlackoilWellModelGasLift.hpp>
|
||||
#include <opm/simulators/wells/BlackoilWellModelGuideRates.hpp>
|
||||
#include <opm/simulators/wells/BlackoilWellModelRestart.hpp>
|
||||
#include <opm/simulators/wells/GasLiftStage2.hpp>
|
||||
@ -87,6 +88,7 @@ namespace Opm {
|
||||
template<class Scalar>
|
||||
BlackoilWellModelGeneric<Scalar>::
|
||||
BlackoilWellModelGeneric(Schedule& schedule,
|
||||
BlackoilWellModelGasLiftGeneric<Scalar>& gaslift,
|
||||
const SummaryState& summaryState,
|
||||
const EclipseState& eclState,
|
||||
const PhaseUsage& phase_usage,
|
||||
@ -95,6 +97,7 @@ BlackoilWellModelGeneric(Schedule& schedule,
|
||||
, summaryState_(summaryState)
|
||||
, eclState_(eclState)
|
||||
, comm_(comm)
|
||||
, gen_gaslift_(gaslift)
|
||||
, wbp_(*this)
|
||||
, phase_usage_(phase_usage)
|
||||
, terminal_output_(comm_.rank() == 0 &&
|
||||
@ -2090,6 +2093,26 @@ reportGroupSwitching(DeferredLogger& local_deferredLogger) const
|
||||
}
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
bool BlackoilWellModelGeneric<Scalar>::
|
||||
operator==(const BlackoilWellModelGeneric& rhs) const
|
||||
{
|
||||
return this->initial_step_ == rhs.initial_step_
|
||||
&& this->report_step_starts_ == rhs.report_step_starts_
|
||||
&& this->last_run_wellpi_ == rhs.last_run_wellpi_
|
||||
&& this->local_shut_wells_ == rhs.local_shut_wells_
|
||||
&& this->closed_this_step_ == rhs.closed_this_step_
|
||||
&& this->node_pressures_ == rhs.node_pressures_
|
||||
&& this->prev_inj_multipliers_ == rhs.prev_inj_multipliers_
|
||||
&& this->active_wgstate_ == rhs.active_wgstate_
|
||||
&& this->last_valid_wgstate_ == rhs.last_valid_wgstate_
|
||||
&& this->nupcol_wgstate_ == rhs.nupcol_wgstate_
|
||||
&& this->switched_prod_groups_ == rhs.switched_prod_groups_
|
||||
&& this->switched_inj_groups_ == rhs.switched_inj_groups_
|
||||
&& this->closed_offending_wells_ == rhs.closed_offending_wells_
|
||||
&& this->gen_gaslift_ == rhs.gen_gaslift_;
|
||||
}
|
||||
|
||||
template class BlackoilWellModelGeneric<double>;
|
||||
|
||||
#if FLOW_INSTANTIATE_FLOAT
|
||||
|
@ -55,6 +55,7 @@
|
||||
namespace Opm {
|
||||
class DeferredLogger;
|
||||
class EclipseState;
|
||||
template<class Scalar> class BlackoilWellModelGasLiftGeneric;
|
||||
template<class Scalar> class GasLiftGroupInfo;
|
||||
template<class Scalar> class GasLiftSingleWellGeneric;
|
||||
template<class Scalar> class GasLiftWellState;
|
||||
@ -91,6 +92,7 @@ class BlackoilWellModelGeneric
|
||||
{
|
||||
public:
|
||||
BlackoilWellModelGeneric(Schedule& schedule,
|
||||
BlackoilWellModelGasLiftGeneric<Scalar>& gaslift,
|
||||
const SummaryState& summaryState,
|
||||
const EclipseState& eclState,
|
||||
const PhaseUsage& phase_usage,
|
||||
@ -256,24 +258,10 @@ public:
|
||||
serializer(switched_prod_groups_);
|
||||
serializer(switched_inj_groups_);
|
||||
serializer(closed_offending_wells_);
|
||||
serializer(gen_gaslift_);
|
||||
}
|
||||
|
||||
bool operator==(const BlackoilWellModelGeneric& rhs) const
|
||||
{
|
||||
return this->initial_step_ == rhs.initial_step_ &&
|
||||
this->report_step_starts_ == rhs.report_step_starts_ &&
|
||||
this->last_run_wellpi_ == rhs.last_run_wellpi_ &&
|
||||
this->local_shut_wells_ == rhs.local_shut_wells_ &&
|
||||
this->closed_this_step_ == rhs.closed_this_step_ &&
|
||||
this->node_pressures_ == rhs.node_pressures_ &&
|
||||
this->prev_inj_multipliers_ == rhs.prev_inj_multipliers_ &&
|
||||
this->active_wgstate_ == rhs.active_wgstate_ &&
|
||||
this->last_valid_wgstate_ == rhs.last_valid_wgstate_ &&
|
||||
this->nupcol_wgstate_ == rhs.nupcol_wgstate_ &&
|
||||
this->switched_prod_groups_ == rhs.switched_prod_groups_ &&
|
||||
this->switched_inj_groups_ == rhs.switched_inj_groups_ &&
|
||||
this->closed_offending_wells_ == rhs.closed_offending_wells_;
|
||||
}
|
||||
bool operator==(const BlackoilWellModelGeneric& rhs) const;
|
||||
|
||||
const ParallelWellInfo<Scalar>&
|
||||
parallelWellInfo(const std::size_t idx) const
|
||||
@ -472,6 +460,7 @@ protected:
|
||||
const SummaryState& summaryState_;
|
||||
const EclipseState& eclState_;
|
||||
const Parallel::Communication& comm_;
|
||||
BlackoilWellModelGasLiftGeneric<Scalar>& gen_gaslift_;
|
||||
BlackoilWellModelWBP<Scalar> wbp_;
|
||||
|
||||
PhaseUsage phase_usage_;
|
||||
|
@ -71,10 +71,11 @@ namespace Opm {
|
||||
BlackoilWellModel(Simulator& simulator, const PhaseUsage& phase_usage)
|
||||
: WellConnectionModule(*this, simulator.gridView().comm())
|
||||
, BlackoilWellModelGeneric<Scalar>(simulator.vanguard().schedule(),
|
||||
simulator.vanguard().summaryState(),
|
||||
simulator.vanguard().eclState(),
|
||||
phase_usage,
|
||||
simulator.gridView().comm())
|
||||
gaslift_,
|
||||
simulator.vanguard().summaryState(),
|
||||
simulator.vanguard().eclState(),
|
||||
phase_usage,
|
||||
simulator.gridView().comm())
|
||||
, simulator_(simulator)
|
||||
, gaslift_(this->terminal_output_, this->phase_usage_)
|
||||
{
|
||||
|
@ -297,12 +297,13 @@ class BlackoilWellModelGenericTest : public BlackoilWellModelGeneric<double>
|
||||
{
|
||||
public:
|
||||
BlackoilWellModelGenericTest(Schedule& schedule,
|
||||
BlackoilWellModelGasLiftGeneric<double>& gaslift,
|
||||
const SummaryState& summaryState,
|
||||
const EclipseState& eclState,
|
||||
const PhaseUsage& phase_usage,
|
||||
const Parallel::Communication& comm,
|
||||
bool deserialize)
|
||||
: BlackoilWellModelGeneric<double>(schedule, summaryState,
|
||||
: BlackoilWellModelGeneric<double>(schedule, gaslift, summaryState,
|
||||
eclState, phase_usage, comm)
|
||||
{
|
||||
if (deserialize) {
|
||||
@ -366,6 +367,16 @@ private:
|
||||
ParallelWellInfo<double> dummy;
|
||||
};
|
||||
|
||||
class BlackoilWellModelGasLiftGenericTest : public BlackoilWellModelGasLiftGeneric<double>
|
||||
{
|
||||
public:
|
||||
BlackoilWellModelGasLiftGenericTest()
|
||||
: BlackoilWellModelGasLiftGeneric<double>(false)
|
||||
{
|
||||
this->last_glift_opt_time_ = 1234.5;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(BlackoilWellModelGeneric)
|
||||
@ -375,14 +386,15 @@ BOOST_AUTO_TEST_CASE(BlackoilWellModelGeneric)
|
||||
Opm::EclipseState eclState{};
|
||||
Opm::PhaseUsage phase_usage{};
|
||||
Opm::Parallel::Communication comm{};
|
||||
Opm::BlackoilWellModelGenericTest data_out(schedule, summaryState,
|
||||
Opm::BlackoilWellModelGasLiftGenericTest gaslift;
|
||||
Opm::BlackoilWellModelGenericTest data_out(schedule, gaslift, summaryState,
|
||||
eclState, phase_usage, comm, false);
|
||||
data_out.setSerializationTestData();
|
||||
Opm::Serialization::MemPacker packer;
|
||||
Opm::Serializer ser(packer);
|
||||
ser.pack(data_out);
|
||||
const size_t pos1 = ser.position();
|
||||
Opm::BlackoilWellModelGenericTest data_in(schedule, summaryState,
|
||||
Opm::BlackoilWellModelGenericTest data_in(schedule, gaslift, summaryState,
|
||||
eclState, phase_usage, comm, true);
|
||||
ser.unpack(data_in);
|
||||
const size_t pos2 = ser.position();
|
||||
|
Loading…
Reference in New Issue
Block a user