opm-simulators
Loading...
Searching...
No Matches
SimulatorReport.hpp
1/*
2 Copyright 2012, 2020 SINTEF Digital, Mathematics and Cybernetics.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_SIMULATORREPORT_HEADER_INCLUDED
21#define OPM_SIMULATORREPORT_HEADER_INCLUDED
22
23#include <cassert>
24#include <cstdlib>
25#include <iosfwd>
26#include <limits>
27#include <vector>
28
29namespace Opm
30{
31
34 {
35 double pressure_time = 0.0;
36 double transport_time = 0.0;
37 double total_time = 0.0;
38 double solver_time = 0.0;
39 double assemble_time = 0.0;
40 double pre_post_time = 0.0;
41 double assemble_time_well = 0.0;
42 double linear_solve_setup_time = 0.0;
43 double linear_solve_time = 0.0;
44 double local_solve_time = 0.0;
45 double update_time = 0.0;
46 double output_write_time = 0.0;
47
48 unsigned int total_well_iterations = 0;
49 unsigned int total_linearizations = 0;
50 unsigned int total_newton_iterations = 0;
51 unsigned int total_linear_iterations = 0;
52 unsigned int min_linear_iterations = std::numeric_limits<unsigned int>::max();
53 unsigned int max_linear_iterations = 0;
54
55 bool converged = false;
56 bool time_step_rejected = false;
57 bool well_group_control_changed = false;
58 int exit_status = EXIT_SUCCESS;
59
60 double global_time = 0.0;
61 double timestep_length = 0.0;
62
63 // NLDD specific data
64 int num_domains = 0;
65 int num_wells = 0;
66 int num_overlap_cells = 0;
67 int num_owned_cells = 0;
68 int converged_domains = 0;
69 int unconverged_domains = 0;
70 int accepted_unconverged_domains = 0;
71 int skipped_domains = 0;
72
73 static SimulatorReportSingle serializationTestObject();
74
75 bool operator==(const SimulatorReportSingle&) const;
77 void operator+=(const SimulatorReportSingle& sr);
79 void reportStep(std::ostream& os) const;
81 void reportFullyImplicit(std::ostream& os, const SimulatorReportSingle* failedReport = nullptr) const;
82 void reportNLDD(std::ostream& os, const SimulatorReportSingle* failedReport = nullptr) const;
83 template<class Serializer>
84 void serializeOp(Serializer& serializer)
85 {
86 serializer(pressure_time);
87 serializer(transport_time);
88 serializer(total_time);
89 serializer(solver_time);
90 serializer(assemble_time);
91 serializer(pre_post_time);
92 serializer(assemble_time_well);
93 serializer(linear_solve_setup_time);
94 serializer(linear_solve_time);
95 serializer(local_solve_time);
96 serializer(update_time);
97 serializer(output_write_time);
98 serializer(total_well_iterations);
99 serializer(total_linearizations);
100 serializer(total_newton_iterations);
101 serializer(total_linear_iterations);
102 serializer(min_linear_iterations);
103 serializer(max_linear_iterations);
104 serializer(converged);
105 serializer(time_step_rejected);
106 serializer(well_group_control_changed);
107 serializer(exit_status);
108 serializer(global_time);
109 serializer(timestep_length);
110 serializer(num_domains);
111 serializer(num_wells);
112 serializer(num_overlap_cells);
113 serializer(num_owned_cells);
114 serializer(converged_domains);
115 serializer(unconverged_domains);
116 serializer(accepted_unconverged_domains);
117 serializer(skipped_domains);
118 }
119 };
120
122 {
123 SimulatorReportSingle success;
124 SimulatorReportSingle failure;
125 std::vector<SimulatorReportSingle> stepreports;
126
127 static SimulatorReport serializationTestObject();
128
129 bool operator==(const SimulatorReport&) const;
130 void operator+=(const SimulatorReportSingle& sr);
131 void operator+=(const SimulatorReport& sr);
132 void reportFullyImplicit(std::ostream& os) const;
133 void reportNLDD(std::ostream& os) const;
134 void fullReports(std::ostream& os) const;
135
136 template<class Serializer>
137 void serializeOp(Serializer& serializer)
138 {
139 serializer(success);
140 serializer(failure);
141 serializer(stepreports);
142 }
143 };
144
145 } // namespace Opm
146
147#endif // OPM_SIMULATORREPORT_HEADER_INCLUDED
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:45
A struct for returning timing data from a simulator to its caller.
Definition SimulatorReport.hpp:34
void reportFullyImplicit(std::ostream &os, const SimulatorReportSingle *failedReport=nullptr) const
Print a report suitable for the end of a fully implicit case, leaving out the pressure/transport time...
Definition SimulatorReport.cpp:133
void reportStep(std::ostream &os) const
Print a report suitable for a single simulation step.
Definition SimulatorReport.cpp:112
void operator+=(const SimulatorReportSingle &sr)
Increment this report's times by those in sr.
Definition SimulatorReport.cpp:78
Definition SimulatorReport.hpp:122