From 104372bbdc5d58ed7ea7a8be0571fc91e41e7ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 3 May 2012 13:29:02 +0200 Subject: [PATCH 1/4] Fixed signs of production rate constraints (should be negative). --- opm/core/WellsManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/core/WellsManager.cpp b/opm/core/WellsManager.cpp index 9ce6ff105..6d3b782e3 100644 --- a/opm/core/WellsManager.cpp +++ b/opm/core/WellsManager.cpp @@ -492,7 +492,7 @@ namespace Opm control_pos[ProductionControl::ORAT] = w_->ctrls[wix]->num; double distr[3] = { 0.0, 0.0, 0.0 }; distr[pu.phase_pos[BlackoilPhases::Liquid]] = 1.0; - ok = append_well_controls(SURFACE_RATE, wcp_line.oil_max_rate_, + ok = append_well_controls(SURFACE_RATE, -wcp_line.oil_max_rate_, distr, wix, w_); } if (ok && wcp_line.water_max_rate_ > 0.0) { @@ -502,7 +502,7 @@ namespace Opm control_pos[ProductionControl::WRAT] = w_->ctrls[wix]->num; double distr[3] = { 0.0, 0.0, 0.0 }; distr[pu.phase_pos[BlackoilPhases::Aqua]] = 1.0; - ok = append_well_controls(SURFACE_RATE, wcp_line.water_max_rate_, + ok = append_well_controls(SURFACE_RATE, -wcp_line.water_max_rate_, distr, wix, w_); } if (ok && wcp_line.gas_max_rate_ > 0.0) { @@ -512,7 +512,7 @@ namespace Opm control_pos[ProductionControl::GRAT] = w_->ctrls[wix]->num; double distr[3] = { 0.0, 0.0, 0.0 }; distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0; - ok = append_well_controls(SURFACE_RATE, wcp_line.gas_max_rate_, + ok = append_well_controls(SURFACE_RATE, -wcp_line.gas_max_rate_, distr, wix, w_); } if (ok && wcp_line.liquid_max_rate_ > 0.0) { @@ -526,13 +526,13 @@ namespace Opm double distr[3] = { 0.0, 0.0, 0.0 }; distr[pu.phase_pos[BlackoilPhases::Aqua]] = 1.0; distr[pu.phase_pos[BlackoilPhases::Liquid]] = 1.0; - ok = append_well_controls(SURFACE_RATE, wcp_line.liquid_max_rate_, + ok = append_well_controls(SURFACE_RATE, -wcp_line.liquid_max_rate_, distr, wix, w_); } if (ok && wcp_line.reservoir_flow_max_rate_ > 0.0) { control_pos[ProductionControl::RESV] = w_->ctrls[wix]->num; double distr[3] = { 1.0, 1.0, 1.0 }; - ok = append_well_controls(RESERVOIR_RATE, wcp_line.reservoir_flow_max_rate_, + ok = append_well_controls(RESERVOIR_RATE, -wcp_line.reservoir_flow_max_rate_, distr, wix, w_); } if (ok && wcp_line.BHP_limit_ > 0.0) { From 8b33bd261d56448d56e48df4cce184ffeec996ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 3 May 2012 13:32:30 +0200 Subject: [PATCH 2/4] Remove unused variable. --- opm/core/pressure/tpfa/ifs_tpfa.c | 1 - 1 file changed, 1 deletion(-) diff --git a/opm/core/pressure/tpfa/ifs_tpfa.c b/opm/core/pressure/tpfa/ifs_tpfa.c index 796ffc6ed..d6d222367 100644 --- a/opm/core/pressure/tpfa/ifs_tpfa.c +++ b/opm/core/pressure/tpfa/ifs_tpfa.c @@ -287,7 +287,6 @@ assemble_well_contrib(int nc , /* ---------------------------------------------------------------------- */ { int w, p, np; - int are_rate; struct WellControls *ctrls; From 0aae87cf16d07440393242f4fc97f45e574757a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 3 May 2012 13:45:19 +0200 Subject: [PATCH 3/4] Rewrote wellsToSrc() to be a little more accepting and correct. --- opm/core/utility/miscUtilities.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/opm/core/utility/miscUtilities.cpp b/opm/core/utility/miscUtilities.cpp index 2782cf8ea..6021e18cb 100644 --- a/opm/core/utility/miscUtilities.cpp +++ b/opm/core/utility/miscUtilities.cpp @@ -410,16 +410,25 @@ namespace Opm } src.resize(num_cells); for (int w = 0; w < wells.number_of_wells; ++w) { + const int cur = wells.ctrls[w]->current; if (wells.ctrls[w]->num != 1) { - THROW("In wellsToSrc(): well has more than one control."); + MESSAGE("In wellsToSrc(): well has more than one control, all but current control will be ignored."); } - if (wells.ctrls[w]->type[0] != RESERVOIR_RATE) { + if (wells.ctrls[w]->type[cur] != RESERVOIR_RATE) { THROW("In wellsToSrc(): well is something other than RESERVOIR_RATE."); } if (wells.well_connpos[w+1] - wells.well_connpos[w] != 1) { THROW("In wellsToSrc(): well has multiple perforations."); } - const double flow = wells.ctrls[w]->target[0] * wells.ctrls[w]->distr[0]; + for (int p = 0; p < np; ++p) { + if (wells.ctrls[w]->distr[np*cur + p] != 1.0) { + THROW("In wellsToSrc(): well not controlled on total rate."); + } + } + double flow = wells.ctrls[w]->target[cur]; + if (wells.type[w] == INJECTOR) { + flow *= wells.comp_frac[np*w + 0]; // Obtaining water rate for inflow source. + } const double cell = wells.well_cells[wells.well_connpos[w]]; src[cell] = flow; } From 1c8e21ae08c42fa4d9f7f3574981aef6cc33e731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 3 May 2012 13:48:59 +0200 Subject: [PATCH 4/4] Rename parameter init_sat -> init_saturation (docs already used this name). --- opm/core/utility/initState_impl.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/opm/core/utility/initState_impl.hpp b/opm/core/utility/initState_impl.hpp index 4bbd0250b..34f944f8d 100644 --- a/opm/core/utility/initState_impl.hpp +++ b/opm/core/utility/initState_impl.hpp @@ -214,16 +214,16 @@ namespace Opm // Initialise pressure to hydrostatic state. const double ref_p = param.getDefault("ref_pressure", 100)*unit::barsa; initHydrostaticPressure(grid, props.density(), woc, gravity, woc, ref_p, state); - } else if (param.has("init_sat")) { - // Initialise water saturation to init_sat parameter. - const double init_sat = param.get("init_sat"); + } else if (param.has("init_saturation")) { + // Initialise water saturation to init_saturation parameter. + const double init_saturation = param.get("init_saturation"); for (int cell = 0; cell < num_cells; ++cell) { - state.saturation()[2*cell] = init_sat; - state.saturation()[2*cell + 1] = 1.0 - init_sat; + state.saturation()[2*cell] = init_saturation; + state.saturation()[2*cell + 1] = 1.0 - init_saturation; } // Initialise pressure to hydrostatic state. const double ref_p = param.getDefault("ref_pressure", 100)*unit::barsa; - const double rho = props.density()[0]*init_sat + props.density()[1]*(1.0 - init_sat); + const double rho = props.density()[0]*init_saturation + props.density()[1]*(1.0 - init_saturation); const double dens[2] = { rho, rho }; const double ref_z = grid.cell_centroids[0 + grid.dimensions - 1]; initHydrostaticPressure(grid, dens, ref_z, gravity, ref_z, ref_p, state);