mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move getQs to StandardWellPrimaryVariables
This commit is contained in:
parent
1aa74a9830
commit
435bd67732
@ -116,54 +116,6 @@ relaxationFactorFractionsProducer(const std::vector<double>& primary_variables,
|
|||||||
return relaxation_factor;
|
return relaxation_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class FluidSystem, class Indices, class Scalar>
|
|
||||||
typename StandardWellEval<FluidSystem,Indices,Scalar>::EvalWell
|
|
||||||
StandardWellEval<FluidSystem,Indices,Scalar>::
|
|
||||||
getQs(const int comp_idx) const
|
|
||||||
{
|
|
||||||
// Note: currently, the WQTotal definition is still depends on Injector/Producer.
|
|
||||||
assert(comp_idx < baseif_.numComponents());
|
|
||||||
|
|
||||||
if (baseif_.isInjector()) { // only single phase injection
|
|
||||||
double inj_frac = 0.0;
|
|
||||||
switch (baseif_.wellEcl().injectorType()) {
|
|
||||||
case InjectorType::WATER:
|
|
||||||
if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx))) {
|
|
||||||
inj_frac = 1.0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case InjectorType::GAS:
|
|
||||||
if (Indices::enableSolvent && comp_idx == Indices::contiSolventEqIdx) { // solvent
|
|
||||||
inj_frac = baseif_.wsolvent();
|
|
||||||
} else if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx))) {
|
|
||||||
inj_frac = 1.0 - baseif_.rsRvInj();
|
|
||||||
if (Indices::enableSolvent) {
|
|
||||||
inj_frac -= baseif_.wsolvent();
|
|
||||||
}
|
|
||||||
} else if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx))) {
|
|
||||||
inj_frac = baseif_.rsRvInj();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case InjectorType::OIL:
|
|
||||||
if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx))) {
|
|
||||||
inj_frac = 1.0 - baseif_.rsRvInj();
|
|
||||||
} else if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx))) {
|
|
||||||
inj_frac = baseif_.rsRvInj();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case InjectorType::MULTI:
|
|
||||||
// Not supported.
|
|
||||||
// deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED",
|
|
||||||
// "Multi phase injectors are not supported, requested for well " + name());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return inj_frac * primary_variables_.evaluation_[WQTotal];
|
|
||||||
} else { // producers
|
|
||||||
return primary_variables_.evaluation_[WQTotal] *
|
|
||||||
primary_variables_.volumeFractionScaled(comp_idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FluidSystem, class Indices, class Scalar>
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
void
|
void
|
||||||
StandardWellEval<FluidSystem,Indices,Scalar>::
|
StandardWellEval<FluidSystem,Indices,Scalar>::
|
||||||
|
@ -84,7 +84,6 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EvalWell extendEval(const Eval& in) const;
|
EvalWell extendEval(const Eval& in) const;
|
||||||
EvalWell getQs(const int compIdx) const;
|
|
||||||
|
|
||||||
// calculate a relaxation factor to avoid overshoot of the fractions for producers
|
// calculate a relaxation factor to avoid overshoot of the fractions for producers
|
||||||
// which might result in negative rates
|
// which might result in negative rates
|
||||||
|
@ -378,6 +378,53 @@ surfaceVolumeFraction(const int compIdx) const
|
|||||||
return this->volumeFractionScaled(compIdx) / sum_volume_fraction_scaled;
|
return this->volumeFractionScaled(compIdx) / sum_volume_fraction_scaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
|
typename StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
|
||||||
|
StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
||||||
|
getQs(const int comp_idx) const
|
||||||
|
{
|
||||||
|
// Note: currently, the WQTotal definition is still depends on Injector/Producer.
|
||||||
|
assert(comp_idx < well_.numComponents());
|
||||||
|
|
||||||
|
if (well_.isInjector()) { // only single phase injection
|
||||||
|
double inj_frac = 0.0;
|
||||||
|
switch (well_.wellEcl().injectorType()) {
|
||||||
|
case InjectorType::WATER:
|
||||||
|
if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx))) {
|
||||||
|
inj_frac = 1.0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case InjectorType::GAS:
|
||||||
|
if (Indices::enableSolvent && comp_idx == Indices::contiSolventEqIdx) { // solvent
|
||||||
|
inj_frac = well_.wsolvent();
|
||||||
|
} else if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx))) {
|
||||||
|
inj_frac = 1.0 - well_.rsRvInj();
|
||||||
|
if constexpr (Indices::enableSolvent) {
|
||||||
|
inj_frac -= well_.wsolvent();
|
||||||
|
}
|
||||||
|
} else if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx))) {
|
||||||
|
inj_frac = well_.rsRvInj();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case InjectorType::OIL:
|
||||||
|
if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx))) {
|
||||||
|
inj_frac = 1.0 - well_.rsRvInj();
|
||||||
|
} else if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx))) {
|
||||||
|
inj_frac = well_.rsRvInj();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case InjectorType::MULTI:
|
||||||
|
// Not supported.
|
||||||
|
// deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED",
|
||||||
|
// "Multi phase injectors are not supported, requested for well " + name());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return inj_frac * evaluation_[WQTotal];
|
||||||
|
} else { // producers
|
||||||
|
return evaluation_[WQTotal] * this->volumeFractionScaled(comp_idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define INSTANCE(...) \
|
#define INSTANCE(...) \
|
||||||
template class StandardWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
|
template class StandardWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
|
||||||
|
|
||||||
|
@ -126,6 +126,9 @@ public:
|
|||||||
//! \brief Returns surface volume fraction for a component.
|
//! \brief Returns surface volume fraction for a component.
|
||||||
EvalWell surfaceVolumeFraction(const int compIdx) const;
|
EvalWell surfaceVolumeFraction(const int compIdx) const;
|
||||||
|
|
||||||
|
//! \brief Returns scaled rate for a component.
|
||||||
|
EvalWell getQs(const int compIdx) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief Returns volume fraction for a component.
|
//! \brief Returns volume fraction for a component.
|
||||||
EvalWell volumeFraction(const unsigned compIdx) const;
|
EvalWell volumeFraction(const unsigned compIdx) const;
|
||||||
|
@ -532,7 +532,7 @@ namespace Opm
|
|||||||
resWell_loc += (this->primary_variables_.surfaceVolumeFraction(componentIdx) -
|
resWell_loc += (this->primary_variables_.surfaceVolumeFraction(componentIdx) -
|
||||||
this->F0_[componentIdx]) * volume / dt;
|
this->F0_[componentIdx]) * volume / dt;
|
||||||
}
|
}
|
||||||
resWell_loc -= this->getQs(componentIdx) * this->well_efficiency_factor_;
|
resWell_loc -= this->primary_variables_.getQs(componentIdx) * this->well_efficiency_factor_;
|
||||||
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
|
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
|
||||||
assembleSourceEq(resWell_loc,
|
assembleSourceEq(resWell_loc,
|
||||||
componentIdx,
|
componentIdx,
|
||||||
@ -542,7 +542,7 @@ namespace Opm
|
|||||||
|
|
||||||
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
||||||
const Schedule& schedule = ebosSimulator.vanguard().schedule();
|
const Schedule& schedule = ebosSimulator.vanguard().schedule();
|
||||||
std::function<EvalWell(int)> gQ = [this](int a) { return this->getQs(a); };
|
std::function<EvalWell(int)> gQ = [this](int a) { return this->primary_variables_.getQs(a); };
|
||||||
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
|
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
|
||||||
assembleControlEq(well_state, group_state,
|
assembleControlEq(well_state, group_state,
|
||||||
schedule, summaryState,
|
schedule, summaryState,
|
||||||
|
Loading…
Reference in New Issue
Block a user