diff --git a/examples/sim_2p_comp_ad.cpp b/examples/sim_2p_comp_ad.cpp index bf8506b0c..de5a24000 100644 --- a/examples/sim_2p_comp_ad.cpp +++ b/examples/sim_2p_comp_ad.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -165,8 +166,8 @@ try if (!ok) { OPM_THROW(std::runtime_error, "Simple well init failed."); } - simple_wells->ctrls[0]->current = 0; - simple_wells->ctrls[1]->current = 0; + well_controls_set_current( simple_wells->ctrls[0] , 0); + well_controls_set_current( simple_wells->ctrls[1] , 0); } // Linear solver. diff --git a/opm/autodiff/FullyImplicitBlackoilSolver.cpp b/opm/autodiff/FullyImplicitBlackoilSolver.cpp index 6d53585f2..5a7545abb 100644 --- a/opm/autodiff/FullyImplicitBlackoilSolver.cpp +++ b/opm/autodiff/FullyImplicitBlackoilSolver.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -738,14 +739,17 @@ namespace { M rate_distr(nw, np*nw); for (int w = 0; w < nw; ++w) { const WellControls* wc = wells_.ctrls[w]; - if (wc->type[wc->current] == BHP) { - bhp_targets[w] = wc->target[wc->current]; + if (well_controls_get_current_type(wc) == BHP) { + bhp_targets[w] = well_controls_get_current_target(wc); rate_targets[w] = -1e100; - } else if (wc->type[wc->current] == SURFACE_RATE) { + } else if (well_controls_get_current_type( wc ) == SURFACE_RATE) { bhp_targets[w] = -1e100; - rate_targets[w] = wc->target[wc->current]; - for (int phase = 0; phase < np; ++phase) { - rate_distr.insert(w, phase*nw + w) = wc->distr[phase]; + rate_targets[w] = well_controls_get_current_target(wc); + { + const double * distr = well_controls_get_current_distr( wc ); + for (int phase = 0; phase < np; ++phase) { + rate_distr.insert(w, phase*nw + w) = distr[phase]; + } } } else { OPM_THROW(std::runtime_error, "Can only handle BHP and SURFACE_RATE type controls."); diff --git a/opm/autodiff/ImpesTPFAAD.cpp b/opm/autodiff/ImpesTPFAAD.cpp index 292031345..4d023039c 100644 --- a/opm/autodiff/ImpesTPFAAD.cpp +++ b/opm/autodiff/ImpesTPFAAD.cpp @@ -377,14 +377,17 @@ namespace { M rate_distr(nw, np*nw); for (int w = 0; w < nw; ++w) { const WellControls* wc = wells_.ctrls[w]; - if (wc->type[wc->current] == BHP) { - bhp_targets[w] = wc->target[wc->current]; + if (well_controls_get_current_type(wc) == BHP) { + bhp_targets[w] = well_controls_get_current_target( wc ); rate_targets[w] = -1e100; - } else if (wc->type[wc->current] == SURFACE_RATE) { + } else if (well_controls_get_current_type(wc) == SURFACE_RATE) { bhp_targets[w] = -1e100; - rate_targets[w] = wc->target[wc->current]; - for (int phase = 0; phase < np; ++phase) { - rate_distr.insert(w, phase*nw + w) = wc->distr[phase]; + rate_targets[w] = well_controls_get_current_target( wc ); + { + const double * distr = well_controls_get_current_distr( wc ); + for (int phase = 0; phase < np; ++phase) { + rate_distr.insert(w, phase*nw + w) = distr[phase]; + } } } else { OPM_THROW(std::runtime_error, "Can only handle BHP and SURFACE_RATE type controls."); diff --git a/opm/autodiff/SimulatorIncompTwophaseAd.cpp b/opm/autodiff/SimulatorIncompTwophaseAd.cpp index d009927f6..e602e87a9 100644 --- a/opm/autodiff/SimulatorIncompTwophaseAd.cpp +++ b/opm/autodiff/SimulatorIncompTwophaseAd.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -297,8 +298,8 @@ namespace Opm const int nw = wells->number_of_wells; for (int w = 0; w < nw; ++w) { const WellControls* wc = wells->ctrls[w]; - if (wc->current >= 0) { - if (wc->type[wc->current] == BHP) { + if (well_controls_get_current( wc ) >= 0) { + if (well_controls_get_current_type(wc) == BHP ) { return false; } }