Renamed writeInit -> writeInitAndEgrid( )

This commit is contained in:
Joakim Hove 2016-06-24 16:17:32 +02:00
parent 5a89598788
commit e262d0da68
6 changed files with 71 additions and 56 deletions

View File

@ -746,7 +746,7 @@ namespace Opm
fullReport.reportParam(tot_os);
}
} else {
output_writer_->writeInit();
output_writer_->writeInit(geoprops_->simProps(grid_init_->grid()) , geoprops_->nonCartesianConnections( ));
if (output_cout_) {
std::cout << "\n\n================ Simulation turned off ===============\n" << std::flush;
}

View File

@ -33,6 +33,7 @@
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/core/grid/PinchProcessor.hpp>
#include <opm/common/utility/platform_dependent/disable_warnings.h>
#include <opm/output/Cells.hpp>
#include <Eigen/Eigen>
@ -218,6 +219,71 @@ namespace Opm
const NNC& nnc() const { return nnc_;}
const NNC& nonCartesianConnections() const { return noncartesian_;}
/// Most properties are loaded by the parser, and managed by
/// the EclipseState class in the opm-parser. However - some
/// properties must be calculated by the simulator, the
/// purpose of this method is to calculate these properties in
/// a form suitable for output. Currently the transmissibility
/// is the only property calculated this way:
///
/// The grid properties TRANX, TRANY and TRANZ are initialized
/// in a form suitable for writing to the INIT file. These
/// properties should be interpreted with a
/// 'the-grid-is-nearly-cartesian' mindset:
///
/// TRANX[i,j,k] = T on face between cells (i,j,k) and (i+1,j ,k )
/// TRANY[i,j,k] = T on face between cells (i,j,k) and (i ,j+1,k )
/// TRANZ[i,j,k] = T on face between cells (i,j,k) and (i ,j ,k+1)
///
/// If the grid structure has no resemblance to a cartesian
/// grid the whole TRAN keyword is quite meaningless.
template <class Grid>
const std::vector<data::CellData> simProps( const Grid& grid ) const {
using namespace UgGridHelpers;
const int* dims = cartDims( grid );
const int globalSize = dims[0] * dims[1] * dims[2];
const auto& trans = this->transmissibility( );
data::CellData tranx = {"TRANX" , UnitSystem::measure::transmissibility, std::vector<double>( globalSize )};
data::CellData trany = {"TRANY" , UnitSystem::measure::transmissibility, std::vector<double>( globalSize )};
data::CellData tranz = {"TRANZ" , UnitSystem::measure::transmissibility, std::vector<double>( globalSize )};
size_t num_faces = numFaces(grid);
auto fc = faceCells(grid);
for (size_t i = 0; i < num_faces; ++i) {
auto c1 = std::min( fc(i,0) , fc(i,1));
auto c2 = std::max( fc(i,0) , fc(i,1));
if (c1 == -1 || c2 == -1)
continue;
c1 = globalCell(grid) ? globalCell(grid)[c1] : c1;
c2 = globalCell(grid) ? globalCell(grid)[c2] : c2;
if ((c2 - c1) == 1) {
tranx.data[c1] = trans[i];
}
if ((c2 - c1) == dims[0]) {
trany.data[c1] = trans[i];
}
if ((c2 - c1) == dims[0]*dims[1]) {
tranz.data[c1] = trans[i];
}
}
std::vector<data::CellData> tran;
tran.push_back( std::move( tranx ));
tran.push_back( std::move( trany ));
tran.push_back( std::move( tranz ));
return tran;
}
private:
template <class Grid>
void multiplyHalfIntersections_(const Grid &grid,

View File

@ -111,59 +111,8 @@ namespace Opm
}
/// This code block is used to initialize grid properties TRANX, TRANY
/// and TRANZ which will be written to the INIT file. These properties
/// should be interpreted with a 'the-grid-is-nearly-cartesian'
/// mindset:
///
/// TRANX[i,j,k] = T on face between cells (i,j,k) and (i+1,j ,k )
/// TRANY[i,j,k] = T on face between cells (i,j,k) and (i ,j+1,k )
/// TRANZ[i,j,k] = T on face between cells (i,j,k) and (i ,j ,k+1)
///
/// If the grid structure has no resemblance to a cartesian grid the
/// whole TRAN keyword is quite meaningless.
{
using namespace UgGridHelpers;
const int* dims = cartDims( grid_ );
const int globalSize = dims[0] * dims[1] * dims[2];
const auto& trans = geo_.transmissibility( );
data::CellData tranx = {"TRANX" , UnitSystem::measure::transmissibility, std::vector<double>( globalSize )};
data::CellData trany = {"TRANY" , UnitSystem::measure::transmissibility, std::vector<double>( globalSize )};
data::CellData tranz = {"TRANZ" , UnitSystem::measure::transmissibility, std::vector<double>( globalSize )};
size_t num_faces = numFaces(grid_);
auto fc = faceCells(grid_);
for (size_t i = 0; i < num_faces; ++i) {
auto c1 = std::min( fc(i,0) , fc(i,1));
auto c2 = std::max( fc(i,0) , fc(i,1));
if (c1 == -1 || c2 == -1)
continue;
c1 = globalCell(grid_) ? globalCell(grid_)[c1] : c1;
c2 = globalCell(grid_) ? globalCell(grid_)[c2] : c2;
if ((c2 - c1) == 1) {
tranx.data[c1] = trans[i];
}
if ((c2 - c1) == dims[0]) {
trany.data[c1] = trans[i];
}
if ((c2 - c1) == dims[0]*dims[1]) {
tranz.data[c1] = trans[i];
}
}
std::vector<data::CellData> tran;
tran.push_back( std::move( tranx ));
tran.push_back( std::move( trany ));
tran.push_back( std::move( tranz ));
output_writer_.writeInit( tran , geo_.nonCartesianConnections( ));
}
output_writer_.writeInit( geo_.simProps(grid_) , geo_.nonCartesianConnections( ) );
std::string restorefilename = param_.getDefault("restorefile", std::string("") );
if( ! restorefilename.empty() )

View File

@ -73,7 +73,7 @@ namespace Opm
}
// init output writer
output_writer_.writeInit();
output_writer_.writeInit( geo_.simProps(grid_) , geo_.nonCartesianConnections( ) );
std::string restorefilename = param_.getDefault("restorefile", std::string("") );
if( ! restorefilename.empty() )

View File

@ -250,7 +250,7 @@ namespace Opm
writeInit(const std::vector<data::CellData>& simProps, const NNC& nnc)
{
if( eclWriter_ ) {
eclWriter_->writeInit(simProps, nnc);
eclWriter_->writeInitAndEgrid(simProps, nnc);
}
}

View File

@ -216,7 +216,7 @@ namespace Opm
const double* permeability );
/** \copydoc Opm::OutputWriter::writeInit */
void writeInit(const std::vector<data::CellData>& simProps = {} , const NNC& = NNC());
void writeInit(const std::vector<data::CellData>& simProps, const NNC& nnc);
/** \copydoc Opm::OutputWriter::writeTimeStep */
void writeTimeStep(const SimulatorTimerInterface& timer,