mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
added: MultisegmentWellSegments
this is a container class for per-segment properties in MultisegmentWell
This commit is contained in:
parent
fe96a7181d
commit
aa684a10b8
@ -96,6 +96,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/simulators/wells/MultisegmentWellEval.cpp
|
||||
opm/simulators/wells/MultisegmentWellGeneric.cpp
|
||||
opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp
|
||||
opm/simulators/wells/MultisegmentWellSegments.cpp
|
||||
opm/simulators/wells/ParallelWellInfo.cpp
|
||||
opm/simulators/wells/PerfData.cpp
|
||||
opm/simulators/wells/SegmentState.cpp
|
||||
@ -382,6 +383,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/simulators/wells/MultisegmentWellEval.hpp
|
||||
opm/simulators/wells/MultisegmentWellGeneric.hpp
|
||||
opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp
|
||||
opm/simulators/wells/MultisegmentWellSegments.hpp
|
||||
opm/simulators/wells/ParallelWellInfo.hpp
|
||||
opm/simulators/wells/PerfData.hpp
|
||||
opm/simulators/wells/PerforationData.hpp
|
||||
|
@ -57,13 +57,7 @@ MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif)
|
||||
, baseif_(baseif)
|
||||
, linSys_(*this)
|
||||
, primary_variables_(baseif)
|
||||
, upwinding_segments_(this->numberOfSegments(), 0)
|
||||
, segment_densities_(this->numberOfSegments(), 0.0)
|
||||
, segment_mass_rates_(this->numberOfSegments(), 0.0)
|
||||
, segment_viscosities_(this->numberOfSegments(), 0.0)
|
||||
, segment_phase_densities_(this->numberOfSegments(), std::vector<EvalWell>(baseif_.numComponents(), 0.0)) // number of phase here?
|
||||
, segment_phase_fractions_(this->numberOfSegments(), std::vector<EvalWell>(baseif_.numComponents(), 0.0)) // number of phase here?
|
||||
, segment_phase_viscosities_(this->numberOfSegments(), std::vector<EvalWell>(baseif_.numComponents(), 0.0)) // number of phase here?
|
||||
, segments_(this->numberOfSegments(), baseif_.numComponents())
|
||||
, cell_perforation_depth_diffs_(baseif_.numPerfs(), 0.0)
|
||||
, cell_perforation_pressure_diffs_(baseif_.numPerfs(), 0.0)
|
||||
{
|
||||
@ -211,7 +205,7 @@ computeSegmentFluidProperties(const EvalWell& temperature,
|
||||
|
||||
std::vector<EvalWell> b(baseif_.numComponents(), 0.0);
|
||||
std::vector<EvalWell> visc(baseif_.numComponents(), 0.0);
|
||||
std::vector<EvalWell>& phase_densities = segment_phase_densities_[seg];
|
||||
std::vector<EvalWell>& phase_densities = segments_.phase_densities_[seg];
|
||||
|
||||
const EvalWell seg_pressure = primary_variables_.getSegmentPressure(seg);
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
|
||||
@ -300,7 +294,7 @@ computeSegmentFluidProperties(const EvalWell& temperature,
|
||||
}
|
||||
}
|
||||
|
||||
segment_phase_viscosities_[seg] = visc;
|
||||
segments_.phase_viscosities_[seg] = visc;
|
||||
|
||||
std::vector<EvalWell> mix(mix_s);
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
|
||||
@ -332,29 +326,29 @@ computeSegmentFluidProperties(const EvalWell& temperature,
|
||||
volrat += mix[comp_idx] / b[comp_idx];
|
||||
}
|
||||
|
||||
this->segment_viscosities_[seg] = 0.;
|
||||
this->segments_.viscosities_[seg] = 0.;
|
||||
// calculate the average viscosity
|
||||
for (int comp_idx = 0; comp_idx < baseif_.numComponents(); ++comp_idx) {
|
||||
const EvalWell fraction = mix[comp_idx] / b[comp_idx] / volrat;
|
||||
// TODO: a little more work needs to be done to handle the negative fractions here
|
||||
this->segment_phase_fractions_[seg][comp_idx] = fraction; // >= 0.0 ? fraction : 0.0;
|
||||
this->segment_viscosities_[seg] += visc[comp_idx] * this->segment_phase_fractions_[seg][comp_idx];
|
||||
this->segments_.phase_fractions_[seg][comp_idx] = fraction; // >= 0.0 ? fraction : 0.0;
|
||||
this->segments_.viscosities_[seg] += visc[comp_idx] * this->segments_.phase_fractions_[seg][comp_idx];
|
||||
}
|
||||
|
||||
EvalWell density(0.0);
|
||||
for (int comp_idx = 0; comp_idx < baseif_.numComponents(); ++comp_idx) {
|
||||
density += surf_dens[comp_idx] * mix_s[comp_idx];
|
||||
}
|
||||
this->segment_densities_[seg] = density / volrat;
|
||||
this->segments_.densities_[seg] = density / volrat;
|
||||
|
||||
// calculate the mass rates
|
||||
segment_mass_rates_[seg] = 0.;
|
||||
segments_.mass_rates_[seg] = 0.;
|
||||
for (int comp_idx = 0; comp_idx < baseif_.numComponents(); ++comp_idx) {
|
||||
const int upwind_seg = upwinding_segments_[seg];
|
||||
const int upwind_seg = segments_.upwinding_segments_[seg];
|
||||
const EvalWell rate = primary_variables_.getSegmentRateUpwinding(seg,
|
||||
upwind_seg,
|
||||
comp_idx);
|
||||
this->segment_mass_rates_[seg] += rate * surf_dens[comp_idx];
|
||||
this->segments_.mass_rates_[seg] += rate * surf_dens[comp_idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -364,7 +358,7 @@ typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
|
||||
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||
getHydroPressureLoss(const int seg) const
|
||||
{
|
||||
return segment_densities_[seg] * baseif_.gravity() * this->segment_depth_diffs_[seg];
|
||||
return segments_.densities_[seg] * baseif_.gravity() * this->segment_depth_diffs_[seg];
|
||||
}
|
||||
|
||||
template<typename FluidSystem, typename Indices, typename Scalar>
|
||||
@ -372,10 +366,10 @@ typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
|
||||
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||
getFrictionPressureLoss(const int seg) const
|
||||
{
|
||||
const EvalWell mass_rate = segment_mass_rates_[seg];
|
||||
const int seg_upwind = upwinding_segments_[seg];
|
||||
EvalWell density = segment_densities_[seg_upwind];
|
||||
EvalWell visc = segment_viscosities_[seg_upwind];
|
||||
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.
|
||||
@ -402,9 +396,9 @@ pressureDropSpiralICD(const int seg) const
|
||||
{
|
||||
const SICD& sicd = this->segmentSet()[seg].spiralICD();
|
||||
|
||||
const int seg_upwind = upwinding_segments_[seg];
|
||||
const std::vector<EvalWell>& phase_fractions = segment_phase_fractions_[seg_upwind];
|
||||
const std::vector<EvalWell>& phase_viscosities = segment_phase_viscosities_[seg_upwind];
|
||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
||||
const std::vector<EvalWell>& phase_fractions = segments_.phase_fractions_[seg_upwind];
|
||||
const std::vector<EvalWell>& phase_viscosities = segments_.phase_viscosities_[seg_upwind];
|
||||
|
||||
EvalWell water_fraction = 0.;
|
||||
EvalWell water_viscosity = 0.;
|
||||
@ -430,7 +424,7 @@ pressureDropSpiralICD(const int seg) const
|
||||
gas_viscosity = phase_viscosities[gas_pos];
|
||||
}
|
||||
|
||||
EvalWell density = segment_densities_[seg_upwind];
|
||||
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.
|
||||
@ -453,7 +447,7 @@ pressureDropSpiralICD(const int seg) const
|
||||
|
||||
const EvalWell mixture_viscosity = liquid_viscosity_fraction + gas_fraction * gas_viscosity;
|
||||
|
||||
const EvalWell reservoir_rate = segment_mass_rates_[seg] / density;
|
||||
const EvalWell reservoir_rate = segments_.mass_rates_[seg] / density;
|
||||
|
||||
const EvalWell reservoir_rate_icd = reservoir_rate * sicd.scalingFactor();
|
||||
|
||||
@ -483,10 +477,10 @@ pressureDropAutoICD(const int seg,
|
||||
{
|
||||
const AutoICD& aicd = this->segmentSet()[seg].autoICD();
|
||||
|
||||
const int seg_upwind = this->upwinding_segments_[seg];
|
||||
const std::vector<EvalWell>& phase_fractions = this->segment_phase_fractions_[seg_upwind];
|
||||
const std::vector<EvalWell>& phase_viscosities = this->segment_phase_viscosities_[seg_upwind];
|
||||
const std::vector<EvalWell>& phase_densities = this->segment_phase_densities_[seg_upwind];
|
||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
||||
const std::vector<EvalWell>& phase_fractions = this->segments_.phase_fractions_[seg_upwind];
|
||||
const std::vector<EvalWell>& phase_viscosities = this->segments_.phase_viscosities_[seg_upwind];
|
||||
const std::vector<EvalWell>& phase_densities = this->segments_.phase_densities_[seg_upwind];
|
||||
|
||||
EvalWell water_fraction = 0.;
|
||||
EvalWell water_viscosity = 0.;
|
||||
@ -518,7 +512,7 @@ pressureDropAutoICD(const int seg,
|
||||
gas_density = phase_densities[gas_pos];
|
||||
}
|
||||
|
||||
EvalWell density = segment_densities_[seg_upwind];
|
||||
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.
|
||||
@ -546,7 +540,7 @@ pressureDropAutoICD(const int seg,
|
||||
|
||||
const double rho_reference = aicd.densityCalibration();
|
||||
const double visc_reference = aicd.viscosityCalibration();
|
||||
const auto volume_rate_icd = this->segment_mass_rates_[seg] * aicd.scalingFactor() / mixture_density;
|
||||
const auto volume_rate_icd = this->segments_.mass_rates_[seg] * aicd.scalingFactor() / mixture_density;
|
||||
const double sign = volume_rate_icd <= 0. ? 1.0 : -1.0;
|
||||
// convert 1 unit volume rate
|
||||
using M = UnitSystem::measure;
|
||||
@ -567,10 +561,10 @@ pressureDropValve(const int seg) const
|
||||
{
|
||||
const Valve& valve = this->segmentSet()[seg].valve();
|
||||
|
||||
const EvalWell& mass_rate = segment_mass_rates_[seg];
|
||||
const int seg_upwind = upwinding_segments_[seg];
|
||||
EvalWell visc = segment_viscosities_[seg_upwind];
|
||||
EvalWell density = segment_densities_[seg_upwind];
|
||||
const EvalWell& mass_rate = segments_.mass_rates_[seg];
|
||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
||||
EvalWell visc = segments_.viscosities_[seg_upwind];
|
||||
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.
|
||||
@ -748,9 +742,9 @@ handleAccelerationPressureLoss(const int seg,
|
||||
WellState& well_state)
|
||||
{
|
||||
const double area = this->segmentSet()[seg].crossArea();
|
||||
const EvalWell mass_rate = segment_mass_rates_[seg];
|
||||
const int seg_upwind = upwinding_segments_[seg];
|
||||
EvalWell density = segment_densities_[seg_upwind];
|
||||
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.
|
||||
@ -761,16 +755,16 @@ handleAccelerationPressureLoss(const int seg,
|
||||
EvalWell accelerationPressureLoss = mswellhelpers::velocityHead(area, mass_rate, density);
|
||||
// handling the velocity head of intlet segments
|
||||
for (const int inlet : this->segment_inlets_[seg]) {
|
||||
const int seg_upwind_inlet = upwinding_segments_[inlet];
|
||||
const int seg_upwind_inlet = segments_.upwinding_segments_[inlet];
|
||||
const double inlet_area = this->segmentSet()[inlet].crossArea();
|
||||
EvalWell inlet_density = this->segment_densities_[seg_upwind_inlet];
|
||||
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 = segment_mass_rates_[inlet];
|
||||
const EvalWell inlet_mass_rate = segments_.mass_rates_[inlet];
|
||||
accelerationPressureLoss -= mswellhelpers::velocityHead(std::max(inlet_area, area), inlet_mass_rate, inlet_density);
|
||||
}
|
||||
|
||||
@ -817,7 +811,7 @@ assembleDefaultPressureEq(const int seg,
|
||||
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
|
||||
const EvalWell outlet_pressure = primary_variables_.getSegmentPressure(outlet_segment_index);
|
||||
|
||||
const int seg_upwind = upwinding_segments_[seg];
|
||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
||||
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
|
||||
assemblePressureEq(seg, seg_upwind, outlet_segment_index,
|
||||
pressure_equation, outlet_pressure, linSys_);
|
||||
@ -880,7 +874,7 @@ assembleICDPressureEq(const int seg,
|
||||
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
|
||||
const EvalWell outlet_pressure = primary_variables_.getSegmentPressure(outlet_segment_index);
|
||||
|
||||
const int seg_upwind = upwinding_segments_[seg];
|
||||
const int seg_upwind = segments_.upwinding_segments_[seg];
|
||||
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
|
||||
assemblePressureEq(seg, seg_upwind, outlet_segment_index,
|
||||
pressure_equation, outlet_pressure,
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <opm/simulators/wells/MultisegmentWellEquations.hpp>
|
||||
#include <opm/simulators/wells/MultisegmentWellGeneric.hpp>
|
||||
#include <opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp>
|
||||
#include <opm/simulators/wells/MultisegmentWellSegments.hpp>
|
||||
|
||||
#include <opm/material/densead/Evaluation.hpp>
|
||||
|
||||
@ -59,6 +60,7 @@ protected:
|
||||
static constexpr int WQTotal = PrimaryVariables::WQTotal;
|
||||
|
||||
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
|
||||
using MSWSegments = MultisegmentWellSegments<FluidSystem,Indices,Scalar>;
|
||||
|
||||
using BVector = typename Equations::BVector;
|
||||
using BVectorWell = typename Equations::BVectorWell;
|
||||
@ -154,22 +156,7 @@ protected:
|
||||
|
||||
PrimaryVariables primary_variables_; //!< The primary variables
|
||||
|
||||
// the upwinding segment for each segment based on the flow direction
|
||||
std::vector<int> upwinding_segments_;
|
||||
|
||||
// the densities of segment fluids
|
||||
// we should not have this member variable
|
||||
std::vector<EvalWell> segment_densities_;
|
||||
|
||||
// the mass rate of the segments
|
||||
std::vector<EvalWell> segment_mass_rates_;
|
||||
|
||||
// the viscosity of the segments
|
||||
std::vector<EvalWell> segment_viscosities_;
|
||||
|
||||
std::vector<std::vector<EvalWell>> segment_phase_densities_;
|
||||
std::vector<std::vector<EvalWell>> segment_phase_fractions_;
|
||||
std::vector<std::vector<EvalWell>> segment_phase_viscosities_;
|
||||
MSWSegments segments_; //!< Segment properties
|
||||
|
||||
// depth difference between perforations and the perforated grid cells
|
||||
std::vector<double> cell_perforation_depth_diffs_;
|
||||
|
77
opm/simulators/wells/MultisegmentWellSegments.cpp
Normal file
77
opm/simulators/wells/MultisegmentWellSegments.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
||||
Copyright 2017 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/simulators/wells/MultisegmentWellSegments.hpp>
|
||||
|
||||
#include <opm/material/fluidsystems/BlackOilDefaultIndexTraits.hpp>
|
||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilindices.hh>
|
||||
#include <opm/models/blackoil/blackoilonephaseindices.hh>
|
||||
#include <opm/models/blackoil/blackoiltwophaseindices.hh>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
|
||||
MultisegmentWellSegments(const int numSegments,
|
||||
const int numComponents)
|
||||
: densities_(numSegments, 0.0)
|
||||
, mass_rates_(numSegments, 0.0)
|
||||
, viscosities_(numSegments, 0.0)
|
||||
, upwinding_segments_(numSegments, 0)
|
||||
, phase_densities_(numSegments, std::vector<EvalWell>(numComponents, 0.0)) // number of phase here?
|
||||
, phase_fractions_(numSegments, std::vector<EvalWell>(numComponents, 0.0)) // number of phase here?
|
||||
, phase_viscosities_(numSegments, std::vector<EvalWell>(numComponents, 0.0)) // number of phase here?
|
||||
{}
|
||||
|
||||
#define INSTANCE(...) \
|
||||
template class MultisegmentWellSegments<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
|
||||
|
||||
// One phase
|
||||
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)
|
||||
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,1u,false,false,0u,1u,0u>)
|
||||
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,5u>)
|
||||
|
||||
// Two phase
|
||||
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,false,0u,0u,0u>)
|
||||
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)
|
||||
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,false,0u,2u,0u>)
|
||||
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,2u,0u>)
|
||||
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,false,0u,2u,0u>)
|
||||
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,2u,0u,false,false,0u,2u,0u>)
|
||||
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,1u,0u>)
|
||||
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,0u,0u>)
|
||||
|
||||
// Blackoil
|
||||
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,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,2u,0u>)
|
||||
INSTANCE(BlackOilIndices<1u,0u,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,0u,1u,false,false,0u,0u>)
|
||||
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>)
|
||||
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
|
||||
|
||||
} // namespace Opm
|
62
opm/simulators/wells/MultisegmentWellSegments.hpp
Normal file
62
opm/simulators/wells/MultisegmentWellSegments.hpp
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
||||
Copyright 2017 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OPM_MULTISEGMENTWELL_SEGMENTS_HEADER_INCLUDED
|
||||
#define OPM_MULTISEGMENTWELL_SEGMENTS_HEADER_INCLUDED
|
||||
|
||||
#include <opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
template<typename FluidSystem, typename Indices, typename Scalar>
|
||||
class MultisegmentWellSegments
|
||||
{
|
||||
using PrimaryVariables = MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>;
|
||||
using EvalWell = typename PrimaryVariables::EvalWell;
|
||||
|
||||
public:
|
||||
MultisegmentWellSegments(const int numSegments,
|
||||
const int numComponents);
|
||||
|
||||
// the densities of segment fluids
|
||||
// we should not have this member variable
|
||||
std::vector<EvalWell> densities_;
|
||||
|
||||
// the mass rate of the segments
|
||||
std::vector<EvalWell> mass_rates_;
|
||||
|
||||
// the viscosity of the segments
|
||||
std::vector<EvalWell> viscosities_;
|
||||
|
||||
// the upwinding segment for each segment based on the flow direction
|
||||
std::vector<int> upwinding_segments_;
|
||||
|
||||
std::vector<std::vector<EvalWell>> phase_densities_;
|
||||
std::vector<std::vector<EvalWell>> phase_fractions_;
|
||||
std::vector<std::vector<EvalWell>> phase_viscosities_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OPM_MULTISEGMENTWELL_SEGMENTS_HEADER_INCLUDED
|
@ -931,7 +931,7 @@ namespace Opm
|
||||
Tw,
|
||||
perf,
|
||||
segment_pressure,
|
||||
this->segment_densities_[seg],
|
||||
this->segments_.densities_[seg],
|
||||
allow_cf,
|
||||
cmix_s,
|
||||
cq_s,
|
||||
@ -992,7 +992,7 @@ namespace Opm
|
||||
Tw,
|
||||
perf,
|
||||
segment_pressure,
|
||||
getValue(this->segment_densities_[seg]),
|
||||
getValue(this->segments_.densities_[seg]),
|
||||
allow_cf,
|
||||
cmix_s,
|
||||
cq_s,
|
||||
@ -1153,7 +1153,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
getRefDensity() const
|
||||
{
|
||||
return this->segment_densities_[0].value();
|
||||
return this->segments_.densities_[0].value();
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
@ -1238,7 +1238,7 @@ namespace Opm
|
||||
const double segment_depth = this->segmentSet()[seg].depth();
|
||||
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
|
||||
const double segment_depth_outlet = seg == 0? ref_depth : this->segmentSet()[outlet_segment_index].depth();
|
||||
double dp = wellhelpers::computeHydrostaticCorrection(segment_depth_outlet, segment_depth, this->segment_densities_[seg].value(), this->gravity_);
|
||||
double dp = wellhelpers::computeHydrostaticCorrection(segment_depth_outlet, segment_depth, this->segments_.densities_[seg].value(), this->gravity_);
|
||||
// we add the hydrostatic correction from the outlet segment
|
||||
// in order to get the correction all the way to the bhp ref depth.
|
||||
if (seg > 0) {
|
||||
@ -1255,7 +1255,7 @@ namespace Opm
|
||||
const auto& int_quantities = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& fs = int_quantities.fluidState();
|
||||
// pressure difference between the segment and the perforation
|
||||
const double perf_seg_press_diff = this->gravity_ * this->segment_densities_[seg].value() * this->perforation_segment_depth_diffs_[perf];
|
||||
const double perf_seg_press_diff = this->gravity_ * this->segments_.densities_[seg].value() * this->perforation_segment_depth_diffs_[perf];
|
||||
// pressure difference between the perforation and the grid cell
|
||||
const double cell_perf_press_diff = this->cell_perforation_pressure_diffs_[perf];
|
||||
const double pressure_cell = this->getPerfCellPressure(fs).value();
|
||||
@ -1530,7 +1530,7 @@ namespace Opm
|
||||
|
||||
// update the upwinding segments
|
||||
this->primary_variables_.updateUpwindingSegments(*this,
|
||||
this->upwinding_segments_);
|
||||
this->segments_.upwinding_segments_);
|
||||
|
||||
// calculate the fluid properties needed.
|
||||
computeSegmentFluidProperties(ebosSimulator, deferred_logger);
|
||||
@ -1572,7 +1572,7 @@ namespace Opm
|
||||
}
|
||||
// considering the contributions due to flowing out from the segment
|
||||
{
|
||||
const int seg_upwind = this->upwinding_segments_[seg];
|
||||
const int seg_upwind = this->segments_.upwinding_segments_[seg];
|
||||
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
|
||||
const EvalWell segment_rate =
|
||||
this->primary_variables_.getSegmentRateUpwinding(seg,
|
||||
@ -1587,7 +1587,7 @@ namespace Opm
|
||||
// considering the contributions from the inlet segments
|
||||
{
|
||||
for (const int inlet : this->segment_inlets_[seg]) {
|
||||
const int inlet_upwind = this->upwinding_segments_[inlet];
|
||||
const int inlet_upwind = this->segments_.upwinding_segments_[inlet];
|
||||
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
|
||||
const EvalWell inlet_rate =
|
||||
this->primary_variables_.getSegmentRateUpwinding(inlet,
|
||||
@ -1694,7 +1694,7 @@ namespace Opm
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
// pressure difference between the segment and the perforation
|
||||
const EvalWell perf_seg_press_diff = this->gravity_ * this->segment_densities_[seg] * this->perforation_segment_depth_diffs_[perf];
|
||||
const EvalWell perf_seg_press_diff = this->gravity_ * this->segments_.densities_[seg] * this->perforation_segment_depth_diffs_[perf];
|
||||
// pressure difference between the perforation and the grid cell
|
||||
const double cell_perf_press_diff = this->cell_perforation_pressure_diffs_[perf];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user