Delete unused code for ?CON serialization

This commit is contained in:
Joakim Hove 2019-04-17 10:14:01 +02:00
parent eef4cad54f
commit b5dbc3d8e5
8 changed files with 0 additions and 301 deletions

View File

@ -171,7 +171,6 @@ if(ENABLE_ECL_OUTPUT)
src/opm/output/eclipse/CreateDoubHead.cpp
src/opm/output/eclipse/CreateInteHead.cpp
src/opm/output/eclipse/CreateLogiHead.cpp
src/opm/output/eclipse/WellDataSerializers.cpp
src/opm/output/eclipse/DoubHEAD.cpp
src/opm/output/eclipse/EclipseGridInspector.cpp
src/opm/output/eclipse/EclipseIO.cpp
@ -290,8 +289,6 @@ if(ENABLE_ECL_OUTPUT)
tests/test_Wells.cpp
tests/test_WindowedArray.cpp
tests/test_writenumwells.cpp
tests/test_serialize_ICON.cpp
tests/test_serialize_SCON.cpp
)
endif()

View File

@ -64,17 +64,6 @@ namespace Opm { namespace RestartIO { namespace Helpers {
createLogiHead(const EclipseState& es);
std::vector<int> serialize_ICON(int lookup_step, // The integer index used to look up dynamic properties, e.g. the number of well.
int ncwmax, // Max number of completions per well, should be entry 17 from createInteHead.
int niconz, // Number of elements per completion in ICON, should be entry 32 from createInteHead.
const std::vector<const Well*>& sched_wells);
std::vector<double> serialize_SCON(int lookup_step, // The integer index used to look up dynamic properties, e.g. the number of well.
int ncwmax, // Max number of completions per well, should be entry 17 from createInteHead.
int nsconz, // Number of elements per completion in SCON, should be entry 33 from createInteHead.
const std::vector<const Well*>& sched_wells,
const UnitSystem& units);
}}} // Opm::RestartIO::Helpers
#endif // OPM_WRITE_RESTART_HELPERS_HPP

View File

@ -113,7 +113,6 @@ namespace Opm
size_t numWells() const;
size_t numWells(size_t timestep) const;
size_t getMaxNumConnectionsForWells(size_t timestep) const;
bool hasWell(const std::string& wellName) const;
std::vector<std::string> wellNames(const std::string& pattern, size_t timeStep, const std::vector<std::string>& matching_wells = {}) const;

View File

@ -1,94 +0,0 @@
/*
Copyright (c) 2018 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/output/eclipse/WriteRestartHelpers.hpp>
#include <ert/ecl_well/well_const.h> // containts ICON_XXX_INDEX
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <vector>
// ----------------------------------------------------------------------------
std::vector<double>
Opm::RestartIO::Helpers::
serialize_SCON(int lookup_step,
int ncwmax,
int nsconz,
const std::vector<const Well*>& sched_wells,
const UnitSystem& units)
// ----------------------------------------------------------------------------
{
const size_t well_field_size = ncwmax * nsconz;
std::vector<double> data(sched_wells.size() * well_field_size, 0);
size_t well_offset = 0;
for (const Opm::Well* well : sched_wells) {
const auto& connections = well->getConnections( lookup_step );
size_t connection_offset = 0;
bool explicit_ctf_not_found = false;
for (const auto& connection : connections) {
const size_t offset = well_offset + connection_offset;
data[ offset + SCON_CF_INDEX ] = units.from_si(Opm::UnitSystem::measure::transmissibility,connection.CF());
data[ offset + SCON_KH_INDEX ] = units.from_si(Opm::UnitSystem::measure::effective_Kh, connection.Kh());
connection_offset += nsconz;
}
if (explicit_ctf_not_found) {
OpmLog::warning("restart output connection data missing",
"Explicit connection transmissibility factors for well " + well->name() + " missing, writing dummy values to restart file.");
}
well_offset += well_field_size;
}
return data;
}
// ----------------------------------------------------------------------------
std::vector<int>
Opm::RestartIO::Helpers::
serialize_ICON(int lookup_step,
int ncwmax,
int niconz,
const std::vector<const Opm::Well*>& sched_wells)
// ----------------------------------------------------------------------------
{
const size_t well_field_size = ncwmax * niconz;
std::vector<int> data(sched_wells.size() * well_field_size, 0);
size_t well_offset = 0;
for (const Opm::Well* well : sched_wells) {
const auto& connections = well->getConnections( lookup_step );
size_t connection_offset = 0;
for (const auto& connection : connections) {
const size_t offset = well_offset + connection_offset;
data[ offset + ICON_IC_INDEX ] = connection.complnum();
data[ offset + ICON_I_INDEX ] = connection.getI() + 1;
data[ offset + ICON_J_INDEX ] = connection.getJ() + 1;
data[ offset + ICON_K_INDEX ] = connection.getK() + 1;
data[ offset + ICON_DIRECTION_INDEX ] = connection.dir();
data[ offset + ICON_STATUS_INDEX ] =
(connection.state() == WellCompletion::StateEnum::OPEN) ?
1 : -1000;
data[ offset + ICON_SEGMENT_INDEX ] =
connection.attachedToSegment() ?
connection.segment() : 0;
connection_offset += niconz;
}
well_offset += well_field_size;
}
return data;
}

View File

@ -1956,16 +1956,6 @@ namespace Opm {
else throw std::invalid_argument("String " + eclipseString + " not recognized as a boolean-convertible string.");
}
size_t Schedule::getMaxNumConnectionsForWells(size_t timestep) const {
size_t ncwmax = 0;
for( const auto& well_pair : this->m_wells) {
const auto& completions = well_pair.second.getConnections(timestep);
if( completions.size() > ncwmax )
ncwmax = completions.size();
}
return ncwmax;
}
const Tuning& Schedule::getTuning() const {
return this->m_tuning;

View File

@ -557,18 +557,6 @@ BOOST_AUTO_TEST_CASE(ReturnNumWellsTimestep) {
BOOST_CHECK_EQUAL(schedule.numWells(3), 3);
}
BOOST_AUTO_TEST_CASE(ReturnMaxNumCompletionsForWellsInTimestep) {
EclipseGrid grid(10,10,10);
auto deck = createDeckWithWellsAndCompletionData();
TableManager table ( deck );
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Runspec runspec (deck);
Schedule schedule(deck, grid , eclipseProperties, runspec);
BOOST_CHECK_EQUAL(schedule.getMaxNumConnectionsForWells(1), 7);
BOOST_CHECK_EQUAL(schedule.getMaxNumConnectionsForWells(3), 9);
}
BOOST_AUTO_TEST_CASE(TestCrossFlowHandling) {
EclipseGrid grid(10,10,10);
auto deck = createDeckForTestingCrossFlow();

View File

@ -1,98 +0,0 @@
/*
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 <config.h>
#include <iostream> // @@
#include <algorithm> // @@
#include <iterator> // @@
#define BOOST_TEST_MODULE serialize_ICON_TEST
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <ert/ecl_well/well_const.h> // containts ICON_XXX_INDEX
#include <opm/output/eclipse/WriteRestartHelpers.hpp>
BOOST_AUTO_TEST_CASE( serialize_icon_test )
{
const Opm::Deck deck(Opm::Parser{}.parseFile("FIRST_SIM.DATA"));
const Opm::EclipseState state(deck);
const Opm::Schedule schedule(deck, state);
const Opm::TimeMap timemap(deck);
for (size_t tstep = 0; tstep != timemap.numTimesteps(); ++tstep) {
const size_t ncwmax = schedule.getMaxNumConnectionsForWells(tstep);
const int ICONZ = 25; // normally obtained from InteHead
const auto wells = schedule.getWells(tstep);
const std::vector<int> icondata =
Opm::RestartIO::Helpers::serialize_ICON(tstep,
ncwmax,
ICONZ,
wells);
size_t w_offset = 0;
for (const auto w : wells) {
size_t c_offset = 0;
for (const auto c : w->getConnections(tstep)) {
const size_t offset = w_offset + c_offset;
BOOST_CHECK_EQUAL(icondata[offset + ICON_IC_INDEX],
c.complnum());
BOOST_CHECK_EQUAL(icondata[offset + ICON_I_INDEX],
c.getI() + 1);
BOOST_CHECK_EQUAL(icondata[offset + ICON_J_INDEX],
c.getJ() + 1);
BOOST_CHECK_EQUAL(icondata[offset + ICON_K_INDEX],
c.getK() + 1);
BOOST_CHECK_EQUAL(icondata[offset + ICON_DIRECTION_INDEX],
c.dir());
if (c.state() == Opm::WellCompletion::StateEnum::OPEN)
BOOST_CHECK_EQUAL(icondata[offset + ICON_STATUS_INDEX],
1);
else
BOOST_CHECK_EQUAL(icondata[offset + ICON_STATUS_INDEX],
-1000);
if (c.attachedToSegment())
BOOST_CHECK_EQUAL(icondata[offset + ICON_SEGMENT_INDEX],
c.segment());
else
BOOST_CHECK_EQUAL(icondata[offset + ICON_SEGMENT_INDEX],
0);
c_offset += ICONZ;
}
w_offset += (ICONZ * ncwmax);
}
std::copy(icondata.begin(),
icondata.end(),
std::ostream_iterator<int>(std::cout, " "));
std::cout << std::endl;
BOOST_CHECK_EQUAL(1, 1);// @@@
}
}

View File

@ -1,72 +0,0 @@
/*
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 <config.h>
#define BOOST_TEST_MODULE serialize_SCON_TEST
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <ert/ecl_well/well_const.h> // containts SCON_CF_INDEX
#include <opm/output/eclipse/WriteRestartHelpers.hpp>
BOOST_AUTO_TEST_CASE( serialize_scon_test )
{
const Opm::Deck deck(Opm::Parser{}.parseFile("FIRST_SIM.DATA"));
Opm::UnitSystem units(Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC); // Unit system used in deck FIRST_SIM.DATA.
const Opm::EclipseState state(deck);
const Opm::Schedule schedule(deck, state);
const Opm::TimeMap timemap(deck);
for (size_t tstep = 0; tstep != timemap.numTimesteps(); ++tstep) {
const size_t ncwmax = schedule.getMaxNumConnectionsForWells(tstep);
const int SCONZ = 40; // normally obtained from InteHead
const auto wells = schedule.getWells(tstep);
const std::vector<double> scondata =
Opm::RestartIO::Helpers::serialize_SCON(tstep,
ncwmax,
SCONZ,
wells,
units);
size_t w_offset = 0;
for (const auto w : wells) {
size_t c_offset = 0;
for (const auto c : w->getConnections(tstep)) {
const size_t offset = w_offset + c_offset;
const double expected_cf = units.from_si(Opm::UnitSystem::measure::transmissibility, c.CF());
const double expected_kh = units.from_si(Opm::UnitSystem::measure::effective_Kh, c.Kh());
BOOST_CHECK_EQUAL(scondata[offset + SCON_CF_INDEX],
expected_cf);
BOOST_CHECK_EQUAL(scondata[offset + SCON_KH_INDEX],
expected_kh);
c_offset += SCONZ;
}
w_offset += (SCONZ * ncwmax);
}
}
};