2016-11-11 08:02:34 -06:00
|
|
|
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
// vi: set et ts=4 sw=4 sts=4:
|
|
|
|
/*
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
Consult the COPYING file in the top-level source directory of this
|
|
|
|
module for the precise wording of the license and the list of
|
|
|
|
copyright holders.
|
|
|
|
*/
|
|
|
|
/*!
|
|
|
|
* \file
|
|
|
|
*
|
2019-09-05 10:04:39 -05:00
|
|
|
* \copydoc Opm::EclWriter
|
2016-11-11 08:02:34 -06:00
|
|
|
*/
|
|
|
|
#ifndef EWOMS_ECL_WRITER_HH
|
|
|
|
#define EWOMS_ECL_WRITER_HH
|
|
|
|
|
|
|
|
#include "collecttoiorank.hh"
|
2017-12-07 05:38:48 -06:00
|
|
|
#include "ecloutputblackoilmodule.hh"
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2019-09-16 04:22:14 -05:00
|
|
|
#include <opm/models/blackoil/blackoilmodel.hh>
|
2019-09-11 06:46:48 -05:00
|
|
|
#include <opm/models/discretization/ecfv/ecfvdiscretization.hh>
|
2019-09-16 03:13:06 -05:00
|
|
|
#include <opm/models/io/baseoutputwriter.hh>
|
2019-09-16 02:52:49 -05:00
|
|
|
#include <opm/models/parallel/tasklets.hh>
|
2018-03-05 06:00:51 -06:00
|
|
|
|
2019-04-26 14:14:44 -05:00
|
|
|
#include <ebos/nncsorter.hpp>
|
|
|
|
|
2017-12-07 05:38:48 -06:00
|
|
|
#include <opm/output/eclipse/EclipseIO.hpp>
|
2018-04-28 06:31:27 -05:00
|
|
|
#include <opm/output/eclipse/RestartValue.hpp>
|
|
|
|
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
|
|
|
|
2018-03-12 08:31:36 -05:00
|
|
|
#include <opm/grid/GridHelpers.hpp>
|
2019-05-16 07:58:49 -05:00
|
|
|
#include <opm/grid/utility/cartesianToCompressed.hpp>
|
2018-03-12 08:31:36 -05:00
|
|
|
|
2018-02-01 07:40:01 -06:00
|
|
|
#include <opm/material/common/Valgrind.hpp>
|
|
|
|
#include <opm/material/common/Exceptions.hpp>
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2019-04-26 14:14:44 -05:00
|
|
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
#include <list>
|
|
|
|
#include <utility>
|
|
|
|
#include <string>
|
2019-09-19 17:49:40 -05:00
|
|
|
#include <chrono>
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2019-06-17 03:02:11 -05:00
|
|
|
#ifdef HAVE_MPI
|
|
|
|
#include <mpi.h>
|
|
|
|
#endif
|
|
|
|
|
2018-06-14 09:06:05 -05:00
|
|
|
BEGIN_PROPERTIES
|
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
NEW_PROP_TAG(EnableEclOutput);
|
2018-03-12 09:17:07 -05:00
|
|
|
NEW_PROP_TAG(EnableAsyncEclOutput);
|
2018-01-17 08:24:24 -06:00
|
|
|
NEW_PROP_TAG(EclOutputDoublePrecision);
|
2018-06-14 09:06:05 -05:00
|
|
|
|
|
|
|
END_PROPERTIES
|
|
|
|
|
2019-09-05 10:04:39 -05:00
|
|
|
namespace Opm {
|
2016-11-11 08:02:34 -06:00
|
|
|
|
|
|
|
template <class TypeTag>
|
|
|
|
class EclWriter;
|
|
|
|
|
2018-03-12 08:31:36 -05:00
|
|
|
template <class TypeTag>
|
|
|
|
class EclOutputBlackOilModule;
|
|
|
|
|
2019-05-16 07:58:49 -05:00
|
|
|
/*!
|
|
|
|
* \brief Detect whether two cells are direct vertical neighbours.
|
|
|
|
*
|
|
|
|
* I.e. have the same i and j index and all cartesian cells between them
|
|
|
|
* along the vertical column are inactive.
|
|
|
|
*
|
|
|
|
* \tparam CM The type of the cartesian index mapper.
|
|
|
|
* \param cartMapper The mapper onto cartesian indices.
|
|
|
|
* \param cartesianToActive The mapping of cartesian indices to active indices.
|
|
|
|
* \param smallGlobalIndex The cartesian cell index of the cell with smaller index
|
|
|
|
* \param largeGlobalIndex The cartesian cell index of the cell with larger index
|
|
|
|
* \return True if the cells have the same i and j indices and all cartesian cells
|
|
|
|
* between them are inactive.
|
|
|
|
*/
|
|
|
|
inline
|
|
|
|
bool directVerticalNeighbors(const std::array<int, 3>& cartDims,
|
|
|
|
const std::unordered_map<int,int>& cartesianToActive,
|
|
|
|
int smallGlobalIndex, int largeGlobalIndex)
|
|
|
|
{
|
|
|
|
assert(smallGlobalIndex <= largeGlobalIndex);
|
|
|
|
std::array<int, 3> ijk1, ijk2;
|
|
|
|
auto globalToIjk = [cartDims](int gc) {
|
|
|
|
std::array<int, 3> ijk;
|
|
|
|
ijk[0] = gc % cartDims[0];
|
|
|
|
gc /= cartDims[0];
|
|
|
|
ijk[1] = gc % cartDims[1];
|
|
|
|
ijk[2] = gc / cartDims[1];
|
|
|
|
return ijk;
|
|
|
|
};
|
|
|
|
ijk1 = globalToIjk(smallGlobalIndex);
|
|
|
|
ijk2 = globalToIjk(largeGlobalIndex);
|
|
|
|
assert(ijk2[2]>=ijk1[2]);
|
|
|
|
|
|
|
|
if ( ijk1[0] == ijk2[0] && ijk1[1] == ijk2[1] && (ijk2[2] - ijk1[2]) > 1)
|
|
|
|
{
|
|
|
|
assert((largeGlobalIndex-smallGlobalIndex)%(cartDims[0]*cartDims[1])==0);
|
|
|
|
for ( int gi = smallGlobalIndex + cartDims[0] * cartDims[1]; gi < largeGlobalIndex;
|
|
|
|
gi += cartDims[0] * cartDims[1] )
|
|
|
|
{
|
|
|
|
if ( cartesianToActive.find( gi ) != cartesianToActive.end() )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
/*!
|
|
|
|
* \ingroup EclBlackOilSimulator
|
|
|
|
*
|
2017-12-07 05:38:48 -06:00
|
|
|
* \brief Collects necessary output values and pass it to opm-output.
|
2016-11-11 08:02:34 -06:00
|
|
|
*
|
|
|
|
* Caveats:
|
2017-12-07 05:38:48 -06:00
|
|
|
* - For this class to do do anything meaningful, you will have to
|
|
|
|
* have the OPM module opm-output.
|
2016-11-11 08:02:34 -06:00
|
|
|
* - The only DUNE grid which is currently supported is Dune::CpGrid
|
2017-12-07 05:38:48 -06:00
|
|
|
* from the OPM module "opm-grid". Using another grid won't
|
2016-11-11 08:02:34 -06:00
|
|
|
* fail at compile time but you will provoke a fatal exception as
|
|
|
|
* soon as you try to write an ECL output file.
|
|
|
|
* - This class requires to use the black oil model with the element
|
|
|
|
* centered finite volume discretization.
|
|
|
|
*/
|
|
|
|
template <class TypeTag>
|
2017-12-07 05:38:48 -06:00
|
|
|
class EclWriter
|
2016-11-11 08:02:34 -06:00
|
|
|
{
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
|
2018-02-01 09:26:58 -06:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
|
2016-11-11 08:02:34 -06:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
|
2017-12-07 05:38:48 -06:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
|
2018-01-22 06:38:50 -06:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
|
2017-12-07 05:38:48 -06:00
|
|
|
typedef typename GridView::template Codim<0>::Entity Element;
|
|
|
|
typedef typename GridView::template Codim<0>::Iterator ElementIterator;
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2018-03-12 09:17:07 -05:00
|
|
|
typedef CollectDataToIORank<Vanguard> CollectDataToIORankType;
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2017-12-07 05:38:48 -06:00
|
|
|
typedef std::vector<Scalar> ScalarBuffer;
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2018-11-16 07:51:07 -06:00
|
|
|
enum { enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy) };
|
2019-09-25 05:28:58 -05:00
|
|
|
enum { enableSolvent = GET_PROP_VALUE(TypeTag, EnableSolvent) };
|
|
|
|
|
2018-11-16 07:51:07 -06:00
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
public:
|
2018-03-12 09:17:07 -05:00
|
|
|
static void registerParameters()
|
|
|
|
{
|
2018-07-26 05:31:32 -05:00
|
|
|
EclOutputBlackOilModule<TypeTag>::registerParameters();
|
|
|
|
|
2018-03-12 09:17:07 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, bool, EnableAsyncEclOutput,
|
|
|
|
"Write the ECL-formated results in a non-blocking way (i.e., using a separate thread).");
|
|
|
|
}
|
|
|
|
|
2019-06-04 00:48:21 -05:00
|
|
|
// The Simulator object should preferably have been const - the
|
|
|
|
// only reason that is not the case is due to the SummaryState
|
|
|
|
// object owned deep down by the vanguard.
|
|
|
|
EclWriter(Simulator& simulator)
|
2016-11-11 08:02:34 -06:00
|
|
|
: simulator_(simulator)
|
2018-02-01 09:26:58 -06:00
|
|
|
, collectToIORank_(simulator_.vanguard())
|
2018-02-01 06:16:37 -06:00
|
|
|
, eclOutputModule_(simulator, collectToIORank_)
|
2016-11-11 08:02:34 -06:00
|
|
|
{
|
2018-02-01 09:26:58 -06:00
|
|
|
globalGrid_ = simulator_.vanguard().grid();
|
2018-01-12 08:32:43 -06:00
|
|
|
globalGrid_.switchToGlobalView();
|
2018-02-01 09:26:58 -06:00
|
|
|
eclIO_.reset(new Opm::EclipseIO(simulator_.vanguard().eclState(),
|
2019-02-01 10:33:30 -06:00
|
|
|
Opm::UgGridHelpers::createEclipseGrid(globalGrid_, simulator_.vanguard().eclState().getInputGrid()),
|
2018-02-01 09:26:58 -06:00
|
|
|
simulator_.vanguard().schedule(),
|
|
|
|
simulator_.vanguard().summaryConfig()));
|
2018-02-01 01:01:16 -06:00
|
|
|
|
|
|
|
// create output thread if enabled and rank is I/O rank
|
|
|
|
// async output is enabled by default if pthread are enabled
|
2018-03-12 09:17:07 -05:00
|
|
|
bool enableAsyncOutput = EWOMS_GET_PARAM(TypeTag, bool, EnableAsyncEclOutput);
|
2018-03-15 05:05:10 -05:00
|
|
|
int numWorkerThreads = 0;
|
|
|
|
if (enableAsyncOutput && collectToIORank_.isIORank())
|
|
|
|
numWorkerThreads = 1;
|
|
|
|
taskletRunner_.reset(new TaskletRunner(numWorkerThreads));
|
2016-11-11 08:02:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
~EclWriter()
|
|
|
|
{ }
|
|
|
|
|
2017-12-07 05:38:48 -06:00
|
|
|
const Opm::EclipseIO& eclIO() const
|
2018-01-15 03:13:41 -06:00
|
|
|
{ return *eclIO_; }
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2018-01-12 08:32:43 -06:00
|
|
|
void writeInit()
|
|
|
|
{
|
|
|
|
if (collectToIORank_.isIORank()) {
|
|
|
|
std::map<std::string, std::vector<int> > integerVectors;
|
|
|
|
if (collectToIORank_.isParallel())
|
|
|
|
integerVectors.emplace("MPI_RANK", collectToIORank_.globalRanks());
|
2019-05-16 07:58:49 -05:00
|
|
|
auto cartMap = Opm::cartesianToCompressed(globalGrid_.size(0),
|
|
|
|
Opm::UgGridHelpers::globalCell(globalGrid_));
|
|
|
|
eclIO_->writeInitial(computeTrans_(cartMap), integerVectors, exportNncStructure_(cartMap));
|
2018-01-12 08:32:43 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
/*!
|
2017-12-07 05:38:48 -06:00
|
|
|
* \brief collect and pass data and pass it to eclIO writer
|
2016-11-11 08:02:34 -06:00
|
|
|
*/
|
2019-06-17 03:02:11 -05:00
|
|
|
|
|
|
|
void evalSummaryState(bool isSubStep)
|
2016-11-11 08:02:34 -06:00
|
|
|
{
|
2019-06-17 03:02:11 -05:00
|
|
|
int reportStepNum = simulator_.episodeIndex() + 1;
|
|
|
|
/*
|
|
|
|
The summary data is not evaluated for timestep 0, that is
|
|
|
|
implemented with a:
|
|
|
|
|
|
|
|
if (time_step == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
check somewhere in the summary code. When the summary code was
|
|
|
|
split in separate methods Summary::eval() and
|
|
|
|
Summary::add_timestep() it was necessary to pull this test out
|
|
|
|
here to ensure that the well and group related keywords in the
|
|
|
|
restart file, like XWEL and XGRP were "correct" also in the
|
|
|
|
initial report step.
|
|
|
|
|
|
|
|
"Correct" in this context means unchanged behavior, might very
|
|
|
|
well be more correct to actually remove this if test.
|
|
|
|
*/
|
|
|
|
if (reportStepNum == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const auto& summary = eclIO_->summary();
|
2018-07-12 06:47:00 -05:00
|
|
|
Scalar curTime = simulator_.time() + simulator_.timeStepSize();
|
2019-02-05 09:51:34 -06:00
|
|
|
Scalar totalCpuTime =
|
|
|
|
simulator_.executionTimer().realTimeElapsed() +
|
|
|
|
simulator_.setupTimer().realTimeElapsed() +
|
|
|
|
simulator_.vanguard().externalSetupTime();
|
2019-06-17 03:02:11 -05:00
|
|
|
|
|
|
|
Opm::data::Wells localWellData = simulator_.problem().wellModel().wellData();
|
|
|
|
|
|
|
|
const auto& gridView = simulator_.vanguard().gridView();
|
|
|
|
int numElements = gridView.size(/*codim=*/0);
|
|
|
|
bool log = collectToIORank_.isIORank();
|
|
|
|
eclOutputModule_.allocBuffers(numElements, reportStepNum, isSubStep, log);
|
|
|
|
|
|
|
|
ElementContext elemCtx(simulator_);
|
|
|
|
ElementIterator elemIt = gridView.template begin</*codim=*/0>();
|
|
|
|
const ElementIterator& elemEndIt = gridView.template end</*codim=*/0>();
|
|
|
|
for (; elemIt != elemEndIt; ++elemIt) {
|
|
|
|
const Element& elem = *elemIt;
|
|
|
|
elemCtx.updatePrimaryStencil(elem);
|
|
|
|
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
|
|
|
eclOutputModule_.processElement(elemCtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (collectToIORank_.isParallel())
|
|
|
|
collectToIORank_.collect({}, eclOutputModule_.getBlockData(), localWellData);
|
|
|
|
|
|
|
|
std::map<std::string, double> miscSummaryData;
|
|
|
|
std::map<std::string, std::vector<double>> regionData;
|
|
|
|
eclOutputModule_.outputFipLog(miscSummaryData, regionData, isSubStep);
|
|
|
|
|
|
|
|
std::vector<char> buffer;
|
|
|
|
if (collectToIORank_.isIORank()) {
|
|
|
|
const auto& eclState = simulator_.vanguard().eclState();
|
|
|
|
|
|
|
|
// Add TCPU
|
|
|
|
if (totalCpuTime != 0.0)
|
|
|
|
miscSummaryData["TCPU"] = totalCpuTime;
|
|
|
|
|
|
|
|
const Opm::data::Wells& wellData = collectToIORank_.isParallel() ? collectToIORank_.globalWellData() : localWellData;
|
|
|
|
|
|
|
|
const std::map<std::pair<std::string, int>, double>& blockData
|
|
|
|
= collectToIORank_.isParallel()
|
|
|
|
? collectToIORank_.globalBlockData()
|
|
|
|
: eclOutputModule_.getBlockData();
|
|
|
|
|
|
|
|
summary.eval(summaryState(),
|
|
|
|
reportStepNum,
|
|
|
|
curTime,
|
|
|
|
eclState,
|
|
|
|
schedule(),
|
|
|
|
wellData,
|
|
|
|
miscSummaryData,
|
|
|
|
regionData,
|
|
|
|
blockData);
|
|
|
|
buffer = summaryState().serialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (collectToIORank_.isParallel()) {
|
|
|
|
#ifdef HAVE_MPI
|
2019-06-19 04:57:56 -05:00
|
|
|
unsigned long buffer_size = buffer.size();
|
2019-06-17 03:02:11 -05:00
|
|
|
MPI_Bcast(&buffer_size, 1, MPI_UNSIGNED_LONG, collectToIORank_.ioRank, MPI_COMM_WORLD);
|
|
|
|
if (!collectToIORank_.isIORank())
|
|
|
|
buffer.resize( buffer_size );
|
|
|
|
|
|
|
|
MPI_Bcast(buffer.data(), buffer_size, MPI_CHAR, collectToIORank_.ioRank, MPI_COMM_WORLD);
|
|
|
|
if (!collectToIORank_.isIORank()) {
|
|
|
|
Opm::SummaryState& st = summaryState();
|
|
|
|
st.deserialize(buffer);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void writeOutput(bool isSubStep)
|
|
|
|
{
|
|
|
|
Scalar curTime = simulator_.time() + simulator_.timeStepSize();
|
2018-07-12 06:47:00 -05:00
|
|
|
Scalar nextStepSize = simulator_.problem().nextTimeStepSize();
|
|
|
|
|
|
|
|
// output using eclWriter if enabled
|
|
|
|
Opm::data::Wells localWellData = simulator_.problem().wellModel().wellData();
|
2017-12-07 05:38:48 -06:00
|
|
|
|
2019-04-03 10:26:57 -05:00
|
|
|
int reportStepNum = simulator_.episodeIndex() + 1;
|
2018-02-01 09:26:58 -06:00
|
|
|
const auto& gridView = simulator_.vanguard().gridView();
|
2017-12-07 05:38:48 -06:00
|
|
|
int numElements = gridView.size(/*codim=*/0);
|
|
|
|
bool log = collectToIORank_.isIORank();
|
2019-04-03 10:26:57 -05:00
|
|
|
eclOutputModule_.allocBuffers(numElements, reportStepNum, isSubStep, log);
|
2017-12-07 05:38:48 -06:00
|
|
|
|
|
|
|
ElementContext elemCtx(simulator_);
|
|
|
|
ElementIterator elemIt = gridView.template begin</*codim=*/0>();
|
|
|
|
const ElementIterator& elemEndIt = gridView.template end</*codim=*/0>();
|
|
|
|
for (; elemIt != elemEndIt; ++elemIt) {
|
|
|
|
const Element& elem = *elemIt;
|
|
|
|
elemCtx.updatePrimaryStencil(elem);
|
|
|
|
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
|
|
|
eclOutputModule_.processElement(elemCtx);
|
2016-11-11 08:02:34 -06:00
|
|
|
}
|
2017-12-07 05:38:48 -06:00
|
|
|
eclOutputModule_.outputErrorLog();
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2017-12-07 05:38:48 -06:00
|
|
|
// collect all data to I/O rank and assign to sol
|
2018-02-01 01:01:16 -06:00
|
|
|
Opm::data::Solution localCellData = {};
|
2018-03-12 09:17:07 -05:00
|
|
|
if (!isSubStep)
|
2018-01-19 08:45:42 -06:00
|
|
|
eclOutputModule_.assignToSolution(localCellData);
|
|
|
|
|
2018-02-07 07:30:43 -06:00
|
|
|
// add cell data to perforations for Rft output
|
2018-03-12 09:17:07 -05:00
|
|
|
if (!isSubStep)
|
2019-04-03 10:26:57 -05:00
|
|
|
eclOutputModule_.addRftDataToWells(localWellData, reportStepNum);
|
2018-02-07 07:30:43 -06:00
|
|
|
|
2018-01-09 06:08:05 -06:00
|
|
|
if (collectToIORank_.isParallel())
|
2018-02-09 05:57:34 -06:00
|
|
|
collectToIORank_.collect(localCellData, eclOutputModule_.getBlockData(), localWellData);
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2018-01-12 08:32:43 -06:00
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
if (collectToIORank_.isIORank()) {
|
2018-04-28 06:31:27 -05:00
|
|
|
const auto& eclState = simulator_.vanguard().eclState();
|
|
|
|
const auto& simConfig = eclState.getSimulationConfig();
|
2017-12-07 05:38:48 -06:00
|
|
|
|
2018-01-22 07:05:10 -06:00
|
|
|
bool enableDoublePrecisionOutput = EWOMS_GET_PARAM(TypeTag, bool, EclOutputDoublePrecision);
|
2017-12-07 05:38:48 -06:00
|
|
|
const Opm::data::Solution& cellData = collectToIORank_.isParallel() ? collectToIORank_.globalCellData() : localCellData;
|
2018-02-01 01:01:16 -06:00
|
|
|
const Opm::data::Wells& wellData = collectToIORank_.isParallel() ? collectToIORank_.globalWellData() : localWellData;
|
2018-04-28 06:31:27 -05:00
|
|
|
Opm::RestartValue restartValue(cellData, wellData);
|
2018-02-01 01:01:16 -06:00
|
|
|
|
2019-06-17 03:02:11 -05:00
|
|
|
if (simConfig.useThresholdPressure())
|
|
|
|
restartValue.addExtra("THRESHPR", Opm::UnitSystem::measure::pressure, simulator_.problem().thresholdPressure().data());
|
2018-03-12 09:17:07 -05:00
|
|
|
|
2018-04-28 06:31:27 -05:00
|
|
|
// Add suggested next timestep to extra data.
|
|
|
|
if (!isSubStep)
|
|
|
|
restartValue.addExtra("OPMEXTRA", std::vector<double>(1, nextStepSize));
|
|
|
|
|
2018-03-12 09:17:07 -05:00
|
|
|
// first, create a tasklet to write the data for the current time step to disk
|
2019-06-04 00:48:21 -05:00
|
|
|
auto eclWriteTasklet = std::make_shared<EclWriteTasklet>(summaryState(),
|
|
|
|
*eclIO_,
|
2019-04-03 10:26:57 -05:00
|
|
|
reportStepNum,
|
2018-03-12 09:17:07 -05:00
|
|
|
isSubStep,
|
|
|
|
curTime,
|
2018-04-28 06:31:27 -05:00
|
|
|
restartValue,
|
2018-03-12 09:17:07 -05:00
|
|
|
enableDoublePrecisionOutput);
|
|
|
|
|
|
|
|
// then, make sure that the previous I/O request has been completed and the
|
|
|
|
// number of incomplete tasklets does not increase between time steps
|
|
|
|
taskletRunner_->barrier();
|
|
|
|
|
|
|
|
// finally, start a new output writing job
|
|
|
|
taskletRunner_->dispatch(eclWriteTasklet);
|
2017-12-07 05:38:48 -06:00
|
|
|
}
|
2016-11-11 08:02:34 -06:00
|
|
|
}
|
|
|
|
|
2019-02-13 05:54:52 -06:00
|
|
|
void beginRestart()
|
2018-01-15 03:13:41 -06:00
|
|
|
{
|
2018-02-19 01:47:33 -06:00
|
|
|
bool enableHysteresis = simulator_.problem().materialLawManager()->enableHysteresis();
|
2018-09-07 03:19:00 -05:00
|
|
|
bool enableSwatinit = simulator_.vanguard().eclState().get3DProperties().hasDeckDoubleGridProperty("SWATINIT");
|
2018-06-14 04:12:34 -05:00
|
|
|
std::vector<Opm::RestartKey> solutionKeys{
|
2019-02-01 10:33:30 -06:00
|
|
|
{"PRESSURE", Opm::UnitSystem::measure::pressure},
|
|
|
|
{"SWAT", Opm::UnitSystem::measure::identity, static_cast<bool>(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx))},
|
|
|
|
{"SGAS", Opm::UnitSystem::measure::identity, static_cast<bool>(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))},
|
|
|
|
{"TEMP" , Opm::UnitSystem::measure::temperature, enableEnergy},
|
2019-09-25 05:28:58 -05:00
|
|
|
{"SSOLVENT" , Opm::UnitSystem::measure::identity, enableSolvent},
|
2019-02-01 10:33:30 -06:00
|
|
|
{"RS", Opm::UnitSystem::measure::gas_oil_ratio, FluidSystem::enableDissolvedGas()},
|
|
|
|
{"RV", Opm::UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedOil()},
|
|
|
|
{"SOMAX", Opm::UnitSystem::measure::identity, simulator_.problem().vapparsActive()},
|
|
|
|
{"PCSWM_OW", Opm::UnitSystem::measure::identity, enableHysteresis},
|
|
|
|
{"KRNSW_OW", Opm::UnitSystem::measure::identity, enableHysteresis},
|
|
|
|
{"PCSWM_GO", Opm::UnitSystem::measure::identity, enableHysteresis},
|
|
|
|
{"KRNSW_GO", Opm::UnitSystem::measure::identity, enableHysteresis},
|
|
|
|
{"PPCW", Opm::UnitSystem::measure::pressure, enableSwatinit}
|
2018-06-14 04:12:34 -05:00
|
|
|
};
|
|
|
|
|
2018-06-29 06:14:04 -05:00
|
|
|
const auto& inputThpres = eclState().getSimulationConfig().getThresholdPressure();
|
|
|
|
std::vector<Opm::RestartKey> extraKeys = {{"OPMEXTRA", Opm::UnitSystem::measure::identity, false},
|
2018-09-05 07:29:31 -05:00
|
|
|
{"THRESHPR", Opm::UnitSystem::measure::pressure, inputThpres.active()}};
|
2017-12-07 05:38:48 -06:00
|
|
|
|
2019-05-13 05:17:19 -05:00
|
|
|
// The episodeIndex is rewined one back before beginRestart is called
|
|
|
|
// and can not be used here.
|
|
|
|
// We just ask the initconfig directly to be sure that we use the correct
|
|
|
|
// index.
|
|
|
|
const auto& initconfig = simulator_.vanguard().eclState().getInitConfig();
|
|
|
|
int restartStepIdx = initconfig.getRestartStep();
|
|
|
|
|
2018-02-01 09:26:58 -06:00
|
|
|
const auto& gridView = simulator_.vanguard().gridView();
|
2017-12-07 05:38:48 -06:00
|
|
|
unsigned numElements = gridView.size(/*codim=*/0);
|
2019-05-13 05:17:19 -05:00
|
|
|
eclOutputModule_.allocBuffers(numElements, restartStepIdx, /*isSubStep=*/false, /*log=*/false);
|
2017-12-07 05:38:48 -06:00
|
|
|
|
2019-06-04 00:48:21 -05:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
When running a restarted simulation the restart file is loaded
|
|
|
|
twice, first here as part of the state initialization and then
|
|
|
|
subsequently in the Simulator::run() method. The global
|
|
|
|
SummaryState instance is accumulates total variables like FOPT, if
|
|
|
|
the same instance is used twice when loading the restart file, the
|
|
|
|
cumulatives will be counted doubly, we therefor use a temporary
|
|
|
|
SummaryState instance in this call to loadRestart().
|
|
|
|
*/
|
2019-09-19 17:49:40 -05:00
|
|
|
Opm::SummaryState summaryState(std::chrono::system_clock::from_time_t(simulator_.vanguard().schedule().getStartTime()));
|
2019-06-04 00:48:21 -05:00
|
|
|
auto restartValues = eclIO_->loadRestart(summaryState, solutionKeys, extraKeys);
|
|
|
|
|
|
|
|
for (unsigned elemIdx = 0; elemIdx < numElements; ++elemIdx) {
|
|
|
|
unsigned globalIdx = collectToIORank_.localIdxToGlobalIdx(elemIdx);
|
|
|
|
eclOutputModule_.setRestart(restartValues.solution, elemIdx, globalIdx);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (inputThpres.active()) {
|
|
|
|
Simulator& mutableSimulator = const_cast<Simulator&>(simulator_);
|
|
|
|
auto& thpres = mutableSimulator.problem().thresholdPressure();
|
|
|
|
const auto& thpresValues = restartValues.getExtra("THRESHPR");
|
|
|
|
thpres.setFromRestart(thpresValues);
|
|
|
|
}
|
|
|
|
restartTimeStepSize_ = restartValues.getExtra("OPMEXTRA")[0];
|
2017-12-07 05:38:48 -06:00
|
|
|
}
|
2016-11-11 08:02:34 -06:00
|
|
|
}
|
|
|
|
|
2019-02-13 05:54:52 -06:00
|
|
|
void endRestart()
|
|
|
|
{}
|
|
|
|
|
2018-03-12 09:17:07 -05:00
|
|
|
const EclOutputBlackOilModule<TypeTag>& eclOutputModule() const
|
|
|
|
{ return eclOutputModule_; }
|
2016-11-11 08:02:34 -06:00
|
|
|
|
2019-02-13 05:54:52 -06:00
|
|
|
Scalar restartTimeStepSize() const
|
|
|
|
{ return restartTimeStepSize_; }
|
|
|
|
|
2017-12-07 05:38:48 -06:00
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
private:
|
|
|
|
static bool enableEclOutput_()
|
|
|
|
{ return EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput); }
|
|
|
|
|
2019-05-16 07:58:49 -05:00
|
|
|
Opm::data::Solution computeTrans_(const std::unordered_map<int,int>& cartesianToActive) const
|
2018-01-12 08:32:43 -06:00
|
|
|
{
|
2018-02-01 09:26:58 -06:00
|
|
|
const auto& cartMapper = simulator_.vanguard().cartesianIndexMapper();
|
2018-01-12 08:32:43 -06:00
|
|
|
const auto& cartDims = cartMapper.cartesianDimensions();
|
|
|
|
const int globalSize = cartDims[0]*cartDims[1]*cartDims[2];
|
|
|
|
|
2019-02-01 10:33:30 -06:00
|
|
|
Opm::data::CellData tranx = {Opm::UnitSystem::measure::transmissibility, std::vector<double>(globalSize), Opm::data::TargetType::INIT};
|
|
|
|
Opm::data::CellData trany = {Opm::UnitSystem::measure::transmissibility, std::vector<double>(globalSize), Opm::data::TargetType::INIT};
|
|
|
|
Opm::data::CellData tranz = {Opm::UnitSystem::measure::transmissibility, std::vector<double>(globalSize), Opm::data::TargetType::INIT};
|
2018-01-12 08:32:43 -06:00
|
|
|
|
|
|
|
for (size_t i = 0; i < tranx.data.size(); ++i) {
|
|
|
|
tranx.data[0] = 0.0;
|
|
|
|
trany.data[0] = 0.0;
|
|
|
|
tranz.data[0] = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto& globalGridView = globalGrid_.leafGridView();
|
2018-01-29 02:12:34 -06:00
|
|
|
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
|
|
|
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView> ElementMapper;
|
|
|
|
ElementMapper globalElemMapper(globalGridView, Dune::mcmgElementLayout());
|
|
|
|
#else
|
2018-01-12 08:32:43 -06:00
|
|
|
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout> ElementMapper;
|
|
|
|
ElementMapper globalElemMapper(globalGridView);
|
2018-01-29 02:12:34 -06:00
|
|
|
#endif
|
|
|
|
|
2018-01-12 08:32:43 -06:00
|
|
|
const auto& cartesianCellIdx = globalGrid_.globalCell();
|
2018-02-01 09:26:58 -06:00
|
|
|
const auto* globalTrans = &(simulator_.vanguard().globalTransmissibility());
|
2018-03-12 09:17:07 -05:00
|
|
|
|
|
|
|
if (!collectToIORank_.isParallel())
|
2018-01-12 08:32:43 -06:00
|
|
|
// in the sequential case we must use the transmissibilites defined by
|
|
|
|
// the problem. (because in the sequential case, the grid manager does
|
|
|
|
// not compute "global" transmissibilities for performance reasons. in
|
|
|
|
// the parallel case, the problem's transmissibilities can't be used
|
|
|
|
// because this object refers to the distributed grid and we need the
|
|
|
|
// sequential version here.)
|
|
|
|
globalTrans = &simulator_.problem().eclTransmissibilities();
|
|
|
|
|
|
|
|
auto elemIt = globalGridView.template begin</*codim=*/0>();
|
|
|
|
const auto& elemEndIt = globalGridView.template end</*codim=*/0>();
|
|
|
|
for (; elemIt != elemEndIt; ++ elemIt) {
|
|
|
|
const auto& elem = *elemIt;
|
|
|
|
|
|
|
|
auto isIt = globalGridView.ibegin(elem);
|
|
|
|
const auto& isEndIt = globalGridView.iend(elem);
|
|
|
|
for (; isIt != isEndIt; ++ isIt) {
|
|
|
|
const auto& is = *isIt;
|
|
|
|
|
|
|
|
if (!is.neighbor())
|
|
|
|
continue; // intersection is on the domain boundary
|
|
|
|
|
|
|
|
unsigned c1 = globalElemMapper.index(is.inside());
|
|
|
|
unsigned c2 = globalElemMapper.index(is.outside());
|
|
|
|
|
|
|
|
if (c1 > c2)
|
|
|
|
continue; // we only need to handle each connection once, thank you.
|
|
|
|
|
2019-05-16 07:58:49 -05:00
|
|
|
// Ordering of compressed and uncompressed index should be the same
|
|
|
|
assert(cartesianCellIdx[c1] <= cartesianCellIdx[c2]);
|
2018-01-12 08:32:43 -06:00
|
|
|
int gc1 = std::min(cartesianCellIdx[c1], cartesianCellIdx[c2]);
|
|
|
|
int gc2 = std::max(cartesianCellIdx[c1], cartesianCellIdx[c2]);
|
2019-05-16 07:58:49 -05:00
|
|
|
|
|
|
|
if (gc2 - gc1 == 1) {
|
2018-01-12 08:32:43 -06:00
|
|
|
tranx.data[gc1] = globalTrans->transmissibility(c1, c2);
|
2019-05-16 07:58:49 -05:00
|
|
|
continue; // skip other if clauses as they are false, last one needs some computation
|
|
|
|
}
|
2018-01-12 08:32:43 -06:00
|
|
|
|
2019-05-16 07:58:49 -05:00
|
|
|
if (gc2 - gc1 == cartDims[0]) {
|
2018-01-12 08:32:43 -06:00
|
|
|
trany.data[gc1] = globalTrans->transmissibility(c1, c2);
|
2019-05-16 07:58:49 -05:00
|
|
|
continue; // skipt next if clause as it needs some computation
|
|
|
|
}
|
2018-01-12 08:32:43 -06:00
|
|
|
|
2019-05-16 07:58:49 -05:00
|
|
|
if ( gc2 - gc1 == cartDims[0]*cartDims[1] ||
|
|
|
|
directVerticalNeighbors(cartDims, cartesianToActive, gc1, gc2))
|
2018-01-12 08:32:43 -06:00
|
|
|
tranz.data[gc1] = globalTrans->transmissibility(c1, c2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-12 09:17:07 -05:00
|
|
|
return {{"TRANX", tranx},
|
2019-02-01 10:33:30 -06:00
|
|
|
{"TRANY", trany},
|
2018-03-12 09:17:07 -05:00
|
|
|
{"TRANZ", tranz}};
|
2018-01-12 08:32:43 -06:00
|
|
|
}
|
|
|
|
|
2019-05-16 07:58:49 -05:00
|
|
|
Opm::NNC exportNncStructure_(const std::unordered_map<int,int>& cartesianToActive) const
|
2018-01-12 08:32:43 -06:00
|
|
|
{
|
2019-04-26 06:55:21 -05:00
|
|
|
std::size_t nx = eclState().getInputGrid().getNX();
|
|
|
|
std::size_t ny = eclState().getInputGrid().getNY();
|
2019-04-26 14:14:44 -05:00
|
|
|
auto nncData = sortNncAndApplyEditnnc(eclState().getInputNNC().nncdata(),
|
|
|
|
eclState().getInputEDITNNC().data());
|
|
|
|
const auto& unitSystem = simulator_.vanguard().deck().getActiveUnitSystem();
|
2019-04-26 06:55:21 -05:00
|
|
|
std::vector<Opm::NNCdata> outputNnc;
|
2019-04-26 14:14:44 -05:00
|
|
|
std::size_t index = 0;
|
|
|
|
|
|
|
|
for( const auto& entry : nncData ) {
|
|
|
|
// test whether NNC is not a neighboring connection
|
|
|
|
// cell2>=cell1 holds due to sortNncAndApplyEditnnc
|
|
|
|
assert( entry.cell2 >= entry.cell1 );
|
|
|
|
auto cellDiff = entry.cell2 - entry.cell1;
|
|
|
|
|
|
|
|
if (cellDiff != 1 && cellDiff != nx && cellDiff != nx*ny) {
|
|
|
|
auto tt = unitSystem.from_si(Opm::UnitSystem::measure::transmissibility, entry.trans);
|
|
|
|
// Eclipse ignores NNCs (with EDITNNC applied) that are small. Seems like the threshold is 1.0e-6
|
|
|
|
if ( tt >= 1.0e-6 )
|
|
|
|
outputNnc.emplace_back(entry.cell1, entry.cell2, entry.trans);
|
|
|
|
}
|
|
|
|
++index;
|
2019-04-26 06:55:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
auto nncCompare = []( const Opm::NNCdata& nnc1, const Opm::NNCdata& nnc2){
|
|
|
|
return nnc1.cell1 < nnc2.cell1 ||
|
|
|
|
( nnc1.cell1 == nnc2.cell1 && nnc1.cell2 < nnc2.cell2);};
|
2019-04-26 14:14:44 -05:00
|
|
|
// Sort the nncData values from the deck as they need to be
|
|
|
|
// Checked when writing NNC transmissibilities from the simulation.
|
|
|
|
std::sort(nncData.begin(), nncData.end(), nncCompare);
|
2018-01-12 08:32:43 -06:00
|
|
|
|
|
|
|
const auto& globalGridView = globalGrid_.leafGridView();
|
2018-01-29 02:12:34 -06:00
|
|
|
#if DUNE_VERSION_NEWER(DUNE_GRID, 2,6)
|
|
|
|
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView> ElementMapper;
|
|
|
|
ElementMapper globalElemMapper(globalGridView, Dune::mcmgElementLayout());
|
|
|
|
|
|
|
|
#else
|
2018-01-12 08:32:43 -06:00
|
|
|
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout> ElementMapper;
|
|
|
|
ElementMapper globalElemMapper(globalGridView);
|
2018-01-29 02:12:34 -06:00
|
|
|
#endif
|
2018-01-12 08:32:43 -06:00
|
|
|
|
2018-02-01 09:26:58 -06:00
|
|
|
const auto* globalTrans = &(simulator_.vanguard().globalTransmissibility());
|
2018-01-12 08:32:43 -06:00
|
|
|
if (!collectToIORank_.isParallel()) {
|
|
|
|
// in the sequential case we must use the transmissibilites defined by
|
|
|
|
// the problem. (because in the sequential case, the grid manager does
|
|
|
|
// not compute "global" transmissibilities for performance reasons. in
|
|
|
|
// the parallel case, the problem's transmissibilities can't be used
|
|
|
|
// because this object refers to the distributed grid and we need the
|
|
|
|
// sequential version here.)
|
|
|
|
globalTrans = &simulator_.problem().eclTransmissibilities();
|
|
|
|
}
|
|
|
|
|
2019-05-16 07:58:49 -05:00
|
|
|
auto cartDims = simulator_.vanguard().cartesianIndexMapper().cartesianDimensions();
|
2018-01-12 08:32:43 -06:00
|
|
|
auto elemIt = globalGridView.template begin</*codim=*/0>();
|
|
|
|
const auto& elemEndIt = globalGridView.template end</*codim=*/0>();
|
|
|
|
for (; elemIt != elemEndIt; ++ elemIt) {
|
|
|
|
const auto& elem = *elemIt;
|
|
|
|
|
|
|
|
auto isIt = globalGridView.ibegin(elem);
|
|
|
|
const auto& isEndIt = globalGridView.iend(elem);
|
|
|
|
for (; isIt != isEndIt; ++ isIt) {
|
|
|
|
const auto& is = *isIt;
|
|
|
|
|
|
|
|
if (!is.neighbor())
|
|
|
|
continue; // intersection is on the domain boundary
|
|
|
|
|
|
|
|
unsigned c1 = globalElemMapper.index(is.inside());
|
|
|
|
unsigned c2 = globalElemMapper.index(is.outside());
|
|
|
|
|
|
|
|
if (c1 > c2)
|
|
|
|
continue; // we only need to handle each connection once, thank you.
|
|
|
|
|
|
|
|
// TODO (?): use the cartesian index mapper to make this code work
|
|
|
|
// with grids other than Dune::CpGrid. The problem is that we need
|
|
|
|
// the a mapper for the sequential grid, not for the distributed one.
|
2019-04-26 06:55:21 -05:00
|
|
|
std::size_t cc1 = globalGrid_.globalCell()[c1];
|
|
|
|
std::size_t cc2 = globalGrid_.globalCell()[c2];
|
|
|
|
|
|
|
|
if ( cc2 < cc1 )
|
|
|
|
std::swap(cc1, cc2);
|
|
|
|
|
|
|
|
auto cellDiff = cc2 - cc1;
|
|
|
|
|
|
|
|
if (cellDiff != 1 &&
|
|
|
|
cellDiff != nx &&
|
2019-05-16 07:58:49 -05:00
|
|
|
cellDiff != nx*ny &&
|
|
|
|
! directVerticalNeighbors(cartDims, cartesianToActive, cc1, cc2)) {
|
2019-04-26 06:55:21 -05:00
|
|
|
// We need to check whether an NNC for this face was also specified
|
|
|
|
// via the NNC keyword in the deck (i.e. in the first origNncSize entries.
|
|
|
|
auto t = globalTrans->transmissibility(c1, c2);
|
2019-04-26 14:14:44 -05:00
|
|
|
auto candidate = std::lower_bound(nncData.begin(), nncData.end(), Opm::NNCdata(cc1, cc2, 0.0), nncCompare);
|
2019-04-26 06:55:21 -05:00
|
|
|
|
2019-04-26 14:14:44 -05:00
|
|
|
while ( candidate != nncData.end() && candidate->cell1 == cc1
|
2019-04-26 06:55:21 -05:00
|
|
|
&& candidate->cell2 == cc2) {
|
|
|
|
t -= candidate->trans;
|
2019-04-26 14:14:44 -05:00
|
|
|
++candidate;
|
2019-04-26 06:55:21 -05:00
|
|
|
}
|
2019-04-26 14:14:44 -05:00
|
|
|
// eclipse ignores NNCs with zero transmissibility (different threshold than for NNC
|
|
|
|
// with corresponding EDITNNC above). In addition we do set small transmissibilties
|
|
|
|
// to zero when setting up the simulator. These will be ignored here, too.
|
|
|
|
auto tt = unitSystem.from_si(Opm::UnitSystem::measure::transmissibility, std::abs(t));
|
|
|
|
if ( tt > 1e-12 )
|
2019-04-26 06:55:21 -05:00
|
|
|
outputNnc.push_back({cc1, cc2, t});
|
2018-01-12 08:32:43 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-26 06:55:21 -05:00
|
|
|
Opm::NNC ret;
|
|
|
|
for(const auto& nncItem: outputNnc)
|
|
|
|
ret.addNNC(nncItem.cell1, nncItem.cell2, nncItem.trans);
|
|
|
|
return ret;
|
2018-01-12 08:32:43 -06:00
|
|
|
}
|
|
|
|
|
2018-03-12 09:17:07 -05:00
|
|
|
struct EclWriteTasklet
|
|
|
|
: public TaskletInterface
|
2018-02-01 01:01:16 -06:00
|
|
|
{
|
2019-06-17 03:02:11 -05:00
|
|
|
Opm::SummaryState summaryState_;
|
2018-02-01 01:01:16 -06:00
|
|
|
Opm::EclipseIO& eclIO_;
|
2019-04-03 10:26:57 -05:00
|
|
|
int reportStepNum_;
|
2018-03-12 09:17:07 -05:00
|
|
|
bool isSubStep_;
|
2018-02-01 01:01:16 -06:00
|
|
|
double secondsElapsed_;
|
2018-04-28 06:31:27 -05:00
|
|
|
Opm::RestartValue restartValue_;
|
2018-02-01 01:01:16 -06:00
|
|
|
bool writeDoublePrecision_;
|
|
|
|
|
2019-06-17 03:02:11 -05:00
|
|
|
explicit EclWriteTasklet(const Opm::SummaryState& summaryState,
|
2019-06-04 00:48:21 -05:00
|
|
|
Opm::EclipseIO& eclIO,
|
2019-04-03 10:26:57 -05:00
|
|
|
int reportStepNum,
|
2018-03-12 09:17:07 -05:00
|
|
|
bool isSubStep,
|
|
|
|
double secondsElapsed,
|
2018-04-28 06:31:27 -05:00
|
|
|
Opm::RestartValue restartValue,
|
2018-03-12 09:17:07 -05:00
|
|
|
bool writeDoublePrecision)
|
2019-06-17 03:02:11 -05:00
|
|
|
: summaryState_(summaryState)
|
2019-06-04 00:48:21 -05:00
|
|
|
, eclIO_(eclIO)
|
2019-04-03 10:26:57 -05:00
|
|
|
, reportStepNum_(reportStepNum)
|
2018-03-12 09:17:07 -05:00
|
|
|
, isSubStep_(isSubStep)
|
|
|
|
, secondsElapsed_(secondsElapsed)
|
2018-04-28 06:31:27 -05:00
|
|
|
, restartValue_(restartValue)
|
2018-03-12 09:17:07 -05:00
|
|
|
, writeDoublePrecision_(writeDoublePrecision)
|
|
|
|
{ }
|
2018-02-01 01:01:16 -06:00
|
|
|
|
|
|
|
// callback to eclIO serial writeTimeStep method
|
2018-03-12 09:17:07 -05:00
|
|
|
void run()
|
2018-02-01 01:01:16 -06:00
|
|
|
{
|
2019-06-17 03:02:11 -05:00
|
|
|
eclIO_.writeTimeStep(summaryState_,
|
2019-06-04 00:48:21 -05:00
|
|
|
reportStepNum_,
|
2018-03-12 09:17:07 -05:00
|
|
|
isSubStep_,
|
2018-02-01 01:01:16 -06:00
|
|
|
secondsElapsed_,
|
2018-04-28 06:31:27 -05:00
|
|
|
restartValue_,
|
2018-02-01 01:01:16 -06:00
|
|
|
writeDoublePrecision_);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-01-12 08:32:43 -06:00
|
|
|
const Opm::EclipseState& eclState() const
|
2018-02-01 09:26:58 -06:00
|
|
|
{ return simulator_.vanguard().eclState(); }
|
2018-01-12 08:32:43 -06:00
|
|
|
|
2019-06-04 00:48:21 -05:00
|
|
|
Opm::SummaryState& summaryState()
|
|
|
|
{ return simulator_.vanguard().summaryState(); }
|
|
|
|
|
|
|
|
const Opm::Schedule& schedule() const
|
|
|
|
{ return simulator_.vanguard().schedule(); }
|
|
|
|
|
|
|
|
Simulator& simulator_;
|
2016-11-11 08:02:34 -06:00
|
|
|
CollectDataToIORankType collectToIORank_;
|
2018-02-01 06:16:37 -06:00
|
|
|
EclOutputBlackOilModule<TypeTag> eclOutputModule_;
|
2017-12-07 05:38:48 -06:00
|
|
|
std::unique_ptr<Opm::EclipseIO> eclIO_;
|
2018-01-12 08:32:43 -06:00
|
|
|
Grid globalGrid_;
|
2018-03-12 09:17:07 -05:00
|
|
|
std::unique_ptr<TaskletRunner> taskletRunner_;
|
2019-02-13 05:54:52 -06:00
|
|
|
Scalar restartTimeStepSize_;
|
2018-02-01 01:01:16 -06:00
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
|
|
|
|
};
|
2019-09-05 10:04:39 -05:00
|
|
|
} // namespace Opm
|
2016-11-11 08:02:34 -06:00
|
|
|
|
|
|
|
#endif
|