Compare commits

..

14 Commits

Author SHA1 Message Date
Arne Morten Kvarving
8f297e2079 bump versions for final 2018-10-24 13:35:03 +02:00
Arne Morten Kvarving
1e77807ff0 correct packaging versions 2018-10-04 06:06:01 +02:00
Joakim Hove
a732ddeb50 Merge pull request #512 from joakim-hove/bump-versions
Bump versions to 2018.10-rc1
2018-10-02 15:50:58 +02:00
Joakim Hove
4768b5cd95 Bump versions to 2018.10-rc1 2018-10-02 15:27:41 +02:00
Joakim Hove
c81e5027c9 Merge pull request #510 from bska/difftime
TimeMap: Use difftime() for Time Deltas as double
2018-10-02 14:44:44 +02:00
Bård Skaflestad
23950403f1 TimeMap: Use difftime() for Time Deltas as double
Reduces the amount of explicit arithmetic on std::time_t values and
thereby, implicitly, the assumption of targeting Posix systems only.
2018-10-02 13:11:02 +02:00
Bård Skaflestad
33372a3337 Merge pull request #506 from jalvestad/flow-flow-restart
EclipseRestart-improvements
2018-10-02 13:05:43 +02:00
Jostein Alvestad
c067e48276 Additional improvement and correction for writing of eclipse compatible restart file 2018-09-28 15:39:25 +02:00
Jostein Alvestad
5d398565c2 Improved the code structure - current improvement 2018-09-28 11:23:42 +02:00
Jostein Alvestad
a9a82e3814 Minor correction to previous commit rseg [39] was not properly assigned 2018-09-28 09:56:03 +02:00
Jostein Alvestad
3f94b580a2 Added changes to improve treatment of multi segment wells in Eclipse Restart
Added flowing well bottom hole pressure to item[8] and [39] plus adjusted item[9]
2018-09-28 09:48:03 +02:00
Jostein Alvestad
cfc1b29c08 Added improvements and corrections to handle writing of eclipse compatible restart file
for more general well data
2018-09-27 16:23:34 +02:00
Jostein Alvestad
264d451d56 Added additional changes to handle repeated read of COMPDAT
for same grid i,j,k cell.
Corrections for handling wells with only 1 connection
Correction for XWEL - BG being NaN
2018-09-27 16:23:32 +02:00
Jostein Alvestad
21eddfbdf2 Added changes to handle repeated read of COMPDAT for same grid cells 2018-09-27 16:23:31 +02:00
13 changed files with 87 additions and 64 deletions

2
debian/changelog vendored
View File

@@ -1,4 +1,4 @@
opm-common (2015.10-1~trusty) trusty; urgency=medium
opm-common (2018.10-rfinal-2~xenial) xenial; urgency=medium
* New release

View File

@@ -5,8 +5,8 @@
Module: opm-common
Description: Open Porous Media Initiative shared infrastructure
Version: 2018.10-pre
Label: 2018.10-pre
Version: 2018.10
Label: 2018.10
Maintainer: opm@opm-project.org
MaintainerName: OPM community
Url: http://opm-project.org

View File

@@ -21,6 +21,8 @@
#define OPM_AGGREGATE_MSW_DATA_HPP
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/SummaryState.hpp>
#include <opm/output/eclipse/CharArrayNullTerm.hpp>
#include <opm/output/eclipse/WindowedArray.hpp>
@@ -32,6 +34,7 @@ namespace Opm {
class Schedule;
class EclipseGrid;
class UnitSystem;
class SummaryState;
} // Opm
namespace Opm { namespace RestartIO { namespace Helpers {
@@ -53,7 +56,9 @@ namespace Opm { namespace RestartIO { namespace Helpers {
const std::size_t rptStep,
const Opm::UnitSystem& units,
const std::vector<int>& inteHead,
const Opm::EclipseGrid& grid);
const Opm::EclipseGrid& grid,
const ::Opm::SummaryState& smry
);
/// Retrieve Integer Multisegment well data Array.
const std::vector<int>& getISeg() const

View File

@@ -5,7 +5,7 @@
%define tag final
Name: opm-common
Version: 2018.04
Version: 2018.10
Release: 0
Summary: Open Porous Media - common helpers and buildsystem
License: GPL-3.0

View File

@@ -88,7 +88,6 @@ namespace {
const auto* well = wells[wellID];
if (well == nullptr) { continue; }
const auto& conns = well->getActiveConnections(sim_step, grid);
const int niSI = static_cast<int>(well->getTotNoConn());
std::map <std::size_t, const Opm::Connection*> sIToConn;
@@ -160,8 +159,8 @@ namespace {
// draining and imbibition curves at connections.
iConn[Ix::Imbibition] = iConn[Ix::Drainage];
//iConn[Ix::ComplNum] = std::abs(conn.complnum);
iConn[Ix::ComplNum] = iConn[Ix::SeqIndex];
iConn[Ix::ComplNum] = std::abs(conn.complnum());
//iConn[Ix::ComplNum] = iConn[Ix::SeqIndex];
iConn[Ix::ConnDir] = conn.dir();
iConn[Ix::Segment] = conn.attachedToSegment()

View File

@@ -20,6 +20,7 @@
#include <opm/output/eclipse/AggregateMSWData.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/output/eclipse/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@@ -216,18 +217,15 @@ namespace {
int newSInd = segIndex;
auto origBranchNo = segSet[segIndex].branchNumber();
bool endOrigBranch = true;
//std::cout << "SegmentOrder-segIndex:" << segIndex << " origBranchno: " << origBranchNo << std::endl;
// loop down branch to find all segments in branch and number from "toe" to "heel"
while (newSInd < segSet.size()) {
endOrigBranch = true;
const auto iSInd = inflowSegmentsIndex(segSet, newSInd);
//std::cout << " SO- inflowSegmentsIndex:" << std::endl;
for (auto isi : iSInd ) {
auto inflowBranch = segSet[isi].branchNumber();
if (origBranchNo == inflowBranch) {
endOrigBranch = false;
}
//std::cout << " SO- isi:" << isi << std::endl;
}
if (iSInd.size() > 0) {
for (auto ind : iSInd) {
@@ -237,16 +235,13 @@ namespace {
segIndCB.insert(segIndCB.begin(), ind);
// search recursively down this branch to find more inflow branches
newSInd = ind;
//std::cout << "SO-ind-loop: origB=iflowB - ind:" << ind << std::endl;
}
else {
// if inflow segment belongs to different branch, start new search
//std::cout << "SO-ind-loop: origB!=iflowB - ind:" << ind << std::endl;
auto nSOrd = segmentOrder(segSet, ind);
// copy the segments already found and indexed into the total ordered segment vector
for (std::size_t indOS = 0; indOS < nSOrd.size(); indOS++) {
ordSegNumber.push_back(nSOrd[indOS]);
//std::cout << "SO-ind-loop: origB!=iflowB - indOS:" << indOS << " nSOrd[indOS] " << nSOrd[indOS] << std::endl;
}
if (endOrigBranch) {
newSInd = segSet.size();
@@ -257,10 +252,8 @@ namespace {
}
if (endOrigBranch || (iSInd.size()==0)) {
// have come to toe of current branch - store segment indicies of current branch
//std::cout << "SO-Toe of current branch - newSInd :" << newSInd << std::endl;
for (std::size_t indOS = 0; indOS < segIndCB.size(); indOS++) {
ordSegNumber.push_back(segIndCB[indOS]);
//std::cout << "SO end CB - indOS:" << indOS << " segIndCB[indOS] " << segIndCB[indOS] << std::endl;
}
// set new index to exit while loop
newSInd = segSet.size();
@@ -270,11 +263,9 @@ namespace {
if (origBranchNo == 1) {
// make the vector of ordered segments
//std::cout << "SO-OrBr=1 -ordSegNumber.size():" << ordSegNumber.size() << std::endl;
tempOrdVect.resize(ordSegNumber.size());
for (std::size_t ov_ind = 0; ov_ind < ordSegNumber.size(); ov_ind++) {
tempOrdVect[ordSegNumber[ov_ind]] = ov_ind+1;
//std::cout << "SO_OrBr=1- ov_ind:" << ov_ind << " ordSegNumber[ov_ind] " << ordSegNumber[ov_ind] << std::endl;
}
return tempOrdVect;
} else {
@@ -400,6 +391,7 @@ namespace {
const std::size_t rptStep,
const std::vector<int>& inteHead,
const Opm::UnitSystem& units,
const ::Opm::SummaryState& smry,
RSegArray& rSeg)
{
if (well.isMultiSegment(rptStep)) {
@@ -408,27 +400,38 @@ namespace {
auto welSegSet = well.getWellSegments(rptStep);
auto completionSet = well.getCompletions(rptStep);
auto noElmSeg = nrsegz(inteHead);
//treat the top segment individually
rSeg[0] = units.from_si(M::length, welSegSet.lengthTopSegment());
rSeg[1] = units.from_si(M::length, welSegSet.depthTopSegment());
rSeg[5] = units.from_si(M::volume, welSegSet.volumeTopSegment());
rSeg[6] = rSeg[0];
rSeg[7] = rSeg[1];
// set item ind + 10 to 0.5 based on tests on E100
rSeg[10] = 0.5;
auto& wname = well.name();
std::string bhpKey = "WBHP:" + wname;
//treat the top segment individually
rSeg[0] = units.from_si(M::length, welSegSet.lengthTopSegment());
rSeg[1] = units.from_si(M::length, welSegSet.depthTopSegment());
rSeg[5] = units.from_si(M::volume, welSegSet.volumeTopSegment());
rSeg[6] = rSeg[0];
rSeg[7] = rSeg[1];
//Item 8: should be some segment cumulative flow rate, use a constant value for now
rSeg[8] = 200.;
//Item ind+9: not sure what this parameter is, the current value works well for tests on E100
rSeg[9] = 0.01;
// set item ind + 10 to 0.5 based on tests on E100
rSeg[10] = 0.5;
//Item 11 should be segment pressure - use flowing bottom hole pressure temporarily
//if (smry.has( bhpKey)) {
// rSeg[11] = smry.get(bhpKey);
//}
// use default value for now
rSeg[11] = 0.;
// segment pressure - set equal to item 8
rSeg[ 39] = rSeg[11];
// segment pressure (to be added!!)
rSeg[ 39] = 0;
//Default values
//rSeg[ 39] = 1.0;
//Default values
rSeg[ 39] = 1.0;
rSeg[105] = 1.0;
rSeg[106] = 1.0;
rSeg[107] = 1.0;
rSeg[108] = 1.0;
rSeg[109] = 1.0;
rSeg[110] = 1.0;
rSeg[105] = 1.0;
rSeg[106] = 1.0;
rSeg[107] = 1.0;
rSeg[108] = 1.0;
rSeg[109] = 1.0;
rSeg[110] = 1.0;
//Treat subsequent segments
for (int ind_seg = 2; ind_seg <= welSegSet.size(); ind_seg++) {
@@ -447,14 +450,19 @@ namespace {
rSeg[iS + 5] = units.from_si(M::volume, (welSegSet[ind].volume()));
rSeg[iS + 6] = units.from_si(M::length, (welSegSet[ind].totalLength()));
rSeg[iS + 7] = units.from_si(M::length, (welSegSet[ind].depth()));
//Item ind+8: should be some segment cumulative flow rate, use a constant value for now
rSeg[iS + 8] = 200.;
//Item ind+9: not sure what this parameter is, the current value works well for tests on E100
rSeg[iS + 9] = 0.01;
// set item ind + 10 to 0.5 based on tests on E100
rSeg[10] = 0.5;
rSeg[iS + 10] = 0.5;
// segment pressure (to be added!!)
rSeg[iS + 11] = 0;
rSeg[iS + 11] = rSeg[11];
//Default values
rSeg[iS + 39] = 1.0;
rSeg[iS + 39] = rSeg[iS + 11];
rSeg[iS + 105] = 1.0;
rSeg[iS + 106] = 1.0;
@@ -573,7 +581,9 @@ captureDeclaredMSWData(const Schedule& sched,
const std::size_t rptStep,
const Opm::UnitSystem& units,
const std::vector<int>& inteHead,
const Opm::EclipseGrid& grid)
const Opm::EclipseGrid& grid,
const ::Opm::SummaryState& smry
)
{
const auto& wells = sched.getWells(rptStep);
auto msw = std::vector<const Opm::Well*>{};
@@ -596,12 +606,12 @@ captureDeclaredMSWData(const Schedule& sched,
// Extract Contributions to RSeg Array
{
MSWLoop(msw, [&units, rptStep, inteHead, this]
MSWLoop(msw, [&units, rptStep, inteHead, &smry, this]
(const Well& well, const std::size_t mswID) -> void
{
auto rmsw = this->rSeg_[mswID];
RSeg::staticContrib(well, rptStep, inteHead, units, rmsw);
RSeg::staticContrib(well, rptStep, inteHead, units, smry, rmsw);
});
}

View File

@@ -694,7 +694,9 @@ namespace {
xWell[Ix::GasFVF] = (std::abs(xWell[Ix::GasPrRate]) > 0.0)
? xWell[Ix::VoidPrRate] / xWell[Ix::GasPrRate]
: 0.0;
if (std::isnan(xWell[Ix::GasFVF])) xWell[Ix::GasFVF] = 0.;
// Not fully characterised.
xWell[Ix::item38] = xWell[Ix::GasPrRate];
xWell[Ix::item83] = xWell[Ix::GasInjTotal];

View File

@@ -467,7 +467,6 @@ void EclipseIO::writeTimeStep(int report_step,
ioConfig.getUNIFOUT() ? ECL_UNIFIED_RESTART_FILE : ECL_RESTART_FILE,
report_step,
ioConfig.getFMTOUT() );
RestartIO::save(filename, report_step, secs_elapsed, value, es, grid, schedule,
this->impl->summary.get_restart_vectors(), write_double);
}

View File

@@ -320,12 +320,13 @@ namespace {
const UnitSystem& units,
const Schedule& schedule,
const EclipseGrid& grid,
const Opm::SummaryState& sumState,
const std::vector<int>& ih)
{
// write ISEG, RSEG, ILBS and ILBR to restart file
const size_t simStep = static_cast<size_t> (sim_step);
auto MSWData = Helpers::AggregateMSWData(ih);
MSWData.captureDeclaredMSWData(schedule, simStep, units, ih, grid);
MSWData.captureDeclaredMSWData(schedule, simStep, units, ih, grid, sumState);
write_kw(rst_file, "ISEG", MSWData.getISeg());
write_kw(rst_file, "ILBS", MSWData.getILBs());
@@ -372,7 +373,7 @@ namespace {
write_kw(rst_file, "ICON", connectionData.getIConn());
write_kw(rst_file, "SCON", connectionData.getSConn());
//write_kw(rst_file, "XCON", connectionData.getXConn());
write_kw(rst_file, "XCON", connectionData.getXConn());
}
void writeSolution(ecl_rst_file_type* rst_file,
@@ -470,7 +471,7 @@ void save(const std::string& filename,
writeGroup(rst_file.get(), sim_step, ecl_compatible_rst, schedule, sumState, inteHD);
writeMSWData(rst_file.get(), sim_step, units, schedule, grid, inteHD);
writeMSWData(rst_file.get(), sim_step, units, schedule, grid, sumState, inteHD);
writeWell(rst_file.get(), sim_step, ecl_compatible_rst, es.runspec().phases(), units,
grid, schedule, value.wells, sumState, inteHD);

View File

@@ -18,6 +18,7 @@
*/
#include <cmath>
#include <iostream>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
@@ -120,12 +121,11 @@ namespace Opm {
segment_number = 0;
// will decide the segment number based on the distance in a process later.
}
if (!record.getItem<ParserKeywords::COMPSEGS::END_IJK>().hasValue(0)) { // only one compsegs
if (grid.cellActive(I, J, K)) {
std::size_t seqIndex = compsegs.size();
totNC = seqIndex;
totNC = seqIndex+1;
compsegs.emplace_back( I, J, K,
branch,
distance_start, distance_end,

View File

@@ -85,8 +85,9 @@ namespace Opm {
{
if (m_timeList.size() < 2)
return 0.0;
const time_t deltaT = m_timeList.back() - m_timeList.front();
return static_cast<double>(deltaT);
return std::difftime(this->m_timeList.back(),
this->m_timeList.front());
}
void TimeMap::addTime(std::time_t newTime) {
@@ -196,19 +197,17 @@ namespace Opm {
double TimeMap::getTimeStepLength(size_t tStepIdx) const
{
assert(tStepIdx < numTimesteps());
const std::time_t t1 = m_timeList[tStepIdx];
const std::time_t t2 = m_timeList[tStepIdx + 1];
const std::time_t deltaT = t2 - t1;
return static_cast<double>(deltaT);
return std::difftime(this->m_timeList[tStepIdx + 1],
this->m_timeList[tStepIdx + 0]);
}
double TimeMap::getTimePassedUntil(size_t tLevelIdx) const
{
assert(tLevelIdx < m_timeList.size());
const std::time_t t1 = m_timeList.front();
const std::time_t t2 = m_timeList[tLevelIdx];
const std::time_t deltaT = t2 - t1;
return static_cast<double>(deltaT);
return std::difftime(this->m_timeList[tLevelIdx],
this->m_timeList.front());
}

View File

@@ -692,7 +692,7 @@ namespace Opm {
std::size_t totNC = 0;
connections->loadCOMPDAT(record, grid, eclipseProperties, totNC);
if (totNC > 0) {
this->setTotNoConn(totNC+1);
this->setTotNoConn(totNC);
}
this->updateWellConnections(time_step, connections);
}
@@ -704,7 +704,7 @@ namespace Opm {
std::size_t totNC = 0;
WellConnections * new_connection_set = newConnectionsWithSegments(keyword, completion_set, segment_set, grid, totNC);
if (totNC > 0) {
this->setTotNoConn(totNC+1);
this->setTotNoConn(totNC);
}
this->updateWellConnections(time_step, new_connection_set);
}

View File

@@ -289,7 +289,7 @@ namespace {
if (grid.cellActive(I, J, k)) {
if (prev == this->m_connections.end()) {
std::size_t noConn = this->m_connections.size();
totNC = noConn;
totNC = noConn+1;
this->addConnection(I,J,k,
grid.getCellDepth( I,J,k ),
state,
@@ -305,6 +305,12 @@ namespace {
// The complnum value carries over; the rest of the state is fully specified by
// the current COMPDAT keyword.
int complnum = prev->complnum();
std::size_t css_ind = prev->getCompSegSeqIndex();
int conSegNo = prev->segment();
std::size_t con_SIndex = prev->getSeqIndex();
double conCDepth = prev->depth();
double conSDStart = prev->getSegDistStart();
double conSDEnd = prev->getSegDistEnd();
*prev = Connection(I,J,k,
complnum,
grid.getCellDepth(I,J,k),
@@ -314,7 +320,9 @@ namespace {
rw,
satTableId,
direction,
noConn, 0., 0., defaultSatTable);
noConn, conSDStart, conSDEnd, defaultSatTable);
prev->setCompSegSeqIndex(css_ind);
prev->updateSegment(conSegNo, conCDepth, con_SIndex);
}
}
}