2014-01-07 17:39:07 +01:00
|
|
|
/*
|
|
|
|
|
Copyright 2013 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-03-17 10:01:38 +01:00
|
|
|
#include <set>
|
|
|
|
|
|
2014-12-12 19:47:18 +01:00
|
|
|
#include <boost/algorithm/string/join.hpp>
|
2014-12-12 20:56:34 +01:00
|
|
|
|
2016-01-24 21:49:39 +01:00
|
|
|
#include <opm/parser/eclipse/Deck/Section.hpp>
|
2016-03-08 17:07:42 +01:00
|
|
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
2014-12-16 13:41:44 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
2014-05-30 10:08:35 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/Box.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/BoxManager.hpp>
|
2016-01-15 08:42:57 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
|
2016-06-20 15:20:29 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
|
2016-01-15 08:42:57 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
|
2015-06-10 09:02:51 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
2015-03-31 11:56:33 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp>
|
2016-01-24 21:49:39 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
|
2016-01-15 08:42:57 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
2016-01-24 21:49:39 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
2016-01-15 08:42:57 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
2016-02-26 23:41:39 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
|
2016-05-06 09:59:22 +02:00
|
|
|
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
2016-01-18 17:51:15 +01:00
|
|
|
#include <opm/parser/eclipse/Parser/ParserKeywords/M.hpp>
|
2016-01-24 21:49:39 +01:00
|
|
|
#include <opm/parser/eclipse/Units/Dimension.hpp>
|
2016-01-15 08:42:57 +01:00
|
|
|
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
2016-04-11 10:44:39 +08:00
|
|
|
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
|
2014-10-01 16:07:44 +02:00
|
|
|
|
2014-01-07 17:39:07 +01:00
|
|
|
|
|
|
|
|
namespace Opm {
|
2014-10-09 13:40:39 +02:00
|
|
|
|
2016-05-06 10:00:58 +02:00
|
|
|
EclipseState::EclipseState(std::shared_ptr<const Deck> deckptr, ParseContext parseContext) :
|
2016-05-02 17:46:20 +02:00
|
|
|
EclipseState(*deckptr, parseContext)
|
|
|
|
|
{}
|
|
|
|
|
|
2016-05-06 10:00:58 +02:00
|
|
|
EclipseState::EclipseState(const Deck& deck, ParseContext parseContext) :
|
2016-04-01 15:27:40 +02:00
|
|
|
m_parseContext( parseContext ),
|
2016-05-20 13:03:24 +02:00
|
|
|
m_tables( deck ),
|
2016-06-21 10:38:07 +02:00
|
|
|
m_gridDims( deck ),
|
2016-05-30 12:54:44 +02:00
|
|
|
m_inputGrid( std::make_shared<EclipseGrid>(deck, nullptr) ),
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult( m_inputGrid->getNX(), m_inputGrid->getNY(), m_inputGrid->getNZ()),
|
2016-09-08 19:42:45 +02:00
|
|
|
m_schedule( std::make_shared<Schedule>( m_parseContext, *m_inputGrid, deck ) ),
|
2016-05-02 10:08:46 +02:00
|
|
|
m_eclipseProperties( deck, m_tables, *m_inputGrid ),
|
2016-06-29 16:38:09 +02:00
|
|
|
m_eclipseConfig( deck, m_eclipseProperties, m_gridDims, *m_schedule , parseContext),
|
2016-06-20 15:20:29 +02:00
|
|
|
m_inputNnc( deck, m_gridDims ),
|
2016-10-14 10:06:35 +08:00
|
|
|
m_deckUnitSystem( deck.getActiveUnitSystem() )
|
2014-05-16 15:58:04 +02:00
|
|
|
{
|
2016-06-21 14:56:34 +02:00
|
|
|
m_inputGrid->resetACTNUM(m_eclipseProperties.getIntGridProperty("ACTNUM").getData().data());
|
2016-04-13 16:43:29 +02:00
|
|
|
|
2016-05-02 17:46:20 +02:00
|
|
|
if (deck.hasKeyword( "TITLE" )) {
|
|
|
|
|
const auto& titleKeyword = deck.getKeyword( "TITLE" );
|
2016-04-01 15:27:40 +02:00
|
|
|
const auto& item = titleKeyword.getRecord( 0 ).getItem( 0 );
|
|
|
|
|
std::vector<std::string> itemValue = item.getData<std::string>();
|
|
|
|
|
m_title = boost::algorithm::join( itemValue, " " );
|
|
|
|
|
}
|
2016-03-08 17:07:42 +01:00
|
|
|
|
2015-01-16 14:51:57 +01:00
|
|
|
initTransMult();
|
|
|
|
|
initFaults(deck);
|
2016-06-20 12:27:56 +02:00
|
|
|
|
|
|
|
|
std::vector< const DeckKeyword* > multregtKeywords;
|
|
|
|
|
if (deck.hasKeyword("MULTREGT"))
|
|
|
|
|
multregtKeywords = deck.getKeywordList("MULTREGT");
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.createMultregtScanner(m_eclipseProperties, multregtKeywords);
|
2016-06-20 12:27:56 +02:00
|
|
|
|
2016-04-18 14:26:39 +08:00
|
|
|
|
|
|
|
|
m_messageContainer.appendMessages(m_tables.getMessageContainer());
|
|
|
|
|
m_messageContainer.appendMessages(m_schedule->getMessageContainer());
|
2016-04-22 14:53:16 +08:00
|
|
|
m_messageContainer.appendMessages(m_inputGrid->getMessageContainer());
|
2016-04-18 14:26:39 +08:00
|
|
|
m_messageContainer.appendMessages(m_eclipseProperties.getMessageContainer());
|
2014-01-07 17:39:07 +01:00
|
|
|
}
|
2014-09-09 12:16:13 +02:00
|
|
|
|
2016-02-09 12:09:40 +01:00
|
|
|
const UnitSystem& EclipseState::getDeckUnitSystem() const {
|
2014-09-09 12:16:13 +02:00
|
|
|
return m_deckUnitSystem;
|
|
|
|
|
}
|
2014-01-07 17:39:07 +01:00
|
|
|
|
2016-05-23 15:12:12 +02:00
|
|
|
const UnitSystem& EclipseState::getUnits() const {
|
|
|
|
|
return m_deckUnitSystem;
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-19 13:05:56 +02:00
|
|
|
EclipseGridConstPtr EclipseState::getInputGrid() const {
|
2016-04-19 13:05:56 +02:00
|
|
|
return m_inputGrid;
|
2014-04-24 09:01:58 +02:00
|
|
|
}
|
|
|
|
|
|
2016-04-19 13:05:56 +02:00
|
|
|
EclipseGridPtr EclipseState::getInputGridCopy() const {
|
2016-05-25 12:46:06 +02:00
|
|
|
return std::make_shared<EclipseGrid>( *m_inputGrid );
|
2014-07-17 21:20:42 +02:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 11:50:07 +02:00
|
|
|
const SummaryConfig& EclipseState::getSummaryConfig() const {
|
2016-05-20 13:03:24 +02:00
|
|
|
return m_eclipseConfig.getSummaryConfig();
|
2016-05-02 11:50:07 +02:00
|
|
|
}
|
|
|
|
|
|
2016-07-20 16:26:46 +02:00
|
|
|
const RestartConfig& EclipseState::getRestartConfig() const {
|
|
|
|
|
return m_eclipseConfig.getRestartConfig();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RestartConfig& EclipseState::getRestartConfig() {
|
|
|
|
|
return const_cast< RestartConfig& >( m_eclipseConfig.getRestartConfig() );
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-11 14:28:24 +02:00
|
|
|
const Eclipse3DProperties& EclipseState::get3DProperties() const {
|
2016-03-08 17:07:42 +01:00
|
|
|
return m_eclipseProperties;
|
|
|
|
|
}
|
2015-08-28 15:41:04 +02:00
|
|
|
|
2016-04-12 09:01:33 +08:00
|
|
|
const MessageContainer& EclipseState::getMessageContainer() const {
|
|
|
|
|
return m_messageContainer;
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-25 12:46:06 +02:00
|
|
|
|
2016-04-12 09:01:33 +08:00
|
|
|
MessageContainer& EclipseState::getMessageContainer() {
|
2016-04-11 10:44:39 +08:00
|
|
|
return m_messageContainer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-04-01 15:27:40 +02:00
|
|
|
const TableManager& EclipseState::getTableManager() const {
|
2015-08-28 15:41:04 +02:00
|
|
|
return m_tables;
|
2015-03-21 15:22:56 +01:00
|
|
|
}
|
|
|
|
|
|
2016-03-16 17:15:09 +08:00
|
|
|
const ParseContext& EclipseState::getParseContext() const {
|
|
|
|
|
return m_parseContext;
|
2015-09-23 10:36:10 +02:00
|
|
|
}
|
|
|
|
|
|
2016-10-07 12:57:26 +02:00
|
|
|
const Schedule& EclipseState::getSchedule() const {
|
|
|
|
|
return *m_schedule;
|
2014-01-07 17:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2016-08-08 11:39:59 +02:00
|
|
|
/// [[deprecated]] --- use cfg().io()
|
2016-10-10 09:52:52 +02:00
|
|
|
const IOConfig& EclipseState::getIOConfig() const {
|
|
|
|
|
return m_eclipseConfig.io();
|
2015-06-11 16:10:27 +02:00
|
|
|
}
|
|
|
|
|
|
2016-08-08 11:39:59 +02:00
|
|
|
/// [[deprecated]] --- use cfg().io()
|
2016-10-10 09:52:52 +02:00
|
|
|
IOConfig& EclipseState::getIOConfig() {
|
|
|
|
|
return m_eclipseConfig.io();
|
2015-05-24 14:40:10 +02:00
|
|
|
}
|
|
|
|
|
|
2016-08-08 11:39:59 +02:00
|
|
|
/// [[deprecated]] --- use cfg().init()
|
2016-08-08 09:37:13 +02:00
|
|
|
const InitConfig& EclipseState::getInitConfig() const {
|
2016-05-20 13:03:24 +02:00
|
|
|
return m_eclipseConfig.getInitConfig();
|
2015-06-09 09:40:48 +02:00
|
|
|
}
|
|
|
|
|
|
2016-08-08 11:39:59 +02:00
|
|
|
/// [[deprecated]] --- use cfg()
|
2016-06-29 16:38:09 +02:00
|
|
|
const EclipseConfig& EclipseState::getEclipseConfig() const {
|
2016-08-08 11:39:59 +02:00
|
|
|
return cfg();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const EclipseConfig& EclipseState::cfg() const {
|
2016-06-29 16:38:09 +02:00
|
|
|
return m_eclipseConfig;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-08 11:39:59 +02:00
|
|
|
/// [[deprecated]] --- use cfg().simulation()
|
2016-08-08 09:37:13 +02:00
|
|
|
const SimulationConfig& EclipseState::getSimulationConfig() const {
|
2016-05-20 13:03:24 +02:00
|
|
|
return m_eclipseConfig.getSimulationConfig();
|
2015-02-12 16:51:04 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 17:50:45 +02:00
|
|
|
const FaultCollection& EclipseState::getFaults() const {
|
2014-07-05 13:47:22 +02:00
|
|
|
return m_faults;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 15:07:15 +02:00
|
|
|
const TransMult& EclipseState::getTransMult() const {
|
2014-06-23 11:58:27 +02:00
|
|
|
return m_transMult;
|
|
|
|
|
}
|
2014-01-07 17:39:07 +01:00
|
|
|
|
2016-05-13 14:09:29 +02:00
|
|
|
const NNC& EclipseState::getInputNNC() const {
|
|
|
|
|
return m_inputNnc;
|
2015-06-10 09:02:51 +02:00
|
|
|
}
|
|
|
|
|
|
2016-05-13 14:09:29 +02:00
|
|
|
bool EclipseState::hasInputNNC() const {
|
|
|
|
|
return m_inputNnc.hasNNC();
|
2015-07-13 11:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
2014-01-29 19:39:33 +01:00
|
|
|
std::string EclipseState::getTitle() const {
|
|
|
|
|
return m_title;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-16 14:51:57 +01:00
|
|
|
void EclipseState::initTransMult() {
|
2016-04-01 15:27:40 +02:00
|
|
|
const auto& p = m_eclipseProperties;
|
2016-03-08 17:07:42 +01:00
|
|
|
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTX"))
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.applyMULT(p.getDoubleGridProperty("MULTX"), FaceDir::XPlus);
|
2016-03-08 17:07:42 +01:00
|
|
|
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTX-"))
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.applyMULT(p.getDoubleGridProperty("MULTX-"), FaceDir::XMinus);
|
2014-07-15 14:09:56 +02:00
|
|
|
|
2016-03-08 17:07:42 +01:00
|
|
|
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTY"))
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.applyMULT(p.getDoubleGridProperty("MULTY"), FaceDir::YPlus);
|
2016-03-08 17:07:42 +01:00
|
|
|
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTY-"))
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.applyMULT(p.getDoubleGridProperty("MULTY-"), FaceDir::YMinus);
|
2014-07-15 14:09:56 +02:00
|
|
|
|
2016-03-08 17:07:42 +01:00
|
|
|
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTZ"))
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.applyMULT(p.getDoubleGridProperty("MULTZ"), FaceDir::ZPlus);
|
2016-03-08 17:07:42 +01:00
|
|
|
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTZ-"))
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.applyMULT(p.getDoubleGridProperty("MULTZ-"), FaceDir::ZMinus);
|
2014-06-23 11:58:27 +02:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 17:50:45 +02:00
|
|
|
void EclipseState::initFaults(const Deck& deck) {
|
2016-06-20 12:27:56 +02:00
|
|
|
const GRIDSection gridSection ( deck );
|
2014-12-08 13:39:32 +01:00
|
|
|
|
2016-06-20 12:27:56 +02:00
|
|
|
m_faults = FaultCollection(gridSection, *m_inputGrid);
|
2015-01-16 14:51:57 +01:00
|
|
|
setMULTFLT(gridSection);
|
2014-07-09 13:27:26 +02:00
|
|
|
|
2016-05-02 17:46:20 +02:00
|
|
|
if (Section::hasEDIT(deck)) {
|
2016-06-20 12:27:56 +02:00
|
|
|
setMULTFLT(EDITSection ( deck ));
|
2014-07-09 13:27:26 +02:00
|
|
|
}
|
|
|
|
|
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.applyMULTFLT( m_faults );
|
2014-07-05 13:47:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-09-19 12:53:46 +02:00
|
|
|
|
2016-06-21 11:43:20 +02:00
|
|
|
void EclipseState::setMULTFLT(const Section& section) {
|
2016-06-20 12:27:56 +02:00
|
|
|
for (size_t index=0; index < section.count("MULTFLT"); index++) {
|
|
|
|
|
const auto& faultsKeyword = section.getKeyword("MULTFLT" , index);
|
2016-02-09 12:09:40 +01:00
|
|
|
for (auto iter = faultsKeyword.begin(); iter != faultsKeyword.end(); ++iter) {
|
2015-06-09 09:40:48 +02:00
|
|
|
|
2016-02-09 12:09:40 +01:00
|
|
|
const auto& faultRecord = *iter;
|
|
|
|
|
const std::string& faultName = faultRecord.getItem(0).get< std::string >(0);
|
|
|
|
|
double multFlt = faultRecord.getItem(1).get< double >(0);
|
2014-12-08 13:39:32 +01:00
|
|
|
|
2016-05-02 17:46:20 +02:00
|
|
|
m_faults.setTransMult( faultName , multFlt );
|
2014-07-05 13:47:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-02 17:46:20 +02:00
|
|
|
void EclipseState::complainAboutAmbiguousKeyword(const Deck& deck, const std::string& keywordName) {
|
2016-04-14 11:03:53 +08:00
|
|
|
m_messageContainer.error("The " + keywordName + " keyword must be unique in the deck. Ignoring all!");
|
2016-05-02 17:46:20 +02:00
|
|
|
auto keywords = deck.getKeywordList(keywordName);
|
2015-01-16 13:01:10 +01:00
|
|
|
for (size_t i = 0; i < keywords.size(); ++i) {
|
|
|
|
|
std::string msg = "Ambiguous keyword "+keywordName+" defined here";
|
2016-04-19 15:06:03 +08:00
|
|
|
m_messageContainer.error(keywords[i]->getFileName(), msg, keywords[i]->getLineNumber());
|
2015-01-16 13:01:10 +01:00
|
|
|
}
|
2014-05-30 13:20:30 +02:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 17:50:45 +02:00
|
|
|
void EclipseState::applyModifierDeck(const Deck& deck) {
|
2015-11-02 12:18:03 +01:00
|
|
|
using namespace ParserKeywords;
|
2016-05-02 17:50:45 +02:00
|
|
|
for (const auto& keyword : deck) {
|
2015-11-02 12:18:03 +01:00
|
|
|
|
2016-02-09 12:09:40 +01:00
|
|
|
if (keyword.isKeyword<MULTFLT>()) {
|
|
|
|
|
for (const auto& record : keyword) {
|
|
|
|
|
const std::string& faultName = record.getItem<MULTFLT::fault>().get< std::string >(0);
|
2016-05-02 17:50:45 +02:00
|
|
|
auto& fault = m_faults.getFault( faultName );
|
2016-02-09 12:09:40 +01:00
|
|
|
double tmpMultFlt = record.getItem<MULTFLT::factor>().get< double >(0);
|
2016-05-02 17:50:45 +02:00
|
|
|
double oldMultFlt = fault.getTransMult( );
|
2015-11-02 12:18:03 +01:00
|
|
|
double newMultFlt = oldMultFlt * tmpMultFlt;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
This extremely contrived way of doing it is because of difference in
|
|
|
|
|
behavior and section awareness between the Fault object and the
|
|
|
|
|
Transmult object:
|
|
|
|
|
|
|
|
|
|
1. MULTFLT keywords found in the SCHEDULE section should apply the
|
|
|
|
|
transmissibility modifiers cumulatively - i.e. the current
|
|
|
|
|
transmissibility across the fault should be *multiplied* with the
|
|
|
|
|
newly entered MULTFLT value, and the resulting transmissibility
|
|
|
|
|
multplier for this fault should be the product of the newly
|
|
|
|
|
entered value and the current value.
|
|
|
|
|
|
|
|
|
|
2. The TransMult::applyMULTFLT() implementation will *multiply* the
|
|
|
|
|
transmissibility across a face with the value in the fault
|
|
|
|
|
object. Hence the current value has already been multiplied in;
|
|
|
|
|
we therefor first *set* the MULTFLT value to the new value, then
|
|
|
|
|
apply it to the TransMult object and then eventually update the
|
|
|
|
|
MULTFLT value in the fault instance.
|
|
|
|
|
|
|
|
|
|
*/
|
2016-05-02 17:50:45 +02:00
|
|
|
fault.setTransMult( tmpMultFlt );
|
2016-08-05 15:07:15 +02:00
|
|
|
m_transMult.applyMULTFLT( fault );
|
2016-05-02 17:50:45 +02:00
|
|
|
fault.setTransMult( newMultFlt );
|
2015-11-02 12:18:03 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-01-07 17:39:07 +01:00
|
|
|
}
|