mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1068 from babrodtk/initial_restart
Added writing initial timestep data to restart
This commit is contained in:
commit
296b0c61d6
@ -1177,6 +1177,24 @@ namespace Opm {
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateSimCache() const
|
||||||
|
{
|
||||||
|
const auto& simulator = ebosSimulator();
|
||||||
|
// Force update of the cache for all elements
|
||||||
|
const auto& gridView = simulator.gridView();
|
||||||
|
auto elemIt = gridView.template begin</*codim=*/ 0>();
|
||||||
|
const auto& elemEndIt = gridView.template end</*codim=*/ 0>();
|
||||||
|
ElementContext elemCtx(simulator);
|
||||||
|
for (; elemIt != elemEndIt; ++elemIt) {
|
||||||
|
|
||||||
|
const auto& elem = *elemIt;
|
||||||
|
if (elem.partitionType() != Dune::InteriorEntity)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
elemCtx.updateAll(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SimulationDataContainer getSimulatorData () const
|
SimulationDataContainer getSimulatorData () const
|
||||||
{
|
{
|
||||||
typedef std::vector<double> VectorType;
|
typedef std::vector<double> VectorType;
|
||||||
@ -1263,8 +1281,16 @@ namespace Opm {
|
|||||||
std::vector<int> failed_cells_pb;
|
std::vector<int> failed_cells_pb;
|
||||||
std::vector<int> failed_cells_pd;
|
std::vector<int> failed_cells_pd;
|
||||||
|
|
||||||
|
if ( ebosModel.cachedIntensiveQuantities(/*cellIdx=*/0, /*timeIdx=*/0) == nullptr ) {
|
||||||
|
updateSimCache();
|
||||||
|
}
|
||||||
|
|
||||||
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
||||||
const auto& intQuants = *ebosModel.cachedIntensiveQuantities(cellIdx, /*timeIdx=*/0);
|
const auto* intQuantsPtr = ebosModel.cachedIntensiveQuantities(cellIdx, /*timeIdx=*/0);
|
||||||
|
assert(intQuantsPtr != nullptr);
|
||||||
|
const auto& intQuants = *intQuantsPtr;
|
||||||
|
|
||||||
|
|
||||||
const auto& fs = intQuants.fluidState();
|
const auto& fs = intQuants.fluidState();
|
||||||
|
|
||||||
const int satIdx = cellIdx * num_phases;
|
const int satIdx = cellIdx * num_phases;
|
||||||
|
@ -235,18 +235,6 @@ public:
|
|||||||
// give the polymer and surfactant simulators the chance to do their stuff
|
// give the polymer and surfactant simulators the chance to do their stuff
|
||||||
handleAdditionalWellInflow(timer, wells_manager, well_state, wells);
|
handleAdditionalWellInflow(timer, wells_manager, well_state, wells);
|
||||||
|
|
||||||
// write the inital state at the report stage
|
|
||||||
if (timer.initialStep()) {
|
|
||||||
Dune::Timer perfTimer;
|
|
||||||
perfTimer.start();
|
|
||||||
|
|
||||||
// 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 );
|
|
||||||
|
|
||||||
report.output_write_time += perfTimer.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute reservoir volumes for RESV controls.
|
// Compute reservoir volumes for RESV controls.
|
||||||
computeRESV(timer.currentStepNum(), wells, state, well_state);
|
computeRESV(timer.currentStepNum(), wells, state, well_state);
|
||||||
|
|
||||||
@ -257,6 +245,18 @@ public:
|
|||||||
|
|
||||||
auto solver = createSolver(well_model);
|
auto solver = createSolver(well_model);
|
||||||
|
|
||||||
|
// write the inital state at the report stage
|
||||||
|
if (timer.initialStep()) {
|
||||||
|
Dune::Timer perfTimer;
|
||||||
|
perfTimer.start();
|
||||||
|
|
||||||
|
// No per cell data is written for initial step, but will be
|
||||||
|
// for subsequent steps, when we have started simulating
|
||||||
|
output_writer_.writeTimeStep( timer, state, well_state, solver->model() );
|
||||||
|
|
||||||
|
report.output_write_time += perfTimer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
// Compute orignal fluid in place if this has not been done yet
|
// Compute orignal fluid in place if this has not been done yet
|
||||||
if (originalFluidInPlace.empty()) {
|
if (originalFluidInPlace.empty()) {
|
||||||
solver->model().convertInput(/*iterationIdx=*/0, state, ebosSimulator_ );
|
solver->model().convertInput(/*iterationIdx=*/0, state, ebosSimulator_ );
|
||||||
|
@ -532,6 +532,8 @@ namespace Opm
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the data requested in the restartConfig
|
* Returns the data requested in the restartConfig
|
||||||
|
* NOTE: Since this function steals data from the SimulationDataContainer (std::move),
|
||||||
|
* the variable sd becomes "invalid" after calling this function.
|
||||||
*/
|
*/
|
||||||
template<class Model>
|
template<class Model>
|
||||||
void getRestartData(data::Solution& output,
|
void getRestartData(data::Solution& output,
|
||||||
|
Loading…
Reference in New Issue
Block a user