mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-20 11:48:25 -06:00
Merge pull request #476 from dr-robertk/PR/ParallelDebugOutput
Pr/parallel debug output fixes
This commit is contained in:
commit
55f8ebacfc
@ -247,7 +247,6 @@ try
|
||||
}
|
||||
|
||||
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);
|
||||
Opm::BlackoilOutputWriter outputWriter(grid, param, eclipseState, pu );
|
||||
|
||||
std::vector<int> compressedToCartesianIdx;
|
||||
Opm::createGlobalCellArray(grid, compressedToCartesianIdx);
|
||||
@ -353,17 +352,14 @@ try
|
||||
// and initilialize new properties and states for it.
|
||||
if( mpi_size > 1 )
|
||||
{
|
||||
if( param.getDefault("output_matlab", false) || param.getDefault("output_ecl", true) )
|
||||
{
|
||||
std::cerr << "We only support vtk output during parallel runs. \n"
|
||||
<< "Please use \"output_matlab=false output_ecl=false\" to deactivate the \n"
|
||||
<< "other outputs!" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Opm::distributeGridAndData( grid, eclipseState, state, new_props, geoprops, parallel_information, use_local_perm );
|
||||
}
|
||||
|
||||
// create output writer after grid is distributed, otherwise the parallel output
|
||||
// won't work correctly since we need to create a mapping from the distributed to
|
||||
// the global view
|
||||
Opm::BlackoilOutputWriter outputWriter(grid, param, eclipseState, pu );
|
||||
|
||||
// Solver for Newton iterations.
|
||||
std::unique_ptr<NewtonIterationBlackoilInterface> fis_solver;
|
||||
if (param.getDefault("use_interleaved", true)) {
|
||||
|
@ -131,7 +131,9 @@ namespace Opm
|
||||
IndexMapType& localIndexMap_;
|
||||
IndexMapStorageType& indexMaps_;
|
||||
std::map< const int, const int > globalPosition_;
|
||||
#ifndef NDEBUG
|
||||
std::set< int > checkPosition_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
DistributeIndexMapping( const std::vector<int>& globalIndex,
|
||||
@ -171,7 +173,9 @@ namespace Opm
|
||||
void pack( const int link, MessageBufferType& buffer )
|
||||
{
|
||||
// we should only get one link
|
||||
assert( link == 0 );
|
||||
if( link != 0 ) {
|
||||
OPM_THROW(std::logic_error,"link in method pack is not 0 as execpted");
|
||||
}
|
||||
|
||||
// pack all interior global cell id's
|
||||
const int size = localIndexMap_.size();
|
||||
@ -343,7 +347,9 @@ namespace Opm
|
||||
void pack( const int link, MessageBufferType& buffer )
|
||||
{
|
||||
// we should only get one link
|
||||
assert( link == 0 );
|
||||
if( link != 0 ) {
|
||||
OPM_THROW(std::logic_error,"link in method pack is not 0 as execpted");
|
||||
}
|
||||
|
||||
// write all cell data registered in local state
|
||||
const size_t numCells = localState_.numCells();
|
||||
@ -500,7 +506,6 @@ namespace Opm
|
||||
// mapping there.
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// gather solution to rank 0 for EclipseWriter
|
||||
|
@ -84,16 +84,33 @@ namespace Opm
|
||||
|
||||
|
||||
void outputStateMatlab(const UnstructuredGrid& grid,
|
||||
const Opm::BlackoilState& state,
|
||||
const Opm::SimulatorState& state,
|
||||
const int step,
|
||||
const std::string& output_dir)
|
||||
{
|
||||
Opm::DataMap dm;
|
||||
dm["saturation"] = &state.saturation();
|
||||
dm["pressure"] = &state.pressure();
|
||||
dm["surfvolume"] = &state.surfacevol();
|
||||
dm["rs"] = &state.gasoilratio();
|
||||
dm["rv"] = &state.rv();
|
||||
for( unsigned int i=0; i<state.cellDataNames().size(); ++ i )
|
||||
{
|
||||
const std::string& name = state.cellDataNames()[ i ];
|
||||
std::string key;
|
||||
if( name == "SURFACEVOL" ) {
|
||||
key = "surfvolume";
|
||||
}
|
||||
else if( name == "RV" ) {
|
||||
key = "rv";
|
||||
}
|
||||
else if( name == "GASOILRATIO" ) {
|
||||
key = "rs";
|
||||
}
|
||||
else { // otherwise skip entry
|
||||
continue;
|
||||
}
|
||||
// set data to datmap
|
||||
dm[ key ] = &state.cellData()[ i ];
|
||||
}
|
||||
|
||||
std::vector<double> cell_velocity;
|
||||
Opm::estimateCellVelocity(AutoDiffGrid::numCells(grid),
|
||||
AutoDiffGrid::numFaces(grid),
|
||||
|
@ -55,7 +55,7 @@ namespace Opm
|
||||
|
||||
|
||||
void outputStateMatlab(const UnstructuredGrid& grid,
|
||||
const Opm::BlackoilState& state,
|
||||
const Opm::SimulatorState& state,
|
||||
const int step,
|
||||
const std::string& output_dir);
|
||||
|
||||
@ -71,16 +71,32 @@ namespace Opm
|
||||
|
||||
template<class Grid>
|
||||
void outputStateMatlab(const Grid& grid,
|
||||
const Opm::BlackoilState& state,
|
||||
const Opm::SimulatorState& state,
|
||||
const int step,
|
||||
const std::string& output_dir)
|
||||
{
|
||||
Opm::DataMap dm;
|
||||
dm["saturation"] = &state.saturation();
|
||||
dm["pressure"] = &state.pressure();
|
||||
dm["surfvolume"] = &state.surfacevol();
|
||||
dm["rs"] = &state.gasoilratio();
|
||||
dm["rv"] = &state.rv();
|
||||
for( unsigned int i=0; i<state.cellDataNames().size(); ++ i )
|
||||
{
|
||||
const std::string& name = state.cellDataNames()[ i ];
|
||||
std::string key;
|
||||
if( name == "SURFACEVOL" ) {
|
||||
key = "surfvolume";
|
||||
}
|
||||
else if( name == "RV" ) {
|
||||
key = "rv";
|
||||
}
|
||||
else if( name == "GASOILRATIO" ) {
|
||||
key = "rs";
|
||||
}
|
||||
else { // otherwise skip entry
|
||||
continue;
|
||||
}
|
||||
// set data to datmap
|
||||
dm[ key ] = &state.cellData()[ i ];
|
||||
}
|
||||
|
||||
std::vector<double> cell_velocity;
|
||||
Opm::estimateCellVelocity(AutoDiffGrid::numCells(grid),
|
||||
@ -167,14 +183,7 @@ namespace Opm
|
||||
const WellState& wellState,
|
||||
bool /*substep*/ = false)
|
||||
{
|
||||
const BlackoilState* state =
|
||||
dynamic_cast< const BlackoilState* > (&reservoirState);
|
||||
if( state ) {
|
||||
outputStateMatlab(grid_, *state, timer.currentStepNum(), outputDir_);
|
||||
}
|
||||
else {
|
||||
OPM_THROW(std::logic_error,"BlackoilMatlabWriter only works for BlackoilState");
|
||||
}
|
||||
outputStateMatlab(grid_, reservoirState, timer.currentStepNum(), outputDir_);
|
||||
outputWellStateMatlab(wellState, timer.currentStepNum(), outputDir_);
|
||||
}
|
||||
protected:
|
||||
|
@ -58,9 +58,10 @@ namespace Opm
|
||||
template <class State, class PrevState>
|
||||
void init(const Wells* wells, const State& state, const PrevState& prevState)
|
||||
{
|
||||
// clear old name mapping
|
||||
wellMap().clear();
|
||||
// call init on base class
|
||||
BaseType :: init(wells, state);
|
||||
|
||||
// if there are no well, do nothing in init
|
||||
if (wells == 0) {
|
||||
return;
|
||||
}
|
||||
@ -68,10 +69,6 @@ namespace Opm
|
||||
const int nw = wells->number_of_wells;
|
||||
if( nw == 0 ) return ;
|
||||
|
||||
// We use the WellState::init() function to do bhp and well rates init.
|
||||
// The alternative would be to copy that function wholesale.
|
||||
BaseType :: init(wells, state);
|
||||
|
||||
// Initialize perfphaserates_, which must be done here.
|
||||
const int np = wells->number_of_phases;
|
||||
const int nperf = wells->well_connpos[nw];
|
||||
@ -85,7 +82,6 @@ namespace Opm
|
||||
if (well_controls_well_is_stopped(ctrl)) {
|
||||
// Shut well: perfphaserates_ are all zero.
|
||||
} else {
|
||||
// also store the number of perforations in this well
|
||||
const int num_perf_this_well = wells->well_connpos[w + 1] - wells->well_connpos[w];
|
||||
// Open well: Initialize perfphaserates_ to well
|
||||
// rates divided by the number of perforations.
|
||||
|
Loading…
Reference in New Issue
Block a user