Store EDITNNC in the EclipseState for latter usage by the simulator.
Only the simulator is able to determine all NNCs and therefore it needs to apply the multiplicators itself.
This commit is contained in:
@@ -53,6 +53,7 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/EclipseConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/EclipseState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/EndpointScaling.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Edit/EDITNNC.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/Box.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/BoxManager.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/EclipseGrid.cpp
|
||||
@@ -361,6 +362,7 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Util/Value.hpp
|
||||
opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp
|
||||
opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/GridDims.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/TransMult.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
@@ -85,6 +86,11 @@ namespace Opm {
|
||||
const NNC& getInputNNC() const;
|
||||
bool hasInputNNC() const;
|
||||
|
||||
/// editing non-neighboring connections
|
||||
/// the non-standard adjacencies as specified in input deck
|
||||
const EDITNNC& getInputEDITNNC() const;
|
||||
bool hasInputEDITNNC() const;
|
||||
|
||||
const Eclipse3DProperties& get3DProperties() const;
|
||||
const TableManager& getTableManager() const;
|
||||
const EclipseConfig& getEclipseConfig() const;
|
||||
@@ -118,6 +124,7 @@ namespace Opm {
|
||||
EclipseConfig m_eclipseConfig;
|
||||
UnitSystem m_deckUnitSystem;
|
||||
NNC m_inputNnc;
|
||||
EDITNNC m_inputEditNnc;
|
||||
EclipseGrid m_inputGrid;
|
||||
Eclipse3DProperties m_eclipseProperties;
|
||||
const SimulationConfig m_simulationConfig;
|
||||
|
||||
48
opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp
Normal file
48
opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2018 Equinor AS
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef OPM_COMMON_EDITNNC_HPP
|
||||
#define OPM_COMMON_EDITNNC_HPP
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
/// Represents edit information for non-neighboring connections (NNCs, faults, etc.)
|
||||
class EDITNNC
|
||||
{
|
||||
public:
|
||||
EDITNNC() = default;
|
||||
|
||||
/// Construct from input deck
|
||||
explicit EDITNNC(const Deck& deck);
|
||||
/// \brief Get an ordered set of EDITNNC
|
||||
const std::vector<NNCdata>& data() const
|
||||
{
|
||||
return m_editnnc;
|
||||
}
|
||||
/// \brief Get the number of entries
|
||||
size_t size() const;
|
||||
/// \brief Whether EDITNNC was empty.
|
||||
bool empty() const;
|
||||
|
||||
private:
|
||||
std::vector<NNCdata> m_editnnc;
|
||||
};
|
||||
}
|
||||
#endif // OPM_COMMON_EDITNNC_HPP
|
||||
@@ -28,6 +28,10 @@ namespace Opm
|
||||
{
|
||||
|
||||
struct NNCdata {
|
||||
NNCdata(size_t c1, size_t c2, double t)
|
||||
: cell1(c1), cell2(c2), trans(t)
|
||||
{}
|
||||
NNCdata() = default;
|
||||
size_t cell1;
|
||||
size_t cell2;
|
||||
double trans;
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace Opm {
|
||||
m_eclipseConfig( deck ),
|
||||
m_deckUnitSystem( deck.getActiveUnitSystem() ),
|
||||
m_inputNnc( deck ),
|
||||
m_inputEditNnc( deck ),
|
||||
m_inputGrid( deck, nullptr ),
|
||||
m_eclipseProperties( deck, m_tables, m_inputGrid ),
|
||||
m_simulationConfig( m_eclipseConfig.getInitConfig().restartRequested(), deck, m_eclipseProperties ),
|
||||
@@ -160,6 +161,13 @@ namespace Opm {
|
||||
return m_inputNnc.hasNNC();
|
||||
}
|
||||
|
||||
const EDITNNC& EclipseState::getInputEDITNNC() const {
|
||||
return m_inputEditNnc;
|
||||
}
|
||||
|
||||
bool EclipseState::hasInputEDITNNC() const {
|
||||
return !m_inputEditNnc.empty();
|
||||
}
|
||||
std::string EclipseState::getTitle() const {
|
||||
return m_title;
|
||||
}
|
||||
|
||||
72
src/opm/parser/eclipse/EclipseState/Edit/EDITNNC.cpp
Normal file
72
src/opm/parser/eclipse/EclipseState/Edit/EDITNNC.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/E.hpp>
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
void readEditNncs(const std::vector< const DeckKeyword* >& editNncsKw, std::vector<NNCdata>& editNncs, const GridDims& gridDims)
|
||||
{
|
||||
for (size_t idx_nnc = 0; idx_nnc<editNncsKw.size(); ++idx_nnc) {
|
||||
const auto& nnc = *editNncsKw[idx_nnc];
|
||||
editNncs.reserve(editNncs.size()+nnc.size());
|
||||
for (size_t i = 0; i < nnc.size(); ++i) {
|
||||
std::array<size_t, 3> ijk1;
|
||||
ijk1[0] = static_cast<size_t>(nnc.getRecord(i).getItem(0).get< int >(0)-1);
|
||||
ijk1[1] = static_cast<size_t>(nnc.getRecord(i).getItem(1).get< int >(0)-1);
|
||||
ijk1[2] = static_cast<size_t>(nnc.getRecord(i).getItem(2).get< int >(0)-1);
|
||||
size_t global_index1 = gridDims.getGlobalIndex(ijk1[0],ijk1[1],ijk1[2]);
|
||||
|
||||
std::array<size_t, 3> ijk2;
|
||||
ijk2[0] = static_cast<size_t>(nnc.getRecord(i).getItem(3).get< int >(0)-1);
|
||||
ijk2[1] = static_cast<size_t>(nnc.getRecord(i).getItem(4).get< int >(0)-1);
|
||||
ijk2[2] = static_cast<size_t>(nnc.getRecord(i).getItem(5).get< int >(0)-1);
|
||||
size_t global_index2 = gridDims.getGlobalIndex(ijk2[0],ijk2[1],ijk2[2]);
|
||||
|
||||
const double trans = nnc.getRecord(i).getItem(6).get<double>(0);
|
||||
using std::abs;
|
||||
if ( ( abs(ijk1[0]-ijk2[0]) > 1 ) || ( abs(ijk1[1]-ijk2[1]) > 1 ) ||
|
||||
( abs(ijk1[2]-ijk2[2]) > 1 ) )
|
||||
{
|
||||
editNncs.emplace_back(global_index1, global_index2, trans);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream sstr;
|
||||
sstr << "Cannot edit neighboring connection from " << global_index1 <<" to "<<
|
||||
global_index2<< " with EDITNNC";
|
||||
Opm::OpmLog::warning(sstr.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EDITNNC::EDITNNC(const Deck& deck)
|
||||
{
|
||||
GridDims gridDims(deck);
|
||||
const auto& tmpEditNncs = deck.getKeywordList<ParserKeywords::EDITNNC>();
|
||||
readEditNncs(tmpEditNncs, m_editnnc, gridDims);
|
||||
auto compare = [](const NNCdata& d1, const NNCdata& d2)
|
||||
{ return d1.cell1 < d2.cell1 ||
|
||||
( d1.cell1 == d2.cell1 && d1.cell2 < d2.cell2 );};
|
||||
std::sort(m_editnnc.begin(), m_editnnc.end(), compare);
|
||||
}
|
||||
|
||||
size_t EDITNNC::size() const {
|
||||
return(m_editnnc.size());
|
||||
}
|
||||
|
||||
bool EDITNNC::empty() const {
|
||||
return m_editnnc.empty();
|
||||
}
|
||||
} // namespace Opm
|
||||
Reference in New Issue
Block a user