2012-06-14 07:13:03 -05:00
|
|
|
/*
|
|
|
|
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
|
|
|
|
|
|
|
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
|
2020-05-06 14:41:03 -05:00
|
|
|
#include <cassert>
|
2012-06-14 07:13:03 -05:00
|
|
|
#include <iosfwd>
|
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-06 14:41:03 -05:00
|
|
|
struct SimulatorReportBase
|
2012-06-14 07:13:03 -05:00
|
|
|
{
|
|
|
|
double pressure_time;
|
|
|
|
double transport_time;
|
|
|
|
double total_time;
|
2016-11-23 14:30:01 -06:00
|
|
|
double solver_time;
|
|
|
|
double assemble_time;
|
2019-04-04 05:20:30 -05:00
|
|
|
double linear_solve_setup_time;
|
2016-11-23 14:30:01 -06:00
|
|
|
double linear_solve_time;
|
|
|
|
double update_time;
|
|
|
|
double output_write_time;
|
2012-06-14 07:13:03 -05:00
|
|
|
|
2016-11-23 14:30:01 -06:00
|
|
|
unsigned int total_well_iterations;
|
2016-07-13 05:15:07 -05:00
|
|
|
unsigned int total_linearizations;
|
2015-03-04 07:01:13 -06:00
|
|
|
unsigned int total_newton_iterations;
|
|
|
|
unsigned int total_linear_iterations;
|
|
|
|
|
2016-11-23 14:30:01 -06:00
|
|
|
bool converged;
|
2020-04-15 08:21:17 -05:00
|
|
|
int exit_status;
|
2016-11-23 14:30:01 -06:00
|
|
|
|
2020-05-06 14:41:03 -05:00
|
|
|
double global_time;
|
2012-06-14 07:13:03 -05:00
|
|
|
/// Default constructor initializing all times to 0.0.
|
2020-05-06 14:41:03 -05:00
|
|
|
explicit SimulatorReportBase(bool verbose=true);
|
2016-11-23 14:30:01 -06:00
|
|
|
/// Copy constructor
|
2020-05-06 14:41:03 -05:00
|
|
|
SimulatorReportBase(const SimulatorReportBase&) = default;
|
2012-06-14 07:13:03 -05:00
|
|
|
/// Increment this report's times by those in sr.
|
2020-05-06 14:41:03 -05:00
|
|
|
void operator+=(const SimulatorReportBase& sr);
|
2012-06-14 07:13:03 -05:00
|
|
|
/// Print a report to the given stream.
|
|
|
|
void report(std::ostream& os);
|
2018-03-12 08:48:34 -05:00
|
|
|
void reportStep(std::ostringstream& os);
|
2015-04-21 03:33:10 -05:00
|
|
|
/// Print a report, leaving out the transport time.
|
2020-05-06 14:41:03 -05:00
|
|
|
void reportFullyImplicit(std::ostream& os, const SimulatorReportBase* failedReport = nullptr);
|
2012-08-21 02:57:36 -05:00
|
|
|
void reportParam(std::ostream& os);
|
2015-05-08 04:07:40 -05:00
|
|
|
private:
|
|
|
|
// Whether to print statistics to std::cout
|
|
|
|
bool verbose_;
|
2012-06-14 07:13:03 -05:00
|
|
|
};
|
2020-05-06 14:41:03 -05:00
|
|
|
struct SimulatorReport: public SimulatorReportBase{
|
|
|
|
std::vector<SimulatorReportBase> stepreports;
|
|
|
|
explicit SimulatorReport(bool verbose=true) :
|
|
|
|
SimulatorReportBase(verbose),
|
|
|
|
stepreports()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void operator+=(const SimulatorReportBase& sr){
|
|
|
|
SimulatorReportBase::operator+=(sr);
|
|
|
|
// if(stepreports.size()>0){
|
|
|
|
// assert(stepreports.back().global_time != sr.global_time);
|
|
|
|
// }
|
|
|
|
stepreports.push_back(sr);
|
|
|
|
}
|
|
|
|
void operator+=(const SimulatorReport& sr){
|
|
|
|
SimulatorReportBase::operator+=(sr);
|
|
|
|
// if(stepreports.size()>0){
|
|
|
|
// assert(stepreports.back().global_time != sr.global_time);
|
|
|
|
// }
|
|
|
|
if(sr.stepreports.size()>0){
|
|
|
|
stepreports.insert(stepreports.end(),sr.stepreports.begin(),sr.stepreports.end());
|
|
|
|
}else{
|
|
|
|
stepreports.push_back(sr);
|
|
|
|
}
|
|
|
|
//stepreports.push_back(sr);
|
|
|
|
}
|
|
|
|
void fullReports(std::ostream& os);
|
|
|
|
};
|
|
|
|
|
2012-06-14 07:13:03 -05:00
|
|
|
} // namespace Opm
|
|
|
|
|
|
|
|
#endif // OPM_SIMULATORREPORT_HEADER_INCLUDED
|