Replace Writer for Summary/SMSPEC Files

This commit replaces the existing system for writing summary and
specification (SMSPEC) files with a new implementation based on
class EclOutput.  We package the evaluators of individual parameters
in a set of classes determined by the parameter's category which
each implement a virtual 'update()' function.  This update function
ultimately writes new values into a SummaryState object.

Add a factory-like system for instantiating the appropriate class
depending on a SummaryNode's 'category()'.  Also, add a helper class
for managing the parameters that a configured in a simulation
model's SUMMARY section in order to distinguish these from those
parameters that are merely needed for restart purposes.  The summary
class's 'eval()' function then becomes a loop over the evaluators
for parameters in SUMMARY followed by a loop over the evaluators for
restart vectors.

We reimplement the 'internal_store()' function in terms of an
std::vector of a helper structure 'MiniStep' which holds a ministep
ID (contiguous counter started at zero), a report step ID, and all
the evaluated parameters of this ministep.  The final write function
then consists of outputting those ministep structures that have
accumulated since the previous call to write().  If a simulation
does not call write at all, then this will accumulate all parameters
for all ministeps throughout the simulation history.

We create the SMSPEC file at most once, and write to it at most each
report step.  We create the summary file once (if unified) or at
each report step (if separate).
This commit is contained in:
Bård Skaflestad
2019-10-09 00:25:45 -05:00
parent 7d11a59197
commit 2eb3a06024
2 changed files with 1273 additions and 516 deletions

View File

@@ -21,66 +21,58 @@
#define OPM_OUTPUT_SUMMARY_HPP
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <ert/ecl/ecl_sum.h>
#include <ert/util/ert_unique_ptr.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/RegionCache.hpp>
namespace Opm {
class EclipseGrid;
class EclipseState;
class Schedule;
class SummaryConfig;
class EclipseGrid;
class Schedule;
class SummaryState;
} // namespace Opm
namespace out {
namespace Opm { namespace data {
class WellRates;
}} // namespace Opm::data
namespace Opm { namespace out {
class Summary {
public:
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule& );
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const std::string& );
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const char* basename );
void add_timestep(const SummaryState& st,
int report_step);
void eval(SummaryState& summary_state,
int report_step,
double secs_elapsed,
const EclipseState& es,
const Schedule& schedule,
const data::Wells&,
const std::map<std::string, double>& single_values,
const std::map<std::string, std::vector<double>>& region_values = {},
const std::map<std::pair<std::string, int>, double>& block_values = {}) const;
using GlobalProcessParameters = std::map<std::string, double>;
using RegionParameters = std::map<std::string, std::vector<double>>;
using BlockValues = std::map<std::pair<std::string, int>, double>;
Summary(const EclipseState& es,
const SummaryConfig& sumcfg,
const EclipseGrid& grid,
const Schedule& sched,
const std::string& basename = "");
~Summary();
void add_timestep(const SummaryState& st, const int report_step);
void eval(SummaryState& summary_state,
const int report_step,
const double secs_elapsed,
const EclipseState& es,
const Schedule& schedule,
const data::WellRates& well_solution,
const GlobalProcessParameters& single_values,
const RegionParameters& region_values = {},
const BlockValues& block_values = {}) const;
void write() const;
private:
void internal_store(const SummaryState& summary_state, int report_step);
class keyword_handlers;
const EclipseGrid& grid;
out::RegionCache regionCache;
ERT::ert_unique_ptr< ecl_sum_type, ecl_sum_free > ecl_sum;
std::unique_ptr< keyword_handlers > handlers;
class SummaryImplementation;
std::unique_ptr<SummaryImplementation> pImpl_;
};
}
}
}} // namespace Opm::out
#endif //OPM_OUTPUT_SUMMARY_HPP

File diff suppressed because it is too large Load Diff