mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
simplyfying code as some logic is moved to the parser
This commit is contained in:
parent
b2258dcf90
commit
36dcf233c5
@ -1379,9 +1379,6 @@ updateNetworkPressures(const int reportStepIdx)
|
||||
if (thp_is_limit) {
|
||||
ws.thp = well->getTHPConstraint(summaryState_);
|
||||
}
|
||||
//PJPE: Set thp of wells belonging to a subsea manifold equal to the node_pressure
|
||||
if (network.node(well->wellEcl().groupName()).as_choke())
|
||||
ws.thp = new_limit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1298,24 +1298,15 @@ namespace Opm {
|
||||
return well_group_rate - orig_target;
|
||||
};
|
||||
|
||||
const std::array<double, 2> range {20E5, 40E5};
|
||||
const std::array<double, 2> range {1E5, 150E5}; //PJPE what lower/upper bound to be taken here?
|
||||
double low, high;
|
||||
|
||||
// // // trying to use bisect way to locate a bracket
|
||||
// std::optional<double> approximate_solution;
|
||||
// bool finding_bracket = WellBhpThpCalculator::bisectBracketModified(mismatch, range, low, high, approximate_solution, local_deferredLogger);
|
||||
// if (approximate_solution.has_value())
|
||||
// std::cout << "Approximate solution: " << *approximate_solution << std::endl;
|
||||
|
||||
bool finding_bracket = false;
|
||||
if (!finding_bracket) {
|
||||
local_deferredLogger.debug(" Trying the brute force search to bracket the bhp for last attempt ");
|
||||
finding_bracket = WellBhpThpCalculator::bruteForceBracket(mismatch, range, low, high, local_deferredLogger);
|
||||
}
|
||||
|
||||
if (!finding_bracket) {
|
||||
local_deferredLogger.debug(" Trying the brute force search to bracket the bhp for last attempt ");
|
||||
const bool finding_bracket = WellBhpThpCalculator::bruteForceBracket(mismatch, range, low, high, local_deferredLogger);
|
||||
if (finding_bracket) {
|
||||
std::cout << "low: " << low << " high: " << high << std::endl;
|
||||
} else {
|
||||
local_deferredLogger.warning("Bracketing THP calculation failed");
|
||||
// return std::nullopt;
|
||||
}
|
||||
|
||||
// PJPE: TODO what settings to take here?
|
||||
@ -2482,6 +2473,9 @@ namespace Opm {
|
||||
const std::string msg = "Compute initial well solution for " + well->name() + " initially failed. Continue with the previous rates";
|
||||
deferred_logger.warning("WELL_INITIAL_SOLVE_FAILED", msg);
|
||||
}
|
||||
// If we're using local well solves that include control switches, they also update
|
||||
// operability, so reset before main iterations begin
|
||||
well->resetWellOperability();
|
||||
}
|
||||
}
|
||||
updatePrimaryVariables(deferred_logger);
|
||||
|
@ -1401,35 +1401,23 @@ namespace Opm
|
||||
assert(well.isAvailableForGroupControl());
|
||||
const auto& group = schedule.getGroup(well.groupName(), this->currentStep());
|
||||
const Scalar efficiencyFactor = well.getEfficiencyFactor();
|
||||
Scalar scale = this->getGroupProductionTargetRate(group,
|
||||
well_state,
|
||||
group_state,
|
||||
schedule,
|
||||
summaryState,
|
||||
efficiencyFactor,
|
||||
deferred_logger);
|
||||
|
||||
bool has_choke(false);
|
||||
const std::size_t report_step = this->currentStep();
|
||||
auto& network = schedule[report_step].network();
|
||||
if (network.active())
|
||||
has_choke = network.node(group.name()).as_choke();
|
||||
if (!has_choke) {
|
||||
Scalar scale = this->getGroupProductionTargetRate(group,
|
||||
well_state,
|
||||
group_state,
|
||||
schedule,
|
||||
summaryState,
|
||||
efficiencyFactor,
|
||||
deferred_logger);
|
||||
|
||||
// we don't want to scale with zero and get zero rates.
|
||||
if (scale > 0) {
|
||||
for (int p = 0; p<np; ++p) {
|
||||
ws.surface_rates[p] *= scale;
|
||||
}
|
||||
ws.trivial_target = false;
|
||||
} else {
|
||||
ws.trivial_target = true;
|
||||
// we don't want to scale with zero and get zero rates.
|
||||
if (scale > 0) {
|
||||
for (int p = 0; p<np; ++p) {
|
||||
ws.surface_rates[p] *= scale;
|
||||
}
|
||||
ws.trivial_target = false;
|
||||
} else {
|
||||
// PJPE: the group is a subsea manifold.Guide rates to be ignored.
|
||||
// The wells of the group are to be operated on a common THP (= manifold node pressure)
|
||||
ws.production_cmode = Well::ProducerCMode::THP;
|
||||
}
|
||||
ws.trivial_target = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Well::ProducerCMode::CMODE_UNDEFINED:
|
||||
|
Loading…
Reference in New Issue
Block a user