mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Passing keys to the restart load function.
- Renamed EclipseWriter -> EclipseIO. - Loading from restart file is a method on the EclipseIO class.
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
|
|
||||||
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
||||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||||
#include <opm/core/props/BlackoilPropertiesBasic.hpp>
|
#include <opm/core/props/BlackoilPropertiesBasic.hpp>
|
||||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||||
@@ -239,11 +239,11 @@ try
|
|||||||
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
||||||
<< std::flush;
|
<< std::flush;
|
||||||
|
|
||||||
std::unique_ptr<Opm::EclipseWriter>
|
std::unique_ptr<Opm::EclipseIO>
|
||||||
eclipseWriter(new Opm::EclipseWriter(*eclipseState,
|
eclipseWriter(new Opm::EclipseIO(*eclipseState,
|
||||||
UgGridHelpers
|
UgGridHelpers
|
||||||
::createEclipseGrid( cGrid ,
|
::createEclipseGrid( cGrid ,
|
||||||
eclipseState->getInputGrid())));
|
eclipseState->getInputGrid())));
|
||||||
Opm::BlackoilOutputWriter
|
Opm::BlackoilOutputWriter
|
||||||
outputWriter(cGrid, param, *eclipseState, std::move(eclipseWriter), pu,
|
outputWriter(cGrid, param, *eclipseState, std::move(eclipseWriter), pu,
|
||||||
new_props->permeability() );
|
new_props->permeability() );
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ namespace Opm
|
|||||||
// distributeData()
|
// distributeData()
|
||||||
boost::any parallel_information_;
|
boost::any parallel_information_;
|
||||||
// setupOutputWriter()
|
// setupOutputWriter()
|
||||||
std::unique_ptr<EclipseWriter> eclipse_writer_;
|
std::unique_ptr<EclipseIO> eclipse_writer_;
|
||||||
std::unique_ptr<OutputWriter> output_writer_;
|
std::unique_ptr<OutputWriter> output_writer_;
|
||||||
// setupLinearSolver
|
// setupLinearSolver
|
||||||
std::unique_ptr<NewtonIterationBlackoilInterface> fis_solver_;
|
std::unique_ptr<NewtonIterationBlackoilInterface> fis_solver_;
|
||||||
@@ -762,7 +762,7 @@ namespace Opm
|
|||||||
if( output && output_ecl && output_cout_)
|
if( output && output_ecl && output_cout_)
|
||||||
{
|
{
|
||||||
const EclipseGrid& inputGrid = eclipse_state_->getInputGrid();
|
const EclipseGrid& inputGrid = eclipse_state_->getInputGrid();
|
||||||
eclipse_writer_.reset(new EclipseWriter(*eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid )));
|
eclipse_writer_.reset(new EclipseIO(*eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid )));
|
||||||
eclipse_writer_->writeInitial(geoprops_->simProps(grid),
|
eclipse_writer_->writeInitial(geoprops_->simProps(grid),
|
||||||
geoprops_->nonCartesianConnections());
|
geoprops_->nonCartesianConnections());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -545,8 +545,8 @@ namespace Opm
|
|||||||
if( output && output_ecl && output_cout_)
|
if( output && output_ecl && output_cout_)
|
||||||
{
|
{
|
||||||
const EclipseGrid& inputGrid = eclState().getInputGrid();
|
const EclipseGrid& inputGrid = eclState().getInputGrid();
|
||||||
eclipse_writer_.reset(new EclipseWriter(eclState(), UgGridHelpers::createEclipseGrid( grid , inputGrid )));
|
eclIO_.reset(new EclipseIO(eclState(), UgGridHelpers::createEclipseGrid( grid , inputGrid )));
|
||||||
eclipse_writer_->writeInitial(geoprops_->simProps(grid),
|
eclIO_->writeInitial(geoprops_->simProps(grid),
|
||||||
geoprops_->nonCartesianConnections());
|
geoprops_->nonCartesianConnections());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,7 +562,7 @@ namespace Opm
|
|||||||
output_writer_.reset(new OutputWriter(grid(),
|
output_writer_.reset(new OutputWriter(grid(),
|
||||||
param_,
|
param_,
|
||||||
eclState(),
|
eclState(),
|
||||||
std::move(eclipse_writer_),
|
std::move(eclIO_),
|
||||||
Opm::phaseUsageFromDeck(deck()),
|
Opm::phaseUsageFromDeck(deck()),
|
||||||
fluidprops_->permeability()));
|
fluidprops_->permeability()));
|
||||||
}
|
}
|
||||||
@@ -725,7 +725,7 @@ namespace Opm
|
|||||||
std::unique_ptr<BlackoilPropsAdFromDeck> fluidprops_;
|
std::unique_ptr<BlackoilPropsAdFromDeck> fluidprops_;
|
||||||
std::unique_ptr<DerivedGeology> geoprops_;
|
std::unique_ptr<DerivedGeology> geoprops_;
|
||||||
std::unique_ptr<ReservoirState> state_;
|
std::unique_ptr<ReservoirState> state_;
|
||||||
std::unique_ptr<EclipseWriter> eclipse_writer_;
|
std::unique_ptr<EclipseIO> eclIO_;
|
||||||
std::unique_ptr<OutputWriter> output_writer_;
|
std::unique_ptr<OutputWriter> output_writer_;
|
||||||
boost::any parallel_information_;
|
boost::any parallel_information_;
|
||||||
std::unique_ptr<NewtonIterationBlackoilInterface> fis_solver_;
|
std::unique_ptr<NewtonIterationBlackoilInterface> fis_solver_;
|
||||||
|
|||||||
@@ -317,18 +317,18 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ECL output
|
// ECL output
|
||||||
if ( eclWriter_ )
|
if ( eclIO_ )
|
||||||
{
|
{
|
||||||
const auto& initConfig = eclipseState_.getInitConfig();
|
const auto& initConfig = eclipseState_.getInitConfig();
|
||||||
if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) {
|
if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) {
|
||||||
std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl;
|
std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl;
|
||||||
} else {
|
} else {
|
||||||
// ... insert "extra" data (KR, VISC, ...)
|
// ... insert "extra" data (KR, VISC, ...)
|
||||||
eclWriter_->writeTimeStep(timer.reportStepNum(),
|
eclIO_->writeTimeStep(timer.reportStepNum(),
|
||||||
substep,
|
substep,
|
||||||
timer.simulationTimeElapsed(),
|
timer.simulationTimeElapsed(),
|
||||||
simProps,
|
simProps,
|
||||||
wellState.report(phaseUsage_));
|
wellState.report(phaseUsage_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,13 @@
|
|||||||
#include <opm/core/utility/DataMap.hpp>
|
#include <opm/core/utility/DataMap.hpp>
|
||||||
#include <opm/common/ErrorMacros.hpp>
|
#include <opm/common/ErrorMacros.hpp>
|
||||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||||
#include <opm/output/eclipse/EclipseReader.hpp>
|
|
||||||
#include <opm/core/utility/miscUtilities.hpp>
|
#include <opm/core/utility/miscUtilities.hpp>
|
||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
#include <opm/core/wells/DynamicListEconLimited.hpp>
|
#include <opm/core/wells/DynamicListEconLimited.hpp>
|
||||||
|
|
||||||
#include <opm/output/data/Cells.hpp>
|
#include <opm/output/data/Cells.hpp>
|
||||||
#include <opm/output/data/Solution.hpp>
|
#include <opm/output/data/Solution.hpp>
|
||||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||||
|
|
||||||
#include <opm/autodiff/GridHelpers.hpp>
|
#include <opm/autodiff/GridHelpers.hpp>
|
||||||
#include <opm/autodiff/ParallelDebugOutput.hpp>
|
#include <opm/autodiff/ParallelDebugOutput.hpp>
|
||||||
@@ -208,7 +207,7 @@ namespace Opm
|
|||||||
BlackoilOutputWriter(const Grid& grid,
|
BlackoilOutputWriter(const Grid& grid,
|
||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
const Opm::EclipseState& eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
std::unique_ptr<EclipseWriter>&& eclWriter,
|
std::unique_ptr<EclipseIO>&& eclIO,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
const double* permeability );
|
const double* permeability );
|
||||||
|
|
||||||
@@ -305,7 +304,7 @@ namespace Opm
|
|||||||
Opm::PhaseUsage phaseUsage_;
|
Opm::PhaseUsage phaseUsage_;
|
||||||
std::unique_ptr< BlackoilSubWriter > vtkWriter_;
|
std::unique_ptr< BlackoilSubWriter > vtkWriter_;
|
||||||
std::unique_ptr< BlackoilSubWriter > matlabWriter_;
|
std::unique_ptr< BlackoilSubWriter > matlabWriter_;
|
||||||
std::unique_ptr< EclipseWriter > eclWriter_;
|
std::unique_ptr< EclipseIO > eclIO_;
|
||||||
const EclipseState& eclipseState_;
|
const EclipseState& eclipseState_;
|
||||||
|
|
||||||
std::unique_ptr< ThreadHandle > asyncOutput_;
|
std::unique_ptr< ThreadHandle > asyncOutput_;
|
||||||
@@ -323,7 +322,7 @@ namespace Opm
|
|||||||
BlackoilOutputWriter(const Grid& grid,
|
BlackoilOutputWriter(const Grid& grid,
|
||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
const Opm::EclipseState& eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
std::unique_ptr<EclipseWriter>&& eclWriter,
|
std::unique_ptr<EclipseIO>&& eclIO,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
const double* permeability )
|
const double* permeability )
|
||||||
: output_( param.getDefault("output", true) ),
|
: output_( param.getDefault("output", true) ),
|
||||||
@@ -360,7 +359,7 @@ namespace Opm
|
|||||||
.reset(new BlackoilMatlabWriter< Grid >( grid, outputDir_ ));
|
.reset(new BlackoilMatlabWriter< Grid >( grid, outputDir_ ));
|
||||||
}
|
}
|
||||||
|
|
||||||
eclWriter_ = std::move(eclWriter);
|
eclIO_ = std::move(eclIO);
|
||||||
|
|
||||||
// Ensure that output dir exists
|
// Ensure that output dir exists
|
||||||
boost::filesystem::path fpath(outputDir_);
|
boost::filesystem::path fpath(outputDir_);
|
||||||
@@ -406,6 +405,13 @@ namespace Opm
|
|||||||
SimulationDataContainer& simulatorstate,
|
SimulationDataContainer& simulatorstate,
|
||||||
WellStateFullyImplicitBlackoil& wellstate)
|
WellStateFullyImplicitBlackoil& wellstate)
|
||||||
{
|
{
|
||||||
|
std::map<std::string, UnitSystem::measure> solution_keys {{"PRESSURE" , UnitSystem::measure::pressure},
|
||||||
|
{"SWAT" , UnitSystem::measure::identity},
|
||||||
|
{"SGAS" , UnitSystem::measure::identity},
|
||||||
|
{"TEMP" , UnitSystem::measure::temperature},
|
||||||
|
{"RS" , UnitSystem::measure::gas_oil_ratio},
|
||||||
|
{"RV" , UnitSystem::measure::oil_gas_ratio}};
|
||||||
|
|
||||||
// gives a dummy dynamic_list_econ_limited
|
// gives a dummy dynamic_list_econ_limited
|
||||||
DynamicListEconLimited dummy_list_econ_limited;
|
DynamicListEconLimited dummy_list_econ_limited;
|
||||||
WellsManager wellsmanager(eclipseState_,
|
WellsManager wellsmanager(eclipseState_,
|
||||||
@@ -428,12 +434,10 @@ namespace Opm
|
|||||||
|
|
||||||
const Wells* wells = wellsmanager.c_wells();
|
const Wells* wells = wellsmanager.c_wells();
|
||||||
wellstate.resize(wells, simulatorstate); //Resize for restart step
|
wellstate.resize(wells, simulatorstate); //Resize for restart step
|
||||||
auto restarted = Opm::init_from_restart_file(
|
auto state = eclIO_->loadRestart(solution_keys);
|
||||||
eclipseState_,
|
|
||||||
Opm::UgGridHelpers::numCells(grid) );
|
|
||||||
|
|
||||||
solutionToSim( restarted.first, phaseusage, simulatorstate );
|
solutionToSim( state.first, phaseusage, simulatorstate );
|
||||||
wellsToState( restarted.second, phaseusage, wellstate );
|
wellsToState( state.second, phaseusage, wellstate );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ namespace Opm
|
|||||||
bool substep)
|
bool substep)
|
||||||
{
|
{
|
||||||
// ECL output
|
// ECL output
|
||||||
if ( eclWriter_ )
|
if ( eclIO_ )
|
||||||
{
|
{
|
||||||
const auto& initConfig = eclipseState_.getInitConfig();
|
const auto& initConfig = eclipseState_.getInitConfig();
|
||||||
if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) {
|
if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) {
|
||||||
@@ -164,11 +164,11 @@ namespace Opm
|
|||||||
} else {
|
} else {
|
||||||
data::Solution combined_sol = simToSolution(state, phaseUsage_); // Get "normal" data (SWAT, PRESSURE, ...)
|
data::Solution combined_sol = simToSolution(state, phaseUsage_); // Get "normal" data (SWAT, PRESSURE, ...)
|
||||||
combined_sol.insert(sol.begin(), sol.end()); // ... insert "extra" data (KR, VISC, ...)
|
combined_sol.insert(sol.begin(), sol.end()); // ... insert "extra" data (KR, VISC, ...)
|
||||||
eclWriter_->writeTimeStep(timer.reportStepNum(),
|
eclIO_->writeTimeStep(timer.reportStepNum(),
|
||||||
substep,
|
substep,
|
||||||
timer.simulationTimeElapsed(),
|
timer.simulationTimeElapsed(),
|
||||||
combined_sol,
|
combined_sol,
|
||||||
wellState.report(phaseUsage_));
|
wellState.report(phaseUsage_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,11 @@
|
|||||||
#include <opm/core/utility/DataMap.hpp>
|
#include <opm/core/utility/DataMap.hpp>
|
||||||
#include <opm/common/ErrorMacros.hpp>
|
#include <opm/common/ErrorMacros.hpp>
|
||||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||||
#include <opm/output/eclipse/EclipseReader.hpp>
|
|
||||||
#include <opm/core/utility/miscUtilities.hpp>
|
#include <opm/core/utility/miscUtilities.hpp>
|
||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
#include <opm/core/wells/DynamicListEconLimited.hpp>
|
#include <opm/core/wells/DynamicListEconLimited.hpp>
|
||||||
|
|
||||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||||
|
|
||||||
#include <opm/autodiff/Compat.hpp>
|
#include <opm/autodiff/Compat.hpp>
|
||||||
#include <opm/autodiff/GridHelpers.hpp>
|
#include <opm/autodiff/GridHelpers.hpp>
|
||||||
@@ -70,7 +69,7 @@ namespace Opm
|
|||||||
BlackoilOutputWriterEbos(const Grid& grid,
|
BlackoilOutputWriterEbos(const Grid& grid,
|
||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
const EclipseState& eclipseState,
|
const EclipseState& eclipseState,
|
||||||
std::unique_ptr<EclipseWriter>&& eclWriter,
|
std::unique_ptr<EclipseIO>&& eclIO,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
const double* permeability );
|
const double* permeability );
|
||||||
|
|
||||||
@@ -162,7 +161,7 @@ namespace Opm
|
|||||||
|
|
||||||
std::ofstream backupfile_;
|
std::ofstream backupfile_;
|
||||||
Opm::PhaseUsage phaseUsage_;
|
Opm::PhaseUsage phaseUsage_;
|
||||||
std::unique_ptr<EclipseWriter> eclWriter_;
|
std::unique_ptr<EclipseIO> eclIO_;
|
||||||
const EclipseState& eclipseState_;
|
const EclipseState& eclipseState_;
|
||||||
|
|
||||||
std::unique_ptr< ThreadHandle > asyncOutput_;
|
std::unique_ptr< ThreadHandle > asyncOutput_;
|
||||||
@@ -180,7 +179,7 @@ namespace Opm
|
|||||||
BlackoilOutputWriterEbos(const Grid& grid,
|
BlackoilOutputWriterEbos(const Grid& grid,
|
||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
const Opm::EclipseState& eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
std::unique_ptr<EclipseWriter>&& eclWriter,
|
std::unique_ptr<EclipseIO>&& eclIO,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
const double* permeability )
|
const double* permeability )
|
||||||
: output_( param.getDefault("output", true) ),
|
: output_( param.getDefault("output", true) ),
|
||||||
@@ -194,7 +193,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
// For output.
|
// For output.
|
||||||
if (output_ && parallelOutput_->isIORank() ) {
|
if (output_ && parallelOutput_->isIORank() ) {
|
||||||
eclWriter_ = std::move(eclWriter);
|
eclIO_ = std::move(eclIO);
|
||||||
|
|
||||||
// Ensure that output dir exists
|
// Ensure that output dir exists
|
||||||
boost::filesystem::path fpath(outputDir_);
|
boost::filesystem::path fpath(outputDir_);
|
||||||
@@ -239,6 +238,13 @@ namespace Opm
|
|||||||
SimulationDataContainer& simulatorstate,
|
SimulationDataContainer& simulatorstate,
|
||||||
WellStateFullyImplicitBlackoilDense& wellstate)
|
WellStateFullyImplicitBlackoilDense& wellstate)
|
||||||
{
|
{
|
||||||
|
std::map<std::string, UnitSystem::measure> solution_keys {{"PRESSURE" , UnitSystem::measure::pressure},
|
||||||
|
{"SWAT" , UnitSystem::measure::identity},
|
||||||
|
{"SGAS" , UnitSystem::measure::identity},
|
||||||
|
{"TEMP" , UnitSystem::measure::temperature},
|
||||||
|
{"RS" , UnitSystem::measure::gas_oil_ratio},
|
||||||
|
{"RV" , UnitSystem::measure::oil_gas_ratio}};
|
||||||
|
|
||||||
// gives a dummy dynamic_list_econ_limited
|
// gives a dummy dynamic_list_econ_limited
|
||||||
DynamicListEconLimited dummy_list_econ_limited;
|
DynamicListEconLimited dummy_list_econ_limited;
|
||||||
WellsManager wellsmanager(eclipseState_,
|
WellsManager wellsmanager(eclipseState_,
|
||||||
@@ -261,12 +267,9 @@ namespace Opm
|
|||||||
|
|
||||||
const Wells* wells = wellsmanager.c_wells();
|
const Wells* wells = wellsmanager.c_wells();
|
||||||
wellstate.resize(wells, simulatorstate, phaseusage ); //Resize for restart step
|
wellstate.resize(wells, simulatorstate, phaseusage ); //Resize for restart step
|
||||||
auto restarted = Opm::init_from_restart_file(
|
auto state = eclIO_->loadRestart(solution_keys);
|
||||||
eclipseState_,
|
solutionToSim( state.first, phaseusage, simulatorstate );
|
||||||
Opm::UgGridHelpers::numCells(grid) );
|
wellsToState( state.second, phaseusage, wellstate );
|
||||||
|
|
||||||
solutionToSim( restarted.first, phaseusage, simulatorstate );
|
|
||||||
wellsToState( restarted.second, phaseusage, wellstate );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||||
#include <opm/core/utility/StopWatch.hpp>
|
#include <opm/core/utility/StopWatch.hpp>
|
||||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||||
#include <opm/core/utility/miscUtilities.hpp>
|
#include <opm/core/utility/miscUtilities.hpp>
|
||||||
#include <opm/core/utility/miscUtilitiesBlackoil.hpp>
|
#include <opm/core/utility/miscUtilitiesBlackoil.hpp>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user