From e57d1697c2d8624e0a6f955e72b7f06bf0585156 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Thu, 21 Nov 2013 15:54:22 +0100 Subject: [PATCH] Get dimensions for Cartesian grids For SPE1, the output writer must also support specifying the grid via the D[XYZ]V keywords instead of relying on the SPECGRID keyword --- opm/core/io/eclipse/EclipseWriter.cpp | 33 +++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/opm/core/io/eclipse/EclipseWriter.cpp b/opm/core/io/eclipse/EclipseWriter.cpp index 5c2793ba..3be4a56d 100644 --- a/opm/core/io/eclipse/EclipseWriter.cpp +++ b/opm/core/io/eclipse/EclipseWriter.cpp @@ -290,7 +290,21 @@ struct EclipseRestart : public EclipseHandle { const PhaseUsage uses, const EclipseGridParser parser, const int num_active_cells) { - const std::vector dim = parser.getSPECGRID ().dimensions; + std::vector dim(/*n=*/3); + if (parser.hasField("SPECGRID")) + dim = parser.getSPECGRID ().dimensions; + else if (parser.hasField("DXV")) { + assert(parser.hasField("DYV")); + assert(parser.hasField("DZV")); + dim[0] = parser.getFloatingPointValue("DXV").size(); + dim[1] = parser.getFloatingPointValue("DYV").size(); + dim[2] = parser.getFloatingPointValue("DZV").size(); + } + else + OPM_THROW(std::runtime_error, + "Only decks featureing either the SPECGRID or the D[XYZ]V keywords " + "are currently supported"); + ecl_rst_file_fwrite_header (*this, stepNum (timer), current (timer), @@ -595,7 +609,22 @@ private: const EclipseGridParser& parser) { boost::filesystem::path casePath (outputDir); casePath /= boost::to_upper_copy (baseName); - const std::vector& dim = parser.getSPECGRID().dimensions; + + std::vector dim(/*n=*/3); + if (parser.hasField("SPECGRID")) + dim = parser.getSPECGRID ().dimensions; + else if (parser.hasField("DXV")) { + assert(parser.hasField("DYV")); + assert(parser.hasField("DZV")); + dim[0] = parser.getFloatingPointValue("DXV").size(); + dim[1] = parser.getFloatingPointValue("DYV").size(); + dim[2] = parser.getFloatingPointValue("DZV").size(); + } + else + OPM_THROW(std::runtime_error, + "Only decks featureing either the SPECGRID or the D[XYZ]V keywords " + "are currently supported"); + return ecl_sum_alloc_writer (casePath.string ().c_str (), false, /* formatted */ true, /* unified */