mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
added: MultisegmentWellAssemble::assemblePressureLoss
extracted from MultisegmentWellEval::handleAccelerationPressureLoss
This commit is contained in:
parent
4ebde4e003
commit
d64508f3b8
@ -48,7 +48,6 @@ assembleControlEq(const WellState& well_state,
|
|||||||
const double rho,
|
const double rho,
|
||||||
const EvalWell& wqTotal,
|
const EvalWell& wqTotal,
|
||||||
const EvalWell& bhp,
|
const EvalWell& bhp,
|
||||||
const int SPres,
|
|
||||||
const std::function<EvalWell(const int)>& getQs,
|
const std::function<EvalWell(const int)>& getQs,
|
||||||
Equations& eqns,
|
Equations& eqns,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
@ -155,6 +154,24 @@ assembleControlEq(const WellState& well_state,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
|
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
|
||||||
|
assemblePressureLoss(const int seg,
|
||||||
|
const int seg_upwind,
|
||||||
|
const EvalWell& accelerationPressureLoss,
|
||||||
|
Equations& eqns) const
|
||||||
|
{
|
||||||
|
eqns.resWell_[seg][SPres] -= accelerationPressureLoss.value();
|
||||||
|
eqns.duneD_[seg][seg][SPres][SPres] -= accelerationPressureLoss.derivative(SPres + Indices::numEq);
|
||||||
|
eqns.duneD_[seg][seg][SPres][WQTotal] -= accelerationPressureLoss.derivative(WQTotal + Indices::numEq);
|
||||||
|
if constexpr (has_wfrac_variable) {
|
||||||
|
eqns.duneD_[seg][seg_upwind][SPres][WFrac] -= accelerationPressureLoss.derivative(WFrac + Indices::numEq);
|
||||||
|
}
|
||||||
|
if constexpr (has_gfrac_variable) {
|
||||||
|
eqns.duneD_[seg][seg_upwind][SPres][GFrac] -= accelerationPressureLoss.derivative(GFrac + Indices::numEq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define INSTANCE(...) \
|
#define INSTANCE(...) \
|
||||||
template class MultisegmentWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
|
template class MultisegmentWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
|
||||||
|
|
||||||
@ -175,8 +192,10 @@ INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,1u,0u>)
|
|||||||
|
|
||||||
// Blackoil
|
// Blackoil
|
||||||
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
|
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>)
|
||||||
INSTANCE(BlackOilIndices<0u,0u,0u,0u,true,false,0u,0u>)
|
INSTANCE(BlackOilIndices<0u,0u,0u,0u,true,false,0u,0u>)
|
||||||
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,0u,0u>)
|
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,2u,0u>)
|
||||||
INSTANCE(BlackOilIndices<1u,0u,0u,0u,false,false,0u,0u>)
|
INSTANCE(BlackOilIndices<1u,0u,0u,0u,false,false,0u,0u>)
|
||||||
INSTANCE(BlackOilIndices<0u,1u,0u,0u,false,false,0u,0u>)
|
INSTANCE(BlackOilIndices<0u,1u,0u,0u,false,false,0u,0u>)
|
||||||
INSTANCE(BlackOilIndices<0u,0u,1u,0u,false,false,0u,0u>)
|
INSTANCE(BlackOilIndices<0u,0u,1u,0u,false,false,0u,0u>)
|
||||||
|
@ -43,6 +43,21 @@ class WellState;
|
|||||||
template<class FluidSystem, class Indices, class Scalar>
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
class MultisegmentWellAssemble
|
class MultisegmentWellAssemble
|
||||||
{
|
{
|
||||||
|
static constexpr bool has_water = (Indices::waterSwitchIdx >= 0);
|
||||||
|
static constexpr bool has_gas = (Indices::compositionSwitchIdx >= 0);
|
||||||
|
static constexpr bool has_oil = (Indices::numPhases - has_gas - has_water) > 0;
|
||||||
|
|
||||||
|
// In the implementation, one should use has_wfrac_variable
|
||||||
|
// rather than has_water to check if you should do something
|
||||||
|
// with the variable at the WFrac location, similar for GFrac.
|
||||||
|
static constexpr bool has_wfrac_variable = has_water && Indices::numPhases > 1;
|
||||||
|
static constexpr bool has_gfrac_variable = has_gas && has_oil;
|
||||||
|
|
||||||
|
static constexpr int WQTotal = 0;
|
||||||
|
static constexpr int WFrac = has_wfrac_variable ? 1 : -1000;
|
||||||
|
static constexpr int GFrac = has_gfrac_variable ? has_wfrac_variable + 1 : -1000;
|
||||||
|
static constexpr int SPres = has_wfrac_variable + has_gfrac_variable + 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr int numWellEq = Indices::numPhases+1;
|
static constexpr int numWellEq = Indices::numPhases+1;
|
||||||
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
|
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
|
||||||
@ -62,11 +77,17 @@ public:
|
|||||||
const double rho,
|
const double rho,
|
||||||
const EvalWell& wqTotal,
|
const EvalWell& wqTotal,
|
||||||
const EvalWell& bhp,
|
const EvalWell& bhp,
|
||||||
const int SPres,
|
|
||||||
const std::function<EvalWell(const int)>& getQs,
|
const std::function<EvalWell(const int)>& getQs,
|
||||||
Equations& eqns,
|
Equations& eqns,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
|
||||||
|
//! \brief Assemble pressure loss term.
|
||||||
|
void assemblePressureLoss(const int seg,
|
||||||
|
const int seg_upwind,
|
||||||
|
const EvalWell& accelerationPressureLoss,
|
||||||
|
Equations& eqns) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well
|
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well
|
||||||
};
|
};
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
||||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||||
#include <opm/simulators/wells/MSWellHelpers.hpp>
|
#include <opm/simulators/wells/MSWellHelpers.hpp>
|
||||||
|
#include <opm/simulators/wells/MultisegmentWellAssemble.hpp>
|
||||||
#include <opm/simulators/wells/RateConverter.hpp>
|
#include <opm/simulators/wells/RateConverter.hpp>
|
||||||
#include <opm/simulators/wells/WellAssemble.hpp>
|
#include <opm/simulators/wells/WellAssemble.hpp>
|
||||||
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
||||||
@ -1148,15 +1149,8 @@ handleAccelerationPressureLoss(const int seg,
|
|||||||
auto& segments = well_state.well(baseif_.indexOfWell()).segments;
|
auto& segments = well_state.well(baseif_.indexOfWell()).segments;
|
||||||
segments.pressure_drop_accel[seg] = accelerationPressureLoss.value();
|
segments.pressure_drop_accel[seg] = accelerationPressureLoss.value();
|
||||||
|
|
||||||
linSys_.resWell_[seg][SPres] -= accelerationPressureLoss.value();
|
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
|
||||||
linSys_.duneD_[seg][seg][SPres][SPres] -= accelerationPressureLoss.derivative(SPres + Indices::numEq);
|
assemblePressureLoss(seg, seg_upwind, accelerationPressureLoss, linSys_);
|
||||||
linSys_.duneD_[seg][seg][SPres][WQTotal] -= accelerationPressureLoss.derivative(WQTotal + Indices::numEq);
|
|
||||||
if (has_wfrac_variable) {
|
|
||||||
linSys_.duneD_[seg][seg_upwind][SPres][WFrac] -= accelerationPressureLoss.derivative(WFrac + Indices::numEq);
|
|
||||||
}
|
|
||||||
if (has_gfrac_variable) {
|
|
||||||
linSys_.duneD_[seg][seg_upwind][SPres][GFrac] -= accelerationPressureLoss.derivative(GFrac + Indices::numEq);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FluidSystem, typename Indices, typename Scalar>
|
template<typename FluidSystem, typename Indices, typename Scalar>
|
||||||
|
@ -1683,7 +1683,6 @@ namespace Opm
|
|||||||
getRefDensity(),
|
getRefDensity(),
|
||||||
this->getWQTotal(),
|
this->getWQTotal(),
|
||||||
this->getBhp(),
|
this->getBhp(),
|
||||||
SPres,
|
|
||||||
gQ,
|
gQ,
|
||||||
this->linSys_,
|
this->linSys_,
|
||||||
deferred_logger);
|
deferred_logger);
|
||||||
|
Loading…
Reference in New Issue
Block a user