2012-06-14 07:13:03 -05:00
|
|
|
/*
|
2020-05-07 09:13:39 -05:00
|
|
|
Copyright 2012, 2020 SINTEF Digital, Mathematics and Cybernetics.
|
2012-06-14 07:13:03 -05:00
|
|
|
|
|
|
|
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_SIMULATORREPORT_HEADER_INCLUDED
|
|
|
|
#define OPM_SIMULATORREPORT_HEADER_INCLUDED
|
2023-02-09 04:28:46 -06:00
|
|
|
|
2020-05-06 14:41:03 -05:00
|
|
|
#include <cassert>
|
2023-02-09 04:28:46 -06:00
|
|
|
#include <cstdlib>
|
2012-06-14 07:13:03 -05:00
|
|
|
#include <iosfwd>
|
2023-02-09 04:28:46 -06:00
|
|
|
#include <limits>
|
2020-05-06 14:41:03 -05:00
|
|
|
#include <vector>
|
2012-06-14 07:13:03 -05:00
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
|
|
|
|
/// A struct for returning timing data from a simulator to its caller.
|
2020-05-07 09:13:39 -05:00
|
|
|
struct SimulatorReportSingle
|
2012-06-14 07:13:03 -05:00
|
|
|
{
|
2023-02-09 04:28:46 -06:00
|
|
|
double pressure_time = 0.0;
|
|
|
|
double transport_time = 0.0;
|
|
|
|
double total_time = 0.0;
|
|
|
|
double solver_time = 0.0;
|
|
|
|
double assemble_time = 0.0;
|
|
|
|
double pre_post_time = 0.0;
|
|
|
|
double assemble_time_well = 0.0;
|
|
|
|
double linear_solve_setup_time = 0.0;
|
|
|
|
double linear_solve_time = 0.0;
|
|
|
|
double update_time = 0.0;
|
|
|
|
double output_write_time = 0.0;
|
|
|
|
|
|
|
|
unsigned int total_well_iterations = 0;
|
|
|
|
unsigned int total_linearizations = 0;
|
|
|
|
unsigned int total_newton_iterations = 0;
|
|
|
|
unsigned int total_linear_iterations = 0;
|
|
|
|
unsigned int min_linear_iterations = std::numeric_limits<unsigned int>::max();
|
|
|
|
unsigned int max_linear_iterations = 0;
|
|
|
|
|
|
|
|
bool converged = false;
|
|
|
|
bool well_group_control_changed = false;
|
|
|
|
int exit_status = EXIT_SUCCESS;
|
|
|
|
|
|
|
|
double global_time = 0.0;
|
|
|
|
double timestep_length = 0.0;
|
|
|
|
|
2023-02-09 04:52:49 -06:00
|
|
|
static SimulatorReportSingle serializationTestObject();
|
|
|
|
|
|
|
|
bool operator==(const SimulatorReportSingle&) const;
|
2012-06-14 07:13:03 -05:00
|
|
|
/// Increment this report's times by those in sr.
|
2020-05-07 09:13:39 -05:00
|
|
|
void operator+=(const SimulatorReportSingle& sr);
|
|
|
|
/// Print a report suitable for a single simulation step.
|
2023-02-09 04:32:39 -06:00
|
|
|
void reportStep(std::ostream& os) const;
|
2020-05-07 09:13:39 -05:00
|
|
|
/// 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;
|
2023-02-09 04:52:49 -06:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2012-06-14 07:13:03 -05:00
|
|
|
};
|
2020-05-07 08:04:20 -05:00
|
|
|
|
2020-05-07 09:13:39 -05:00
|
|
|
struct SimulatorReport
|
|
|
|
{
|
|
|
|
SimulatorReportSingle success;
|
|
|
|
SimulatorReportSingle failure;
|
|
|
|
std::vector<SimulatorReportSingle> stepreports;
|
|
|
|
|
2023-02-09 04:52:49 -06:00
|
|
|
static SimulatorReport serializationTestObject();
|
|
|
|
|
|
|
|
bool operator==(const SimulatorReport&) const;
|
2020-05-07 14:00:39 -05:00
|
|
|
void operator+=(const SimulatorReportSingle& sr);
|
|
|
|
void operator+=(const SimulatorReport& sr);
|
|
|
|
void reportFullyImplicit(std::ostream& os) const;
|
2020-05-07 09:13:39 -05:00
|
|
|
void fullReports(std::ostream& os) const;
|
2023-02-09 04:52:49 -06:00
|
|
|
|
|
|
|
template<class Serializer>
|
|
|
|
void serializeOp(Serializer& serializer)
|
|
|
|
{
|
|
|
|
serializer(success);
|
|
|
|
serializer(failure);
|
|
|
|
serializer(stepreports);
|
|
|
|
}
|
2020-05-06 14:41:03 -05:00
|
|
|
};
|
2020-05-07 08:04:20 -05:00
|
|
|
|
|
|
|
} // namespace Opm
|
2012-06-14 07:13:03 -05:00
|
|
|
|
|
|
|
#endif // OPM_SIMULATORREPORT_HEADER_INCLUDED
|