Merge pull request #27 from pgdr/nnc-structure
Added support for writing NNC information
This commit is contained in:
commit
fe3bf63bd2
@ -26,9 +26,9 @@ struct MultiWriter : public OutputWriter {
|
||||
MultiWriter (ptr_t writers) : writers_ (std::move (writers)) { }
|
||||
|
||||
/// Forward the call to all writers
|
||||
virtual void writeInit(const SimulatorTimerInterface &timer) {
|
||||
virtual void writeInit(const SimulatorTimerInterface &timer, const NNC& nnc) {
|
||||
for (it_t it = writers_->begin (); it != writers_->end (); ++it) {
|
||||
(*it)->writeInit (timer);
|
||||
(*it)->writeInit (timer, nnc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <memory> // unique_ptr, shared_ptr
|
||||
#include <opm/core/simulator/SimulatorTimerInterface.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
@ -73,7 +74,7 @@ public:
|
||||
* This routine should be called before the first timestep (i.e. when
|
||||
* timer.currentStepNum () == 0)
|
||||
*/
|
||||
virtual void writeInit(const SimulatorTimerInterface &timer) = 0;
|
||||
virtual void writeInit(const SimulatorTimerInterface &timer, const NNC& nnc = NNC()) = 0;
|
||||
|
||||
/*!
|
||||
* \brief Write a blackoil reservoir state to disk for later inspection with
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <opm/core/simulator/SimulatorTimerInterface.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
@ -38,7 +39,6 @@
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@ -80,8 +80,11 @@ public:
|
||||
|
||||
/**
|
||||
* Write the static eclipse data (grid, PVT curves, etc) to disk.
|
||||
*
|
||||
* If NNC is given, writes TRANNNC keyword.
|
||||
*/
|
||||
virtual void writeInit(const SimulatorTimerInterface &timer);
|
||||
virtual void writeInit(const SimulatorTimerInterface &timer,
|
||||
const NNC& nnc = NNC());
|
||||
|
||||
/*!
|
||||
* \brief Write a reservoir state and summary information to disk.
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Units/ConversionFactors.hpp>
|
||||
#include <opm/parser/eclipse/Units/Dimension.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
@ -547,7 +548,8 @@ public:
|
||||
const int* compressedToCartesianCellIdx,
|
||||
const SimulatorTimerInterface& timer,
|
||||
Opm::EclipseStateConstPtr eclipseState,
|
||||
const PhaseUsage uses)
|
||||
const PhaseUsage uses,
|
||||
const NNC& nnc = NNC())
|
||||
{
|
||||
auto dataField = eclipseState->get3DProperties().getDoubleGridProperty("PORO").getData();
|
||||
restrictAndReorderToActiveCells(dataField, numCells, compressedToCartesianCellIdx);
|
||||
@ -566,6 +568,16 @@ public:
|
||||
|
||||
eclGrid->resetACTNUM(&actnumData[0]);
|
||||
|
||||
if (nnc.hasNNC())
|
||||
{
|
||||
int idx = 0;
|
||||
// const_cast is safe, since this is a copy of the input grid
|
||||
auto ecl_grid = const_cast<ecl_grid_type*>(eclGrid->c_ptr());
|
||||
for (NNCdata n : nnc.nncdata()) {
|
||||
ecl_grid_add_self_nnc( ecl_grid, n.cell1, n.cell2, idx++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// finally, write the grid to disk
|
||||
IOConfigConstPtr ioConfig = eclipseState->getIOConfigConst();
|
||||
@ -1165,7 +1177,7 @@ EclipseWriter::convertUnitTypeErtEclUnitEnum(UnitSystem::UnitType unit)
|
||||
}
|
||||
|
||||
|
||||
void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
|
||||
void EclipseWriter::writeInit(const SimulatorTimerInterface &timer, const NNC& nnc)
|
||||
{
|
||||
// if we don't want to write anything, this method becomes a
|
||||
// no-op...
|
||||
@ -1181,11 +1193,13 @@ void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
|
||||
compressedToCartesianCellIdx_,
|
||||
timer,
|
||||
eclipseState_,
|
||||
phaseUsage_);
|
||||
phaseUsage_,
|
||||
nnc);
|
||||
|
||||
IOConfigConstPtr ioConfig = eclipseState_->getIOConfigConst();
|
||||
const auto& props = eclipseState_->get3DProperties();
|
||||
|
||||
|
||||
if (ioConfig->getWriteINITFile()) {
|
||||
if (props.hasDeckDoubleGridProperty("PERMX")) {
|
||||
auto data = props.getDoubleGridProperty("PERMX").getData();
|
||||
@ -1205,6 +1219,17 @@ void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
|
||||
EclipseWriterDetails::restrictAndReorderToActiveCells(data, gridToEclipseIdx_.size(), gridToEclipseIdx_.data());
|
||||
fortio.writeKeyword("PERMZ", data);
|
||||
}
|
||||
if (nnc.hasNNC()) {
|
||||
std::vector<double> tran;
|
||||
for (NNCdata nd : nnc.nncdata()) {
|
||||
tran.push_back(nd.trans);
|
||||
}
|
||||
if (eclipseState_->getDeckUnitSystem().getType() == UnitSystem::UNIT_TYPE_METRIC)
|
||||
EclipseWriterDetails::convertFromSiTo(tran, 1.0 / Opm::Metric::Transmissibility);
|
||||
else
|
||||
EclipseWriterDetails::convertFromSiTo(tran, 1.0 / Opm::Field::Transmissibility);
|
||||
fortio.writeKeyword("TRANNNC", tran);
|
||||
}
|
||||
}
|
||||
|
||||
/* Create summary object (could not do it at construction time,
|
||||
|
Loading…
Reference in New Issue
Block a user