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) {
|
if (thp_is_limit) {
|
||||||
ws.thp = well->getTHPConstraint(summaryState_);
|
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;
|
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;
|
double low, high;
|
||||||
|
|
||||||
// // // trying to use bisect way to locate a bracket
|
local_deferredLogger.debug(" Trying the brute force search to bracket the bhp for last attempt ");
|
||||||
// std::optional<double> approximate_solution;
|
const bool finding_bracket = WellBhpThpCalculator::bruteForceBracket(mismatch, range, low, high, local_deferredLogger);
|
||||||
// bool finding_bracket = WellBhpThpCalculator::bisectBracketModified(mismatch, range, low, high, approximate_solution, local_deferredLogger);
|
if (finding_bracket) {
|
||||||
// if (approximate_solution.has_value())
|
std::cout << "low: " << low << " high: " << high << std::endl;
|
||||||
// std::cout << "Approximate solution: " << *approximate_solution << std::endl;
|
} else {
|
||||||
|
|
||||||
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.warning("Bracketing THP calculation failed");
|
local_deferredLogger.warning("Bracketing THP calculation failed");
|
||||||
// return std::nullopt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PJPE: TODO what settings to take here?
|
// 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";
|
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);
|
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);
|
updatePrimaryVariables(deferred_logger);
|
||||||
|
@ -1401,34 +1401,22 @@ namespace Opm
|
|||||||
assert(well.isAvailableForGroupControl());
|
assert(well.isAvailableForGroupControl());
|
||||||
const auto& group = schedule.getGroup(well.groupName(), this->currentStep());
|
const auto& group = schedule.getGroup(well.groupName(), this->currentStep());
|
||||||
const Scalar efficiencyFactor = well.getEfficiencyFactor();
|
const Scalar efficiencyFactor = well.getEfficiencyFactor();
|
||||||
|
Scalar scale = this->getGroupProductionTargetRate(group,
|
||||||
|
well_state,
|
||||||
|
group_state,
|
||||||
|
schedule,
|
||||||
|
summaryState,
|
||||||
|
efficiencyFactor,
|
||||||
|
deferred_logger);
|
||||||
|
|
||||||
bool has_choke(false);
|
// we don't want to scale with zero and get zero rates.
|
||||||
const std::size_t report_step = this->currentStep();
|
if (scale > 0) {
|
||||||
auto& network = schedule[report_step].network();
|
for (int p = 0; p<np; ++p) {
|
||||||
if (network.active())
|
ws.surface_rates[p] *= scale;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
ws.trivial_target = false;
|
||||||
} else {
|
} else {
|
||||||
// PJPE: the group is a subsea manifold.Guide rates to be ignored.
|
ws.trivial_target = true;
|
||||||
// The wells of the group are to be operated on a common THP (= manifold node pressure)
|
|
||||||
ws.production_cmode = Well::ProducerCMode::THP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user