Skip to content

Commit

Permalink
BlackoilWellModelGasLift: serialize last_glift_opt_time
Browse files Browse the repository at this point in the history
  • Loading branch information
akva2 committed Jan 24, 2025
1 parent da22efb commit b41f512
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
9 changes: 9 additions & 0 deletions opm/simulators/wells/BlackoilWellModelGasLift.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ class BlackoilWellModelGasLiftGeneric

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,
Expand Down
6 changes: 5 additions & 1 deletion opm/simulators/wells/BlackoilWellModelGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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,
Expand All @@ -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 &&
Expand Down Expand Up @@ -2106,7 +2109,8 @@ operator==(const BlackoilWellModelGeneric& rhs) const
&& 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->closed_offending_wells_ == rhs.closed_offending_wells_
&& this->gen_gaslift_ == rhs.gen_gaslift_;
}

template class BlackoilWellModelGeneric<double>;
Expand Down
3 changes: 3 additions & 0 deletions opm/simulators/wells/BlackoilWellModelGeneric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,6 +92,7 @@ class BlackoilWellModelGeneric
{
public:
BlackoilWellModelGeneric(Schedule& schedule,
BlackoilWellModelGasLiftGeneric<Scalar>& gaslift,
const SummaryState& summaryState,
const EclipseState& eclState,
const PhaseUsage& phase_usage,
Expand Down Expand Up @@ -458,6 +460,7 @@ class BlackoilWellModelGeneric
const SummaryState& summaryState_;
const EclipseState& eclState_;
const Parallel::Communication& comm_;
BlackoilWellModelGasLiftGeneric<Scalar>& gen_gaslift_;
BlackoilWellModelWBP<Scalar> wbp_;

PhaseUsage phase_usage_;
Expand Down
9 changes: 5 additions & 4 deletions opm/simulators/wells/BlackoilWellModel_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
{
Expand Down
18 changes: 15 additions & 3 deletions tests/test_RestartSerialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -366,6 +367,16 @@ class BlackoilWellModelGenericTest : public BlackoilWellModelGeneric<double>
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)
Expand All @@ -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();
Expand Down

0 comments on commit b41f512

Please sign in to comment.