2022-11-07 23:38:12 -06:00
|
|
|
/*
|
|
|
|
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
|
|
|
Copyright 2017 Statoil ASA.
|
|
|
|
Copyright 2016 - 2017 IRIS AS.
|
|
|
|
|
|
|
|
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/StandardWellPrimaryVariables.hpp>
|
|
|
|
|
2022-11-08 00:09:51 -06:00
|
|
|
#include <dune/common/dynvector.hh>
|
|
|
|
#include <dune/istl/bvector.hh>
|
|
|
|
|
2022-11-07 23:38:12 -06:00
|
|
|
#include <opm/material/densead/Evaluation.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>
|
|
|
|
|
|
|
|
#include <opm/simulators/wells/WellInterfaceIndices.hpp>
|
2022-11-08 00:09:51 -06:00
|
|
|
#include <opm/simulators/wells/WellState.hpp>
|
2022-11-07 23:38:12 -06:00
|
|
|
|
|
|
|
namespace Opm {
|
|
|
|
|
|
|
|
template<class FluidSystem, class Indices, class Scalar>
|
|
|
|
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
|
|
|
init()
|
|
|
|
{
|
|
|
|
for (int eqIdx = 0; eqIdx < numWellEq_; ++eqIdx) {
|
|
|
|
evaluation_[eqIdx] =
|
|
|
|
EvalWell::createVariable(numWellEq_ + Indices::numEq,
|
|
|
|
value_[eqIdx],
|
|
|
|
Indices::numEq + eqIdx);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class FluidSystem, class Indices, class Scalar>
|
|
|
|
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
|
|
|
resize(const int numWellEq)
|
|
|
|
{
|
|
|
|
value_.resize(numWellEq, 0.0);
|
|
|
|
evaluation_.resize(numWellEq, EvalWell{numWellEq + Indices::numEq, 0.0});
|
|
|
|
numWellEq_ = numWellEq;
|
|
|
|
}
|
|
|
|
|
2022-11-08 00:09:51 -06:00
|
|
|
|
|
|
|
template<class FluidSystem, class Indices, class Scalar>
|
|
|
|
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
|
|
|
updatePolyMW(const BVectorWell& dwells)
|
|
|
|
{
|
|
|
|
if (well_.isInjector()) {
|
|
|
|
for (int perf = 0; perf < well_.numPerfs(); ++perf) {
|
|
|
|
const int wat_vel_index = Bhp + 1 + perf;
|
|
|
|
const int pskin_index = Bhp + 1 + well_.numPerfs() + perf;
|
|
|
|
|
|
|
|
const double relaxation_factor = 0.9;
|
|
|
|
const double dx_wat_vel = dwells[0][wat_vel_index];
|
|
|
|
value_[wat_vel_index] -= relaxation_factor * dx_wat_vel;
|
|
|
|
|
|
|
|
const double dx_pskin = dwells[0][pskin_index];
|
|
|
|
value_[pskin_index] -= relaxation_factor * dx_pskin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-08 00:09:51 -06:00
|
|
|
template<class FluidSystem, class Indices, class Scalar>
|
|
|
|
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
|
|
|
copyToWellStatePolyMW(WellState& well_state) const
|
|
|
|
{
|
|
|
|
if (well_.isInjector()) {
|
|
|
|
auto& ws = well_state.well(well_.indexOfWell());
|
|
|
|
auto& perf_data = ws.perf_data;
|
|
|
|
auto& perf_water_velocity = perf_data.water_velocity;
|
|
|
|
auto& perf_skin_pressure = perf_data.skin_pressure;
|
|
|
|
for (int perf = 0; perf < well_.numPerfs(); ++perf) {
|
|
|
|
perf_water_velocity[perf] = value_[Bhp + 1 + perf];
|
|
|
|
perf_skin_pressure[perf] = value_[Bhp + 1 + well_.numPerfs() + perf];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-07 23:38:12 -06:00
|
|
|
#define INSTANCE(...) \
|
|
|
|
template class StandardWellPrimaryVariables<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,1u,0u,false,false,0u,2u,0u>)
|
|
|
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,true,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>)
|
|
|
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,2u,0u>)
|
|
|
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,2u,0u,false,false,0u,2u,0u>)
|
|
|
|
|
|
|
|
// Blackoil
|
|
|
|
INSTANCE(BlackOilIndices<0u,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,0u,1u,0u,false,false,0u,0u>)
|
|
|
|
INSTANCE(BlackOilIndices<0u,0u,0u,1u,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,1u,false,true,0u,0u>)
|
|
|
|
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,1u,0u>)
|
|
|
|
|
|
|
|
}
|