Add Connection constructor based on RestartIO::connection

This commit is contained in:
Joakim Hove 2020-03-12 17:54:55 +01:00
parent 03be91a951
commit bf00fec1f9
2 changed files with 47 additions and 1 deletions

View File

@ -33,8 +33,14 @@
namespace Opm {
namespace RestartIO {
class RstConnection;
}
class DeckKeyword;
class DeckRecord;
class EclipseGrid;
class FieldPropsManager;
class Connection {
public:
@ -111,6 +117,7 @@ namespace Opm {
int segment,
double wellPi);
Connection(const RestartIO::RstConnection& rst_connection, std::size_t insert_index, const EclipseGrid& grid, const FieldPropsManager& fp);
bool attachedToSegment() const;
bool sameCoordinate(const int i, const int j, const int k) const;

View File

@ -25,11 +25,13 @@
#include <stdexcept>
#include <vector>
#include <opm/io/eclipse/rst/connection.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/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
@ -70,7 +72,44 @@ namespace Opm {
m_segDistStart(segDistStart),
m_segDistEnd(segDistEnd),
m_defaultSatTabId(defaultSatTabId)
{}
{
}
namespace {
constexpr bool defaultSatTabId = true;
constexpr int compseg_seqIndex = 1;
constexpr double def_wellPi = 1.0;
}
Connection::Connection(const RestartIO::RstConnection& rst_connection, std::size_t insert_index, const EclipseGrid& grid, const FieldPropsManager& fp) :
direction(rst_connection.dir),
center_depth(rst_connection.depth),
open_state(rst_connection.state),
sat_tableId(rst_connection.drain_sat_table),
m_complnum(rst_connection.completion),
m_CF(rst_connection.cf),
m_Kh(rst_connection.kh),
m_rw(rst_connection.diameter / 2),
m_r0(rst_connection.r0),
m_skin_factor(rst_connection.skin_factor),
ijk(rst_connection.ijk),
m_ctfkind(rst_connection.cf_kind),
m_seqIndex(insert_index),
m_segDistStart(rst_connection.segdist_start),
m_segDistEnd(rst_connection.segdist_end),
m_defaultSatTabId(defaultSatTabId),
m_compSeg_seqIndex(compseg_seqIndex),
segment_number(rst_connection.segment),
wPi(def_wellPi)
{
if (this->m_defaultSatTabId) {
const auto& satnum = fp.get_int("SATNUM");
auto active_index = grid.activeIndex(this->ijk[0], this->ijk[1], this->ijk[2]);
this->sat_tableId = satnum[active_index];
}
}
Connection::Connection(Direction dir, double depth, State state,
int satTableId, int complnum, double CF,