Merge pull request #1467 from joakim-hove/rst-units
Add units to rst classes
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
@@ -49,9 +50,11 @@ void compare_connections(const RestartIO::RstConnection& rst_conn, const Connect
|
||||
BOOST_CHECK_EQUAL(rst_conn.insert_index, static_cast<int>(sched_conn.getSeqIndex()));
|
||||
BOOST_CHECK(rst_conn.state == sched_conn.state());
|
||||
BOOST_CHECK(rst_conn.dir == sched_conn.dir());
|
||||
BOOST_CHECK_CLOSE( rst_conn.tran, sched_conn.CF() , 1e-6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void compare_wells(const RestartIO::RstWell& rst_well, const Well& sched_well) {
|
||||
BOOST_CHECK_EQUAL(rst_well.name, sched_well.name());
|
||||
BOOST_CHECK_EQUAL(rst_well.group, sched_well.groupName());
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <opm/io/eclipse/rst/state.hpp>
|
||||
#include <opm/io/eclipse/ERst.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +36,16 @@ int main(int argc, char ** argv) {
|
||||
std::cout << "Loading restart step: " << report_step << std::endl;
|
||||
const auto& state = Opm::RestartIO::RstState::load(rst_file, report_step);
|
||||
static_cast<void>(state); // Suppress unused variable warning.
|
||||
|
||||
|
||||
|
||||
for (const auto& rst_well : state.wells) {
|
||||
std::cout << "Loading well " << rst_well.name << std::endl;
|
||||
for (const auto& rst_segment : rst_well.segments) {
|
||||
std::cout << " Segment: " << rst_segment.segment << std::endl;
|
||||
Opm::Segment segment(rst_segment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@ BOOST_AUTO_TEST_CASE(MSW_RST) {
|
||||
);
|
||||
const auto& iseg = amswd.getISeg();
|
||||
const auto& rseg = amswd.getRSeg();
|
||||
auto segment = Opm::RestartIO::RstSegment(iseg.data(), rseg.data());
|
||||
auto segment = Opm::RestartIO::RstSegment(simCase.es.getUnits(), iseg.data(), rseg.data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -827,7 +827,8 @@ BOOST_AUTO_TEST_CASE(WELL_POD) {
|
||||
std::size_t scon_offset = header.nsconz * header.ncwmax * iw;
|
||||
std::size_t xcon_offset = header.nxconz * header.ncwmax * iw;
|
||||
|
||||
wells.emplace_back(header,
|
||||
wells.emplace_back(units,
|
||||
header,
|
||||
"GROUP",
|
||||
zwel.data() + zwel_offset,
|
||||
iwel.data() + iwel_offset,
|
||||
|
||||
@@ -232,6 +232,7 @@ BOOST_AUTO_TEST_CASE(group_test) {
|
||||
const auto& xgrp = groupData.getXGroup();
|
||||
const auto& zgrp8 = groupData.getZGroup();
|
||||
|
||||
Opm::UnitSystem unit_system(Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC);
|
||||
std::vector<std::string> zgrp;
|
||||
for (const auto& s8: zgrp8)
|
||||
zgrp.push_back(s8.c_str());
|
||||
@@ -243,7 +244,8 @@ BOOST_AUTO_TEST_CASE(group_test) {
|
||||
std::size_t sgrp_offset = ig * header.nsgrpz;
|
||||
std::size_t xgrp_offset = ig * header.nxgrpz;
|
||||
|
||||
Opm::RestartIO::RstGroup group(zgrp.data() + zgrp_offset,
|
||||
Opm::RestartIO::RstGroup group(unit_system,
|
||||
zgrp.data() + zgrp_offset,
|
||||
igrp.data() + igrp_offset,
|
||||
sgrp.data() + sgrp_offset,
|
||||
xgrp.data() + xgrp_offset);
|
||||
@@ -254,7 +256,7 @@ BOOST_AUTO_TEST_CASE(State_test) {
|
||||
const auto simCase = SimulationCase{first_sim()};
|
||||
const auto& units = simCase.es.getUnits();
|
||||
// Report Step 2: 2011-01-20 --> 2013-06-15
|
||||
const auto rptStep = std::size_t{2};
|
||||
const auto rptStep = std::size_t{4};
|
||||
const auto sim_step = rptStep - 1;
|
||||
Opm::SummaryState sumState(std::chrono::system_clock::now());
|
||||
|
||||
@@ -304,8 +306,12 @@ BOOST_AUTO_TEST_CASE(State_test) {
|
||||
for (const auto& s8: zgrp8)
|
||||
zgrp.push_back(s8.c_str());
|
||||
|
||||
Opm::RestartIO::RstState state(ih, lh, dh,
|
||||
Opm::RestartIO::RstState state(units,
|
||||
ih, lh, dh,
|
||||
zgrp, igrp, sgrp, xgrp,
|
||||
zwel, iwel, swel, xwel,
|
||||
icon, scon, xcon);
|
||||
|
||||
const auto& well = state.get_well("OP_3");
|
||||
BOOST_CHECK_THROW(well.segment(10), std::invalid_argument);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user