diff --git a/examples/sim_fibo_ad.cpp b/examples/sim_fibo_ad.cpp index 249cbcf09..0819f2fed 100644 --- a/examples/sim_fibo_ad.cpp +++ b/examples/sim_fibo_ad.cpp @@ -187,6 +187,8 @@ try Opm::DerivedGeology geology(*grid->c_grid(), *new_props, eclipseState, grav); + std::vector threshold_pressures;// = getThresholdPressures(); + SimulatorFullyImplicitBlackoil simulator(param, *grid->c_grid(), geology, @@ -197,7 +199,8 @@ try deck->hasKeyword("DISGAS"), deck->hasKeyword("VAPOIL"), eclipseState, - outputWriter); + outputWriter, + threshold_pressures); std::cout << "\n\n================ Starting main simulation loop ===============\n" << std::flush; diff --git a/examples/sim_fibo_ad_cp.cpp b/examples/sim_fibo_ad_cp.cpp index 10339668b..0825e866c 100644 --- a/examples/sim_fibo_ad_cp.cpp +++ b/examples/sim_fibo_ad_cp.cpp @@ -225,6 +225,8 @@ try Opm::DerivedGeology geology(*grid, *new_props, eclipseState, grav); + std::vector threshold_pressures;// = getThresholdPressures(); + SimulatorFullyImplicitBlackoil simulator(param, *grid, geology, @@ -235,7 +237,8 @@ try deck->hasKeyword("DISGAS"), deck->hasKeyword("VAPOIL"), eclipseState, - outputWriter); + outputWriter, + threshold_pressures); std::cout << "\n\n================ Starting main simulation loop ===============\n" << std::flush; diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoil.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoil.hpp index 4b320918d..a33356424 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoil.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoil.hpp @@ -74,6 +74,7 @@ namespace Opm /// \param[in] vapoil true for vaporized oil option /// \param[in] eclipse_state /// \param[in] output_writer + /// \param[in] threshold_pressures_by_face if nonempty, threshold pressures that inhibit flow SimulatorFullyImplicitBlackoil(const parameter::ParameterGroup& param, const Grid& grid, const DerivedGeology& geo, @@ -84,7 +85,8 @@ namespace Opm const bool disgas, const bool vapoil, std::shared_ptr eclipse_state, - EclipseWriter& output_writer); + EclipseWriter& output_writer, + const std::vector& threshold_pressures_by_face); /// Run the simulation. /// This will run succesive timesteps until timer.done() is true. It will diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp index 81eb54c78..97db1cfdc 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp @@ -83,7 +83,8 @@ namespace Opm bool has_disgas, bool has_vapoil, std::shared_ptr eclipse_state, - EclipseWriter& output_writer); + EclipseWriter& output_writer, + const std::vector& threshold_pressures_by_face); SimulatorReport run(SimulatorTimer& timer, BlackoilState& state); @@ -118,6 +119,8 @@ namespace Opm // output_writer EclipseWriter& output_writer_; RateConverterType rateConverter_; + // Threshold pressures. + std::vector threshold_pressures_by_face_; void computeRESV(const std::size_t step, @@ -140,11 +143,12 @@ namespace Opm const bool has_disgas, const bool has_vapoil, std::shared_ptr eclipse_state, - EclipseWriter& output_writer) + EclipseWriter& output_writer, + const std::vector& threshold_pressures_by_face) { pimpl_.reset(new Impl(param, grid, geo, props, rock_comp_props, linsolver, gravity, has_disgas, has_vapoil, - eclipse_state, output_writer)); + eclipse_state, output_writer, threshold_pressures_by_face)); } @@ -229,7 +233,8 @@ namespace Opm const bool has_disgas, const bool has_vapoil, std::shared_ptr eclipse_state, - EclipseWriter& output_writer) + EclipseWriter& output_writer, + const std::vector& threshold_pressures_by_face) : param_(param), grid_(grid), props_(props), @@ -241,7 +246,8 @@ namespace Opm has_vapoil_(has_vapoil), eclipse_state_(eclipse_state), output_writer_(output_writer), - rateConverter_(props_, std::vector(AutoDiffGrid::numCells(grid_), 0)) + rateConverter_(props_, std::vector(AutoDiffGrid::numCells(grid_), 0)), + threshold_pressures_by_face_(threshold_pressures_by_face) { // For output. output_ = param.getDefault("output", true); @@ -267,6 +273,9 @@ namespace Opm } } + + + template SimulatorReport SimulatorFullyImplicitBlackoil::Impl::run(SimulatorTimer& timer, BlackoilState& state) @@ -332,6 +341,9 @@ namespace Opm // Run a single step of the solver. solver_timer.start(); FullyImplicitBlackoilSolver solver(param_, grid_, props_, geo_, rock_comp_props_, *wells, solver_, has_disgas_, has_vapoil_); + if (!threshold_pressures_by_face_.empty()) { + solver.setThresholdPressures(threshold_pressures_by_face_); + } solver.step(timer.currentStepLength(), state, well_state); solver_timer.stop();