Merge pull request #2695 from totto82/addBrineOutput

Add brine to output
This commit is contained in:
Atgeirr Flø Rasmussen 2020-07-01 11:46:23 +02:00 committed by GitHub
commit f2395f6d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 2 deletions

View File

@ -65,6 +65,14 @@ namespace Opm
if (Base::has_energy) {
OPM_THROW(std::runtime_error, "energy is not supported by multisegment well yet");
}
if (Base::has_foam) {
OPM_THROW(std::runtime_error, "foam is not supported by multisegment well yet");
}
if (Base::has_brine) {
OPM_THROW(std::runtime_error, "brine is not supported by multisegment well yet");
}
// since we decide to use the WellSegments from the well parser. we can reuse a lot from it.
// for other facilities needed but not available from parser, we need to process them here

View File

@ -699,12 +699,16 @@ namespace Opm
if (has_brine) {
// TODO: the application of well efficiency factor has not been tested with an example yet
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
EvalWell cq_s_sm = cq_s[waterCompIdx] * well_efficiency_factor_;
EvalWell cq_s_sm = cq_s[waterCompIdx];
if (this->isInjector()) {
cq_s_sm *= wsalt();
} else {
cq_s_sm *= extendEval(intQuants.fluidState().saltConcentration());
}
// Note. Efficiency factor is handled in the output layer
well_state.perfRateBrine()[first_perf_ + perf] = cq_s_sm.value();
cq_s_sm *= well_efficiency_factor_;
connectionRates_[perf][contiBrineEqIdx] = Base::restrictEval(cq_s_sm);
}

View File

@ -161,6 +161,9 @@ namespace Opm
perfRatePolymer_.clear();
perfRatePolymer_.resize(nperf, 0.0);
perfRateBrine_.clear();
perfRateBrine_.resize(nperf, 0.0);
// intialize wells that have been there before
// order may change so the mapping is based on the well name
if (prevState && !prevState->wellMap().empty()) {
@ -571,6 +574,10 @@ namespace Opm
well.rates.set( rt::polymer, polymerWellRate(w) );
}
if ( pu.has_brine ) {
well.rates.set( rt::brine, brineWellRate(w) );
}
well.rates.set( rt::dissolved_gas, this->well_dissolved_gas_rates_[w] );
well.rates.set( rt::vaporized_oil, this->well_vaporized_oil_rates_[w] );
@ -586,11 +593,22 @@ namespace Opm
const auto rates = this->perfPhaseRates().begin()
+ (np * wt.second[ 1 ])
+ (np * local_comp_index);
++local_comp_index;
for( int i = 0; i < np; ++i ) {
comp.rates.set( phs[ i ], *(rates + i) );
}
if ( pu.has_polymer ) {
comp.rates.set( rt::polymer, this->perfRatePolymer()[local_comp_index]);
}
if ( pu.has_brine ) {
comp.rates.set( rt::brine, this->perfRateBrine()[local_comp_index]);
}
if ( pu.has_solvent ) {
comp.rates.set( rt::solvent, this->perfRateSolvent()[local_comp_index]);
}
++local_comp_index;
}
assert(local_comp_index == this->well_perf_data_[w].size());
@ -832,6 +850,15 @@ namespace Opm
return std::accumulate(&perfRatePolymer_[0] + first_perf_index_[w], &perfRatePolymer_[0] + first_perf_index_[w+1], 0.0);
}
/// One rate pr well connection.
std::vector<double>& perfRateBrine() { return perfRateBrine_; }
const std::vector<double>& perfRateBrine() const { return perfRateBrine_; }
/// One rate pr well
double brineWellRate(const int w) const {
return std::accumulate(&perfRateBrine_[0] + first_perf_index_[w], &perfRateBrine_[0] + first_perf_index_[w+1], 0.0);
}
std::vector<double>& wellReservoirRates()
{
return well_reservoir_rates_;
@ -1086,6 +1113,7 @@ namespace Opm
// only for output
std::vector<double> perfRatePolymer_;
std::vector<double> perfRateBrine_;
// it is the throughput of water flow through the perforations
// it is used as a measure of formation damage around well-bore due to particle deposition