Merge pull request #1546 from joakim-hove/rst-small

Rst small
This commit is contained in:
Joakim Hove 2020-03-09 16:56:30 +01:00 committed by GitHub
commit ed0018ac98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 16 deletions

View File

@ -26,14 +26,13 @@
#include <opm/io/eclipse/rst/header.hpp>
#include <opm/io/eclipse/rst/group.hpp>
#include <opm/io/eclipse/rst/well.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
namespace Opm {
class UnitSystem;
namespace RestartIO {
struct RstState {
RstState(const ::Opm::UnitSystem& unit_system,
@ -74,10 +73,13 @@ struct RstState {
static RstState load(EclIO::ERst& rst_file, int report_step);
const RstWell& get_well(const std::string& wname) const;
const ::Opm::UnitSystem unit_system;
RstHeader header;
std::vector<RstWell> wells;
std::vector<RstGroup> groups;
RstHeader header;
Tuning tuning;
private:
void load_tuning(const ::Opm::UnitSystem& unit_system,
const std::vector<int>& intehead,

View File

@ -62,9 +62,9 @@ namespace Opm {
WellSegments() = default;
WellSegments(const DeckKeyword& keyword);
WellSegments(CompPressureDrop compDrop,
const std::vector<Segment>& segments);
explicit WellSegments(const DeckKeyword& keyword);
std::size_t size() const;
double depthTopSegment() const;

View File

@ -64,7 +64,7 @@ RstConnection::RstConnection(const ::Opm::UnitSystem& unit_system, const int* ic
state( from_int<Connection::State>(icon[VI::IConn::ConnStat])),
drain_sat_table( icon[VI::IConn::Drainage]),
imb_sat_table( icon[VI::IConn::Imbibition]),
completion( icon[VI::IConn::ComplNum] - 1),
completion( icon[VI::IConn::ComplNum]),
dir( from_int<Connection::Direction>(icon[VI::IConn::ConnDir])),
segment( icon[VI::IConn::Segment] - 1),
tran( unit_system.to_si(M::transmissibility, scon[VI::SConn::ConnTrans])),

View File

@ -28,14 +28,13 @@
#include <opm/output/eclipse/VectorItems/intehead.hpp>
#include <opm/output/eclipse/VectorItems/doubhead.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
namespace VI = ::Opm::RestartIO::Helpers::VectorItems;
namespace Opm {
namespace RestartIO {
RstState::RstState(const ::Opm::UnitSystem& unit_system,
RstState::RstState(const ::Opm::UnitSystem& unit_system_,
const std::vector<int>& intehead,
const std::vector<bool>& logihead,
const std::vector<double>& doubhead,
@ -50,6 +49,7 @@ RstState::RstState(const ::Opm::UnitSystem& unit_system,
const std::vector<int>& icon,
const std::vector<float>& scon,
const std::vector<double>& xcon):
unit_system(unit_system_),
header(intehead, logihead, doubhead)
{
this->add_groups(unit_system, zgrp, igrp, sgrp, xgrp);
@ -66,7 +66,7 @@ RstState::RstState(const ::Opm::UnitSystem& unit_system,
int group_index = iwel[ iwel_offset + VI::IWell::Group ] - 1;
const std::string group = this->groups[group_index].name;
this->wells.emplace_back(unit_system,
this->wells.emplace_back(this->unit_system,
this->header,
group,
zwel.data() + zwel_offset,
@ -82,7 +82,7 @@ RstState::RstState(const ::Opm::UnitSystem& unit_system,
}
}
RstState::RstState(const ::Opm::UnitSystem& unit_system,
RstState::RstState(const ::Opm::UnitSystem& unit_system_,
const std::vector<int>& intehead,
const std::vector<bool>& logihead,
const std::vector<double>& doubhead,
@ -99,6 +99,7 @@ RstState::RstState(const ::Opm::UnitSystem& unit_system,
const std::vector<double>& xcon,
const std::vector<int>& iseg,
const std::vector<double>& rseg) :
unit_system(unit_system_),
header(intehead, logihead, doubhead)
{
this->add_groups(unit_system, zgrp, igrp, sgrp, xgrp);
@ -115,7 +116,7 @@ RstState::RstState(const ::Opm::UnitSystem& unit_system,
int group_index = iwel[ iwel_offset + VI::IWell::Group ] - 1;
const std::string group = this->groups[group_index].name;
this->wells.emplace_back(unit_system,
this->wells.emplace_back(this->unit_system,
this->header,
group,
zwel.data() + zwel_offset,
@ -181,7 +182,7 @@ void RstState::add_groups(const ::Opm::UnitSystem& unit_system,
std::size_t sgrp_offset = ig * this->header.nsgrpz;
std::size_t xgrp_offset = ig * this->header.nxgrpz;
this->groups.emplace_back(unit_system,
this->groups.emplace_back(this->unit_system,
zgrp.data() + zgrp_offset,
igrp.data() + igrp_offset,
sgrp.data() + sgrp_offset,

View File

@ -35,6 +35,14 @@ namespace RestartIO {
using M = ::Opm::UnitSystem::measure;
double swel_value(float raw_value) {
const auto infty = 1.0e+20f;
if (raw_value == infty)
return 0;
else
return raw_value;
}
RstWell::RstWell(const ::Opm::UnitSystem& unit_system,
const RstHeader& header,
const std::string& group_arg,
@ -57,11 +65,11 @@ RstWell::RstWell(const ::Opm::UnitSystem& unit_system,
hist_requested_control( iwel[VI::IWell::HistReqWCtrl]),
msw_index( iwel[VI::IWell::MsWID]),
completion_ordering( iwel[VI::IWell::CompOrd]),
orat_target( unit_system.to_si(M::identity, swel[VI::SWell::OilRateTarget])),
wrat_target( unit_system.to_si(M::identity, swel[VI::SWell::WatRateTarget])),
grat_target( unit_system.to_si(M::identity, swel[VI::SWell::GasRateTarget])),
lrat_target( unit_system.to_si(M::identity, swel[VI::SWell::LiqRateTarget])),
resv_target( unit_system.to_si(M::identity, swel[VI::SWell::ResVRateTarget])),
orat_target( unit_system.to_si(M::identity, swel_value(swel[VI::SWell::OilRateTarget]))),
wrat_target( unit_system.to_si(M::identity, swel_value(swel[VI::SWell::WatRateTarget]))),
grat_target( unit_system.to_si(M::identity, swel_value(swel[VI::SWell::GasRateTarget]))),
lrat_target( unit_system.to_si(M::identity, swel_value(swel[VI::SWell::LiqRateTarget]))),
resv_target( unit_system.to_si(M::identity, swel_value(swel[VI::SWell::ResVRateTarget]))),
thp_target( unit_system.to_si(M::identity, swel[VI::SWell::THPTarget])),
bhp_target_float( unit_system.to_si(M::identity, swel[VI::SWell::BHPTarget])),
hist_lrat_target( unit_system.to_si(M::liquid_surface_rate, swel[VI::SWell::HistLiqRateTarget])),

View File

@ -107,6 +107,7 @@ static constexpr double invalid_value = -1.e100;
segment.
*/
double segment_length = -1;
throw std::logic_error("Sorry can not create a Valve segment from restart file");
this->updateValve(valve, segment_length);
}
}