mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
sim_fibo_ad: fix writing
the initial condition was written multiple times. We now fix this by not writing anything in the simulator and moving this logic to the main loop..
This commit is contained in:
parent
66d73083b2
commit
49a5b67137
@ -207,10 +207,11 @@ try
|
|||||||
WellStateFullyImplicitBlackoil well_state;
|
WellStateFullyImplicitBlackoil well_state;
|
||||||
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
||||||
SimulatorTimer simtimer;
|
SimulatorTimer simtimer;
|
||||||
|
|
||||||
// Create new wells, well_state
|
|
||||||
std::shared_ptr<EclipseState> eclipseState(new EclipseState(newParserDeck));
|
std::shared_ptr<EclipseState> eclipseState(new EclipseState(newParserDeck));
|
||||||
|
|
||||||
|
// initialize variables
|
||||||
|
simtimer.init(timeMap, /*beginReportStepIdx=*/0, /*endReportStepIdx=*/0);
|
||||||
|
|
||||||
SimulatorReport fullReport;
|
SimulatorReport fullReport;
|
||||||
for (size_t episodeIdx = 0; episodeIdx < timeMap->numTimesteps(); ++episodeIdx) {
|
for (size_t episodeIdx = 0; episodeIdx < timeMap->numTimesteps(); ++episodeIdx) {
|
||||||
WellsManager wells(eclipseState,
|
WellsManager wells(eclipseState,
|
||||||
@ -218,10 +219,19 @@ try
|
|||||||
*grid->c_grid(),
|
*grid->c_grid(),
|
||||||
props->permeability());
|
props->permeability());
|
||||||
|
|
||||||
// @@@ HACK: we should really make a new well state and
|
if (episodeIdx == 0) {
|
||||||
// properly transfer old well state to it every epoch,
|
// @@@ HACK: we should really make a new well state and
|
||||||
// since number of wells may change etc.
|
// properly transfer old well state to it every epoch,
|
||||||
well_state.init(wells.c_wells(), state);
|
// since number of wells may change etc.
|
||||||
|
well_state.init(wells.c_wells(), state);
|
||||||
|
}
|
||||||
|
|
||||||
|
simtimer.init(timeMap,
|
||||||
|
/*beginReportStepIdx=*/episodeIdx,
|
||||||
|
/*endReportStepIdx=*/episodeIdx + 1);
|
||||||
|
|
||||||
|
if (episodeIdx == 0)
|
||||||
|
outputWriter.writeInit(simtimer, state, well_state.basicWellState());
|
||||||
|
|
||||||
// Create and run simulator.
|
// Create and run simulator.
|
||||||
SimulatorFullyImplicitBlackoil simulator(param,
|
SimulatorFullyImplicitBlackoil simulator(param,
|
||||||
@ -232,10 +242,9 @@ try
|
|||||||
linsolver,
|
linsolver,
|
||||||
grav,
|
grav,
|
||||||
outputWriter);
|
outputWriter);
|
||||||
simtimer.init(timeMap,
|
|
||||||
/*beginReportStepIdx=*/episodeIdx,
|
|
||||||
/*endReportStepIdx=*/episodeIdx + 1);
|
|
||||||
SimulatorReport episodeReport = simulator.run(simtimer, state, well_state);
|
SimulatorReport episodeReport = simulator.run(simtimer, state, well_state);
|
||||||
|
|
||||||
|
outputWriter.writeTimeStep(simtimer, state, well_state.basicWellState());
|
||||||
fullReport += episodeReport;
|
fullReport += episodeReport;
|
||||||
|
|
||||||
if (output) {
|
if (output) {
|
||||||
@ -265,6 +274,7 @@ try
|
|||||||
// Use timer for last epoch to obtain total time.
|
// Use timer for last epoch to obtain total time.
|
||||||
deck->setCurrentEpoch(deck->numberOfEpochs() - 1);
|
deck->setCurrentEpoch(deck->numberOfEpochs() - 1);
|
||||||
simtimer.init(*deck);
|
simtimer.init(*deck);
|
||||||
|
|
||||||
const double total_time = simtimer.totalTime();
|
const double total_time = simtimer.totalTime();
|
||||||
for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) {
|
for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) {
|
||||||
// Set epoch index.
|
// Set epoch index.
|
||||||
@ -296,6 +306,9 @@ try
|
|||||||
well_state.init(wells.c_wells(), state);
|
well_state.init(wells.c_wells(), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (epoch == 0)
|
||||||
|
outputWriter.writeInit(simtimer, state, well_state.basicWellState());
|
||||||
|
|
||||||
// Create and run simulator.
|
// Create and run simulator.
|
||||||
SimulatorFullyImplicitBlackoil simulator(param,
|
SimulatorFullyImplicitBlackoil simulator(param,
|
||||||
*grid->c_grid(),
|
*grid->c_grid(),
|
||||||
@ -305,6 +318,8 @@ try
|
|||||||
linsolver,
|
linsolver,
|
||||||
grav,
|
grav,
|
||||||
outputWriter);
|
outputWriter);
|
||||||
|
outputWriter.writeTimeStep(simtimer, state, well_state.basicWellState());
|
||||||
|
|
||||||
if (epoch == 0) {
|
if (epoch == 0) {
|
||||||
warnIfUnusedParams(param);
|
warnIfUnusedParams(param);
|
||||||
}
|
}
|
||||||
|
@ -314,9 +314,6 @@ namespace Opm
|
|||||||
BlackoilState& state,
|
BlackoilState& state,
|
||||||
WellStateFullyImplicitBlackoil& well_state)
|
WellStateFullyImplicitBlackoil& well_state)
|
||||||
{
|
{
|
||||||
eclipseWriter_.writeInit(timer, state, well_state.basicWellState());
|
|
||||||
eclipseWriter_.writeTimeStep(timer, state, well_state.basicWellState());
|
|
||||||
|
|
||||||
// Initialisation.
|
// Initialisation.
|
||||||
std::vector<double> porevol;
|
std::vector<double> porevol;
|
||||||
if (rock_comp_props_ && rock_comp_props_->isActive()) {
|
if (rock_comp_props_ && rock_comp_props_->isActive()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user