mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Introducing NNC output
* Compute NNC by face2cell information from a grid * Pass NNC information to EclipseWriter * Made NNC respect ECLIPSE input data * nncStructure() is now exportNncStructure()
This commit is contained in:
parent
1f4b9e56f8
commit
973914931d
@ -252,9 +252,57 @@ namespace Opm
|
||||
#endif
|
||||
}
|
||||
|
||||
/// checks cartesian adjacency of global indices g1 and g2
|
||||
bool cartesianAdjacent(const Grid& grid, int g1, int g2) {
|
||||
// we need cartDims from UgGridHelpers
|
||||
using namespace UgGridHelpers;
|
||||
|
||||
int diff = std::abs(g1 - g2);
|
||||
|
||||
const int * dimens = cartDims(grid);
|
||||
if (diff == 1)
|
||||
return true;
|
||||
if (diff == dimens[0])
|
||||
return true;
|
||||
if (diff == dimens[0] * dimens[1])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// Write the NNC structure of the given grid to NNC.
|
||||
///
|
||||
/// Write cell adjacencies beyond Cartesian neighborhoods to NNC.
|
||||
///
|
||||
/// The trans vector is indexed by face number as it is in grid.
|
||||
void exportNncStructure(NNC& nnc, const Grid& grid, const std::vector<double>& trans) {
|
||||
// we use numFaces, numCells, cell2Faces, globalCell from UgGridHelpers
|
||||
using namespace UgGridHelpers;
|
||||
|
||||
size_t num_faces = numFaces(grid);
|
||||
if (trans.size() > 0 && trans.size() != num_faces) {
|
||||
throw std::logic_error(
|
||||
"non-empty trans vector with wrong dimension.");
|
||||
}
|
||||
|
||||
auto fc = faceCells(grid);
|
||||
for (size_t i = 0; i < num_faces; ++i) {
|
||||
auto c1 = fc(i, 0);
|
||||
auto c2 = fc(i, 1);
|
||||
|
||||
if (c1 == -1 || c2 == -1)
|
||||
continue; // face on grid boundary
|
||||
// translate from active cell idx (ac1,ac2) to global cell idx
|
||||
c1 = globalCell(grid) ? globalCell(grid)[c1] : c1;
|
||||
c2 = globalCell(grid) ? globalCell(grid)[c2] : c2;
|
||||
if (!cartesianAdjacent(grid, c1, c2)) {
|
||||
// suppose c1,c2 is specified in ECLIPSE input
|
||||
// we here overwrite its trans by grid's
|
||||
nnc.addNNC(c1, c2, trans[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Print startup message if on output rank.
|
||||
void printStartupMessage()
|
||||
@ -676,7 +724,8 @@ namespace Opm
|
||||
const auto initConfig = eclipse_state_->getInitConfig();
|
||||
simtimer.init(timeMap, (size_t)initConfig->getRestartStep());
|
||||
|
||||
|
||||
Opm::NNC nnc = eclipse_state_->getNNC(); // copy, otherwise we write to ecl_state
|
||||
exportNncStructure(nnc, grid_init_->grid(), trans_);
|
||||
|
||||
if (!schedule->initOnly()) {
|
||||
if (output_cout_) {
|
||||
@ -704,10 +753,11 @@ namespace Opm
|
||||
fullReport.reportParam(tot_os);
|
||||
}
|
||||
} else {
|
||||
output_writer_->writeInit( simtimer );
|
||||
output_writer_->writeInit( simtimer, geoprops_->nnc() );
|
||||
if (output_cout_) {
|
||||
std::cout << "\n\n================ Simulation turned off ===============\n" << std::flush;
|
||||
}
|
||||
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
// init output writer
|
||||
output_writer_.writeInit( timer );
|
||||
output_writer_.writeInit( timer, geo_.nnc() );
|
||||
|
||||
std::string restorefilename = param_.getDefault("restorefile", std::string("") );
|
||||
if( ! restorefilename.empty() )
|
||||
|
@ -74,7 +74,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
// init output writer
|
||||
output_writer_.writeInit( timer );
|
||||
output_writer_.writeInit( timer, geo_.nnc());
|
||||
|
||||
std::string restorefilename = param_.getDefault("restorefile", std::string("") );
|
||||
if( ! restorefilename.empty() )
|
||||
|
@ -246,10 +246,10 @@ namespace Opm
|
||||
|
||||
void
|
||||
BlackoilOutputWriter::
|
||||
writeInit(const SimulatorTimerInterface& timer)
|
||||
writeInit(const SimulatorTimerInterface& timer, const NNC& nnc)
|
||||
{
|
||||
if( eclWriter_ ) {
|
||||
eclWriter_->writeInit(timer);
|
||||
eclWriter_->writeInit(timer, nnc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ namespace Opm
|
||||
{}
|
||||
|
||||
/** \copydoc Opm::OutputWriter::writeInit */
|
||||
void writeInit(const SimulatorTimerInterface& /* timer */)
|
||||
void writeInit(const SimulatorTimerInterface& /* timer */, const NNC& nnc)
|
||||
{}
|
||||
|
||||
/** \copydoc Opm::OutputWriter::writeTimeStep */
|
||||
@ -183,7 +183,7 @@ namespace Opm
|
||||
{}
|
||||
|
||||
/** \copydoc Opm::OutputWriter::writeInit */
|
||||
void writeInit(const SimulatorTimerInterface& /* timer */)
|
||||
void writeInit(const SimulatorTimerInterface& /* timer */, const NNC& nnc)
|
||||
{}
|
||||
|
||||
/** \copydoc Opm::OutputWriter::writeTimeStep */
|
||||
@ -214,7 +214,7 @@ namespace Opm
|
||||
const double* permeability );
|
||||
|
||||
/** \copydoc Opm::OutputWriter::writeInit */
|
||||
void writeInit(const SimulatorTimerInterface &timer);
|
||||
void writeInit(const SimulatorTimerInterface &timer, const NNC& nnc);
|
||||
|
||||
/** \copydoc Opm::OutputWriter::writeTimeStep */
|
||||
void writeTimeStep(const SimulatorTimerInterface& timer,
|
||||
|
Loading…
Reference in New Issue
Block a user