From 436624f662337fad622f3bde726f55068cc7d978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 30 Jan 2014 14:57:58 +0100 Subject: [PATCH 1/4] Write initial values to eclipse format output. This yields output files that have the same behaviour as eclipse in terms of number of steps, and what the steps mean. --- opm/autodiff/SimulatorFullyImplicitBlackoil.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoil.cpp b/opm/autodiff/SimulatorFullyImplicitBlackoil.cpp index 83f0ba3ca..5ddf8454a 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoil.cpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoil.cpp @@ -315,6 +315,7 @@ namespace Opm WellState& well_state) { eclipseWriter_.writeInit(timer, state, well_state); + eclipseWriter_.writeTimeStep(timer, state, well_state); // Initialisation. std::vector porevol; From 614c3f35af4e202602040ce369c8feef6d91603e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Fri, 31 Jan 2014 09:07:53 +0100 Subject: [PATCH 2/4] Removed dead code. The code was partially kept as a reminder to implement proper well reporting and mass balance reporting. Now well reporting has been taken care of, so we remove the code. --- .../SimulatorFullyImplicitBlackoil.cpp | 72 ------------------- 1 file changed, 72 deletions(-) diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoil.cpp b/opm/autodiff/SimulatorFullyImplicitBlackoil.cpp index 5ddf8454a..bb792173b 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoil.cpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoil.cpp @@ -333,26 +333,10 @@ namespace Opm Opm::time::StopWatch step_timer; Opm::time::StopWatch total_timer; total_timer.start(); -#if 0 - // These must be changed for three-phase. - double init_surfvol[2] = { 0.0 }; - double inplace_surfvol[2] = { 0.0 }; - double tot_injected[2] = { 0.0 }; - double tot_produced[2] = { 0.0 }; - Opm::computeSaturatedVol(porevol, state.surfacevol(), init_surfvol); - Opm::Watercut watercut; - watercut.push(0.0, 0.0, 0.0); - Opm::WellReport wellreport; -#endif std::vector fractional_flows; std::vector well_resflows_phase; if (wells_) { well_resflows_phase.resize((wells_->number_of_phases)*(wells_->number_of_wells), 0.0); -#if 0 - wellreport.push(props_, *wells_, - state.pressure(), state.surfacevol(), state.saturation(), - 0.0, well_state.bhp(), well_state.perfRates()); -#endif } std::fstream tstep_os; if (output_) { @@ -424,56 +408,6 @@ namespace Opm computePorevolume(grid_, props_.porosity(), *rock_comp_props_, state.pressure(), porevol); } - // The reports below are geared towards two phases only. -#if 0 - // Report mass balances. - double injected[2] = { 0.0 }; - double produced[2] = { 0.0 }; - Opm::computeInjectedProduced(props_, state, transport_src, stepsize, - injected, produced); - Opm::computeSaturatedVol(porevol, state.surfacevol(), inplace_surfvol); - tot_injected[0] += injected[0]; - tot_injected[1] += injected[1]; - tot_produced[0] += produced[0]; - tot_produced[1] += produced[1]; - std::cout.precision(5); - const int width = 18; - std::cout << "\nMass balance report.\n"; - std::cout << " Injected surface volumes: " - << std::setw(width) << injected[0] - << std::setw(width) << injected[1] << std::endl; - std::cout << " Produced surface volumes: " - << std::setw(width) << produced[0] - << std::setw(width) << produced[1] << std::endl; - std::cout << " Total inj surface volumes: " - << std::setw(width) << tot_injected[0] - << std::setw(width) << tot_injected[1] << std::endl; - std::cout << " Total prod surface volumes: " - << std::setw(width) << tot_produced[0] - << std::setw(width) << tot_produced[1] << std::endl; - const double balance[2] = { init_surfvol[0] - inplace_surfvol[0] - tot_produced[0] + tot_injected[0], - init_surfvol[1] - inplace_surfvol[1] - tot_produced[1] + tot_injected[1] }; - std::cout << " Initial - inplace + inj - prod: " - << std::setw(width) << balance[0] - << std::setw(width) << balance[1] - << std::endl; - std::cout << " Relative mass error: " - << std::setw(width) << balance[0]/(init_surfvol[0] + tot_injected[0]) - << std::setw(width) << balance[1]/(init_surfvol[1] + tot_injected[1]) - << std::endl; - std::cout.precision(8); - - // Make well reports. - watercut.push(timer.currentTime() + timer.currentStepLength(), - produced[0]/(produced[0] + produced[1]), - tot_produced[0]/tot_porevol_init); - if (wells_) { - wellreport.push(props_, *wells_, - state.pressure(), state.surfacevol(), state.saturation(), - timer.currentTime() + timer.currentStepLength(), - well_state.bhp(), well_state.perfRates()); - } -#endif sreport.total_time = step_timer.secsSinceStart(); if (output_) { sreport.reportParam(tstep_os); @@ -483,12 +417,6 @@ namespace Opm } outputStateMatlab(grid_, state, timer.currentStepNum(), output_dir_); outputWellStateMatlab(well_state,timer.currentStepNum(), output_dir_); -#if 0 - outputWaterCut(watercut, output_dir_); - if (wells_) { - outputWellReport(wellreport, output_dir_); - } -#endif tstep_os.close(); } From 0de82f3172f26bc7abf9fc9957c5fa0cf3fa817c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Fri, 31 Jan 2014 12:29:15 +0100 Subject: [PATCH 3/4] Remove more unused code. --- examples/sim_fibo_ad.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/examples/sim_fibo_ad.cpp b/examples/sim_fibo_ad.cpp index beb729c27..138c0f69c 100644 --- a/examples/sim_fibo_ad.cpp +++ b/examples/sim_fibo_ad.cpp @@ -104,17 +104,6 @@ try // Grid init grid.reset(new GridManager(*deck)); - // use the capitalized part of the deck's filename between the - // last '/' and the last '.' character as base name. - std::string baseName = deck_filename; - auto charPos = baseName.rfind('/'); - if (charPos != std::string::npos) - baseName = baseName.substr(charPos + 1); - charPos = baseName.rfind('.'); - if (charPos != std::string::npos) - baseName = baseName.substr(0, charPos); - baseName = boost::to_upper_copy(baseName); - Opm::EclipseWriter outputWriter(param, share_obj(*deck), share_obj(*grid->c_grid())); // Rock and fluid init props.reset(new BlackoilPropertiesFromDeck(*deck, *grid->c_grid(), param)); From e05675bd411bb29d12a900618bf7bf917e4ecdba Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Mon, 3 Feb 2014 18:14:49 +0100 Subject: [PATCH 4/4] Fixes warning about initialization order in FullyImpliciteBlackOilSolver. --- opm/autodiff/FullyImplicitBlackoilSolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/autodiff/FullyImplicitBlackoilSolver.cpp b/opm/autodiff/FullyImplicitBlackoilSolver.cpp index df83fd1ab..93f0b8124 100644 --- a/opm/autodiff/FullyImplicitBlackoilSolver.cpp +++ b/opm/autodiff/FullyImplicitBlackoilSolver.cpp @@ -208,11 +208,11 @@ namespace { , wops_ (wells) , grav_ (gravityOperator(grid_, ops_, geo_)) , rq_ (fluid.numPhases()) + , phaseCondition_(grid.number_of_cells) , residual_ ( { std::vector(fluid.numPhases(), ADB::null()), ADB::null(), ADB::null(), ADB::null() } ) - , phaseCondition_(grid.number_of_cells) { }