Merge pull request #5767 from totto82/network_sub_iter

Network sub iter
This commit is contained in:
Tor Harald Sandve 2024-11-27 15:48:12 +01:00 committed by GitHub
commit d0bcf54b00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 11 deletions

View File

@ -127,8 +127,8 @@ struct UseImplicitIpr { static constexpr bool value = true; };
struct CheckGroupConstraintsInnerWellIterations { static constexpr bool value = true; };
// Network solver parameters
struct NetworkMaxStrictIterations { static constexpr int value = 100; };
struct NetworkMaxIterations { static constexpr int value = 200; };
struct NetworkMaxStrictIterations { static constexpr int value = 10; };
struct NetworkMaxIterations { static constexpr int value = 20; };
struct NonlinearSolver { static constexpr auto value = "newton"; };
struct LocalSolveApproach { static constexpr auto value = "gauss-seidel"; };
struct MaxLocalSolveIterations { static constexpr int value = 20; };

View File

@ -1396,7 +1396,7 @@ inferLocalShutWells()
template<class Scalar>
Scalar BlackoilWellModelGeneric<Scalar>::
updateNetworkPressures(const int reportStepIdx)
updateNetworkPressures(const int reportStepIdx, const Scalar damping_factor)
{
// Get the network and return if inactive (no wells in network at this time)
const auto& network = schedule()[reportStepIdx].network();
@ -1436,7 +1436,6 @@ updateNetworkPressures(const int reportStepIdx)
// TODO: the following parameters are subject to adjustment for optimization purpose
constexpr Scalar upper_update_bound = 5.0 * unit::barsa;
// relative dampening factor based on update value
constexpr Scalar damping_factor = 0.1;
const Scalar damped_change = std::min(damping_factor * std::abs(change), upper_update_bound);
const Scalar sign = change > 0 ? 1. : -1.;
node_pressures_[name] = pressure + sign * damped_change;

View File

@ -332,7 +332,8 @@ protected:
bool wasDynamicallyShutThisTimeStep(const int well_index) const;
Scalar updateNetworkPressures(const int reportStepIdx);
Scalar updateNetworkPressures(const int reportStepIdx,
const Scalar damping_factor);
void updateWsolvent(const Group& group,
const int reportStepIdx,

View File

@ -2187,12 +2187,18 @@ namespace Opm {
const double dt = this->simulator_.timeStepSize();
// Calculate common THP for subsea manifold well group (item 3 of NODEPROP set to YES)
computeWellGroupThp(dt, deferred_logger);
const auto local_network_imbalance = this->updateNetworkPressures(episodeIdx);
const Scalar network_imbalance = comm.max(local_network_imbalance);
const auto& balance = this->schedule()[episodeIdx].network_balance();
constexpr Scalar relaxation_factor = 10.0;
const Scalar tolerance = relax_network_tolerance ? relaxation_factor * balance.pressure_tolerance() : balance.pressure_tolerance();
more_network_update = this->networkActive() && network_imbalance > tolerance;
constexpr int max_number_of_sub_iterations = 20;
constexpr Scalar damping_factor = 0.1;
for (int i = 0; i < max_number_of_sub_iterations; i++) {
const auto local_network_imbalance = this->updateNetworkPressures(episodeIdx, damping_factor);
const Scalar network_imbalance = comm.max(local_network_imbalance);
const auto& balance = this->schedule()[episodeIdx].network_balance();
constexpr Scalar relaxation_factor = 10.0;
const Scalar tolerance = relax_network_tolerance ? relaxation_factor * balance.pressure_tolerance() : balance.pressure_tolerance();
more_network_update = this->networkActive() && network_imbalance > tolerance;
if (!more_network_update)
break;
}
}
bool changed_well_group = false;