mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move getFrictionPressureLoss to MultisegmentWellSegments
This commit is contained in:
@@ -179,34 +179,6 @@ extendEval(const Eval& in) const
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FluidSystem, typename Indices, typename Scalar>
|
|
||||||
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
|
|
||||||
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
|
||||||
getFrictionPressureLoss(const int seg) const
|
|
||||||
{
|
|
||||||
const EvalWell mass_rate = segments_.mass_rates_[seg];
|
|
||||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
|
||||||
EvalWell density = segments_.densities_[seg_upwind];
|
|
||||||
EvalWell visc = segments_.viscosities_[seg_upwind];
|
|
||||||
// WARNING
|
|
||||||
// We disregard the derivatives from the upwind density to make sure derivatives
|
|
||||||
// wrt. to different segments dont get mixed.
|
|
||||||
if (seg != seg_upwind) {
|
|
||||||
density.clearDerivatives();
|
|
||||||
visc.clearDerivatives();
|
|
||||||
}
|
|
||||||
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
|
|
||||||
const double length = this->segmentSet()[seg].totalLength() - this->segmentSet()[outlet_segment_index].totalLength();
|
|
||||||
assert(length > 0.);
|
|
||||||
const double roughness = this->segmentSet()[seg].roughness();
|
|
||||||
const double area = this->segmentSet()[seg].crossArea();
|
|
||||||
const double diameter = this->segmentSet()[seg].internalDiameter();
|
|
||||||
|
|
||||||
const double sign = mass_rate < 0. ? 1.0 : - 1.0;
|
|
||||||
|
|
||||||
return sign * mswellhelpers::frictionPressureLoss(length, diameter, area, roughness, density, mass_rate, visc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename FluidSystem, typename Indices, typename Scalar>
|
template<typename FluidSystem, typename Indices, typename Scalar>
|
||||||
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
|
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
|
||||||
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||||
@@ -476,7 +448,7 @@ assembleDefaultPressureEq(const int seg,
|
|||||||
pressure_equation -= hydro_pressure_drop;
|
pressure_equation -= hydro_pressure_drop;
|
||||||
|
|
||||||
if (this->frictionalPressureLossConsidered()) {
|
if (this->frictionalPressureLossConsidered()) {
|
||||||
const auto friction_pressure_drop = getFrictionPressureLoss(seg);
|
const auto friction_pressure_drop = segments_.getFrictionPressureLoss(seg);
|
||||||
pressure_equation -= friction_pressure_drop;
|
pressure_equation -= friction_pressure_drop;
|
||||||
segments.pressure_drop_friction[seg] = friction_pressure_drop.value();
|
segments.pressure_drop_friction[seg] = friction_pressure_drop.value();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,8 +107,6 @@ protected:
|
|||||||
const double relaxed_inner_tolerance_pressure_ms_well,
|
const double relaxed_inner_tolerance_pressure_ms_well,
|
||||||
const bool relax_tolerance) const;
|
const bool relax_tolerance) const;
|
||||||
|
|
||||||
EvalWell getFrictionPressureLoss(const int seg) const;
|
|
||||||
|
|
||||||
std::pair<bool, std::vector<Scalar> >
|
std::pair<bool, std::vector<Scalar> >
|
||||||
getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <opm/models/blackoil/blackoiltwophaseindices.hh>
|
#include <opm/models/blackoil/blackoiltwophaseindices.hh>
|
||||||
|
|
||||||
#include <opm/simulators/utils/DeferredLogger.hpp>
|
#include <opm/simulators/utils/DeferredLogger.hpp>
|
||||||
|
#include <opm/simulators/wells/MSWellHelpers.hpp>
|
||||||
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
|
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
@@ -439,6 +440,36 @@ getSurfaceVolume(const EvalWell& temperature,
|
|||||||
return volume / vol_ratio;
|
return volume / vol_ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
|
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
|
||||||
|
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
|
||||||
|
getFrictionPressureLoss(const int seg) const
|
||||||
|
{
|
||||||
|
const EvalWell mass_rate = mass_rates_[seg];
|
||||||
|
const int seg_upwind = upwinding_segments_[seg];
|
||||||
|
EvalWell density = densities_[seg_upwind];
|
||||||
|
EvalWell visc = viscosities_[seg_upwind];
|
||||||
|
// WARNING
|
||||||
|
// We disregard the derivatives from the upwind density to make sure derivatives
|
||||||
|
// wrt. to different segments dont get mixed.
|
||||||
|
if (seg != seg_upwind) {
|
||||||
|
density.clearDerivatives();
|
||||||
|
visc.clearDerivatives();
|
||||||
|
}
|
||||||
|
const auto& segment_set = well_.wellEcl().getSegments();
|
||||||
|
const int outlet_segment_index = segment_set.segmentNumberToIndex(segment_set[seg].outletSegment());
|
||||||
|
const double length = segment_set[seg].totalLength() - segment_set[outlet_segment_index].totalLength();
|
||||||
|
assert(length > 0.);
|
||||||
|
const double roughness = segment_set[seg].roughness();
|
||||||
|
const double area = segment_set[seg].crossArea();
|
||||||
|
const double diameter = segment_set[seg].internalDiameter();
|
||||||
|
|
||||||
|
const double sign = mass_rate < 0. ? 1.0 : - 1.0;
|
||||||
|
|
||||||
|
return sign * mswellhelpers::frictionPressureLoss(length, diameter, area, roughness, density, mass_rate, visc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define INSTANCE(...) \
|
#define INSTANCE(...) \
|
||||||
template class MultisegmentWellSegments<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
|
template class MultisegmentWellSegments<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ public:
|
|||||||
const int pvt_region_index,
|
const int pvt_region_index,
|
||||||
const int seg_idx) const;
|
const int seg_idx) const;
|
||||||
|
|
||||||
|
EvalWell getFrictionPressureLoss(const int seg) const;
|
||||||
|
|
||||||
// TODO: trying to use the information from the Well opm-parser as much
|
// TODO: trying to use the information from the Well opm-parser as much
|
||||||
// as possible, it will possibly be re-implemented later for efficiency reason.
|
// as possible, it will possibly be re-implemented later for efficiency reason.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user