From 7b81facfb053217e4848b025817ca6adab142417 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 16 Mar 2016 15:35:26 +0100 Subject: [PATCH 1/7] Make use of extractWellPerfProperties to avoid code duplication The following changes are done in order to remove the duplicated code in assemble(). - extractWellPerfProperties takes SolutionState as input (only used in the solvent model) - the computation of effective parameters is moved to computeAccum() With these changes the solvent model can use assemble() from the base model. --- opm/autodiff/BlackoilModelBase.hpp | 3 +- opm/autodiff/BlackoilModelBase_impl.hpp | 5 +- opm/autodiff/BlackoilSolventModel.hpp | 13 +- opm/autodiff/BlackoilSolventModel_impl.hpp | 141 +++++++-------------- 4 files changed, 53 insertions(+), 109 deletions(-) diff --git a/opm/autodiff/BlackoilModelBase.hpp b/opm/autodiff/BlackoilModelBase.hpp index 2551bd7fb..6a6a5a84f 100644 --- a/opm/autodiff/BlackoilModelBase.hpp +++ b/opm/autodiff/BlackoilModelBase.hpp @@ -392,7 +392,8 @@ namespace Opm { void extractWellPerfProperties(std::vector& mob_perfcells, - std::vector& b_perfcells) const; + std::vector& b_perfcells, + const SolutionState&) const; bool solveWellEq(const std::vector& mob_perfcells, diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index ed89c4481..fa6d2f38d 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -954,7 +954,7 @@ namespace detail { std::vector mob_perfcells; std::vector b_perfcells; - asImpl().extractWellPerfProperties(mob_perfcells, b_perfcells); + asImpl().extractWellPerfProperties(mob_perfcells, b_perfcells, state); if (param_.solve_welleq_initially_ && initial_assembly) { // solve the well equations as a pre-processing step asImpl().solveWellEq(mob_perfcells, b_perfcells, state, well_state); @@ -1102,7 +1102,8 @@ namespace detail { template void BlackoilModelBase::extractWellPerfProperties(std::vector& mob_perfcells, - std::vector& b_perfcells) const + std::vector& b_perfcells, + const SolutionState&) const { // If we have wells, extract the mobilities and b-factors for // the well-perforated cells. diff --git a/opm/autodiff/BlackoilSolventModel.hpp b/opm/autodiff/BlackoilSolventModel.hpp index eaaa5bf04..987a93db1 100644 --- a/opm/autodiff/BlackoilSolventModel.hpp +++ b/opm/autodiff/BlackoilSolventModel.hpp @@ -87,14 +87,6 @@ namespace Opm { ReservoirState& reservoir_state, WellState& well_state); - /// Assemble the residual and Jacobian of the nonlinear system. - /// \param[in] reservoir_state reservoir state variables - /// \param[in, out] well_state well state variables - /// \param[in] initial_assembly pass true if this is the first call to assemble() in this timestep - void assemble(const ReservoirState& reservoir_state, - WellState& well_state, - const bool initial_assembly); - protected: @@ -229,6 +221,11 @@ namespace Opm { const std::vector phaseCondition() const {return this->phaseCondition_;} + void extractWellPerfProperties(std::vector& mob_perfcells, + std::vector& b_perfcells, + const SolutionState& state); + + // compute effective viscosities (mu_eff_) and effective b factors (b_eff_) using the ToddLongstaff model void computeEffectiveProperties(const SolutionState& state); diff --git a/opm/autodiff/BlackoilSolventModel_impl.hpp b/opm/autodiff/BlackoilSolventModel_impl.hpp index 03dcf8746..34e9f1b54 100644 --- a/opm/autodiff/BlackoilSolventModel_impl.hpp +++ b/opm/autodiff/BlackoilSolventModel_impl.hpp @@ -135,7 +135,7 @@ namespace Opm { std::vector vars0 = Base::variableStateInitials(x, xw); assert(int(vars0.size()) == fluid_.numPhases() + 2); - // Initial polymer concentration. + // Initial solvent concentration. if (has_solvent_) { const auto& solvent_saturation = x.getCellData( BlackoilSolventState::SSOL ); const int nc = solvent_saturation.size(); @@ -257,6 +257,10 @@ namespace Opm { BlackoilSolventModel::computeAccum(const SolutionState& state, const int aix ) { + + if (is_miscible_) { + computeEffectiveProperties(state); + } Base::computeAccum(state, aix); // Compute accumulation of the solvent @@ -771,6 +775,44 @@ namespace Opm { } + template + void + BlackoilSolventModel::extractWellPerfProperties(std::vector& mob_perfcells, + std::vector& b_perfcells, + const SolutionState& state) + { + Base::extractWellPerfProperties(mob_perfcells, b_perfcells, state); + if (has_solvent_) { + int gas_pos = fluid_.phaseUsage().phase_pos[Gas]; + const std::vector& well_cells = wops_.well_cells; + const int nperf = well_cells.size(); + // Gas and solvent is combinded and solved together + // The input in the well equation is then the + // total gas phase = hydro carbon gas + solvent gas + + // The total mobility is the sum of the solvent and gas mobiliy + mob_perfcells[gas_pos] += subset(rq_[solvent_pos_].mob, well_cells); + + // A weighted sum of the b-factors of gas and solvent are used. + const int nc = Opm::AutoDiffGrid::numCells(grid_); + + const Opm::PhaseUsage& pu = fluid_.phaseUsage(); + const ADB zero = ADB::constant(V::Zero(nc)); + const ADB& ss = state.solvent_saturation; + const ADB& sg = (active_[ Gas ] + ? state.saturation[ pu.phase_pos[ Gas ] ] + : zero); + + Selector zero_selector(ss.value() + sg.value(), Selector::Zero); + ADB F_solvent = subset(zero_selector.select(ss, ss / (ss + sg)),well_cells); + V ones = V::Constant(nperf,1.0); + + b_perfcells[gas_pos] = (ones - F_solvent) * b_perfcells[gas_pos]; + b_perfcells[gas_pos] += (F_solvent * subset(rq_[solvent_pos_].b, well_cells)); + + } + } + template void BlackoilSolventModel::computeEffectiveProperties(const SolutionState& state) @@ -979,103 +1021,6 @@ namespace Opm { } - template - void - BlackoilSolventModel::assemble(const ReservoirState& reservoir_state, - WellState& well_state, - const bool initial_assembly) - { - - using namespace Opm::AutoDiffGrid; - - // Possibly switch well controls and updating well state to - // get reasonable initial conditions for the wells - updateWellControls(well_state); - - // Create the primary variables. - SolutionState state = variableState(reservoir_state, well_state); - - if (initial_assembly) { - // Create the (constant, derivativeless) initial state. - SolutionState state0 = state; - makeConstantState(state0); - // Compute initial accumulation contributions - // and well connection pressures. - if (is_miscible_) { - computeEffectiveProperties(state0); - } - - computeAccum(state0, 0); - computeWellConnectionPressures(state0, well_state); - } - if (is_miscible_) { - computeEffectiveProperties(state); - } - - // -------- Mass balance equations -------- - assembleMassBalanceEq(state); - - // -------- Well equations ---------- - if ( ! wellsActive() ) { - return; - } - - V aliveWells; - - const int np = wells().number_of_phases; - std::vector cq_s(np, ADB::null()); - - const int nw = wells().number_of_wells; - const int nperf = wells().well_connpos[nw]; - const std::vector well_cells(wells().well_cells, wells().well_cells + nperf); - - std::vector mob_perfcells(np, ADB::null()); - std::vector b_perfcells(np, ADB::null()); - for (int phase = 0; phase < np; ++phase) { - mob_perfcells[phase] = subset(rq_[phase].mob, well_cells); - b_perfcells[phase] = subset(rq_[phase].b, well_cells); - } - - if (has_solvent_) { - int gas_pos = fluid_.phaseUsage().phase_pos[Gas]; - // Gas and solvent is combinded and solved together - // The input in the well equation is then the - // total gas phase = hydro carbon gas + solvent gas - - // The total mobility is the sum of the solvent and gas mobiliy - mob_perfcells[gas_pos] += subset(rq_[solvent_pos_].mob, well_cells); - - // A weighted sum of the b-factors of gas and solvent are used. - const int nc = Opm::AutoDiffGrid::numCells(grid_); - - const Opm::PhaseUsage& pu = fluid_.phaseUsage(); - const ADB zero = ADB::constant(V::Zero(nc)); - const ADB& ss = state.solvent_saturation; - const ADB& sg = (active_[ Gas ] - ? state.saturation[ pu.phase_pos[ Gas ] ] - : zero); - - Selector zero_selector(ss.value() + sg.value(), Selector::Zero); - ADB F_solvent = subset(zero_selector.select(ss, ss / (ss + sg)),well_cells); - V ones = V::Constant(nperf,1.0); - - b_perfcells[gas_pos] = (ones - F_solvent) * b_perfcells[gas_pos]; - b_perfcells[gas_pos] += (F_solvent * subset(rq_[solvent_pos_].b, well_cells)); - - } - if (param_.solve_welleq_initially_ && initial_assembly) { - // solve the well equations as a pre-processing step - Base::solveWellEq(mob_perfcells, b_perfcells, state, well_state); - } - Base::computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s); - Base::updatePerfPhaseRatesAndPressures(cq_s, state, well_state); - Base::addWellFluxEq(cq_s, state); - addWellContributionToMassBalanceEq(cq_s, state, well_state); - Base::addWellControlEq(state, well_state, aliveWells); - - } - - } From 9cd0383d367632b977dbd79012cdecc52f70cf7e Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 18 Mar 2016 10:48:54 +0100 Subject: [PATCH 2/7] Factor out computation of properties for well connection pressures Computation of properties used in computeConnectionPressureDelta is factored out to computePropertiesForWellConnectionPressures The motivation is to be able to use a modified version of computePropertiesForWellConnectionPressures in the solvent model --- opm/autodiff/BlackoilModelBase.hpp | 7 +++ opm/autodiff/BlackoilModelBase_impl.hpp | 60 +++++++++++++++++-------- 2 files changed, 49 insertions(+), 18 deletions(-) diff --git a/opm/autodiff/BlackoilModelBase.hpp b/opm/autodiff/BlackoilModelBase.hpp index 6a6a5a84f..9ab41f3fa 100644 --- a/opm/autodiff/BlackoilModelBase.hpp +++ b/opm/autodiff/BlackoilModelBase.hpp @@ -387,6 +387,13 @@ namespace Opm { void computeWellConnectionPressures(const SolutionState& state, const WellState& xw); + void computePropertiesForWellConnectionPressures(const SolutionState& state, + const WellState& xw, + std::vector& b_perf, + std::vector& rsmax_perf, + std::vector& rvmax_perf, + std::vector& surf_dens_perf); + void assembleMassBalanceEq(const SolutionState& state); diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index fa6d2f38d..a26dda854 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -795,18 +795,14 @@ namespace detail { } } - - template - void BlackoilModelBase::computeWellConnectionPressures(const SolutionState& state, - const WellState& xw) + void BlackoilModelBase::computePropertiesForWellConnectionPressures(const SolutionState& state, + const WellState& xw, + std::vector& b_perf, + std::vector& rsmax_perf, + std::vector& rvmax_perf, + std::vector& surf_dens_perf) { - if( ! localWellsActive() ) return ; - - using namespace Opm::AutoDiffGrid; - // 1. Compute properties required by computeConnectionPressureDelta(). - // Note that some of the complexity of this part is due to the function - // taking std::vector arguments, and not Eigen objects. const int nperf = wells().well_connpos[wells().number_of_wells]; const int nw = wells().number_of_wells; @@ -837,8 +833,6 @@ namespace detail { } const PhaseUsage& pu = fluid_.phaseUsage(); DataBlock b(nperf, pu.num_phases); - std::vector rsmax_perf(nperf, 0.0); - std::vector rvmax_perf(nperf, 0.0); if (pu.phase_used[BlackoilPhases::Aqua]) { const V bw = fluid_.bWat(avg_press_ad, perf_temp, well_cells).value(); b.col(pu.phase_pos[BlackoilPhases::Aqua]) = bw; @@ -851,6 +845,8 @@ namespace detail { b.col(pu.phase_pos[BlackoilPhases::Liquid]) = bo; const V rssat = fluidRsSat(avg_press, perf_so, well_cells); rsmax_perf.assign(rssat.data(), rssat.data() + nperf); + } else { + rsmax_perf.assign(nperf, 0.0); } if (pu.phase_used[BlackoilPhases::Vapour]) { const ADB perf_rv = subset(state.rv, well_cells); @@ -858,13 +854,12 @@ namespace detail { b.col(pu.phase_pos[BlackoilPhases::Vapour]) = bg; const V rvsat = fluidRvSat(avg_press, perf_so, well_cells); rvmax_perf.assign(rvsat.data(), rvsat.data() + nperf); + } else { + rvmax_perf.assign(nperf, 0.0); } // b is row major, so can just copy data. - std::vector b_perf(b.data(), b.data() + nperf * pu.num_phases); - // Extract well connection depths. - const V depth = cellCentroidsZToEigen(grid_); - const V pdepth = subset(depth, well_cells); - std::vector perf_depth(pdepth.data(), pdepth.data() + nperf); + b_perf.assign(b.data(), b.data() + nperf * pu.num_phases); + // Surface density. // The compute density segment wants the surface densities as @@ -873,17 +868,46 @@ namespace detail { for (int phase = 1; phase < pu.num_phases; ++phase) { rho += superset(fluid_.surfaceDensity(phase , well_cells), Span(nperf, pu.num_phases, phase), nperf*pu.num_phases); } - std::vector surf_dens_perf(rho.data(), rho.data() + nperf * pu.num_phases); + surf_dens_perf.assign(rho.data(), rho.data() + nperf * pu.num_phases); + } // Gravity double grav = detail::getGravity(geo_.gravity(), dimensions(grid_)); + + template + void BlackoilModelBase::computeWellConnectionPressures(const SolutionState& state, + const WellState& xw) + { + if( ! localWellsActive() ) return ; + + using namespace Opm::AutoDiffGrid; + // 1. Compute properties required by computeConnectionPressureDelta(). + // Note that some of the complexity of this part is due to the function + // taking std::vector arguments, and not Eigen objects. + std::vector b_perf; + std::vector rsmax_perf; + std::vector rvmax_perf; + std::vector surf_dens_perf; + asImpl().computePropertiesForWellConnectionPressures(state, xw, b_perf, rsmax_perf, rvmax_perf, surf_dens_perf); + // 2. Compute densities std::vector cd = WellDensitySegmented::computeConnectionDensities( wells(), xw, fluid_.phaseUsage(), b_perf, rsmax_perf, rvmax_perf, surf_dens_perf); + const int nperf = wells().well_connpos[wells().number_of_wells]; + const std::vector& well_cells = wops_.well_cells; + + // Extract well connection depths. + const V depth = cellCentroidsZToEigen(grid_); + const V pdepth = subset(depth, well_cells); + std::vector perf_depth(pdepth.data(), pdepth.data() + nperf); + + // Gravity + double grav = detail::getGravity(geo_.gravity(), dimensions(grid_)); + // 3. Compute pressure deltas std::vector cdp = WellDensitySegmented::computeConnectionPressureDelta( From 541475b2db37823f1fad44e6c287688a1cd9daad Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 18 Mar 2016 11:13:13 +0100 Subject: [PATCH 3/7] Implement computePropertiesForWellConnectionPressures for solvent model The solvent specify part of computeWellConnectionPressures is factored out to computePropertiesForWellConnectionPressures in order to reuse the computeWellConnectionPressures from the base model. --- opm/autodiff/BlackoilSolventModel.hpp | 9 ++++- opm/autodiff/BlackoilSolventModel_impl.hpp | 45 +++++++--------------- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/opm/autodiff/BlackoilSolventModel.hpp b/opm/autodiff/BlackoilSolventModel.hpp index 987a93db1..060c40d12 100644 --- a/opm/autodiff/BlackoilSolventModel.hpp +++ b/opm/autodiff/BlackoilSolventModel.hpp @@ -151,6 +151,7 @@ namespace Opm { using Base::updateWellControls; using Base::computeWellConnectionPressures; using Base::addWellControlEq; + using Base::computePropertiesForWellConnectionPressures; std::vector computeRelPerm(const SolutionState& state) const; @@ -204,8 +205,12 @@ namespace Opm { const SolutionState& state, WellState& xw); - void computeWellConnectionPressures(const SolutionState& state, - const WellState& xw); + void computePropertiesForWellConnectionPressures(const SolutionState& state, + const WellState& xw, + std::vector& b_perf, + std::vector& rsmax_perf, + std::vector& rvmax_perf, + std::vector& surf_dens_perf); void updateEquationsScaling(); diff --git a/opm/autodiff/BlackoilSolventModel_impl.hpp b/opm/autodiff/BlackoilSolventModel_impl.hpp index 34e9f1b54..60ba32798 100644 --- a/opm/autodiff/BlackoilSolventModel_impl.hpp +++ b/opm/autodiff/BlackoilSolventModel_impl.hpp @@ -382,10 +382,13 @@ namespace Opm { } template - void BlackoilSolventModel::computeWellConnectionPressures(const SolutionState& state, - const WellState& xw) + void BlackoilSolventModel::computePropertiesForWellConnectionPressures(const SolutionState& state, + const WellState& xw, + std::vector& b_perf, + std::vector& rsmax_perf, + std::vector& rvmax_perf, + std::vector& surf_dens_perf) { - if( ! Base::localWellsActive() ) return ; using namespace Opm::AutoDiffGrid; // 1. Compute properties required by computeConnectionPressureDelta(). @@ -421,8 +424,7 @@ namespace Opm { const PhaseUsage& pu = fluid_.phaseUsage(); DataBlock b(nperf, pu.num_phases); - std::vector rsmax_perf(nperf, 0.0); - std::vector rvmax_perf(nperf, 0.0); + const V bw = fluid_.bWat(avg_press_ad, perf_temp, well_cells).value(); if (pu.phase_used[BlackoilPhases::Aqua]) { b.col(pu.phase_pos[BlackoilPhases::Aqua]) = bw; @@ -439,6 +441,8 @@ namespace Opm { b.col(pu.phase_pos[BlackoilPhases::Liquid]) = bo; const V rssat = fluidRsSat(avg_press, perf_so, well_cells); rsmax_perf.assign(rssat.data(), rssat.data() + nperf); + } else { + rsmax_perf.assign(0.0, nperf); } V surf_dens_copy = superset(fluid_.surfaceDensity(0, well_cells), Span(nperf, pu.num_phases, 0), nperf*pu.num_phases); for (int phase = 1; phase < pu.num_phases; ++phase) { @@ -496,41 +500,18 @@ namespace Opm { const V rvsat = fluidRvSat(avg_press, perf_so, well_cells); rvmax_perf.assign(rvsat.data(), rvsat.data() + nperf); + } else { + rvmax_perf.assign(0.0, nperf); } // b and surf_dens_perf is row major, so can just copy data. - std::vector b_perf(b.data(), b.data() + nperf * pu.num_phases); - std::vector surf_dens_perf(surf_dens_copy.data(), surf_dens_copy.data() + nperf * pu.num_phases); - - // Extract well connection depths. - const V depth = cellCentroidsZToEigen(grid_); - const V pdepth = subset(depth, well_cells); - std::vector perf_depth(pdepth.data(), pdepth.data() + nperf); - - // Gravity - double grav = detail::getGravity(geo_.gravity(), dimensions(grid_)); - - // 2. Compute densities - std::vector cd = - WellDensitySegmented::computeConnectionDensities( - wells(), xw, fluid_.phaseUsage(), - b_perf, rsmax_perf, rvmax_perf, surf_dens_perf); - - // 3. Compute pressure deltas - std::vector cdp = - WellDensitySegmented::computeConnectionPressureDelta( - wells(), perf_depth, cd, grav); - - // 4. Store the results - Base::well_perforation_densities_ = Eigen::Map(cd.data(), nperf); - Base::well_perforation_pressure_diffs_ = Eigen::Map(cdp.data(), nperf); + b_perf.assign(b.data(), b.data() + nperf * pu.num_phases); + surf_dens_perf.assign(surf_dens_copy.data(), surf_dens_copy.data() + nperf * pu.num_phases); } - - template void BlackoilSolventModel::updateState(const V& dx, ReservoirState& reservoir_state, From 925d0becf36bb432162842fc99718c1bd1a4ccf1 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 18 Mar 2016 13:33:51 +0100 Subject: [PATCH 4/7] Fix to make flow_solvent run decks without solvent --- opm/autodiff/BlackoilSolventModel_impl.hpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/opm/autodiff/BlackoilSolventModel_impl.hpp b/opm/autodiff/BlackoilSolventModel_impl.hpp index 60ba32798..da97e5677 100644 --- a/opm/autodiff/BlackoilSolventModel_impl.hpp +++ b/opm/autodiff/BlackoilSolventModel_impl.hpp @@ -988,16 +988,19 @@ namespace Opm { const ADB& ss) const { std::vector pressures = Base::computePressures(po, sw, so, sg); - // The imiscible capillary pressure is evaluated using the total gas saturation (sg + ss) - std::vector pressures_imisc = Base::computePressures(po, sw, so, sg + ss); - // Pressure effects on capillary pressure miscibility - const ADB pmisc = solvent_props_.pressureMiscibilityFunction(po, cells_); - // Only the pcog is effected by the miscibility. Since pg = po + pcog, changing pg is eqvivalent - // to changing the gas pressure directly. - const int nc = cells_.size(); - const V ones = V::Constant(nc, 1.0); - pressures[Gas] = ( pmisc * pressures[Gas] + ((ones - pmisc) * pressures_imisc[Gas])); + if (has_solvent_) { + // The imiscible capillary pressure is evaluated using the total gas saturation (sg + ss) + std::vector pressures_imisc = Base::computePressures(po, sw, so, sg + ss); + + // Pressure effects on capillary pressure miscibility + const ADB pmisc = solvent_props_.pressureMiscibilityFunction(po, cells_); + // Only the pcog is effected by the miscibility. Since pg = po + pcog, changing pg is eqvivalent + // to changing the gas pressure directly. + const int nc = cells_.size(); + const V ones = V::Constant(nc, 1.0); + pressures[Gas] = ( pmisc * pressures[Gas] + ((ones - pmisc) * pressures_imisc[Gas])); + } return pressures; } From 89e540cb2cd594312553901f6caa9564fb8995ce Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 1 Apr 2016 15:52:38 +0200 Subject: [PATCH 5/7] Pass solutionState as first parameter output parameters go last... --- opm/autodiff/BlackoilModelBase.hpp | 6 +++--- opm/autodiff/BlackoilModelBase_impl.hpp | 8 ++++---- opm/autodiff/BlackoilSolventModel.hpp | 6 +++--- opm/autodiff/BlackoilSolventModel_impl.hpp | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/opm/autodiff/BlackoilModelBase.hpp b/opm/autodiff/BlackoilModelBase.hpp index 9ab41f3fa..8b388ac10 100644 --- a/opm/autodiff/BlackoilModelBase.hpp +++ b/opm/autodiff/BlackoilModelBase.hpp @@ -398,9 +398,9 @@ namespace Opm { assembleMassBalanceEq(const SolutionState& state); void - extractWellPerfProperties(std::vector& mob_perfcells, - std::vector& b_perfcells, - const SolutionState&) const; + extractWellPerfProperties(const SolutionState& state, + std::vector& mob_perfcells, + std::vector& b_perfcells) const; bool solveWellEq(const std::vector& mob_perfcells, diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index a26dda854..a02e0c635 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -978,7 +978,7 @@ namespace detail { std::vector mob_perfcells; std::vector b_perfcells; - asImpl().extractWellPerfProperties(mob_perfcells, b_perfcells, state); + asImpl().extractWellPerfProperties(state, mob_perfcells, b_perfcells); if (param_.solve_welleq_initially_ && initial_assembly) { // solve the well equations as a pre-processing step asImpl().solveWellEq(mob_perfcells, b_perfcells, state, well_state); @@ -1125,9 +1125,9 @@ namespace detail { template void - BlackoilModelBase::extractWellPerfProperties(std::vector& mob_perfcells, - std::vector& b_perfcells, - const SolutionState&) const + BlackoilModelBase::extractWellPerfProperties(const SolutionState&, + std::vector& mob_perfcells, + std::vector& b_perfcells) const { // If we have wells, extract the mobilities and b-factors for // the well-perforated cells. diff --git a/opm/autodiff/BlackoilSolventModel.hpp b/opm/autodiff/BlackoilSolventModel.hpp index 060c40d12..176e8a758 100644 --- a/opm/autodiff/BlackoilSolventModel.hpp +++ b/opm/autodiff/BlackoilSolventModel.hpp @@ -226,9 +226,9 @@ namespace Opm { const std::vector phaseCondition() const {return this->phaseCondition_;} - void extractWellPerfProperties(std::vector& mob_perfcells, - std::vector& b_perfcells, - const SolutionState& state); + void extractWellPerfProperties(const SolutionState& state, + std::vector& mob_perfcells, + std::vector& b_perfcells); // compute effective viscosities (mu_eff_) and effective b factors (b_eff_) using the ToddLongstaff model diff --git a/opm/autodiff/BlackoilSolventModel_impl.hpp b/opm/autodiff/BlackoilSolventModel_impl.hpp index da97e5677..65fb18ee6 100644 --- a/opm/autodiff/BlackoilSolventModel_impl.hpp +++ b/opm/autodiff/BlackoilSolventModel_impl.hpp @@ -758,11 +758,11 @@ namespace Opm { template void - BlackoilSolventModel::extractWellPerfProperties(std::vector& mob_perfcells, - std::vector& b_perfcells, - const SolutionState& state) + BlackoilSolventModel::extractWellPerfProperties(const SolutionState& state, + std::vector& mob_perfcells, + std::vector& b_perfcells) { - Base::extractWellPerfProperties(mob_perfcells, b_perfcells, state); + Base::extractWellPerfProperties(state, mob_perfcells, b_perfcells); if (has_solvent_) { int gas_pos = fluid_.phaseUsage().phase_pos[Gas]; const std::vector& well_cells = wops_.well_cells; From 764d8a1c3fd981feb566e6cd55f5931eb5de8944 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 5 Apr 2016 09:03:22 +0200 Subject: [PATCH 6/7] Remove leftovers from a merge process going wrong --- opm/autodiff/BlackoilModelBase_impl.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index a02e0c635..c9703992b 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -871,9 +871,6 @@ namespace detail { surf_dens_perf.assign(rho.data(), rho.data() + nperf * pu.num_phases); } - // Gravity - double grav = detail::getGravity(geo_.gravity(), dimensions(grid_)); - template void BlackoilModelBase::computeWellConnectionPressures(const SolutionState& state, From e5254f3779fec62a9e4dc24ef92d4d3d8a27348e Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 5 Apr 2016 09:13:29 +0200 Subject: [PATCH 7/7] Adapt to changes interface of extractWellPerfProperties The BlockoilmultisegmentModel is updated to account for changes in the extractWellPerfProperties() interface. --- opm/autodiff/BlackoilMultiSegmentModel_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp b/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp index f58ac64c2..5a2c5fcb2 100644 --- a/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp +++ b/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp @@ -630,7 +630,7 @@ namespace Opm { std::vector mob_perfcells; std::vector b_perfcells; - asImpl().extractWellPerfProperties(mob_perfcells, b_perfcells); + asImpl().extractWellPerfProperties(state, mob_perfcells, b_perfcells); if (param_.solve_welleq_initially_ && initial_assembly) { // solve the well equations as a pre-processing step asImpl().solveWellEq(mob_perfcells, b_perfcells, state, well_state);