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:
@@ -191,7 +191,7 @@ namespace Opm
|
|||||||
|
|
||||||
// No per cell data is written for initial step, but will be
|
// No per cell data is written for initial step, but will be
|
||||||
// for subsequent steps, when we have started simulating
|
// 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();
|
report.output_write_time += perfTimer.stop();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace Opm
|
|||||||
if (timer.initialStep()) {
|
if (timer.initialStep()) {
|
||||||
// No per cell data is written for initial step, but will be
|
// No per cell data is written for initial step, but will be
|
||||||
// for subsequent steps, when we have started simulating
|
// 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.
|
// Max oil saturation (for VPPARS), hysteresis update.
|
||||||
|
|||||||
@@ -185,7 +185,8 @@ namespace Opm
|
|||||||
const SimulationDataContainer state_;
|
const SimulationDataContainer state_;
|
||||||
const WellStateFullyImplicitBlackoil wellState_;
|
const WellStateFullyImplicitBlackoil wellState_;
|
||||||
data::Solution simProps_;
|
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_;
|
const bool substep_;
|
||||||
|
|
||||||
explicit WriterCall( BlackoilOutputWriter& writer,
|
explicit WriterCall( BlackoilOutputWriter& writer,
|
||||||
@@ -193,14 +194,16 @@ namespace Opm
|
|||||||
const SimulationDataContainer& state,
|
const SimulationDataContainer& state,
|
||||||
const WellStateFullyImplicitBlackoil& wellState,
|
const WellStateFullyImplicitBlackoil& wellState,
|
||||||
const data::Solution& simProps,
|
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 )
|
bool substep )
|
||||||
: writer_( writer ),
|
: writer_( writer ),
|
||||||
timer_( timer.clone() ),
|
timer_( timer.clone() ),
|
||||||
state_( state ),
|
state_( state ),
|
||||||
wellState_( wellState ),
|
wellState_( wellState ),
|
||||||
simProps_( simProps ),
|
simProps_( simProps ),
|
||||||
extraData_( extraData ),
|
miscSummaryData_( miscSummaryData ),
|
||||||
|
extraRestartData_( extraRestartData ),
|
||||||
substep_( substep )
|
substep_( substep )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -209,7 +212,7 @@ namespace Opm
|
|||||||
void run ()
|
void run ()
|
||||||
{
|
{
|
||||||
// write data
|
// 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 SimulatorTimerInterface& timer,
|
||||||
const SimulationDataContainer& localState,
|
const SimulationDataContainer& localState,
|
||||||
const WellStateFullyImplicitBlackoil& localWellState,
|
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)
|
bool substep)
|
||||||
{
|
{
|
||||||
data::Solution localCellData{};
|
data::Solution localCellData{};
|
||||||
@@ -232,7 +236,7 @@ namespace Opm
|
|||||||
localCellData = simToSolution(localState, restart_double_si_, phaseUsage_); // Get "normal" data (SWAT, PRESSURE, ...);
|
localCellData = simToSolution(localState, restart_double_si_, phaseUsage_); // Get "normal" data (SWAT, PRESSURE, ...);
|
||||||
}
|
}
|
||||||
writeTimeStepWithCellProperties(timer, localState, localCellData ,
|
writeTimeStepWithCellProperties(timer, localState, localCellData ,
|
||||||
localWellState, extraData, substep);
|
localWellState, miscSummaryData, extraRestartData, substep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -246,7 +250,8 @@ namespace Opm
|
|||||||
const SimulationDataContainer& localState,
|
const SimulationDataContainer& localState,
|
||||||
const data::Solution& localCellData,
|
const data::Solution& localCellData,
|
||||||
const WellStateFullyImplicitBlackoil& localWellState,
|
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)
|
bool substep)
|
||||||
{
|
{
|
||||||
// VTK output (is parallel if grid is parallel)
|
// VTK output (is parallel if grid is parallel)
|
||||||
@@ -282,12 +287,12 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
if( asyncOutput_ ) {
|
if( asyncOutput_ ) {
|
||||||
// dispatch the write call to the extra thread
|
// 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 {
|
else {
|
||||||
// just write the data to disk
|
// just write the data to disk
|
||||||
try {
|
try {
|
||||||
writeTimeStepSerial( timer, state, wellState, cellData, extraData, substep );
|
writeTimeStepSerial( timer, state, wellState, cellData, miscSummaryData, extraRestartData, substep );
|
||||||
} catch (std::runtime_error& msg) {
|
} catch (std::runtime_error& msg) {
|
||||||
err = 1;
|
err = 1;
|
||||||
emsg = msg.what();
|
emsg = msg.what();
|
||||||
@@ -317,7 +322,8 @@ namespace Opm
|
|||||||
const SimulationDataContainer& state,
|
const SimulationDataContainer& state,
|
||||||
const WellStateFullyImplicitBlackoil& wellState,
|
const WellStateFullyImplicitBlackoil& wellState,
|
||||||
const data::Solution& simProps,
|
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)
|
bool substep)
|
||||||
{
|
{
|
||||||
// Matlab output
|
// Matlab output
|
||||||
@@ -338,7 +344,8 @@ namespace Opm
|
|||||||
timer.simulationTimeElapsed(),
|
timer.simulationTimeElapsed(),
|
||||||
simProps,
|
simProps,
|
||||||
wellState.report(phaseUsage_),
|
wellState.report(phaseUsage_),
|
||||||
extraData,
|
miscSummaryData,
|
||||||
|
extraRestartData,
|
||||||
restart_double_si_);
|
restart_double_si_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -407,7 +414,7 @@ namespace Opm
|
|||||||
|
|
||||||
// No per cell data is written for restore steps, but will be
|
// No per cell data is written for restore steps, but will be
|
||||||
// for subsequent steps, when we have started simulating
|
// for subsequent steps, when we have started simulating
|
||||||
writeTimeStepWithoutCellProperties( timer, state, wellState, {} );
|
writeTimeStepWithoutCellProperties( timer, state, wellState, {}, {});
|
||||||
|
|
||||||
// some output
|
// some output
|
||||||
std::cout << "Restored step " << timer.reportStepNum() << " at day "
|
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
|
* \brief Write a blackoil reservoir state to disk for later inspection with
|
||||||
* visualization tools like ResInsight. This function will write all
|
* 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(
|
void writeTimeStepWithCellProperties(
|
||||||
const SimulatorTimerInterface& timer,
|
const SimulatorTimerInterface& timer,
|
||||||
const SimulationDataContainer& reservoirState,
|
const SimulationDataContainer& reservoirState,
|
||||||
const data::Solution& cellData,
|
const data::Solution& cellData,
|
||||||
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
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);
|
bool substep = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -254,7 +255,8 @@ namespace Opm
|
|||||||
const SimulatorTimerInterface& timer,
|
const SimulatorTimerInterface& timer,
|
||||||
const SimulationDataContainer& reservoirState,
|
const SimulationDataContainer& reservoirState,
|
||||||
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
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);
|
bool substep = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -266,7 +268,8 @@ namespace Opm
|
|||||||
const SimulationDataContainer& reservoirState,
|
const SimulationDataContainer& reservoirState,
|
||||||
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
||||||
const data::Solution& simProps,
|
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);
|
bool substep);
|
||||||
|
|
||||||
/** \brief return output directory */
|
/** \brief return output directory */
|
||||||
@@ -994,7 +997,8 @@ namespace Opm
|
|||||||
const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig();
|
const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig();
|
||||||
const int reportStepNum = timer.reportStepNum();
|
const int reportStepNum = timer.reportStepNum();
|
||||||
bool logMessages = output_ && parallelOutput_->isIORank();
|
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_ )
|
if( output_ )
|
||||||
{
|
{
|
||||||
@@ -1016,10 +1020,14 @@ namespace Opm
|
|||||||
assert(!localCellData.empty());
|
assert(!localCellData.empty());
|
||||||
|
|
||||||
// Add suggested next timestep to extra data.
|
// 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
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user