changed: put calculation of filter cake multiplier in WellFilterCake

This commit is contained in:
Arne Morten Kvarving 2023-07-07 10:51:06 +02:00
parent aaeedf4091
commit dcf8a444fd
5 changed files with 81 additions and 52 deletions

View File

@ -1456,7 +1456,11 @@ void BlackoilWellModelGeneric::updateInjFCMult(DeferredLogger& deferred_logger)
const auto it = this->filtration_particle_volume_.find(well->name());
if (it != this->filtration_particle_volume_.end()) {
const auto& filtration_particle_volume = it->second;
well->updateInjFCMult(filtration_particle_volume, deferred_logger);
std::vector<double> multipliers(well->numPerfs(), 0.0);
WellFilterCake::
updateInjFCMult(multipliers, *well,
filtration_particle_volume, deferred_logger);
well->updateFilterCakeMultipliers(multipliers);
}
}
}

View File

@ -20,9 +20,17 @@
#include <config.h>
#include <opm/simulators/wells/WellFilterCake.hpp>
#include <opm/input/eclipse/Schedule/Well/WellConnections.hpp>
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
#include <opm/simulators/wells/WellState.hpp>
#include <fmt/format.h>
#include <stdexcept>
namespace Opm {
void WellFilterCake::
@ -58,4 +66,59 @@ updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
}
}
void WellFilterCake::
updateInjFCMult(std::vector<double>& inj_fc_multiplier,
const WellInterfaceGeneric& well,
const std::vector<double>& filtration_particle_volume,
DeferredLogger& deferred_logger)
{
for (int perf = 0; perf < well.numPerfs(); ++perf) {
const auto perf_ecl_index = well.perforationData()[perf].ecl_index;
const auto& connections = well.wellEcl().getConnections();
const auto& connection = connections[perf_ecl_index];
if (well.isInjector() && connection.filterCakeActive()) {
const auto& filter_cake = connection.getFilterCake();
const double area = connection.getFilterCakeArea();
const double poro = filter_cake.poro;
const double perm = filter_cake.perm;
const double rw = connection.getFilterCakeRadius();
const auto cr0 = connection.r0();
const auto crw = connection.rw();
const double K = connection.Kh() / connection.connectionLength();
const double factor = filter_cake.sf_multiplier;
// the thickness of the filtration cake
const double thickness = filtration_particle_volume[perf] / (area * (1. - poro));
double skin_factor = 0.;
switch (filter_cake.geometry) {
case FilterCake::FilterCakeGeometry::LINEAR: {
skin_factor = thickness / rw * K / perm * factor;
break;
}
case FilterCake::FilterCakeGeometry::RADIAL: {
const double rc = std::sqrt(rw * rw + 2. * rw * thickness);
skin_factor = K / perm * std::log(rc / rw) * factor;
break;
}
default:
const auto geometry =
FilterCake::filterCakeGeometryToString(filter_cake.geometry);
OPM_DEFLOG_THROW(std::runtime_error,
fmt::format(" Invalid filtration cake geometry type ({}) for well {}",
geometry, well.name()),
deferred_logger);
}
// the original skin factor for the connection
const auto cskinfactor = connection.skinFactor();
// compute a multiplier for the well connection transmissibility
const auto denom = std::log(cr0 / std::min(crw, cr0)) + cskinfactor;
const auto denom2 = denom + skin_factor;
inj_fc_multiplier[perf] = denom / denom2;
} else {
inj_fc_multiplier[perf] = 1.0;
}
}
}
} // namespace Opm

View File

@ -25,6 +25,7 @@
namespace Opm {
class DeferredLogger;
class WellInterfaceGeneric;
class WellState;
@ -38,6 +39,12 @@ public:
const std::size_t water_index,
const WellState& well_state,
std::vector<double>& filtration_particle_volume);
//! \brief Update the multiplier for well transmissbility due to cake filtration.
static void updateInjFCMult(std::vector<double>& inj_fc_multiplier,
const WellInterfaceGeneric& well,
const std::vector<double>& filtration_particle_volume,
DeferredLogger& deferred_logger);
};
}

View File

@ -718,52 +718,4 @@ checkNegativeWellPotentials(std::vector<double>& well_potentials,
}
}
void WellInterfaceGeneric::
updateInjFCMult(const std::vector<double>& filtration_particle_volume, DeferredLogger& deferred_logger) {
for (int perf = 0; perf < this->number_of_perforations_; ++perf) {
const auto perf_ecl_index = this->perforationData()[perf].ecl_index;
const auto& connections = this->well_ecl_.getConnections();
const auto& connection = connections[perf_ecl_index];
if (this->isInjector() && connection.filterCakeActive()) {
const auto& filter_cake = connection.getFilterCake();
const double area = connection.getFilterCakeArea();
const double poro = filter_cake.poro;
const double perm = filter_cake.perm;
const double rw = connection.getFilterCakeRadius();
const auto cr0 = connection.r0();
const auto crw = connection.rw();
const double K = connection.Kh() / connection.connectionLength();
const double factor = filter_cake.sf_multiplier;
// the thickness of the filtration cake
const double thickness = filtration_particle_volume[perf] / (area * (1. - poro));
double skin_factor = 0.;
switch (filter_cake.geometry) {
case FilterCake::FilterCakeGeometry::LINEAR: {
skin_factor = thickness / rw * K / perm * factor;
break;
}
case FilterCake::FilterCakeGeometry::RADIAL: {
const double rc = std::sqrt(rw * rw + 2. * rw * thickness);
skin_factor = K / perm * std::log(rc / rw) * factor;
break;
}
default:
OPM_DEFLOG_THROW(std::runtime_error,
fmt::format(" Invalid filtration cake geometry type ({}) for well {}",
FilterCake::filterCakeGeometryToString(filter_cake.geometry), name()),
deferred_logger);
}
// the original skin factor for the connection
const auto cskinfactor = connection.skinFactor();
// compute a multiplier for the well connection transmissibility
const auto denom = std::log(cr0 / std::min(crw, cr0)) + cskinfactor;
const auto denom2 = denom + skin_factor;
this->inj_fc_multiplier_[perf] = denom / denom2;
} else {
this->inj_fc_multiplier_[perf] = 1.0;
}
}
}
} // namespace Opm

View File

@ -188,9 +188,6 @@ public:
// it might change in the future
double getInjMult(const int perf, const double bhp, const double perf_pres) const;
// update the multiplier for well transmissbility due to cake filteration
void updateInjFCMult(const std::vector<double>& filtration_particle_volume, DeferredLogger& deferred_logger);
// whether a well is specified with a non-zero and valid VFP table number
bool isVFPActive(DeferredLogger& deferred_logger) const;
@ -214,6 +211,12 @@ public:
double wellEfficiencyFactor() const
{ return well_efficiency_factor_; }
//! \brief Update filter cake multipliers.
void updateFilterCakeMultipliers(const std::vector<double>& inj_fc_multiplier)
{
inj_fc_multiplier_ = inj_fc_multiplier;
}
protected:
bool getAllowCrossFlow() const;