2017-06-15 04:41:03 -05:00
|
|
|
/*
|
|
|
|
Copyright 2017 SINTEF ICT, Applied Mathematics.
|
|
|
|
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_STANDARDWELL_HEADER_INCLUDED
|
|
|
|
#define OPM_STANDARDWELL_HEADER_INCLUDED
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <opm/autodiff/WellInterface.hpp>
|
|
|
|
|
|
|
|
#include<dune/common/fmatrix.hh>
|
|
|
|
#include<dune/istl/bcrsmatrix.hh>
|
|
|
|
#include<dune/istl/matrixmatrix.hh>
|
|
|
|
|
|
|
|
#include <opm/material/densead/Math.hpp>
|
|
|
|
#include <opm/material/densead/Evaluation.hpp>
|
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
|
2017-06-19 07:49:49 -05:00
|
|
|
template<typename TypeTag>
|
|
|
|
class StandardWell: public WellInterface<TypeTag>
|
2017-06-15 04:41:03 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2017-06-19 07:49:49 -05:00
|
|
|
// using WellInterface<TypeTag>::Simulator;
|
|
|
|
// using WellInterface<TypeTag>::WellState;
|
2017-06-19 09:46:06 -05:00
|
|
|
using Simulator = typename WellInterface<TypeTag>::Simulator;
|
|
|
|
using WellState = typename WellInterface<TypeTag>::WellState;
|
|
|
|
using IntensiveQuantities = typename WellInterface<TypeTag>::IntensiveQuantities;
|
2017-06-20 03:54:33 -05:00
|
|
|
using FluidSystem = typename WellInterface<TypeTag>::FluidSystem;
|
2017-06-19 09:46:06 -05:00
|
|
|
|
2017-06-15 04:41:03 -05:00
|
|
|
// the positions of the primary variables for StandardWell
|
|
|
|
// there are three primary variables, the second and the third ones are F_w and F_g
|
|
|
|
// the first one can be total rate (G_t) or bhp, based on the control
|
|
|
|
enum WellVariablePositions {
|
|
|
|
XvarWell = 0,
|
|
|
|
WFrac = 1,
|
|
|
|
GFrac = 2
|
|
|
|
};
|
|
|
|
|
2017-06-15 10:19:49 -05:00
|
|
|
|
|
|
|
typedef double Scalar;
|
|
|
|
// static const int numEq = BlackoilIndices::numEq;
|
|
|
|
static const int numEq = 3;
|
|
|
|
static const int numWellEq = numEq; //number of wellEq is the same as numEq in the model
|
|
|
|
static const int solventCompIdx = 3; //TODO get this from ebos
|
|
|
|
typedef Dune::FieldVector<Scalar, numEq > VectorBlockType;
|
|
|
|
typedef Dune::FieldMatrix<Scalar, numEq, numEq > MatrixBlockType;
|
|
|
|
typedef Dune::BCRSMatrix <MatrixBlockType> Mat;
|
|
|
|
typedef Dune::BlockVector<VectorBlockType> BVector;
|
|
|
|
typedef DenseAd::Evaluation<double, /*size=*/numEq + numWellEq> EvalWell;
|
|
|
|
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
|
|
|
|
|
2017-06-15 04:41:03 -05:00
|
|
|
// for now, using the matrix and block version in StandardWellsDense.
|
|
|
|
// TODO: for bettern generality, it should contain blocksize_field and blocksize_well.
|
|
|
|
// They are allowed to be different and it will create four types of matrix blocks and two types of
|
|
|
|
// vector blocks.
|
|
|
|
|
|
|
|
/* const static int blocksize = 3;
|
|
|
|
typedef double Scalar;
|
|
|
|
typedef Dune::FieldVector<Scalar, blocksize > VectorBlockType;
|
|
|
|
typedef Dune::FieldMatrix<Scalar, blocksize, blocksize > MatrixBlockType;
|
|
|
|
typedef Dune::BCRSMatrix <MatrixBlockType> Mat;
|
|
|
|
typedef Dune::BlockVector<VectorBlockType> BVector;
|
|
|
|
typedef DenseAd::Evaluation<double, blocksize + blocksize> EvalWell; */
|
|
|
|
/* using WellInterface::EvalWell;
|
|
|
|
using WellInterface::BVector;
|
|
|
|
using WellInterface::Mat;
|
|
|
|
using WellInterface::MatrixBlockType;
|
|
|
|
using WellInterface::VectorBlockType; */
|
|
|
|
|
2017-06-15 10:19:49 -05:00
|
|
|
StandardWell(const Well* well, const int time_step, const Wells* wells);
|
2017-06-15 04:41:03 -05:00
|
|
|
|
|
|
|
/// the densities of the fluid in each perforation
|
|
|
|
virtual const std::vector<double>& perfDensities() const;
|
|
|
|
virtual std::vector<double>& perfDensities();
|
|
|
|
|
|
|
|
/// the pressure difference between different perforations
|
|
|
|
virtual const std::vector<double>& perfPressureDiffs() const;
|
|
|
|
virtual std::vector<double>& perfPressureDiffs();
|
|
|
|
|
|
|
|
virtual void assembleWellEq(Simulator& ebos_simulator,
|
|
|
|
const double dt,
|
|
|
|
WellState& well_state,
|
|
|
|
bool only_wells);
|
|
|
|
|
|
|
|
virtual void setWellVariables(const WellState& well_state);
|
|
|
|
|
|
|
|
EvalWell wellVolumeFractionScaled(const int phase) const;
|
|
|
|
|
|
|
|
EvalWell wellVolumeFraction(const int phase) const;
|
|
|
|
|
|
|
|
EvalWell wellSurfaceVolumeFraction(const int phase) const;
|
|
|
|
|
2017-06-19 08:24:49 -05:00
|
|
|
EvalWell extendEval(const Eval& in) const;
|
|
|
|
|
2017-06-19 09:46:06 -05:00
|
|
|
// TODO: to check whether all the paramters are required
|
|
|
|
void computePerfRate(const IntensiveQuantities& intQuants,
|
|
|
|
const std::vector<EvalWell>& mob_perfcells_dense,
|
2017-06-20 03:54:33 -05:00
|
|
|
const double Tw, const EvalWell& bhp, const double& cdp,
|
2017-06-19 09:46:06 -05:00
|
|
|
const bool& allow_cf, std::vector<EvalWell>& cq_s) const;
|
|
|
|
|
2017-06-19 07:49:49 -05:00
|
|
|
using WellInterface<TypeTag>::phaseUsage;
|
|
|
|
using WellInterface<TypeTag>::active;
|
|
|
|
using WellInterface<TypeTag>::numberOfPerforations;
|
|
|
|
using WellInterface<TypeTag>::indexOfWell;
|
|
|
|
using WellInterface<TypeTag>::name;
|
|
|
|
using WellInterface<TypeTag>::wellType;
|
|
|
|
using WellInterface<TypeTag>::wellControls;
|
|
|
|
using WellInterface<TypeTag>::compFrac;
|
|
|
|
using WellInterface<TypeTag>::numberOfPhases;
|
|
|
|
using WellInterface<TypeTag>::perfDepth;
|
2017-06-19 08:24:49 -05:00
|
|
|
using WellInterface<TypeTag>::flowToEbosPvIdx;
|
2017-06-20 03:54:33 -05:00
|
|
|
using WellInterface<TypeTag>::flowPhaseToEbosPhaseIdx;
|
2017-06-19 09:46:06 -05:00
|
|
|
using WellInterface<TypeTag>::numComponents;
|
2017-06-20 03:54:33 -05:00
|
|
|
using WellInterface<TypeTag>::numPhases;
|
|
|
|
using WellInterface<TypeTag>::has_solvent;
|
2017-06-19 07:49:49 -05:00
|
|
|
|
2017-06-15 04:41:03 -05:00
|
|
|
protected:
|
2017-06-19 07:49:49 -05:00
|
|
|
|
|
|
|
using WellInterface<TypeTag>::vfp_properties_;
|
|
|
|
using WellInterface<TypeTag>::gravity_;
|
|
|
|
|
2017-06-15 04:41:03 -05:00
|
|
|
// densities of the fluid in each perforation
|
|
|
|
std::vector<double> perf_densities_;
|
|
|
|
// pressure drop between different perforations
|
|
|
|
std::vector<double> perf_pressure_diffs_;
|
|
|
|
|
|
|
|
// TODO: probably, they should be moved to the WellInterface, when
|
|
|
|
// we decide the template paramters.
|
|
|
|
// two off-diagonal matrices
|
|
|
|
Mat dune_B_;
|
|
|
|
Mat dune_C_;
|
|
|
|
// diagonal matrix for the well
|
|
|
|
Mat inv_dune_D_;
|
|
|
|
|
|
|
|
BVector res_well_;
|
|
|
|
|
|
|
|
std::vector<EvalWell> well_variables_;
|
|
|
|
|
|
|
|
// TODO: this function should be moved to the base class.
|
|
|
|
// while it faces chanllenges for MSWell later, since the calculation of bhp
|
|
|
|
// based on THP is never implemented for MSWell yet.
|
|
|
|
EvalWell getBhp() const;
|
|
|
|
|
|
|
|
// TODO: it is also possible to be moved to the base class.
|
|
|
|
EvalWell getQs(const int phase) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-06-19 07:49:49 -05:00
|
|
|
#include "StandardWell_impl.hpp"
|
|
|
|
|
2017-06-15 04:41:03 -05:00
|
|
|
#endif // OPM_STANDARDWELL_HEADER_INCLUDED
|