From c93d46c1be7fd9d7efa31dc33b6e9751670a9b9d Mon Sep 17 00:00:00 2001 From: David Landa Marban Date: Mon, 9 Oct 2023 14:08:18 +0200 Subject: [PATCH] Mult well trans due to perm reduction in salt prec --- ebos/eclproblem.hh | 34 +++++++++++++++++++ .../wells/MultisegmentWell_impl.hpp | 8 ++--- opm/simulators/wells/StandardWell_impl.hpp | 10 +++--- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index add391164..2252215f5 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -1666,6 +1666,40 @@ public: return this->rockCompTransMultWc_[tableIdx].eval(effectiveOilPressure, SwDeltaMax, /*extrapolation=*/true); } + /*! + * \brief Calculate the transmissibility multiplier due to porosity reduction. + * + * TODO: The API of this is a bit ad-hoc, it would be better to use context objects. + */ + template + LhsEval permFactTransMultiplier(const IntensiveQuantities& intQuants) const + { + OPM_TIMEBLOCK_LOCAL(permFactTransMultiplier); + if (!enableSaltPrecipitation) + return 1.0; + + const auto& fs = intQuants.fluidState(); + unsigned tableIdx = fs.pvtRegionIndex(); + LhsEval porosityFactor = decay(1. - fs.saltSaturation()); + porosityFactor = min(porosityFactor, 1.0); + const auto& permfactTable = BrineModule::permfactTable(tableIdx); + return permfactTable.eval(porosityFactor, /*extrapolation=*/true); + } + + /*! + * \brief Return the well transmissibility multiplier due to rock changues. + */ + template + LhsEval wellTransMultiplier(const IntensiveQuantities& intQuants, unsigned elementIdx) const + { + OPM_TIMEBLOCK_LOCAL(wellTransMultiplier); + + double trans_mult = this->simulator().problem().template rockCompTransMultiplier(intQuants, elementIdx); + trans_mult *= this->simulator().problem().template permFactTransMultiplier(intQuants); + + return trans_mult; + } + std::pair boundaryCondition(const unsigned int globalSpaceIdx, const int directionId) const { OPM_TIMEBLOCK_LOCAL(boundaryCondition); diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 59f752b2c..d255f6daa 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -347,7 +347,7 @@ namespace Opm // flux for each perforation std::vector mob(this->num_components_, 0.); getMobility(ebosSimulator, perf, mob, deferred_logger); - const double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier(intQuants, cell_idx); + const double trans_mult = ebosSimulator.problem().template wellTransMultiplier(intQuants, cell_idx); const auto& wellstate_nupcol = ebosSimulator.problem().wellModel().nupcolWellState().well(this->index_of_well_); const double Tw = this->wellIndex(perf, intQuants, trans_mult, wellstate_nupcol); const Scalar seg_pressure = segment_pressure[seg]; @@ -1180,7 +1180,7 @@ namespace Opm } // the well index associated with the connection - const double trans_mult = ebos_simulator.problem().template rockCompTransMultiplier(int_quantities, cell_idx); + const double trans_mult = ebos_simulator.problem().template wellTransMultiplier(int_quantities, cell_idx); const auto& wellstate_nupcol = ebos_simulator.problem().wellModel().nupcolWellState().well(this->index_of_well_); const double tw_perf = this->wellIndex(perf, int_quantities, trans_mult, wellstate_nupcol); std::vector ipr_a_perf(this->ipr_a_.size()); @@ -1680,7 +1680,7 @@ namespace Opm const auto& int_quants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0); std::vector mob(this->num_components_, 0.0); getMobility(ebosSimulator, perf, mob, deferred_logger); - const double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier(int_quants, cell_idx); + const double trans_mult = ebosSimulator.problem().template wellTransMultiplier(int_quants, cell_idx); const auto& wellstate_nupcol = ebosSimulator.problem().wellModel().nupcolWellState().well(this->index_of_well_); const double Tw = this->wellIndex(perf, int_quants, trans_mult, wellstate_nupcol); std::vector cq_s(this->num_components_, 0.0); @@ -1993,7 +1993,7 @@ namespace Opm const auto& int_quants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0); std::vector mob(this->num_components_, 0.0); getMobility(ebosSimulator, perf, mob, deferred_logger); - const double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier(int_quants, cell_idx); + const double trans_mult = ebosSimulator.problem().template wellTransMultiplier(int_quants, cell_idx); const auto& wellstate_nupcol = ebosSimulator.problem().wellModel().nupcolWellState().well(this->index_of_well_); const double Tw = this->wellIndex(perf, int_quants, trans_mult, wellstate_nupcol); std::vector cq_s(this->num_components_, 0.0); diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 09129b2a3..89145604e 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -494,7 +494,7 @@ namespace Opm getMobility(ebosSimulator, perf, mob, deferred_logger); PerforationRates perf_rates; - double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier(intQuants, cell_idx); + double trans_mult = ebosSimulator.problem().template wellTransMultiplier(intQuants, cell_idx); const auto& wellstate_nupcol = ebosSimulator.problem().wellModel().nupcolWellState().well(this->index_of_well_); const double Tw = this->wellIndex(perf, intQuants, trans_mult, wellstate_nupcol); computePerfRate(intQuants, mob, bhp, Tw, perf, allow_cf, @@ -790,7 +790,7 @@ namespace Opm } // the well index associated with the connection - const double tw_perf = this->well_index_[perf]*ebos_simulator.problem().template rockCompTransMultiplier(int_quantities, cell_idx); + const double tw_perf = this->well_index_[perf]*ebos_simulator.problem().template wellTransMultiplier(int_quantities, cell_idx); std::vector ipr_a_perf(this->ipr_a_.size()); std::vector ipr_b_perf(this->ipr_b_.size()); @@ -1364,7 +1364,7 @@ namespace Opm // flux for each perforation std::vector mob(this->num_components_, 0.); getMobility(ebosSimulator, perf, mob, deferred_logger); - double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier(intQuants, cell_idx); + double trans_mult = ebosSimulator.problem().template wellTransMultiplier(intQuants, cell_idx); const auto& wellstate_nupcol = ebosSimulator.problem().wellModel().nupcolWellState().well(this->index_of_well_); const double Tw = this->wellIndex(perf, intQuants, trans_mult, wellstate_nupcol); @@ -1668,7 +1668,7 @@ namespace Opm std::vector cq_s(this->num_components_, {this->primary_variables_.numWellEq() + Indices::numEq, 0.}); PerforationRates perf_rates; - double trans_mult = ebos_simulator.problem().template rockCompTransMultiplier(int_quant, cell_idx); + double trans_mult = ebos_simulator.problem().template wellTransMultiplier(int_quant, cell_idx); const double Tw = this->well_index_[perf] * trans_mult; computePerfRate(int_quant, mob, bhp, Tw, perf, allow_cf, cq_s, perf_rates, deferred_logger); @@ -2272,7 +2272,7 @@ namespace Opm std::vector mob(this->num_components_, 0.); getMobility(ebosSimulator, perf, mob, deferred_logger); std::vector cq_s(this->num_components_, 0.); - double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier(intQuants, cell_idx); + double trans_mult = ebosSimulator.problem().template wellTransMultiplier(intQuants, cell_idx); const auto& wellstate_nupcol = ebosSimulator.problem().wellModel().nupcolWellState().well(this->index_of_well_); const double Tw = this->wellIndex(perf, intQuants, trans_mult, wellstate_nupcol); PerforationRates perf_rates;