Skip to content

Commit

Permalink
Output More Restart File Items
Browse files Browse the repository at this point in the history
Needed for compatibility.
  • Loading branch information
bska committed Jan 30, 2025
1 parent c780f38 commit 27233aa
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 26 deletions.
14 changes: 13 additions & 1 deletion opm/io/eclipse/rst/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ double pressEquivRadius(const float denom,
return rw * std::exp(denom - skin);
}

double pressEquivRadius(const Opm::UnitSystem& usys,
const std::size_t nsconz,
const float* scon,
const float denom,
const float skin,
const float rw)
{
return (nsconz > VI::SConn::PressEquivRad)
? usys.to_si(Opm::UnitSystem::measure::length, scon[VI::SConn::PressEquivRad])
: pressEquivRadius(denom, skin, rw);
}

} // Anonymous namespace

double Opm::RestartIO::RstConnection::inverse_peaceman(double cf, double kh, double rw, double skin)
Expand Down Expand Up @@ -137,7 +149,7 @@ Opm::RestartIO::RstConnection::RstConnection(const UnitSystem& unit_system,
, resv_rate { unit_system.to_si(M::rate, xcon[VI::XConn::ResVRate]) }
// -----------------------------------------------------------------
// Derived quantities
, r0 { pressEquivRadius(this->denom, this->skin_factor, this->diameter / 2) }
, r0 { pressEquivRadius(unit_system, nsconz, scon, this->denom, this->skin_factor, this->diameter / 2) }
{
if (static_cast<std::size_t>(nsconz) > VI::SConn::CFInDeck) {
this->cf_kind = from_float(scon[VI::SConn::CFInDeck]);
Expand Down
4 changes: 4 additions & 0 deletions opm/output/eclipse/AggregateConnectionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ namespace {
iConn[Ix::ConnDir] = static_cast<int>(conn.dir());
iConn[Ix::Segment] = conn.attachedToSegment()
? conn.segment() : 0;

iConn[Ix::ConnIdx] = iConn[Ix::SeqIndex];
}
} // IConn

Expand Down Expand Up @@ -219,6 +221,8 @@ namespace {
staticDFacCorrCoeff(conn.ctfProperties(), units);

sConn[Ix::CFInDeck] = conn.ctfAssignedFromInput() ? 1.0f : 0.0f;

sConn[Ix::PressEquivRad] = scprop(M::length, conn.r0());
}

template <class SConnArray>
Expand Down
31 changes: 17 additions & 14 deletions opm/output/eclipse/CreateInteHead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ namespace {

const int nigrpz = 97 + std::max(nwgmax, ngmax);
const int nsgrpz = 112;
const int nxgrpz = 180 + 4*num_water_tracer;
const int nxgrpz = 181 + 4*num_water_tracer;
const int nzgrpz = 5;

return {{
Expand Down Expand Up @@ -377,10 +377,10 @@ namespace {
std::max(numMSW, wsd.maxSegmentedWells()),
std::max(maxNumSeg, wsd.maxSegmentsPerWell()),
std::max(maxNumBr, wsd.maxLateralBranchesPerWell()),
22, // Number of entries per segment in ISEG (2017.2)
22, // #ISEG elems per segment
Opm::RestartIO::InteHEAD::numRsegElem(rspec.phases())
+ 8*num_water_tracer, // Number of entries per segment in RSEG
10 // Number of entries per segment in ILBR (2017.2)
+ 8*num_water_tracer, // #RSEG elems per segment
10 // #ILBR elems per branch
};
}

Expand Down Expand Up @@ -584,12 +584,15 @@ createInteHead(const EclipseState& es,
report_step, lookup_step))
.calendarDate (getSimulationTimePoint(sched.posixStartTime(), simTime))
.activePhases (getActivePhases(rspec))
// The numbers below have been determined experimentally to work
// across a range of reference cases, but are not guaranteed to be
// universally valid.
.drsdt(sched, lookup_step)
.params_NWELZ (155 + num_water_tracer, 122 + 2*num_water_tracer, 130 + nxwelz_tracer_shift, 3) // n{isxz}welz: number of data elements per well in {ISXZ}WELL
.params_NCON (25, 41, 58 + 5*num_water_tracer) // n{isx}conz: number of data elements per completion in ICON
.drsdt (sched, lookup_step)
// -----------------------------------------------------------------------------------
// NIWELZ | NSWELZ | NXWELZ | NZWELZ
// #IWEL elems per well | #SWEL elems per well | #XWEL elems per well | #ZWEL elems per well
.params_NWELZ (155 + num_water_tracer, 122 + 2*num_water_tracer, 131 + nxwelz_tracer_shift, 3)
// -----------------------------------------------------------------------------------
// NICONZ | NSCONZ | NXCONZ
// #ICON elems per conn | #SCON elems per conn | #XCON elems per conn
.params_NCON (26, 42, 58 + 5*num_water_tracer)
.params_GRPZ (getNGRPZ(nwgmax, ngmax, num_water_tracer, rspec))
.aquiferDimensions (inferAquiferDimensions(es, sched[lookup_step]))
.stepParam (num_solver_steps, report_step)
Expand All @@ -599,16 +602,16 @@ createInteHead(const EclipseState& es,
.regionDimensions (getRegDims(tdim, rdim))
.ngroups ({ ngmax })
.params_NGCTRL (GroupControl(sched, report_step, lookup_step))
.variousParam (201802, 100) // Output should be compatible with Eclipse 100, 2017.02 version.
.variousParam (202204, 100)
.udqParam_1 (getUdqParam(rspec, sched, report_step, lookup_step))
.actionParam (getActionParam(rspec, acts, report_step))
.variousUDQ_ACTIONXParam()
.nominatedPhaseGuideRate(setGuideRateNominatedPhase(sched, report_step, lookup_step))
.whistControlMode (getWhistctlMode(sched, report_step, lookup_step))
.activeNetwork (getActiveNetwork(sched, lookup_step))
.activeNetwork (getActiveNetwork(sched, lookup_step))
.networkDimensions (getNetworkDims(sched, lookup_step, rspec))
.netBalanceData (getNetworkBalanceParameters(sched, report_step))
.rockOpts(getRockOpts(rckcfg,rdim))
.netBalanceData (getNetworkBalanceParameters(sched, report_step))
.rockOpts (getRockOpts(rckcfg, rdim))
;

return ih.data();
Expand Down
12 changes: 6 additions & 6 deletions opm/output/eclipse/InteHEAD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,16 +873,16 @@ int Opm::RestartIO::InteHEAD::numRsegElem(const ::Opm::Phases& phase)
+ phase.active(::Opm::Phase::WATER);

switch (nact) {
case 1: return 126;
case 2: return 134;
case 3: return 146;
case 1: return 127;
case 2: return 135;
case 3: return 147;
}

throw std::invalid_argument {
"NRSEGZ is not supported for " +
std::to_string(nact) +
" active phases"
};
std::to_string(nact) +
" active phases"
};
}

// =====================================================================
Expand Down
11 changes: 8 additions & 3 deletions opm/output/eclipse/VectorItems/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <vector>

namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
namespace Opm::RestartIO::Helpers::VectorItems {
namespace IConn {
enum index : std::vector<int>::size_type {
SeqIndex = 0, // Connection sequence index
Expand All @@ -39,6 +39,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
ConnDir = 13, // Penetration direction (1:X, 2:Y, 3:Z)
Segment = 14, // Segment ID of connection
// 0 for regular connections, > 0 for MSW.

ConnIdx = 25, // Connection index (1-based)
};
} // IConn

Expand Down Expand Up @@ -67,7 +69,10 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
StaticDFacCorrCoeff = 37, // Static component of Forchheimer
// D-factor correlation.

CFInDeck = 40, // = 0 for connection factor not defined, = 1 for connection factor defined
CFInDeck = 40, // = 0 for connection factor not defined in input,
// = 1 for connection factor defined in input.

PressEquivRad = 41, // Connection's pressure equivalent radius.
};
} // SConn

Expand Down Expand Up @@ -100,6 +105,6 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
TracerOffset = 58, // Tracer data starts after this index
};
} // XConn
}}}} // Opm::RestartIO::Helpers::VectorItems
} // Opm::RestartIO::Helpers::VectorItems

#endif // OPM_OUTPUT_ECLIPSE_VECTOR_CONNECTION_HPP
4 changes: 2 additions & 2 deletions tests/test_AggregateConnectionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ namespace {
explicit MockIH(const int numWells,
const int nsegWell = 1, // E100
const int ncwMax = 20,
const int iConnPerConn = 25, // NICONZ
const int sConnPerConn = 41, // NSCONZ
const int iConnPerConn = 26, // NICONZ
const int sConnPerConn = 42, // NSCONZ
const int xConnPerConn = 58); // NXCONZ

std::vector<int> value;
Expand Down

0 comments on commit 27233aa

Please sign in to comment.