mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move gasWaterPerfRateInj to RatioCalculator
This commit is contained in:
parent
725b95a1ac
commit
f1ab605fbe
@ -26,6 +26,7 @@
|
|||||||
#include <opm/material/densead/EvaluationFormat.hpp>
|
#include <opm/material/densead/EvaluationFormat.hpp>
|
||||||
|
|
||||||
#include <opm/simulators/utils/DeferredLogger.hpp>
|
#include <opm/simulators/utils/DeferredLogger.hpp>
|
||||||
|
#include <opm/simulators/wells/PerforationData.hpp>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
@ -117,6 +118,35 @@ gasOilVolumeRatio(Value& volumeRatio,
|
|||||||
volumeRatio += tmp_gas / b_perfcells_dense[gasComp_];
|
volumeRatio += tmp_gas / b_perfcells_dense[gasComp_];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Value>
|
||||||
|
void
|
||||||
|
RatioCalculator<Value>::
|
||||||
|
gasWaterPerfRateInj(const std::vector<Value>& cq_s,
|
||||||
|
PerforationRates<Scalar>& perf_rates,
|
||||||
|
const Value& rvw,
|
||||||
|
const Value& rsw,
|
||||||
|
const Value& pressure,
|
||||||
|
DeferredLogger& deferred_logger) const
|
||||||
|
|
||||||
|
{
|
||||||
|
const Scalar dw = 1.0 - getValue(rvw) * getValue(rsw);
|
||||||
|
|
||||||
|
if (dw <= 0.0) {
|
||||||
|
deferred_logger.debug(dValueError(dw, name_,
|
||||||
|
"gasWaterPerfRateInj",
|
||||||
|
rsw, rvw, pressure));
|
||||||
|
} else {
|
||||||
|
// vaporized water into gas
|
||||||
|
// rvw * q_gr * b_g = rvw * (q_gs - rsw * q_ws) / dw
|
||||||
|
perf_rates.vap_wat = getValue(rvw) * (getValue(cq_s[gasComp_]) -
|
||||||
|
getValue(rsw) * getValue(cq_s[waterComp_])) / dw;
|
||||||
|
// dissolved gas in water
|
||||||
|
// rsw * q_wr * b_w = rsw * (q_ws - rvw * q_gs) / dw
|
||||||
|
perf_rates.dis_gas_in_water = getValue(rsw) * (getValue(cq_s[waterComp_]) -
|
||||||
|
getValue(rvw) * getValue(cq_s[gasComp_])) / dw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define INSTANTIATE_TYPE(T) \
|
#define INSTANTIATE_TYPE(T) \
|
||||||
template class RatioCalculator<T>; \
|
template class RatioCalculator<T>; \
|
||||||
template class RatioCalculator<DenseAd::Evaluation<T, -1, 4u>>; \
|
template class RatioCalculator<DenseAd::Evaluation<T, -1, 4u>>; \
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#ifndef RATIO_CALCULATOR_HPP
|
#ifndef RATIO_CALCULATOR_HPP
|
||||||
#define RATIO_CALCULATOR_HPP
|
#define RATIO_CALCULATOR_HPP
|
||||||
|
|
||||||
|
#include <opm/material/densead/Math.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -29,16 +31,27 @@
|
|||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
|
template<class Scalar> struct PerforationRates;
|
||||||
|
|
||||||
template<class Value>
|
template<class Value>
|
||||||
class RatioCalculator
|
class RatioCalculator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using Scalar = decltype(getValue(Value{}));
|
||||||
|
|
||||||
RatioCalculator(unsigned gasCompIdx,
|
RatioCalculator(unsigned gasCompIdx,
|
||||||
unsigned oilCompIdx,
|
unsigned oilCompIdx,
|
||||||
unsigned waterCompIdx,
|
unsigned waterCompIdx,
|
||||||
std::string_view name);
|
std::string_view name);
|
||||||
|
|
||||||
|
void disOilVapWatVolumeRatio(Value& volumeRatio,
|
||||||
|
const Value& rvw,
|
||||||
|
const Value& rsw,
|
||||||
|
const Value& pressure,
|
||||||
|
const std::vector<Value>& cmix_s,
|
||||||
|
const std::vector<Value>& b_perfcells_dense,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
void gasOilVolumeRatio(Value& volumeRatio,
|
void gasOilVolumeRatio(Value& volumeRatio,
|
||||||
const Value& rv,
|
const Value& rv,
|
||||||
const Value& rs,
|
const Value& rs,
|
||||||
@ -47,13 +60,12 @@ public:
|
|||||||
const std::vector<Value>& b_perfcells_dense,
|
const std::vector<Value>& b_perfcells_dense,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
void disOilVapWatVolumeRatio(Value& volumeRatio,
|
void gasWaterPerfRateInj(const std::vector<Value>& cq_s,
|
||||||
const Value& rvw,
|
PerforationRates<Scalar>& perf_rates,
|
||||||
const Value& rsw,
|
const Value& rvw,
|
||||||
const Value& pressure,
|
const Value& rsw,
|
||||||
const std::vector<Value>& cmix_s,
|
const Value& pressure,
|
||||||
const std::vector<Value>& b_perfcells_dense,
|
DeferredLogger& deferred_logger) const;
|
||||||
DeferredLogger& deferred_logger) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned gasComp_;
|
unsigned gasComp_;
|
||||||
|
@ -489,14 +489,6 @@ namespace Opm
|
|||||||
PerforationRates<Scalar>& perf_rates,
|
PerforationRates<Scalar>& perf_rates,
|
||||||
const Value& rvw,
|
const Value& rvw,
|
||||||
const Value& rsw) const;
|
const Value& rsw) const;
|
||||||
|
|
||||||
template<class Value>
|
|
||||||
void gasWaterPerfRateInj(const std::vector<Value>& cq_s,
|
|
||||||
PerforationRates<Scalar>& perf_rates,
|
|
||||||
const Value& rvw,
|
|
||||||
const Value& rsw,
|
|
||||||
const Value& pressure,
|
|
||||||
DeferredLogger& deferred_logger) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -345,8 +345,8 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
|
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
|
||||||
//no oil
|
//no oil
|
||||||
gasWaterPerfRateInj(cq_s, perf_rates, rvw, rsw,
|
ratioCalc.gasWaterPerfRateInj(cq_s, perf_rates, rvw, rsw,
|
||||||
pressure, deferred_logger);
|
pressure, deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2764,35 +2764,4 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename TypeTag>
|
|
||||||
template<class Value>
|
|
||||||
void
|
|
||||||
StandardWell<TypeTag>::
|
|
||||||
gasWaterPerfRateInj(const std::vector<Value>& cq_s,
|
|
||||||
PerforationRates<Scalar>& perf_rates,
|
|
||||||
const Value& rvw,
|
|
||||||
const Value& rsw,
|
|
||||||
const Value& pressure,
|
|
||||||
DeferredLogger& deferred_logger) const
|
|
||||||
|
|
||||||
{
|
|
||||||
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
|
|
||||||
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
|
|
||||||
|
|
||||||
const Scalar dw = 1.0 - getValue(rvw) * getValue(rsw);
|
|
||||||
|
|
||||||
if (dw <= 0.0) {
|
|
||||||
deferred_logger.debug(dValueError(dw, this->name(),
|
|
||||||
"gasWaterPerfRateInj",
|
|
||||||
rsw, rvw, pressure));
|
|
||||||
} else {
|
|
||||||
// vaporized water into gas
|
|
||||||
// rvw * q_gr * b_g = rvw * (q_gs - rsw * q_ws) / dw
|
|
||||||
perf_rates.vap_wat = getValue(rvw) * (getValue(cq_s[gasCompIdx]) - getValue(rsw) * getValue(cq_s[waterCompIdx])) / dw;
|
|
||||||
// dissolved gas in water
|
|
||||||
// rsw * q_wr * b_w = rsw * (q_ws - rvw * q_gs) / dw
|
|
||||||
perf_rates.dis_gas_in_water = getValue(rsw) * (getValue(cq_s[waterCompIdx]) - getValue(rvw) * getValue(cq_s[gasCompIdx])) / dw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
Loading…
Reference in New Issue
Block a user