adding OperabilityStatus to WellInterface

to check the operability status of a well.
This commit is contained in:
Kai Bao 2018-11-15 12:55:30 +01:00
parent 4337483ac6
commit 2e43b440e0

View File

@ -350,6 +350,10 @@ namespace Opm
// whether a well is specified with a non-zero and valid VFP table number // whether a well is specified with a non-zero and valid VFP table number
bool isVFPActive() const; bool isVFPActive() const;
struct OperabilityStatus;
OperabilityStatus operability_status_;
void wellTestingEconomic(Simulator& simulator, const std::vector<double>& B_avg, void wellTestingEconomic(Simulator& simulator, const std::vector<double>& B_avg,
const double simulation_time, const int report_step, const bool terminal_output, const double simulation_time, const int report_step, const bool terminal_output,
const WellState& well_state, WellTestState& welltest_state); const WellState& well_state, WellTestState& welltest_state);
@ -366,6 +370,65 @@ namespace Opm
}; };
// definition of the struct OperabilityStatus
template<typename TypeTag>
struct
WellInterface<TypeTag>::
OperabilityStatus {
bool isOperable() const {
if (!operable_under_only_bhp_limit) {
return false;
} else {
return !negative_well_rates && (isOperableUnderBHPLimit() || isOperableUnderTHPLimit());
}
}
bool isOperableUnderBHPLimit() const {
return operable_under_only_bhp_limit && !violate_thp_limit_under_bhp_limit;
}
bool isOperableUnderTHPLimit() const {
return obtain_solution_with_thp_limit && !violate_bhp_limit_with_thp_limit;
}
void reset() {
operable_under_only_bhp_limit = true;
violate_thp_limit_under_bhp_limit = false;
obtain_solution_with_thp_limit = true;
violate_bhp_limit_with_thp_limit = false;
// TODO: the following one might need to be different
negative_well_rates = false;
}
// TODO: re-design the boolean variables so that they have meaning in the same directions.
// For example, true are all for positive situation, and false are all for negative circumstances.
// whether the well can be operated under bhp limit
// without considering other limits.
// if it is false, then the well is not operable for sure.
bool operable_under_only_bhp_limit = true;
// if the well can be operated under bhp limit, will it violate
// the thp limit when operated under bhp limit
bool violate_thp_limit_under_bhp_limit = false;
// whether the well operate under the thp limit only
bool obtain_solution_with_thp_limit = true;
// whether the well violate bhp limit when operated under thp limit
bool violate_bhp_limit_with_thp_limit = false;
// we get negatvie well rates
// currently, we are trying to address the one result from updateWellStateWithTHPTargetIPR
bool negative_well_rates = false;
// could not get converged, maybe at the end of the time step, after chopping for some steps.
// TODO: the best way is that this well can not get converged during local iterations.
bool could_not_get_converged = false;
};
}
} }
#include "WellInterface_impl.hpp" #include "WellInterface_impl.hpp"