From 776ab451defa54ea6f519e19dfb9a27d99030d1a Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Thu, 14 Jul 2016 09:31:24 +0800 Subject: [PATCH 01/11] handle partially supported options manually. --- opm/autodiff/MissingFeatures.cpp | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index e1bd7cd6c..05a69120c 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -66,6 +66,61 @@ namespace MissingFeatures { + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; OpmLog::error(msg); } + + // check for partially supported options. + if (keyword.name() == "COMPORD") { + for (unsigned recordIdx = 0; recordIdx < keyword.size(); ++recordIdx) { + const auto& record = keyword.getRecord(recordIdx); + if (record.getItem("ORDER_TYPE").getTrimmedString(0) != "TRACK") { + std::string msg = std::string("For keyword 'COMPORD' only 'TRACK' in second item is supported by flow.\n") + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); + } + } + } + + if (keyword.name() == "EHYSTR") { + for (unsigned recordIdx = 0; recordIdx < keyword.size(); ++recordIdx) { + const auto& record = keyword.getRecord(recordIdx); + if (record.getItem(1).get(0) != 0) { + std::string msg = std::string("For keyword 'EHYSTR' only Carlson kr hystersis model is supported by flow.\n") + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); + } + } + } + + if (keyword.name() == "ENDSCALE") { + for (unsigned recordIdx = 0; recordIdx < keyword.size(); ++recordIdx) { + const auto& record = keyword.getRecord(recordIdx); + if (record.getItem(0).getTrimmedString(0) == "DIRECT") { + std::string msg = std::string("For keyword 'ENDSCALE', 'DIRECT' in first item is not supported by flow.\n") + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); + } + if (record.getItem(1).getTrimmedString(0) == "IRREVERS") { + std::string msg = std::string("For keyword 'ENDSCALE', 'IRREVERS' in second item is not supported by flow.\n") + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); + } + } + } + + if (keyword.name() == "PINCH") { + for (unsigned recordIdx = 0; recordIdx < keyword.size(); ++recordIdx) { + const auto& record = keyword.getRecord(recordIdx); + if (record.getItem(1).getTrimmedString(0) != "GAP") { + std::string msg = std::string("For keyword 'PINCH' only 'GAP' in second item is supported by flow.\n") + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); + } + if (record.getItem(3).getTrimmedString(0) != "TOPBOT") { + std::string msg = std::string("For keyword 'PINCH' only 'TOPBOT' in fourth item is supported by flow.\n") + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); + } + } + } } } } // namespace MissingFeatures From a9e51eeb424bcd22ecd142fa631327e7b2666baa Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Mon, 18 Jul 2016 12:32:28 +0800 Subject: [PATCH 02/11] treat partially supported options by different multimap. --- opm/autodiff/MissingFeatures.cpp | 88 ++++++++++++++------------------ 1 file changed, 39 insertions(+), 49 deletions(-) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index 05a69120c..539fd7568 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -22,12 +22,30 @@ #include #include #include +#include namespace Opm { namespace MissingFeatures { + template + struct PartiallySupported { + int item; + T item_value; + }; + + std::multimap > + string_options = { {"COMPORD", PartiallySupported{1, "TRACK"}}, + {"ENDSCALE",PartiallySupported{0, "NODIR"}}, + {"ENDSCALE",PartiallySupported{1, "REVER"}}, + {"PINCH", PartiallySupported{1, "GAP"}}, + {"PINCH", PartiallySupported{3, "TOPBOT"}} + }; + + std::multimap > + int_options = { {"EHYSTR", PartiallySupported{1, 0}}}; + void checkKeywords(const Deck& deck) { // These keywords are supported by opm-parser, but are not supported @@ -67,58 +85,30 @@ namespace MissingFeatures { OpmLog::error(msg); } - // check for partially supported options. - if (keyword.name() == "COMPORD") { - for (unsigned recordIdx = 0; recordIdx < keyword.size(); ++recordIdx) { - const auto& record = keyword.getRecord(recordIdx); - if (record.getItem("ORDER_TYPE").getTrimmedString(0) != "TRACK") { - std::string msg = std::string("For keyword 'COMPORD' only 'TRACK' in second item is supported by flow.\n") - + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); - } + // check for partially supported keywords. + std::multimap>::iterator string_it, string_low, string_up; + string_low = string_options.lower_bound(keyword.name()); + string_up = string_options.upper_bound(keyword.name()); + for (string_it = string_low; string_it != string_up; ++string_it) { + const auto& record = keyword.getRecord(0); + if (record.getItem(string_it->second.item).get(0) != string_it->second.item_value) { + std::string msg = "For keyword '" + string_it->first + "' only value " + string_it->second.item_value + " in item " + + std::to_string(string_it->second.item + 1) + " is supported by flow.\n" + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); } } - if (keyword.name() == "EHYSTR") { - for (unsigned recordIdx = 0; recordIdx < keyword.size(); ++recordIdx) { - const auto& record = keyword.getRecord(recordIdx); - if (record.getItem(1).get(0) != 0) { - std::string msg = std::string("For keyword 'EHYSTR' only Carlson kr hystersis model is supported by flow.\n") - + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); - } - } - } - - if (keyword.name() == "ENDSCALE") { - for (unsigned recordIdx = 0; recordIdx < keyword.size(); ++recordIdx) { - const auto& record = keyword.getRecord(recordIdx); - if (record.getItem(0).getTrimmedString(0) == "DIRECT") { - std::string msg = std::string("For keyword 'ENDSCALE', 'DIRECT' in first item is not supported by flow.\n") - + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); - } - if (record.getItem(1).getTrimmedString(0) == "IRREVERS") { - std::string msg = std::string("For keyword 'ENDSCALE', 'IRREVERS' in second item is not supported by flow.\n") - + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); - } - } - } - - if (keyword.name() == "PINCH") { - for (unsigned recordIdx = 0; recordIdx < keyword.size(); ++recordIdx) { - const auto& record = keyword.getRecord(recordIdx); - if (record.getItem(1).getTrimmedString(0) != "GAP") { - std::string msg = std::string("For keyword 'PINCH' only 'GAP' in second item is supported by flow.\n") - + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); - } - if (record.getItem(3).getTrimmedString(0) != "TOPBOT") { - std::string msg = std::string("For keyword 'PINCH' only 'TOPBOT' in fourth item is supported by flow.\n") - + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); - } + std::multimap>::iterator int_it, int_low, int_up; + int_low = int_options.lower_bound(keyword.name()); + int_up = int_options.upper_bound(keyword.name()); + for (int_it = int_low; int_it != int_up; ++int_it) { + const auto& record = keyword.getRecord(0); + if (record.getItem(int_it->second.item).get(0) != int_it->second.item_value) { + std::string msg = "For keyword '" + int_it->first + "' only value " + std::to_string(int_it->second.item_value) + " in item " + + std::to_string(int_it->second.item + 1) + " is supported by flow.\n" + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); } } } From b62834f81c6f6ed1d16753d6d2ae63472357364f Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Wed, 20 Jul 2016 10:27:30 +0800 Subject: [PATCH 03/11] Treat unsupported options in a more general way. --- opm/autodiff/MissingFeatures.cpp | 83 ++++++++++++++++---------------- opm/autodiff/MissingFeatures.hpp | 12 +++++ 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index 539fd7568..1c377e51d 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -17,34 +17,50 @@ along with OPM. If not, see . */ #include + #include #include +#include +#include +#include + #include + #include #include #include - +#include namespace Opm { namespace MissingFeatures { - template - struct PartiallySupported { - int item; - T item_value; - }; - std::multimap > - string_options = { {"COMPORD", PartiallySupported{1, "TRACK"}}, - {"ENDSCALE",PartiallySupported{0, "NODIR"}}, - {"ENDSCALE",PartiallySupported{1, "REVER"}}, - {"PINCH", PartiallySupported{1, "GAP"}}, - {"PINCH", PartiallySupported{3, "TOPBOT"}} - }; + template + void addUnsupported(std::multimap >& map, T itemValue) + { + std::pair > pair({Keyword::keywordName, PartiallySupported{Item::itemName , itemValue}}); + map.insert(pair); + } - std::multimap > - int_options = { {"EHYSTR", PartiallySupported{1, 0}}}; + + template + void checkOptions(const DeckKeyword& keyword, std::multimap >& map) + { + // check for partially supported keywords. + typename std::multimap >::iterator it, itlow, itup; + itlow = map.lower_bound(keyword.name()); + itup = map.upper_bound(keyword.name()); + for (it = itlow; it != itup; ++it) { + const auto& record = keyword.getRecord(0); + if (record.getItem(it->second.item).template get(0) != it->second.item_value) { + std::string msg = "For keyword '" + it->first + "' only value " + boost::lexical_cast(it->second.item_value) + + " in item " + it->second.item + " is supported by flow.\n" + + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; + OpmLog::error(msg); + } + } + } void checkKeywords(const Deck& deck) { @@ -73,6 +89,14 @@ namespace MissingFeatures { "VAPPARS", "VISCREF", "WATVISCT", "WPAVE", "WPIMULT", "WPITAB", "WTEMP", "WTEST", "WTRACER", "ZIPPY2" }; + std::multimap > string_options; + std::multimap > int_options; + addUnsupported(string_options , "TRACK"); + addUnsupported(string_options, "NODIR"); + addUnsupported(string_options, "REVER"); + addUnsupported(string_options, "GAP"); + addUnsupported(string_options, "TOPBOT"); + addUnsupported(int_options , 0); // check deck and keyword for flow and parser. for (size_t idx = 0; idx < deck.size(); ++idx) { @@ -84,33 +108,8 @@ namespace MissingFeatures { + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; OpmLog::error(msg); } - - // check for partially supported keywords. - std::multimap>::iterator string_it, string_low, string_up; - string_low = string_options.lower_bound(keyword.name()); - string_up = string_options.upper_bound(keyword.name()); - for (string_it = string_low; string_it != string_up; ++string_it) { - const auto& record = keyword.getRecord(0); - if (record.getItem(string_it->second.item).get(0) != string_it->second.item_value) { - std::string msg = "For keyword '" + string_it->first + "' only value " + string_it->second.item_value + " in item " + - std::to_string(string_it->second.item + 1) + " is supported by flow.\n" - + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); - } - } - - std::multimap>::iterator int_it, int_low, int_up; - int_low = int_options.lower_bound(keyword.name()); - int_up = int_options.upper_bound(keyword.name()); - for (int_it = int_low; int_it != int_up; ++int_it) { - const auto& record = keyword.getRecord(0); - if (record.getItem(int_it->second.item).get(0) != int_it->second.item_value) { - std::string msg = "For keyword '" + int_it->first + "' only value " + std::to_string(int_it->second.item_value) + " in item " + - std::to_string(int_it->second.item + 1) + " is supported by flow.\n" - + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); - } - } + checkOptions(keyword, string_options); + checkOptions(keyword, int_options); } } } // namespace MissingFeatures diff --git a/opm/autodiff/MissingFeatures.hpp b/opm/autodiff/MissingFeatures.hpp index 2cd805616..f8188b7bd 100644 --- a/opm/autodiff/MissingFeatures.hpp +++ b/opm/autodiff/MissingFeatures.hpp @@ -24,6 +24,18 @@ namespace Opm { namespace MissingFeatures { + template + struct PartiallySupported { + std::string item; + T item_value; + }; + + template + void addUnsupported(std::multimap >& map, T itemValue); + + template + void checkOptions(const DeckKeyword& keyword, std::multimap >& map); + void checkKeywords(const Deck& deck); } From 4ae5a0a85ba71153f6803abf543f1cd86d5f1755 Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Wed, 27 Jul 2016 16:14:22 +0800 Subject: [PATCH 04/11] change message type from error to warning. --- opm/autodiff/MissingFeatures.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index 1c377e51d..905d9f3ee 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -57,7 +57,7 @@ namespace MissingFeatures { std::string msg = "For keyword '" + it->first + "' only value " + boost::lexical_cast(it->second.item_value) + " in item " + it->second.item + " is supported by flow.\n" + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); + OpmLog::warning(msg); } } } @@ -106,7 +106,7 @@ namespace MissingFeatures { if (it != unsupported_keywords.end()) { std::string msg = "Keyword '" + keyword.name() + "' is not supported by flow.\n" + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; - OpmLog::error(msg); + OpmLog::warning(msg); } checkOptions(keyword, string_options); checkOptions(keyword, int_options); From ab95133d1c09f0a772777004c417747d44584ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Thu, 11 Aug 2016 09:59:07 +0200 Subject: [PATCH 05/11] Match RestartConfig interface in opm-parser --- opm/autodiff/FlowMain.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/opm/autodiff/FlowMain.hpp b/opm/autodiff/FlowMain.hpp index 0c703c7e8..dd1235077 100644 --- a/opm/autodiff/FlowMain.hpp +++ b/opm/autodiff/FlowMain.hpp @@ -427,8 +427,7 @@ namespace Opm // Possibly override IOConfig setting (from deck) for how often RESTART files should get written to disk (every N report step) if (param_.has("output_interval")) { const int output_interval = param_.get("output_interval"); - IOConfigPtr ioConfig = eclipse_state_->getIOConfig(); - ioConfig->overrideRestartWriteInterval(static_cast(output_interval)); + eclipse_state_->getRestartConfig().overrideRestartWriteInterval( size_t( output_interval ) ); } // Possible to force initialization only behavior (NOSIM). From 5f059da0a4cdc371ec935ca4805c820bd322b77e Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Fri, 12 Aug 2016 08:27:07 +0800 Subject: [PATCH 06/11] look for water injector only, if not find, just continue to next step. --- opm/polymer/PolymerInflow.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/opm/polymer/PolymerInflow.cpp b/opm/polymer/PolymerInflow.cpp index d804a20aa..9e1a7b2b4 100644 --- a/opm/polymer/PolymerInflow.cpp +++ b/opm/polymer/PolymerInflow.cpp @@ -73,15 +73,27 @@ namespace Opm { ScheduleConstPtr schedule = eclipseState->getSchedule(); for (const auto& well : schedule->getWells(currentStep)) { + WellInjectionProperties injection = well->getInjectionProperties(currentStep); + WellPolymerProperties polymer = well->getPolymerProperties(currentStep); if (well->isInjector(currentStep)) { - WellInjectionProperties injection = well->getInjectionProperties(currentStep); - if (injection.injectorType == WellInjector::WATER) { - WellPolymerProperties polymer = well->getPolymerProperties(currentStep); - wellPolymerRate_.insert(std::make_pair(well->name(), polymer.m_polymerConcentration)); + if (well->getStatus(currentStep) != WellCommon::SHUT) { + if (injection.injectorType == WellInjector::WATER) { + wellPolymerRate_.insert(std::make_pair(well->name(), polymer.m_polymerConcentration)); + } else { + if (polymer.m_polymerConcentration > 0) { + OpmLog::error("Inject polymer through non-water injector '" + well->name() + "'"); + } + } } else { - OPM_THROW(std::logic_error, "For polymer injector you must have a water injector"); + if (polymer.m_polymerConcentration > 0) { + OpmLog::error("Inject polymer through a shut injector '" + well->name() + "'"); + } } } + + if (well->isProducer(currentStep) && polymer.m_polymerConcentration > 0) { + OpmLog::error("Inject polymer through a producer '" + well->name() + "'"); + } } } @@ -137,7 +149,7 @@ namespace Opm std::fill(poly_inflow_c.begin(), poly_inflow_c.end(), 0.0); const int nnz = sparse_inflow_.nonzeroSize(); for (int i = 0; i < nnz; ++i) { - poly_inflow_c[sparse_inflow_.nonzeroIndex(i)] = sparse_inflow_.nonzeroElement(i) ; + poly_inflow_c[sparse_inflow_.nonzeroIndex(i)] = sparse_inflow_.nonzeroElement(i); } } From 56a7775fee2d0d79e06d013cf1f5cfd9ae121c56 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Sat, 20 Aug 2016 20:09:56 +0200 Subject: [PATCH 07/11] Changed order of arguments to match opm-output. --- opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp index 3f13ccbec..cadce133c 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp @@ -345,10 +345,10 @@ namespace Opm std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl; } else { eclWriter_->writeTimeStep(timer.currentStepNum(), + substep, timer.simulationTimeElapsed(), simToSolution( state, phaseUsage_ ), - wellState.report(), - substep ); + wellState.report()); } } From 0f7c9f4b97592368e7bf3d07ce980c251e3bcb5f Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Sat, 20 Aug 2016 20:10:50 +0200 Subject: [PATCH 08/11] Added optional simProps argument to restart. --- .../SimulatorFullyImplicitBlackoilOutput.cpp | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp index cadce133c..038e43090 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp @@ -24,7 +24,7 @@ #include #include - +#include #include #include #include @@ -344,11 +344,38 @@ namespace Opm if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) { std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl; } else { - eclWriter_->writeTimeStep(timer.currentStepNum(), - substep, - timer.simulationTimeElapsed(), - simToSolution( state, phaseUsage_ ), - wellState.report()); + std::vector simProps; + /* + The simProps vector can be passed to the writeTimestep routine + to add more properties to the restart file. Examples of the + elements for the simProps vector can be the relative + permeabilites KRO, KRG and KRW and the fluxes. + + Which properties are requested are configured with the RPTRST + keyword, which is internalized in the RestartConfig class in + EclipseState. + */ + + /* + Assuming we already have correctly initialized + std::vector instances kro,krw and krg with the oil, + water and gas relative permeabilities. Then we can write those + to the restart file with: + + std::vector simProps; + + simProps.emplace_back( {"KRO" , UnitSystem::measure::identity , kro} ); + simProps.emplace_back( {"KRG" , UnitSystem::measure::identity , krg} ); + simProps.emplace_back( {"KRW" , UnitSystem::measure::identity , krw} ); + + */ + + eclWriter_->writeTimeStep(timer.currentStepNum(), + substep, + timer.simulationTimeElapsed(), + simToSolution( state, phaseUsage_ ), + wellState.report(), + simProps); } } From 95ab7038ea360f10a764503bea7defb5a428d65a Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Mon, 22 Aug 2016 16:14:37 +0800 Subject: [PATCH 09/11] Rename addUnsupported to addSupported. --- opm/autodiff/MissingFeatures.cpp | 14 +++++++------- opm/autodiff/MissingFeatures.hpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index 905d9f3ee..ab5aa7027 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -37,7 +37,7 @@ namespace MissingFeatures { template - void addUnsupported(std::multimap >& map, T itemValue) + void addSupported(std::multimap >& map, T itemValue) { std::pair > pair({Keyword::keywordName, PartiallySupported{Item::itemName , itemValue}}); map.insert(pair); @@ -91,12 +91,12 @@ namespace MissingFeatures { "WTEST", "WTRACER", "ZIPPY2" }; std::multimap > string_options; std::multimap > int_options; - addUnsupported(string_options , "TRACK"); - addUnsupported(string_options, "NODIR"); - addUnsupported(string_options, "REVER"); - addUnsupported(string_options, "GAP"); - addUnsupported(string_options, "TOPBOT"); - addUnsupported(int_options , 0); + addSupported(string_options , "DEPTH"); + addSupported(string_options, "NODIR"); + addSupported(string_options, "REVER"); + addSupported(string_options, "GAP"); + addSupported(string_options, "TOPBOT"); + addSupported(int_options , 0); // check deck and keyword for flow and parser. for (size_t idx = 0; idx < deck.size(); ++idx) { diff --git a/opm/autodiff/MissingFeatures.hpp b/opm/autodiff/MissingFeatures.hpp index f8188b7bd..b3cfbb11a 100644 --- a/opm/autodiff/MissingFeatures.hpp +++ b/opm/autodiff/MissingFeatures.hpp @@ -31,7 +31,7 @@ namespace MissingFeatures { }; template - void addUnsupported(std::multimap >& map, T itemValue); + void addSupported(std::multimap >& map, T itemValue); template void checkOptions(const DeckKeyword& keyword, std::multimap >& map); From cd822bc7141f47478de73e1cec41ed6ea6a91f87 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 22 Aug 2016 13:57:32 +0200 Subject: [PATCH 10/11] simplify jenkins build scripts after ert reorganization --- jenkins/build-opm-simulators.sh | 21 ++------------------- jenkins/build-pr.sh | 12 ++++-------- jenkins/build.sh | 5 +++-- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/jenkins/build-opm-simulators.sh b/jenkins/build-opm-simulators.sh index 805800a22..ec8459706 100755 --- a/jenkins/build-opm-simulators.sh +++ b/jenkins/build-opm-simulators.sh @@ -1,24 +1,6 @@ #!/bin/bash function build_opm_simulators { - # Build ERT - pushd . - mkdir -p $WORKSPACE/deps/ert - cd $WORKSPACE/deps/ert - git init . - git remote add origin https://github.com/Ensembles/ert - git fetch --depth 1 origin $ERT_REVISION:branch_to_build - test $? -eq 0 || exit 1 - git checkout branch_to_build - popd - - pushd . - mkdir -p serial/build-ert - cd serial/build-ert - cmake $WORKSPACE/deps/ert/devel -DBUILD_APPLICATIONS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install - cmake --build . --target install - popd - # Build opm-common pushd . mkdir -p $WORKSPACE/deps/opm-common @@ -29,10 +11,11 @@ function build_opm_simulators { test $? -eq 0 || exit 1 git checkout branch_to_build popd + source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh pushd . - mkdir serial/build-opm-common + mkdir -p serial/build-opm-common cd serial/build-opm-common build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" 0 $WORKSPACE/deps/opm-common test $? -eq 0 || exit 1 diff --git a/jenkins/build-pr.sh b/jenkins/build-pr.sh index 7ec9e7525..dbbac8227 100755 --- a/jenkins/build-pr.sh +++ b/jenkins/build-pr.sh @@ -3,27 +3,23 @@ source `dirname $0`/build-opm-simulators.sh declare -a upstreams -upstreams=(opm-parser +upstreams=(ert + opm-parser opm-output opm-material opm-core opm-grid) declare -A upstreamRev +upstreamRev[ert]=master upstreamRev[opm-parser]=master upstreamRev[opm-material]=master upstreamRev[opm-core]=master upstreamRev[opm-grid]=master upstreamRev[opm-output]=master -ERT_REVISION=master OPM_COMMON_REVISION=master -if grep -q "ert=" <<< $ghprbCommentBody -then - ERT_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*ert=([0-9]+).*/\1/g'`/merge -fi - if grep -q "opm-common=" <<< $ghprbCommentBody then OPM_COMMON_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge @@ -37,7 +33,7 @@ do fi done -echo "Building with ert=$ERT_REVISION opm-common=$OPM_COMMON_REVISION opm-parser=${upstreamRev[opm-parser]} opm-material=${upstreamRev[opm-material]} opm-core=${upstreamRev[opm-core]} opm-grid=${upstreamRev[opm-grid]} opm-output=${upstreamRev[opm-output]} opm-simulators=$sha1" +echo "Building with opm-common=$OPM_COMMON_REVISION ert=${upstreamRev[ert]} opm-parser=${upstreamRev[opm-parser]} opm-material=${upstreamRev[opm-material]} opm-core=${upstreamRev[opm-core]} opm-grid=${upstreamRev[opm-grid]} opm-output=${upstreamRev[opm-output]} opm-simulators=$sha1" build_opm_simulators test $? -eq 0 || exit 1 diff --git a/jenkins/build.sh b/jenkins/build.sh index d203379dc..a18695566 100755 --- a/jenkins/build.sh +++ b/jenkins/build.sh @@ -3,20 +3,21 @@ source `dirname $0`/build-opm-simulators.sh declare -a upstreams -upstreams=(opm-parser +upstreams=(ert + opm-parser opm-output opm-material opm-core opm-grid) declare -A upstreamRev +upstreamRev[ert]=master upstreamRev[opm-parser]=master upstreamRev[opm-material]=master upstreamRev[opm-core]=master upstreamRev[opm-grid]=master upstreamRev[opm-output]=master -ERT_REVISION=master OPM_COMMON_REVISION=master build_opm_simulators From 4f779b7a015e079e643bc64420700a848f4eddcc Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 23 Aug 2016 14:26:06 +0200 Subject: [PATCH 11/11] add multiconfiguration support to jenkins build script also unifies build.sh and build-pr.sh and gets rid of build-opm-simulators.sh --- jenkins/README.md | 41 +++++++++++++-------------------- jenkins/build-opm-simulators.sh | 37 ----------------------------- jenkins/build-pr.sh | 41 --------------------------------- jenkins/build.sh | 35 +++++++++++++++++++++++----- jenkins/run-norne.sh | 4 ++-- jenkins/run-polymer.sh | 4 ++-- jenkins/run-spe.sh | 18 +++++++-------- 7 files changed, 58 insertions(+), 122 deletions(-) delete mode 100755 jenkins/build-opm-simulators.sh delete mode 100755 jenkins/build-pr.sh diff --git a/jenkins/README.md b/jenkins/README.md index c84a024f4..86a7bf159 100644 --- a/jenkins/README.md +++ b/jenkins/README.md @@ -1,41 +1,32 @@ # opm-simulators jenkins build scripts: -**build-opm-simulators.sh**: -This is a helper script which contains functions for building, -testing and cloning opm-simulators and its dependencies. - **build.sh**: This script will build dependencies, then build opm-simulators and execute its tests. -It is intended for post-merge builds of the master branch. - -**build-pr.sh**: -This script will build dependencies, then build opm-simulators and execute its tests. -It inspects the $ghbPrBuildComment environmental variable to obtain a pull request -to use for ert, opm-common, opm-parser, opm-material, opm-core and -opm-grid (defaults to master) and then builds $sha1 of opm-simulators. +It also inspects the $ghbPrBuildComment environmental variable and builds +downstreams if requested. It inspects the $ghbPrBuildComment +environmental variable to obtain a pull request to use for the modules. It is intended for pre-merge builds of pull requests. -You can optionally specify a given pull request to use for ert, opm-common, -opm-parser, opm-material, opm-core and opm-grid through the trigger. -The trigger line needs to contain ert=<pull request number> and/or -opm-common=<pull request number> and/or opm-parser=<pull request number> -and/or opm-material=<pull request number> -and/or opm-core=<pull request number> -and/or opm-grid=<pull request number> -and/or opm-output=<pull request number>. +To specify a given pull request to use for upstreams and downstreams, +trigger line needs to contain <module-name>=<pull request number>. + +To build with downstreams the trigger line needs to contain 'with downstreams'. **run-spe.sh**: This script will execute the SPE1, SPE3 and SPE9 cases, then compare against -OPM and Eclipse reference results. It is meant to be executed after either -of the two build scripts above. +OPM and Eclipse reference results. It is meant to be executed after a build. +The binary used used is from the build identified by the configuration +environment variable. **run-norne.sh**: This script will execute the Norne case, and generate a document with -plots of the results. It is meant to be executed after either -of the two build scripts above. +plots of the results. It is meant to be executed after a build. +The binary used used is from the build identified by the configuration +environment variable. **run-polymer.sh**: This script will execute the simple2D polymer case, then compare against -Eclipse reference results. It is meant to be executed after either -of the two build scripts above. +Eclipse reference results. It is meant to be executed after a build. +The binary used used is from the build identified by the configuration +environment variable. diff --git a/jenkins/build-opm-simulators.sh b/jenkins/build-opm-simulators.sh deleted file mode 100755 index ec8459706..000000000 --- a/jenkins/build-opm-simulators.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -function build_opm_simulators { - # Build opm-common - pushd . - mkdir -p $WORKSPACE/deps/opm-common - cd $WORKSPACE/deps/opm-common - git init . - git remote add origin https://github.com/OPM/opm-common - git fetch --depth 1 origin $OPM_COMMON_REVISION:branch_to_build - test $? -eq 0 || exit 1 - git checkout branch_to_build - popd - - source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh - - pushd . - mkdir -p serial/build-opm-common - cd serial/build-opm-common - build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" 0 $WORKSPACE/deps/opm-common - test $? -eq 0 || exit 1 - popd - - # Build upstreams - build_upstreams - - # Setup opm-data - source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh - - # Build opm-simulators - pushd . - mkdir serial/build-opm-simulators - cd serial/build-opm-simulators - build_module "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DOPM_DATA_ROOT=$OPM_DATA_ROOT" 1 $WORKSPACE - test $? -eq 0 || exit 1 - popd -} diff --git a/jenkins/build-pr.sh b/jenkins/build-pr.sh deleted file mode 100755 index dbbac8227..000000000 --- a/jenkins/build-pr.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -source `dirname $0`/build-opm-simulators.sh - -declare -a upstreams -upstreams=(ert - opm-parser - opm-output - opm-material - opm-core - opm-grid) - -declare -A upstreamRev -upstreamRev[ert]=master -upstreamRev[opm-parser]=master -upstreamRev[opm-material]=master -upstreamRev[opm-core]=master -upstreamRev[opm-grid]=master -upstreamRev[opm-output]=master - -OPM_COMMON_REVISION=master - -if grep -q "opm-common=" <<< $ghprbCommentBody -then - OPM_COMMON_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge -fi - -for upstream in ${upstreams[*]} -do - if grep -q "$upstream=" <<< $ghprbCommentBody - then - upstreamRev[$upstream]=pull/`echo $ghprbCommentBody | sed -r "s/.*$upstream=([0-9]+).*/\1/g"`/merge - fi -done - -echo "Building with opm-common=$OPM_COMMON_REVISION ert=${upstreamRev[ert]} opm-parser=${upstreamRev[opm-parser]} opm-material=${upstreamRev[opm-material]} opm-core=${upstreamRev[opm-core]} opm-grid=${upstreamRev[opm-grid]} opm-output=${upstreamRev[opm-output]} opm-simulators=$sha1" - -build_opm_simulators -test $? -eq 0 || exit 1 - -cp serial/build-opm-simulators/testoutput.xml . diff --git a/jenkins/build.sh b/jenkins/build.sh index a18695566..f785f1c8d 100755 --- a/jenkins/build.sh +++ b/jenkins/build.sh @@ -1,9 +1,8 @@ #!/bin/bash -source `dirname $0`/build-opm-simulators.sh - declare -a upstreams -upstreams=(ert +upstreams=(opm-common + ert opm-parser opm-output opm-material @@ -11,6 +10,7 @@ upstreams=(ert opm-grid) declare -A upstreamRev +upstreamRev[opm-common]=master upstreamRev[ert]=master upstreamRev[opm-parser]=master upstreamRev[opm-material]=master @@ -18,9 +18,32 @@ upstreamRev[opm-core]=master upstreamRev[opm-grid]=master upstreamRev[opm-output]=master -OPM_COMMON_REVISION=master +if grep -q "opm-common=" <<< $ghprbCommentBody +then + upstreamRev[opm-common]=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge +fi -build_opm_simulators +# No downstreams currently +declare -a downstreams +declare -A downstreamRev + +# Clone opm-common +pushd . +mkdir -p $WORKSPACE/deps/opm-common +cd $WORKSPACE/deps/opm-common +git init . +git remote add origin https://github.com/OPM/opm-common +git fetch --depth 1 origin ${upstreamRev[opm-common]}:branch_to_build test $? -eq 0 || exit 1 +git checkout branch_to_build +popd -cp serial/build-opm-simulators/testoutput.xml . +source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh + +parseRevisions +printHeader opm-simulators + +# Setup opm-data +source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh + +build_module_full opm-simulators diff --git a/jenkins/run-norne.sh b/jenkins/run-norne.sh index 2da4288a2..cac96c625 100755 --- a/jenkins/run-norne.sh +++ b/jenkins/run-norne.sh @@ -5,8 +5,8 @@ cd deps/opm-data # Run the norne case cd norne -$WORKSPACE/serial/build-opm-simulators/bin/flow deck_filename=NORNE_ATW2013.DATA output_dir=OPM +$WORKSPACE/$configuration/build-opm-simulators/bin/flow deck_filename=NORNE_ATW2013.DATA output_dir=OPM test $? -eq 0 || exit 1 -PATH=$WORKSPACE/serial/install/bin:$PATH ./plotwells.sh +PATH=$WORKSPACE/$configuration/install/bin:$PATH ./plotwells.sh popd diff --git a/jenkins/run-polymer.sh b/jenkins/run-polymer.sh index f82ccec5c..b73ea8a4b 100755 --- a/jenkins/run-polymer.sh +++ b/jenkins/run-polymer.sh @@ -5,12 +5,12 @@ cd deps/opm-data # Run the simple2D polymer case cd polymer_test_suite/simple2D -$WORKSPACE/serial/build-opm-simulators/bin/flow_polymer run.param +$WORKSPACE/$configuration/build-opm-simulators/bin/flow_polymer run.param test $? -eq 0 || exit 1 cd ../.. # Compare OPM with eclipse reference -PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py polymer_test_suite/simple2D/eclipse-simulation/ polymer_test_suite/simple2D/opm-simulation/ 2D_THREEPHASE_POLY_HETER 0.0006 0.004 +PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py polymer_test_suite/simple2D/eclipse-simulation/ polymer_test_suite/simple2D/opm-simulation/ 2D_THREEPHASE_POLY_HETER 0.0006 0.004 test $? -eq 0 || exit 1 popd diff --git a/jenkins/run-spe.sh b/jenkins/run-spe.sh index 48074cfb0..b26ff28e9 100755 --- a/jenkins/run-spe.sh +++ b/jenkins/run-spe.sh @@ -5,32 +5,32 @@ cd deps/opm-data # Run the SPE1/3/9 cases cd spe1 -$WORKSPACE/serial/build-opm-simulators/bin/flow deck_filename=SPE1CASE2.DATA +$WORKSPACE/$configuration/build-opm-simulators/bin/flow deck_filename=SPE1CASE2.DATA test $? -eq 0 || exit 1 cd .. cd spe3 -$WORKSPACE/serial/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE3CASE1.DATA +$WORKSPACE/$configuration/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE3CASE1.DATA test $? -eq 0 || exit 1 cd .. cd spe9 -$WORKSPACE/serial/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE9_CP.DATA +$WORKSPACE/$configuration/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE9_CP.DATA test $? -eq 0 || exit 1 cd .. # Compare OPM with eclipse reference -PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/eclipse-simulation/ spe1/ SPE1CASE2 0.01 0.01 +PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/eclipse-simulation/ spe1/ SPE1CASE2 0.01 0.01 test $? -eq 0 || exit 1 -PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/eclipse-simulation/ spe3/ SPE3CASE1 0.02 0.02 +PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/eclipse-simulation/ spe3/ SPE3CASE1 0.02 0.02 test $? -eq 0 || exit 1 -PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/eclipse-simulation/ spe9/ SPE9_CP 0.002 0.001 +PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/eclipse-simulation/ spe9/ SPE9_CP 0.002 0.001 test $? -eq 0 || exit 1 # Compare OPM with OPM reference -PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/opm-simulation-reference/ spe1/ SPE1CASE2 0.001 0.001 +PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/opm-simulation-reference/ spe1/ SPE1CASE2 0.001 0.001 test $? -eq 0 || exit 1 -PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/opm-simulation-reference/ spe3/ SPE3CASE1 0.001 0.001 +PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/opm-simulation-reference/ spe3/ SPE3CASE1 0.001 0.001 test $? -eq 0 || exit 1 -PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/opm-simulation-reference/ spe9/ SPE9_CP 0.002 0.007 +PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/opm-simulation-reference/ spe9/ SPE9_CP 0.002 0.007 test $? -eq 0 || exit 1 popd