adding the support for filtration_summary_keywords

This commit is contained in:
Kai Bao 2023-08-08 15:40:32 +02:00
parent 005e67ffbf
commit f7bd386402
11 changed files with 199 additions and 9 deletions

View File

@ -94,6 +94,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/wells/BlackoilWellModelGeneric.cpp
opm/simulators/wells/BlackoilWellModelGuideRates.cpp
opm/simulators/wells/BlackoilWellModelRestart.cpp
opm/simulators/wells/ConnFiltrateData.cpp
opm/simulators/wells/GasLiftCommon.cpp
opm/simulators/wells/GasLiftGroupInfo.cpp
opm/simulators/wells/GasLiftSingleWellGeneric.cpp
@ -525,6 +526,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/wells/BlackoilWellModelGeneric.hpp
opm/simulators/wells/BlackoilWellModelGuideRates.hpp
opm/simulators/wells/BlackoilWellModelRestart.hpp
opm/simulators/wells/ConnFiltrateData.hpp
opm/simulators/wells/GasLiftCommon.hpp
opm/simulators/wells/GasLiftGroupInfo.hpp
opm/simulators/wells/GasLiftSingleWellGeneric.hpp

View File

@ -1491,7 +1491,7 @@ void BlackoilWellModelGeneric::updateInjFCMult(DeferredLogger& deferred_logger)
if (well->isInjector()) {
const auto it = filter_cake_.find(well->name());
if (it != filter_cake_.end()) {
it->second.updateInjFCMult(*well, deferred_logger);
it->second.updateInjFCMult(*well, this->wellState(), deferred_logger);
well->updateFilterCakeMultipliers(it->second.multipliers());
}
}

View File

@ -0,0 +1,65 @@
/*
Copyright 2023 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#include <opm/simulators/wells/ConnFiltrateData.hpp>
namespace Opm {
void ConnFiltrateData::resize(std::size_t num_perf) {
this->rates.resize(num_perf);
this->total.resize(num_perf);
this->skin_factor.resize(num_perf);
this->thickness.resize(num_perf);
this->perm.resize(num_perf);
this->poro.resize(num_perf);
this->radius.resize(num_perf);
this->area_of_flow.resize(num_perf);
}
ConnFiltrateData ConnFiltrateData::serializationTestObject()
{
ConnFiltrateData result;
result.rates = {8.};
result.total = {100.};
result.skin_factor = {0.5};
result.thickness = {0.05};
result.perm = {0.00001};
result.poro = {0.3};
result.radius = {0.05};
result.area_of_flow = {0.7};
return result;
}
bool ConnFiltrateData::operator==(const ConnFiltrateData& rhs) const
{
return this->rates == rhs.rates &&
this->total == rhs.total &&
this->skin_factor == rhs.skin_factor &&
this->thickness == rhs.thickness &&
this->perm == rhs.perm &&
this->poro == rhs.poro &&
this->radius == rhs.radius &&
this->area_of_flow == rhs.area_of_flow;
}
}

View File

@ -0,0 +1,60 @@
/*
Copyright 2023 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_CONNFILTRATEDATA_HPP
#define OPM_CONNFILTRATEDATA_HPP
#include <vector>
namespace Opm {
struct ConnFiltrateData {
ConnFiltrateData() = default;
void resize(std::size_t num_perf);
template<class Serializer>
void serializeOp(Serializer& serializer) {
serializer(rates);
serializer(total);
serializer(skin_factor);
serializer(thickness);
serializer(perm);
serializer(poro);
serializer(radius);
serializer(area_of_flow);
}
static ConnFiltrateData serializationTestObject();
bool operator==(const ConnFiltrateData& rhs) const;
std::vector<double> rates;
std::vector<double> total;
std::vector<double> skin_factor;
std::vector<double> thickness;
std::vector<double> perm;
std::vector<double> poro;
std::vector<double> radius;
std::vector<double> area_of_flow;
};
}
#endif //OPM_CONNFILTRATEDATA_HPP

View File

@ -22,6 +22,7 @@
#include "config.h"
#endif // HAVE_CONFIG_H
#include <opm/simulators/wells/ConnFiltrateData.hpp>
#include <opm/simulators/wells/PerfData.hpp>
namespace Opm {
@ -46,6 +47,7 @@ PerfData::PerfData(std::size_t num_perf, double pressure_first_connection_, bool
this->water_throughput.resize(num_perf);
this->skin_pressure.resize(num_perf);
this->water_velocity.resize(num_perf);
this->filtrate_data.resize(num_perf);
}
}
@ -68,6 +70,7 @@ PerfData PerfData::serializationTestObject()
result.water_throughput = {25.0, 26.0};
result.skin_pressure = {27.0, 28.0};
result.water_velocity = {29.0, 30.0};
result.filtrate_data = ConnFiltrateData::serializationTestObject();
return result;
}
@ -99,6 +102,7 @@ bool PerfData::try_assign(const PerfData& other) {
this->water_velocity = other.water_velocity;
this->prod_index = other.prod_index;
this->micp_rates = other.micp_rates;
this->filtrate_data = other.filtrate_data;
return true;
}
@ -119,7 +123,8 @@ bool PerfData::operator==(const PerfData& rhs) const
this->ecl_index == rhs.ecl_index &&
this->water_throughput == rhs.water_throughput &&
this->skin_pressure == rhs.skin_pressure &&
this->water_velocity == rhs.water_velocity;
this->water_velocity == rhs.water_velocity &&
this->filtrate_data == rhs.filtrate_data;
}
}

View File

@ -21,6 +21,8 @@
#ifndef OPM_PERFDATA_HEADER_INCLUDED
#define OPM_PERFDATA_HEADER_INCLUDED
#include <opm/simulators/wells/ConnFiltrateData.hpp>
#include <cstddef>
#include <vector>
@ -60,6 +62,7 @@ public:
serializer(water_throughput);
serializer(skin_pressure);
serializer(water_velocity);
serializer(filtrate_data);
}
bool operator==(const PerfData&) const;
@ -73,7 +76,6 @@ public:
std::vector<double> brine_rates;
std::vector<double> prod_index;
std::vector<double> micp_rates;
std::vector<std::size_t> cell_index;
std::vector<double> connection_transmissibility_factor;
std::vector<int> satnum_id;
@ -84,6 +86,8 @@ public:
std::vector<double> water_throughput;
std::vector<double> skin_pressure;
std::vector<double> water_velocity;
ConnFiltrateData filtrate_data;
};
} // namespace Opm

View File

@ -166,6 +166,17 @@ double SingleWellState::sum_solvent_rates() const {
return this->sum_connection_rates(this->perf_data.solvent_rates);
}
double SingleWellState::sum_filtrate_rate() const {
if (this->producer) return 0.;
return this->sum_connection_rates(this->perf_data.filtrate_data.rates);
}
double SingleWellState::sum_filtrate_total() const {
if (this->producer) return 0.;
return this->sum_connection_rates(this->perf_data.filtrate_data.total);
}
void SingleWellState::update_producer_targets(const Well& ecl_well, const SummaryState& st) {
const double bhp_safety_factor = 0.99;
@ -300,6 +311,7 @@ bool SingleWellState::operator==(const SingleWellState& rhs) const
this->reservoir_rates == rhs.reservoir_rates &&
this->prev_surface_rates == rhs.prev_surface_rates &&
this->perf_data == rhs.perf_data &&
this->filtrate_conc == rhs.filtrate_conc &&
this->trivial_target == rhs.trivial_target &&
this->segments == rhs.segments &&
this->events == rhs.events &&

View File

@ -69,6 +69,7 @@ public:
serializer(events);
serializer(injection_cmode);
serializer(production_cmode);
serializer(filtrate_conc);
serializer(perf_data);
}
@ -84,6 +85,9 @@ public:
double thp{0};
double temperature{0};
// filtration injection concentration
double filtrate_conc{0};
std::array<double,4> phase_mixing_rates{};
enum RateIndices {
dissolved_gas = 0,
@ -128,6 +132,9 @@ public:
double sum_polymer_rates() const;
double sum_brine_rates() const;
double sum_filtrate_rate() const;
double sum_filtrate_total() const;
private:
double sum_connection_rates(const std::vector<double>& connection_rates) const;
};

View File

@ -25,7 +25,6 @@
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <opm/simulators/wells/PerforationData.hpp>
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
#include <opm/simulators/wells/WellState.hpp>
@ -40,7 +39,7 @@ updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
const double dt,
const double conc,
const std::size_t water_index,
const WellState& well_state)
WellState& well_state)
{
if (!well.isInjector()) {
return;
@ -56,25 +55,36 @@ updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
return;
}
// it is currently used for the filter cake modeling related to formation damage study
auto& ws = well_state.well(well.indexOfWell());
ws.filtrate_conc = conc;
if (conc == 0.) {
return;
}
const auto& connection_rates = ws.perf_data.phase_rates;
const std::size_t np = well_state.numPhases();
for (int perf = 0; perf < well.numPerfs(); ++perf) {
// not considering the production water
const double water_rates = std::max(0., connection_rates[perf * np + water_index]);
filtration_particle_volume_[perf] += water_rates * conc * dt;
const double filtrate_rate = water_rates * conc;
filtration_particle_volume_[perf] += filtrate_rate * dt;
ws.perf_data.filtrate_data.rates[perf] = filtrate_rate;
ws.perf_data.filtrate_data.total[perf] = filtration_particle_volume_[perf];
}
}
void WellFilterCake::
updateInjFCMult(const WellInterfaceGeneric& well,
WellState& well_state,
DeferredLogger& deferred_logger)
{
if (inj_fc_multiplier_.empty()) {
inj_fc_multiplier_.resize(well.numPerfs(), 1.0);
}
auto& ws = well_state.well(well.indexOfWell());
auto& perf_data = ws.perf_data;
for (int perf = 0; perf < well.numPerfs(); ++perf) {
const auto perf_ecl_index = well.perforationData()[perf].ecl_index;
@ -92,6 +102,12 @@ updateInjFCMult(const WellInterfaceGeneric& well,
const double factor = filter_cake.sf_multiplier;
// the thickness of the filtration cake
const double thickness = filtration_particle_volume_[perf] / (area * (1. - poro));
auto& filtrate_data = perf_data.filtrate_data;
filtrate_data.thickness[perf] = thickness;
filtrate_data.poro[perf] = poro;
filtrate_data.perm[perf] = perm;
filtrate_data.radius[perf] = connection.getFilterCakeRadius();
filtrate_data.area_of_flow[perf] = connection.getFilterCakeArea();
double skin_factor = 0.;
switch (filter_cake.geometry) {
@ -112,6 +128,8 @@ updateInjFCMult(const WellInterfaceGeneric& well,
geometry, well.name()),
deferred_logger);
}
filtrate_data.skin_factor[perf] = skin_factor;
// the original skin factor for the connection
const auto cskinfactor = connection.skinFactor();
// compute a multiplier for the well connection transmissibility

View File

@ -38,10 +38,11 @@ public:
const double dt,
const double conc,
const std::size_t water_index,
const WellState& well_state);
WellState& well_state);
//! \brief Update the multiplier for well transmissbility due to cake filtration.
void updateInjFCMult(const WellInterfaceGeneric& well,
WellState& well_state,
DeferredLogger& deferred_logger);
//! \brief Returns a const-ref to multipliers.

View File

@ -500,6 +500,9 @@ WellState::report(const int* globalCellIdxMap,
well.bhp = ws.bhp;
well.thp = ws.thp;
well.temperature = ws.temperature;
well.filtrate.rate = ws.sum_filtrate_rate();
well.filtrate.total = ws.sum_filtrate_total();
well.filtrate.concentration = ws.filtrate_conc;
if (pu.phase_used[BlackoilPhases::Aqua]) {
well.rates.set(rt::wat, wv[ pu.phase_pos[BlackoilPhases::Aqua] ] );
@ -582,7 +585,8 @@ void WellState::reportConnections(std::vector<data::Connection>& connections,
const int* globalCellIdxMap) const
{
using rt = data::Rates::opt;
const auto& perf_data = this->well(well_index).perf_data;
const auto& ws = this->well(well_index);
const auto& perf_data = ws.perf_data;
const int num_perf_well = perf_data.size();
connections.resize(num_perf_well);
const auto& perf_rates = perf_data.rates;
@ -594,6 +598,18 @@ void WellState::reportConnections(std::vector<data::Connection>& connections,
connection.pressure = perf_pressure[i];
connection.reservoir_rate = perf_rates[i];
connection.trans_factor = perf_data.connection_transmissibility_factor[i];
if (!ws.producer) {
const auto& filtrate_data = perf_data.filtrate_data;
auto& filtrate = connection.filtrate;
filtrate.rate = filtrate_data.rates[i];
filtrate.total = filtrate_data.total[i];
filtrate.skin_factor = filtrate_data.skin_factor[i];
filtrate.thickness = filtrate_data.thickness[i];
filtrate.poro = filtrate_data.poro[i];
filtrate.perm = filtrate_data.perm[i];
filtrate.radius = filtrate_data.radius[i];
filtrate.area_of_flow = filtrate_data.area_of_flow[i];
}
}
const int np = pu.num_phases;