Merge pull request #1082 from bska/new-summary-writer
New summary writer
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -593,6 +593,7 @@ namespace {
|
||||
auto ret = std::vector<PaddedOutputString<substrLength>>{};
|
||||
|
||||
if (restart.root.empty()) {
|
||||
ret.resize(maxSubstrings);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -605,6 +606,7 @@ namespace {
|
||||
|
||||
Opm::OpmLog::warning(msg);
|
||||
|
||||
ret.resize(maxSubstrings);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -738,7 +740,7 @@ SummarySpecification::write(const Parameters& params)
|
||||
// Pretend to be ECLIPSE 100
|
||||
smspec.write("INTEHEAD", std::vector<int>{ this->unit_, 100 });
|
||||
|
||||
if (! this->restart_.empty())
|
||||
// if (! this->restart_.empty())
|
||||
smspec.write("RESTART", this->restart_);
|
||||
|
||||
smspec.write("DIMENS",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1863,12 +1863,13 @@ BOOST_AUTO_TEST_CASE(Unformatted_Base)
|
||||
|
||||
auto smspec = ::Opm::EclIO::EclFile{fname};
|
||||
|
||||
BOOST_CHECK_MESSAGE(! smspec.hasKey("RESTART"), "SMSPEC File must NOT have 'RESTART'");
|
||||
//BOOST_CHECK_MESSAGE(! smspec.hasKey("RESTART"), "SMSPEC File must NOT have 'RESTART'");
|
||||
|
||||
{
|
||||
const auto vectors = smspec.getList();
|
||||
const auto expect_vectors = std::vector<Opm::EclIO::EclFile::EclEntry>{
|
||||
Opm::EclIO::EclFile::EclEntry{"INTEHEAD", Opm::EclIO::eclArrType::INTE, 2},
|
||||
Opm::EclIO::EclFile::EclEntry{"RESTART", Opm::EclIO::eclArrType::CHAR, 9},
|
||||
Opm::EclIO::EclFile::EclEntry{"DIMENS", Opm::EclIO::eclArrType::INTE, 6},
|
||||
Opm::EclIO::EclFile::EclEntry{"KEYWORDS", Opm::EclIO::eclArrType::CHAR, 4},
|
||||
Opm::EclIO::EclFile::EclEntry{"WGNAMES", Opm::EclIO::eclArrType::CHAR, 4},
|
||||
@@ -1974,6 +1975,7 @@ BOOST_AUTO_TEST_CASE(Unformatted_Base)
|
||||
const auto vectors = smspec.getList();
|
||||
const auto expect_vectors = std::vector<Opm::EclIO::EclFile::EclEntry>{
|
||||
Opm::EclIO::EclFile::EclEntry{"INTEHEAD", Opm::EclIO::eclArrType::INTE, 2},
|
||||
Opm::EclIO::EclFile::EclEntry{"RESTART", Opm::EclIO::eclArrType::CHAR, 9},
|
||||
Opm::EclIO::EclFile::EclEntry{"DIMENS", Opm::EclIO::eclArrType::INTE, 6},
|
||||
Opm::EclIO::EclFile::EclEntry{"KEYWORDS", Opm::EclIO::eclArrType::CHAR, 4},
|
||||
Opm::EclIO::EclFile::EclEntry{"WGNAMES", Opm::EclIO::eclArrType::CHAR, 4},
|
||||
@@ -2079,6 +2081,7 @@ BOOST_AUTO_TEST_CASE(Unformatted_Base)
|
||||
const auto vectors = smspec.getList();
|
||||
const auto expect_vectors = std::vector<Opm::EclIO::EclFile::EclEntry>{
|
||||
Opm::EclIO::EclFile::EclEntry{"INTEHEAD", Opm::EclIO::eclArrType::INTE, 2},
|
||||
Opm::EclIO::EclFile::EclEntry{"RESTART", Opm::EclIO::eclArrType::CHAR, 9},
|
||||
Opm::EclIO::EclFile::EclEntry{"DIMENS", Opm::EclIO::eclArrType::INTE, 6},
|
||||
Opm::EclIO::EclFile::EclEntry{"KEYWORDS", Opm::EclIO::eclArrType::CHAR, 4},
|
||||
Opm::EclIO::EclFile::EclEntry{"WGNAMES", Opm::EclIO::eclArrType::CHAR, 4},
|
||||
@@ -2184,6 +2187,7 @@ BOOST_AUTO_TEST_CASE(Unformatted_Base)
|
||||
const auto vectors = smspec.getList();
|
||||
const auto expect_vectors = std::vector<Opm::EclIO::EclFile::EclEntry>{
|
||||
Opm::EclIO::EclFile::EclEntry{"INTEHEAD", Opm::EclIO::eclArrType::INTE, 2},
|
||||
Opm::EclIO::EclFile::EclEntry{"RESTART", Opm::EclIO::eclArrType::CHAR, 9},
|
||||
Opm::EclIO::EclFile::EclEntry{"DIMENS", Opm::EclIO::eclArrType::INTE, 6},
|
||||
Opm::EclIO::EclFile::EclEntry{"KEYWORDS", Opm::EclIO::eclArrType::CHAR, 4},
|
||||
Opm::EclIO::EclFile::EclEntry{"WGNAMES", Opm::EclIO::eclArrType::CHAR, 4},
|
||||
@@ -2296,9 +2300,11 @@ BOOST_AUTO_TEST_CASE(Formatted_Restarted)
|
||||
|
||||
auto smspec = ::Opm::EclIO::EclFile{fname};
|
||||
|
||||
#if 0
|
||||
BOOST_CHECK_MESSAGE(! smspec.hasKey("RESTART"),
|
||||
"SMSPEC file must NOT have RESTART "
|
||||
"data if root name is too long");
|
||||
#endif
|
||||
}
|
||||
|
||||
// ========================= METRIC =======================
|
||||
|
||||
Reference in New Issue
Block a user