mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Improve debugging tools in gaslift code.
Introduces a gaslift debugging variable in ALQState in WellState. This
variable will persist between timesteps in contrast to when debugging
variables are defined in GasLiftSingleWell, GasLiftGroupState, or GasLiftStage2.
Currently only an integer variable debug_counter is added to ALQState,
which can be used as follows: First debugging is switched on globally
for BlackOilWellModel, GasLiftSingleWell, GasLiftGroupState, and
GasLiftStage2 by setting glift_debug to a true value in BlackOilWellModelGeneric.
Then, the following debugging code can be added to e.g. one of
GasLiftSingleWell, GasLiftGroupState, or GasLiftStage2 :
auto count = debugUpdateGlobalCounter_();
if (count == some_integer) {
displayDebugMessage_("stop here");
}
Here, the integer "some_integer" is determined typically by looking at
the debugging output of a previous run. This can be done since the
call to debugUpdateGlobalCounter_() will print out the current value
of the counter and then increment the counter by one. And it will be
easy to recognize these values in the debug ouput. If you find a place
in the output that looks suspect, just take a note of the counter
value in the output around that point and insert the value for
"some_integer", then after recompiling the code with the desired value
for "some_integer", it is now easy to set a breakpoint in GDB at the
line
displayDebugMessage_("stop here").
shown in the above snippet. This should improve the ability to quickly
to set a breakpoint in GDB around at a given time and point in the simulation.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <opm/input/eclipse/Schedule/Group/Group.hpp>
|
||||
#include <opm/input/eclipse/Schedule/GasLiftOpt.hpp>
|
||||
#include <opm/input/eclipse/Schedule/SummaryState.hpp>
|
||||
#include <opm/simulators/wells/GasLiftCommon.hpp>
|
||||
#include <opm/simulators/wells/WellState.hpp>
|
||||
#include <opm/simulators/utils/DeferredLogger.hpp>
|
||||
|
||||
@@ -42,8 +43,9 @@
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
class GasLiftGroupInfo
|
||||
class GasLiftGroupInfo : public GasLiftCommon
|
||||
{
|
||||
protected:
|
||||
class GroupRates;
|
||||
// NOTE: In the Well2GroupMap below, in the std::vector value we store
|
||||
// pairs of group names and efficiency factors. The efficiency factors
|
||||
@@ -79,7 +81,9 @@ public:
|
||||
const PhaseUsage& phase_usage,
|
||||
DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
const Parallel::Communication& comm);
|
||||
const Parallel::Communication& comm,
|
||||
bool glift_debug
|
||||
);
|
||||
std::vector<std::pair<std::string,double>>& getWellGroups(
|
||||
const std::string& well_name);
|
||||
|
||||
@@ -105,10 +109,10 @@ public:
|
||||
double delta_oil, double delta_gas, double delta_water, double delta_alq);
|
||||
void updateRate(int idx, double oil_rate, double gas_rate, double water_rate, double alq);
|
||||
const Well2GroupMap& wellGroupMap() { return well_group_map_; }
|
||||
private:
|
||||
protected:
|
||||
void displayDebugMessage_(const std::string& msg) const override;
|
||||
bool checkDoGasLiftOptimization_(const std::string& well_name);
|
||||
bool checkNewtonIterationIdxOk_(const std::string& well_name);
|
||||
void displayDebugMessage_(const std::string& msg);
|
||||
void displayDebugMessage_(const std::string& msg, const std::string& well_name);
|
||||
std::tuple<double, double, double> getProducerWellRates_(const int index);
|
||||
std::tuple<double, double, double, double>
|
||||
@@ -183,13 +187,10 @@ private:
|
||||
const int report_step_idx_;
|
||||
const int iteration_idx_;
|
||||
const PhaseUsage &phase_usage_;
|
||||
DeferredLogger &deferred_logger_;
|
||||
WellState &well_state_;
|
||||
const Parallel::Communication &comm_;
|
||||
const GasLiftOpt& glo_;
|
||||
GroupRateMap group_rate_map_;
|
||||
Well2GroupMap well_group_map_;
|
||||
bool debug;
|
||||
GroupIdxMap group_idx_;
|
||||
int next_group_idx_ = 0;
|
||||
// Optimize only wells under THP control
|
||||
|
||||
Reference in New Issue
Block a user