mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move calculation part of handleAccelerationPressureLoss to MultisegmentwellSegments
This commit is contained in:
@@ -185,43 +185,15 @@ MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||
handleAccelerationPressureLoss(const int seg,
|
||||
WellState& well_state)
|
||||
{
|
||||
const double area = this->segmentSet()[seg].crossArea();
|
||||
const EvalWell mass_rate = segments_.mass_rates_[seg];
|
||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
||||
EvalWell density = segments_.densities_[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();
|
||||
}
|
||||
|
||||
EvalWell accelerationPressureLoss = mswellhelpers::velocityHead(area, mass_rate, density);
|
||||
// handling the velocity head of intlet segments
|
||||
for (const int inlet : this->segments_.inlets_[seg]) {
|
||||
const int seg_upwind_inlet = segments_.upwinding_segments_[inlet];
|
||||
const double inlet_area = this->segmentSet()[inlet].crossArea();
|
||||
EvalWell inlet_density = this->segments_.densities_[seg_upwind_inlet];
|
||||
// WARNING
|
||||
// We disregard the derivatives from the upwind density to make sure derivatives
|
||||
// wrt. to different segments dont get mixed.
|
||||
if (inlet != seg_upwind_inlet) {
|
||||
inlet_density.clearDerivatives();
|
||||
}
|
||||
const EvalWell inlet_mass_rate = segments_.mass_rates_[inlet];
|
||||
accelerationPressureLoss -= mswellhelpers::velocityHead(std::max(inlet_area, area), inlet_mass_rate, inlet_density);
|
||||
}
|
||||
|
||||
// We change the sign of the accelerationPressureLoss for injectors.
|
||||
// Is this correct? Testing indicates that this is what the reference simulator does
|
||||
const double sign = mass_rate < 0. ? 1.0 : - 1.0;
|
||||
accelerationPressureLoss *= sign;
|
||||
const EvalWell accelerationPressureLoss = segments_.accelerationPressureLoss(seg);
|
||||
|
||||
auto& segments = well_state.well(baseif_.indexOfWell()).segments;
|
||||
segments.pressure_drop_accel[seg] = accelerationPressureLoss.value();
|
||||
|
||||
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
|
||||
assemblePressureLoss(seg, seg_upwind, accelerationPressureLoss, linSys_);
|
||||
assemblePressureLoss(seg,
|
||||
segments_.upwinding_segments_[seg],
|
||||
accelerationPressureLoss, linSys_);
|
||||
}
|
||||
|
||||
template<typename FluidSystem, typename Indices, typename Scalar>
|
||||
|
||||
@@ -673,6 +673,47 @@ pressureDropValve(const int seg) const
|
||||
return sign * (friction_pressure_loss + constriction_pressure_loss);
|
||||
}
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
|
||||
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
|
||||
accelerationPressureLoss(const int seg) const
|
||||
{
|
||||
const auto& segment_set = well_.wellEcl().getSegments();
|
||||
const double area = segment_set[seg].crossArea();
|
||||
const EvalWell mass_rate = mass_rates_[seg];
|
||||
const int seg_upwind = upwinding_segments_[seg];
|
||||
EvalWell density = densities_[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();
|
||||
}
|
||||
|
||||
EvalWell accelerationPressureLoss = mswellhelpers::velocityHead(area, mass_rate, density);
|
||||
// handling the velocity head of intlet segments
|
||||
for (const int inlet : inlets_[seg]) {
|
||||
const int seg_upwind_inlet = upwinding_segments_[inlet];
|
||||
const double inlet_area = segment_set[inlet].crossArea();
|
||||
EvalWell inlet_density = densities_[seg_upwind_inlet];
|
||||
// WARNING
|
||||
// We disregard the derivatives from the upwind density to make sure derivatives
|
||||
// wrt. to different segments dont get mixed.
|
||||
if (inlet != seg_upwind_inlet) {
|
||||
inlet_density.clearDerivatives();
|
||||
}
|
||||
const EvalWell inlet_mass_rate = mass_rates_[inlet];
|
||||
accelerationPressureLoss -= mswellhelpers::velocityHead(std::max(inlet_area, area), inlet_mass_rate, inlet_density);
|
||||
}
|
||||
|
||||
// We change the sign of the accelerationPressureLoss for injectors.
|
||||
// Is this correct? Testing indicates that this is what the reference simulator does
|
||||
const double sign = mass_rate < 0. ? 1.0 : - 1.0;
|
||||
accelerationPressureLoss *= sign;
|
||||
|
||||
return accelerationPressureLoss;
|
||||
}
|
||||
|
||||
#define INSTANCE(...) \
|
||||
template class MultisegmentWellSegments<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ public:
|
||||
// pressure drop for sub-critical valve (WSEGVALV)
|
||||
EvalWell pressureDropValve(const int seg) const;
|
||||
|
||||
// pressure loss due to acceleration
|
||||
EvalWell accelerationPressureLoss(const int seg) const;
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user