mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Include possibility for arbitrary summary data.
This adapts to the upstream API change in opm-data, and adds a proof-of-concept dummy TCPU field.
This commit is contained in:
parent
e5732ea0a7
commit
2d0701c1e8
@ -191,7 +191,7 @@ namespace Opm
|
||||
|
||||
// No per cell data is written for initial step, but will be
|
||||
// for subsequent steps, when we have started simulating
|
||||
output_writer_.writeTimeStepWithoutCellProperties( timer, state, well_state, {} );
|
||||
output_writer_.writeTimeStepWithoutCellProperties( timer, state, well_state, {}, {} );
|
||||
|
||||
report.output_write_time += perfTimer.stop();
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ namespace Opm
|
||||
if (timer.initialStep()) {
|
||||
// No per cell data is written for initial step, but will be
|
||||
// for subsequent steps, when we have started simulating
|
||||
output_writer_.writeTimeStepWithoutCellProperties( timer, state, well_state, {} );
|
||||
output_writer_.writeTimeStepWithoutCellProperties( timer, state, well_state, {}, {} );
|
||||
}
|
||||
|
||||
// Max oil saturation (for VPPARS), hysteresis update.
|
||||
|
@ -185,7 +185,8 @@ namespace Opm
|
||||
const SimulationDataContainer state_;
|
||||
const WellStateFullyImplicitBlackoil wellState_;
|
||||
data::Solution simProps_;
|
||||
std::map<std::string, std::vector<double>> extraData_;
|
||||
std::map<std::string, double> miscSummaryData_;
|
||||
std::map<std::string, std::vector<double>> extraRestartData_;
|
||||
const bool substep_;
|
||||
|
||||
explicit WriterCall( BlackoilOutputWriter& writer,
|
||||
@ -193,14 +194,16 @@ namespace Opm
|
||||
const SimulationDataContainer& state,
|
||||
const WellStateFullyImplicitBlackoil& wellState,
|
||||
const data::Solution& simProps,
|
||||
const std::map<std::string, std::vector<double>>& extraData,
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& extraRestartData,
|
||||
bool substep )
|
||||
: writer_( writer ),
|
||||
timer_( timer.clone() ),
|
||||
state_( state ),
|
||||
wellState_( wellState ),
|
||||
simProps_( simProps ),
|
||||
extraData_( extraData ),
|
||||
miscSummaryData_( miscSummaryData ),
|
||||
extraRestartData_( extraRestartData ),
|
||||
substep_( substep )
|
||||
{
|
||||
}
|
||||
@ -209,7 +212,7 @@ namespace Opm
|
||||
void run ()
|
||||
{
|
||||
// write data
|
||||
writer_.writeTimeStepSerial( *timer_, state_, wellState_, simProps_, extraData_, substep_ );
|
||||
writer_.writeTimeStepSerial( *timer_, state_, wellState_, simProps_, miscSummaryData_, extraRestartData_, substep_ );
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -223,7 +226,8 @@ namespace Opm
|
||||
const SimulatorTimerInterface& timer,
|
||||
const SimulationDataContainer& localState,
|
||||
const WellStateFullyImplicitBlackoil& localWellState,
|
||||
const std::map<std::string, std::vector<double>>& extraData,
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& extraRestartData,
|
||||
bool substep)
|
||||
{
|
||||
data::Solution localCellData{};
|
||||
@ -232,7 +236,7 @@ namespace Opm
|
||||
localCellData = simToSolution(localState, restart_double_si_, phaseUsage_); // Get "normal" data (SWAT, PRESSURE, ...);
|
||||
}
|
||||
writeTimeStepWithCellProperties(timer, localState, localCellData ,
|
||||
localWellState, extraData, substep);
|
||||
localWellState, miscSummaryData, extraRestartData, substep);
|
||||
}
|
||||
|
||||
|
||||
@ -246,7 +250,8 @@ namespace Opm
|
||||
const SimulationDataContainer& localState,
|
||||
const data::Solution& localCellData,
|
||||
const WellStateFullyImplicitBlackoil& localWellState,
|
||||
const std::map<std::string, std::vector<double>>& extraData,
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& extraRestartData,
|
||||
bool substep)
|
||||
{
|
||||
// VTK output (is parallel if grid is parallel)
|
||||
@ -282,12 +287,12 @@ namespace Opm
|
||||
{
|
||||
if( asyncOutput_ ) {
|
||||
// dispatch the write call to the extra thread
|
||||
asyncOutput_->dispatch( detail::WriterCall( *this, timer, state, wellState, cellData, extraData, substep ) );
|
||||
asyncOutput_->dispatch( detail::WriterCall( *this, timer, state, wellState, cellData, miscSummaryData, extraRestartData, substep ) );
|
||||
}
|
||||
else {
|
||||
// just write the data to disk
|
||||
try {
|
||||
writeTimeStepSerial( timer, state, wellState, cellData, extraData, substep );
|
||||
writeTimeStepSerial( timer, state, wellState, cellData, miscSummaryData, extraRestartData, substep );
|
||||
} catch (std::runtime_error& msg) {
|
||||
err = 1;
|
||||
emsg = msg.what();
|
||||
@ -317,7 +322,8 @@ namespace Opm
|
||||
const SimulationDataContainer& state,
|
||||
const WellStateFullyImplicitBlackoil& wellState,
|
||||
const data::Solution& simProps,
|
||||
const std::map<std::string, std::vector<double>>& extraData,
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& extraRestartData,
|
||||
bool substep)
|
||||
{
|
||||
// Matlab output
|
||||
@ -338,7 +344,8 @@ namespace Opm
|
||||
timer.simulationTimeElapsed(),
|
||||
simProps,
|
||||
wellState.report(phaseUsage_),
|
||||
extraData,
|
||||
miscSummaryData,
|
||||
extraRestartData,
|
||||
restart_double_si_);
|
||||
}
|
||||
}
|
||||
@ -407,7 +414,7 @@ namespace Opm
|
||||
|
||||
// No per cell data is written for restore steps, but will be
|
||||
// for subsequent steps, when we have started simulating
|
||||
writeTimeStepWithoutCellProperties( timer, state, wellState, {} );
|
||||
writeTimeStepWithoutCellProperties( timer, state, wellState, {}, {});
|
||||
|
||||
// some output
|
||||
std::cout << "Restored step " << timer.reportStepNum() << " at day "
|
||||
|
@ -235,14 +235,15 @@ namespace Opm
|
||||
/*!
|
||||
* \brief Write a blackoil reservoir state to disk for later inspection with
|
||||
* visualization tools like ResInsight. This function will write all
|
||||
* CellData in simProps to the file as well as the extraData.
|
||||
* CellData in simProps to the file as well as the extraRestartData.
|
||||
*/
|
||||
void writeTimeStepWithCellProperties(
|
||||
const SimulatorTimerInterface& timer,
|
||||
const SimulationDataContainer& reservoirState,
|
||||
const data::Solution& cellData,
|
||||
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
||||
const std::map<std::string, std::vector<double>>& extraData,
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& extraRestartData,
|
||||
bool substep = false);
|
||||
|
||||
/*!
|
||||
@ -254,7 +255,8 @@ namespace Opm
|
||||
const SimulatorTimerInterface& timer,
|
||||
const SimulationDataContainer& reservoirState,
|
||||
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
||||
const std::map<std::string, std::vector<double>>& extraData,
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& extraRestartData,
|
||||
bool substep = false);
|
||||
|
||||
/*!
|
||||
@ -266,7 +268,8 @@ namespace Opm
|
||||
const SimulationDataContainer& reservoirState,
|
||||
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
||||
const data::Solution& simProps,
|
||||
const std::map<std::string, std::vector<double>>& extraData,
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& extraRestartData,
|
||||
bool substep);
|
||||
|
||||
/** \brief return output directory */
|
||||
@ -994,7 +997,8 @@ namespace Opm
|
||||
const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig();
|
||||
const int reportStepNum = timer.reportStepNum();
|
||||
bool logMessages = output_ && parallelOutput_->isIORank();
|
||||
std::map<std::string, std::vector<double>> extraData;
|
||||
std::map<std::string, std::vector<double>> extraRestartData;
|
||||
std::map<std::string, double> miscSummaryData;
|
||||
|
||||
if( output_ )
|
||||
{
|
||||
@ -1016,10 +1020,14 @@ namespace Opm
|
||||
assert(!localCellData.empty());
|
||||
|
||||
// Add suggested next timestep to extra data.
|
||||
extraData["OPMEXTRA"] = std::vector<double>(1, nextstep);
|
||||
extraRestartData["OPMEXTRA"] = std::vector<double>(1, nextstep);
|
||||
|
||||
// @@@ HACK @@@
|
||||
// Add TCPU
|
||||
miscSummaryData["TCPU"] = 100.0;
|
||||
}
|
||||
|
||||
writeTimeStepWithCellProperties(timer, localState, localCellData, localWellState, extraData, substep);
|
||||
writeTimeStepWithCellProperties(timer, localState, localCellData, localWellState, miscSummaryData, extraRestartData, substep);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user