| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  | /*
 | 
					
						
							|  |  |  |   Copyright 2016 Statoil ASA. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   This file is part of the Open Porous Media project (OPM). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   OPM is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |   it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |   the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  |   (at your option) any later version. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   OPM is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |   GNU General Public License for more details. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |   along with OPM.  If not, see <http://www.gnu.org/licenses/>.
 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | #include <opm/common/OpmLog/OpmLog.hpp>
 | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  | #include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
 | 
					
						
							|  |  |  | #include <opm/parser/eclipse/Parser/Parser.hpp>
 | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  | #include <opm/parser/eclipse/Parser/ParserKeywords/C.hpp>
 | 
					
						
							|  |  |  | #include <opm/parser/eclipse/Parser/ParserKeywords/E.hpp>
 | 
					
						
							|  |  |  | #include <opm/parser/eclipse/Parser/ParserKeywords/P.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  | #include <opm/autodiff/MissingFeatures.hpp>
 | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-07 13:50:32 +08:00
										 |  |  | #include <unordered_set>
 | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  | #include <string>
 | 
					
						
							| 
									
										
										
										
											2016-07-18 12:32:28 +08:00
										 |  |  | #include <map>
 | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  | #include <boost/lexical_cast.hpp>
 | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Opm { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-07 15:38:03 +08:00
										 |  |  | namespace MissingFeatures { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-18 12:32:28 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  |     template <typename Keyword, typename Item, typename T> | 
					
						
							| 
									
										
										
										
											2016-08-22 16:14:37 +08:00
										 |  |  |     void addSupported(std::multimap<std::string, PartiallySupported<T> >& map, T itemValue) | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  |     { | 
					
						
							|  |  |  |         std::pair<std::string,PartiallySupported<T> > pair({Keyword::keywordName, PartiallySupported<T>{Item::itemName , itemValue}}); | 
					
						
							|  |  |  |         map.insert(pair); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-07-18 12:32:28 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     template <typename T> | 
					
						
							|  |  |  |     void checkOptions(const DeckKeyword& keyword, std::multimap<std::string , PartiallySupported<T> >& map) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // check for partially supported keywords.
 | 
					
						
							|  |  |  |         typename std::multimap<std::string, PartiallySupported<T> >::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<T>(0) != it->second.item_value) { | 
					
						
							|  |  |  |                 std::string msg = "For keyword '" + it->first + "' only value " + boost::lexical_cast<std::string>(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"; | 
					
						
							| 
									
										
										
										
											2016-07-27 16:14:22 +08:00
										 |  |  |                 OpmLog::warning(msg); | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-07-18 12:32:28 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-08 14:52:37 +08:00
										 |  |  |     void checkKeywords(const Deck& deck) | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  |     { | 
					
						
							|  |  |  |         // These keywords are supported by opm-parser, but are not supported
 | 
					
						
							|  |  |  |         // by flow. For some of them, only part of the options are supported.
 | 
					
						
							|  |  |  |         // The list is used to output messages only.
 | 
					
						
							| 
									
										
										
										
											2016-07-07 13:50:32 +08:00
										 |  |  |         std::unordered_set<std::string> unsupported_keywords = { | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "ACTION", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "ADSALNOD", | 
					
						
							|  |  |  |             "API", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "APIGROUP", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "AQUCON", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "AQUCT", | 
					
						
							|  |  |  |             "AQUTAB", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "AQUNUM" | 
					
						
							| 
									
										
										
										
											2018-04-03 09:40:36 +02:00
										 |  |  |             "CARFIN" | 
					
						
							|  |  |  |             "COMPDATL", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "COMPLUMP", | 
					
						
							|  |  |  |             "CONNECTION", | 
					
						
							|  |  |  |             "CPR", | 
					
						
							|  |  |  |             "DATE", | 
					
						
							|  |  |  |             "ECHO", | 
					
						
							|  |  |  |             "EDITNNC", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "ENDACTIO", | 
					
						
							| 
									
										
										
										
											2018-04-03 09:40:36 +02:00
										 |  |  |             "ENDFIN" | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "ENDNUM", | 
					
						
							|  |  |  |             "ENDSKIP", | 
					
						
							|  |  |  |             "ENKSRVD", | 
					
						
							|  |  |  |             "ENPTVD", | 
					
						
							|  |  |  |             "EQLNUM", | 
					
						
							|  |  |  |             "EQUALREG", | 
					
						
							|  |  |  |             "EXCEL", | 
					
						
							|  |  |  |             "EXTRAPMS", | 
					
						
							|  |  |  |             "FILLEPS", | 
					
						
							|  |  |  |             "FIPNUM", | 
					
						
							|  |  |  |             "FULLIMP", | 
					
						
							|  |  |  |             "GDORIENT", | 
					
						
							|  |  |  |             "GECON", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "GLIFTOPT", | 
					
						
							| 
									
										
										
										
											2018-05-25 15:03:16 +02:00
										 |  |  |             "GNETINJE", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "GRIDUNIT", | 
					
						
							|  |  |  |             "GRUPNET", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "GSATPROD", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "IMKRVD", | 
					
						
							|  |  |  |             "IMPES", | 
					
						
							|  |  |  |             "IMPTVD", | 
					
						
							| 
									
										
										
										
											2018-04-03 09:40:36 +02:00
										 |  |  |             "LGR", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "LIFTOPT", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "MAPUNITS", | 
					
						
							|  |  |  |             "MAXVALUE", | 
					
						
							|  |  |  |             "MESSAGES", | 
					
						
							|  |  |  |             "MINVALUE", | 
					
						
							|  |  |  |             "MONITOR", | 
					
						
							|  |  |  |             "MSGFILE", | 
					
						
							|  |  |  |             "MULT_XYZ", | 
					
						
							|  |  |  |             "NETBALAN", | 
					
						
							|  |  |  |             "NEXTSTEP", | 
					
						
							|  |  |  |             "NOCASC", | 
					
						
							|  |  |  |             "NOECHO", | 
					
						
							|  |  |  |             "NOGGF", | 
					
						
							|  |  |  |             "NOINSPEC", | 
					
						
							|  |  |  |             "NOMONITO", | 
					
						
							|  |  |  |             "NONNC", | 
					
						
							|  |  |  |             "NORSSPEC", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "NOWARN", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "NSTACK", | 
					
						
							|  |  |  |             "NUMRES", | 
					
						
							|  |  |  |             "NUPCOL", | 
					
						
							|  |  |  |             "OILVISCT", | 
					
						
							|  |  |  |             "OLDTRAN", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "OPERATER", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "OPTIONS", | 
					
						
							|  |  |  |             "PARALLEL", | 
					
						
							|  |  |  |             "PBVD", | 
					
						
							|  |  |  |             "PCG", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "PERMR", | 
					
						
							|  |  |  |             "PERMTHT", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "PERMXY", | 
					
						
							|  |  |  |             "PERMYZ", | 
					
						
							|  |  |  |             "PERMZX", | 
					
						
							|  |  |  |             "PIMULTAB", | 
					
						
							|  |  |  |             "PLYADSS", | 
					
						
							|  |  |  |             "PLYDHFLF", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "PPCWMAX", | 
					
						
							| 
									
										
										
										
											2018-04-03 09:40:36 +02:00
										 |  |  |             "REFINE", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "RADFIN4", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "RHO", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "RKTRMDIR", | 
					
						
							|  |  |  |             "ROCKCOMP", | 
					
						
							|  |  |  |             "ROCKOPTS", | 
					
						
							|  |  |  |             "ROCKTAB", | 
					
						
							|  |  |  |             "RPTGRID", | 
					
						
							|  |  |  |             "RPTONLY", | 
					
						
							|  |  |  |             "RPTONLYO", | 
					
						
							|  |  |  |             "RPTPROS", | 
					
						
							|  |  |  |             "PRTRST", | 
					
						
							|  |  |  |             "RPTRUNSP", | 
					
						
							|  |  |  |             "RPTSCHED", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "RPTSMRY", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "RPTSOL", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "RSCONST", | 
					
						
							|  |  |  |             "RSCONSTT", | 
					
						
							|  |  |  |             "RTEMP", | 
					
						
							|  |  |  |             "RTEMPA", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "RTEMPVD", | 
					
						
							|  |  |  |             "RUNSUM", | 
					
						
							|  |  |  |             "SATOPTS", | 
					
						
							|  |  |  |             "SAVE", | 
					
						
							|  |  |  |             "SEPARATE", | 
					
						
							|  |  |  |             "SKIP", | 
					
						
							|  |  |  |             "SKIP100", | 
					
						
							|  |  |  |             "SKIP300", | 
					
						
							|  |  |  |             "SKIPREST", | 
					
						
							|  |  |  |             "SPECGRID", | 
					
						
							|  |  |  |             "SUMTHIN", | 
					
						
							|  |  |  |             "TEMP", | 
					
						
							|  |  |  |             "THCONR", | 
					
						
							|  |  |  |             "TRACER", | 
					
						
							|  |  |  |             "TRACERS", | 
					
						
							|  |  |  |             "VAPPARS", | 
					
						
							|  |  |  |             "VISCREF", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "WARN", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "WATVISCT", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "WELPI", | 
					
						
							| 
									
										
										
										
											2018-04-03 09:40:36 +02:00
										 |  |  |             "WELSPECL", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:41:39 +01:00
										 |  |  |             "WGASPROD", | 
					
						
							|  |  |  |             "WINJMULT", | 
					
						
							|  |  |  |             "WLIMTOL", | 
					
						
							|  |  |  |             "WORKTHP", | 
					
						
							| 
									
										
										
										
											2017-11-06 13:26:53 +01:00
										 |  |  |             "WPAVE", | 
					
						
							|  |  |  |             "WPITAB", | 
					
						
							|  |  |  |             "WTEMP", | 
					
						
							|  |  |  |             "WTEST", | 
					
						
							|  |  |  |             "WTRACER", | 
					
						
							|  |  |  |             "ZIPPY2" }; | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  |         std::multimap<std::string, PartiallySupported<std::string> > string_options; | 
					
						
							|  |  |  |         std::multimap<std::string, PartiallySupported<int> > int_options; | 
					
						
							| 
									
										
										
										
											2016-08-22 16:14:37 +08:00
										 |  |  |         addSupported<ParserKeywords::COMPORD, ParserKeywords::COMPORD::ORDER_TYPE, std::string>(string_options , "DEPTH"); | 
					
						
							|  |  |  |         addSupported<ParserKeywords::ENDSCALE, ParserKeywords::ENDSCALE::DIRECT, std::string>(string_options, "NODIR"); | 
					
						
							|  |  |  |         addSupported<ParserKeywords::ENDSCALE, ParserKeywords::ENDSCALE::IRREVERS, std::string>(string_options, "REVER"); | 
					
						
							|  |  |  |         addSupported<ParserKeywords::PINCH, ParserKeywords::PINCH::CONTROL_OPTION, std::string>(string_options, "GAP"); | 
					
						
							|  |  |  |         addSupported<ParserKeywords::PINCH, ParserKeywords::PINCH::PINCHOUT_OPTION, std::string>(string_options, "TOPBOT"); | 
					
						
							|  |  |  |         addSupported<ParserKeywords::EHYSTR, ParserKeywords::EHYSTR::relative_perm_hyst, int>(int_options , 0); | 
					
						
							| 
									
										
										
										
											2016-07-12 17:00:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  |         // check deck and keyword for flow and parser.
 | 
					
						
							| 
									
										
										
										
											2016-07-08 14:52:37 +08:00
										 |  |  |         for (size_t idx = 0; idx < deck.size(); ++idx) { | 
					
						
							|  |  |  |             const auto& keyword = deck.getKeyword(idx); | 
					
						
							| 
									
										
										
										
											2016-07-07 15:38:03 +08:00
										 |  |  |             std::unordered_set<std::string>::const_iterator it; | 
					
						
							|  |  |  |             it = unsupported_keywords.find(keyword.name()); | 
					
						
							|  |  |  |             if (it != unsupported_keywords.end()) { | 
					
						
							|  |  |  |                 std::string msg = "Keyword '" + keyword.name() + "' is not supported by flow.\n" | 
					
						
							| 
									
										
										
										
											2016-07-12 17:00:15 +02:00
										 |  |  |                     + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; | 
					
						
							| 
									
										
										
										
											2016-07-27 16:14:22 +08:00
										 |  |  |                 OpmLog::warning(msg); | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-07-20 10:27:30 +08:00
										 |  |  |             checkOptions<std::string>(keyword, string_options); | 
					
						
							|  |  |  |             checkOptions<int>(keyword, int_options); | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-07-07 15:38:03 +08:00
										 |  |  | } // namespace MissingFeatures
 | 
					
						
							| 
									
										
										
										
											2016-07-07 10:38:29 +08:00
										 |  |  | } // namespace Opm
 |