From cfbfd841be14e7180d1078fa79fad109a18f6369 Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Tue, 17 Apr 2012 08:59:20 +0200 Subject: [PATCH] Added shutdown of wells when they exceed their limits (if procedure = shut). --- opm/core/WellsGroup.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/opm/core/WellsGroup.cpp b/opm/core/WellsGroup.cpp index 1ab1e034..3d49f334 100644 --- a/opm/core/WellsGroup.cpp +++ b/opm/core/WellsGroup.cpp @@ -130,6 +130,7 @@ namespace Opm int number_of_leaf_nodes = numberOfLeafNodes(); + bool shut_down_on_exceed = false; double bhp_target = 1e100; double rate_target = 1e100; switch(wells->type[index_of_well]) { @@ -145,6 +146,7 @@ namespace Opm const ProductionSpecification& prod_spec = prodSpec(); bhp_target = prod_spec.BHP_limit_ / number_of_leaf_nodes; rate_target = prod_spec.fluid_volume_max_rate_ / number_of_leaf_nodes; + shut_down_on_exceed = prodSpec().procedure_ == ProductionSpecification::Well; break; } } @@ -153,12 +155,22 @@ namespace Opm std::cout << "BHP not met" << std::endl; std::cout << "BHP limit was " << bhp_target << std::endl; std::cout << "Actual bhp was " << well_bhp[index_of_well] << std::endl; + + if(shut_down_on_exceed) { + // Shut down well + wells->ctrls->target = 0.0; + } return false; } if(well_rate[index_of_well] - rate_target > epsilon) { std::cout << "well_rate not met" << std::endl; std::cout << "target = " << rate_target << ", well_rate[index_of_well] = " << well_rate[index_of_well] << std::endl; std::cout << "Group name = " << name() << std::endl; + + if(shut_down_on_exceed) { + // Shut down well + wells->ctrls->target = 0.0; + } return false; } return true;