SimulatorReportSingle: add serialization support

This commit is contained in:
Arne Morten Kvarving 2023-02-09 11:52:49 +01:00
parent 12b0e1c2de
commit f0ca3120ff
3 changed files with 66 additions and 0 deletions

View File

@ -29,6 +29,40 @@
namespace Opm
{
SimulatorReportSingle SimulatorReportSingle::serializationTestObject()
{
return SimulatorReportSingle{1.0, 2.0, 3.0, 4.0, 5.0, 6.0,
7.0, 8.0, 9.0, 10.0, 11.0,
12, 13, 14, 15, 16, 17,
true, false, 18, 19.0, 20.0};
}
bool SimulatorReportSingle::operator==(const SimulatorReportSingle& rhs) const
{
return this->pressure_time == rhs.pressure_time &&
this->transport_time == rhs.transport_time &&
this->total_time == rhs.total_time &&
this->solver_time == rhs.solver_time &&
this->assemble_time == rhs.assemble_time &&
this->pre_post_time == rhs.pre_post_time &&
this->assemble_time_well == rhs.assemble_time_well &&
this->linear_solve_setup_time == rhs.linear_solve_setup_time &&
this->linear_solve_time == rhs.linear_solve_time &&
this->update_time == rhs.update_time &&
this->output_write_time == rhs.output_write_time &&
this->total_well_iterations == rhs.total_well_iterations &&
this->total_linearizations == rhs.total_linearizations &&
this->total_newton_iterations == rhs.total_newton_iterations &&
this->total_linear_iterations == rhs.total_linear_iterations &&
this->min_linear_iterations == rhs.min_linear_iterations &&
this->max_linear_iterations == rhs.max_linear_iterations &&
this->converged == rhs.converged &&
this->well_group_control_changed == rhs.well_group_control_changed &&
this->exit_status == rhs.exit_status &&
this->global_time == rhs.global_time &&
this->timestep_length == rhs.timestep_length;
}
void SimulatorReportSingle::operator+=(const SimulatorReportSingle& sr)
{
pressure_time += sr.pressure_time;

View File

@ -58,12 +58,42 @@ namespace Opm
double global_time = 0.0;
double timestep_length = 0.0;
static SimulatorReportSingle serializationTestObject();
bool operator==(const SimulatorReportSingle&) const;
/// Increment this report's times by those in sr.
void operator+=(const SimulatorReportSingle& sr);
/// Print a report suitable for a single simulation step.
void reportStep(std::ostream& os) const;
/// Print a report suitable for the end of a fully implicit case, leaving out the pressure/transport time.
void reportFullyImplicit(std::ostream& os, const SimulatorReportSingle* failedReport = nullptr) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(pressure_time);
serializer(transport_time);
serializer(total_time);
serializer(solver_time);
serializer(assemble_time);
serializer(pre_post_time);
serializer(assemble_time_well);
serializer(linear_solve_setup_time);
serializer(linear_solve_time);
serializer(update_time);
serializer(output_write_time);
serializer(total_well_iterations);
serializer(total_linearizations);
serializer(total_newton_iterations);
serializer(total_linear_iterations);
serializer(min_linear_iterations);
serializer(max_linear_iterations);
serializer(converged);
serializer(well_group_control_changed);
serializer(exit_status);
serializer(global_time);
serializer(timestep_length);
}
};
struct SimulatorReport

View File

@ -33,6 +33,7 @@
#include <opm/models/blackoil/blackoilprimaryvariables.hh>
#include <opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/simulators/timestepping/SimulatorTimer.hpp>
#include <opm/simulators/timestepping/TimeStepControl.hpp>
#include <opm/simulators/utils/SerializationPackers.hpp>
@ -86,6 +87,7 @@ TEST_FOR_TYPE(PIDAndIterationCountTimeStepControl)
TEST_FOR_TYPE(PIDTimeStepControl)
TEST_FOR_TYPE(SegmentState)
TEST_FOR_TYPE(SimpleIterationCountTimeStepControl)
TEST_FOR_TYPE(SimulatorReportSingle)
TEST_FOR_TYPE(SimulatorTimer)
namespace Opm { using ATE = AdaptiveTimeSteppingEbos<Properties::TTag::EbosTypeTag>; }