23 #ifndef OPM_STANDARDWELL_EQUATIONS_HEADER_INCLUDED 24 #define OPM_STANDARDWELL_EQUATIONS_HEADER_INCLUDED 26 #include <opm/simulators/utils/ParallelCommunication.hpp> 27 #include <opm/simulators/wells/WellHelpers.hpp> 28 #include <opm/common/TimingMacros.hpp> 29 #include <dune/common/dynmatrix.hh> 30 #include <dune/common/dynvector.hh> 31 #include <dune/istl/bcrsmatrix.hh> 32 #include <dune/istl/bvector.hh> 37 template<
class Scalar>
class ParallelWellInfo;
38 template<
class Scalar,
typename IndexTraits,
int numEq>
class StandardWellEquationAccess;
39 #if COMPILE_GPU_BRIDGE 40 template<
class Scalar>
class WellContributions;
42 template<
typename Scalar,
typename IndexTraits>
class WellInterfaceGeneric;
43 template<
typename Scalar,
typename IndexTraits>
class WellState;
45 template<
typename Scalar,
typename IndexTraits,
int numEq>
46 class StandardWellEquations
54 using VectorBlockWellType = Dune::DynamicVector<Scalar>;
55 using BVectorWell = Dune::BlockVector<VectorBlockWellType>;
58 using DiagMatrixBlockWellType = Dune::DynamicMatrix<Scalar>;
59 using DiagMatWell = Dune::BCRSMatrix<DiagMatrixBlockWellType>;
62 using OffDiagMatrixBlockWellType = Dune::DynamicMatrix<Scalar>;
63 using OffDiagMatWell = Dune::BCRSMatrix<OffDiagMatrixBlockWellType>;
66 using BVector = Dune::BlockVector<Dune::FieldVector<Scalar,numEq>>;
68 explicit StandardWellEquations(
const ParallelWellInfo<Scalar>& parallel_well_info);
74 void init(
const int numWellEq,
76 const std::vector<int>& cells);
82 void apply(
const BVector& x, BVector& Ax)
const;
85 void apply(BVector& r)
const;
88 void solve(BVectorWell& dx_well)
const;
91 void solve(
const BVectorWell& rhs_well, BVectorWell& x_well)
const;
100 #if COMPILE_GPU_BRIDGE 101 void extract(
const int numStaticWellEq,
103 WellContributions<Scalar>& wellContribs)
const;
107 template<
class SparseMatrixAdapter>
108 void extract(SparseMatrixAdapter& jacobian)
const;
111 template<
class PressureMatrix>
113 const BVector& weights,
114 const int pressureVarIndex,
115 const bool use_well_weights,
116 const WellInterfaceGeneric<Scalar, IndexTraits>& well,
117 const int bhp_var_index,
118 const WellState<Scalar, IndexTraits>& well_state)
const;
136 OffDiagMatWell duneB_;
137 OffDiagMatWell duneC_;
139 DiagMatWell invDuneD_;
146 BVectorWell resWell_;
149 mutable BVectorWell Bx_;
150 mutable BVectorWell invDrw_;
153 std::vector<int> cells_;
158 #endif // OPM_STANDARDWELL_EQUATIONS_HEADER_INCLUDED Class administering assembler access to equation system.
Definition: StandardWellAssemble.cpp:45
void invert()
Invert D matrix.
Definition: StandardWellEquations.cpp:160
void extract(SparseMatrixAdapter &jacobian) const
Add the matrices of this well to the sparse matrix adapter.
Definition: StandardWellEquations.cpp:248
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
void extractCPRPressureMatrix(PressureMatrix &jacobian, const BVector &weights, const int pressureVarIndex, const bool use_well_weights, const WellInterfaceGeneric< Scalar, IndexTraits > &well, const int bhp_var_index, const WellState< Scalar, IndexTraits > &well_state) const
Extract CPR pressure matrix.
Definition: StandardWellEquations.cpp:284
A wrapper around the B matrix for distributed wells.
Definition: WellHelpers.hpp:52
const BVectorWell & residual() const
Returns a const reference to the residual.
Definition: StandardWellEquations.hpp:127
unsigned int getNumBlocks() const
Get the number of blocks of the C and B matrices.
Definition: StandardWellEquations.cpp:276
void apply(const BVector &x, BVector &Ax) const
Apply linear operator to vector.
Definition: StandardWellEquations.cpp:130
void recoverSolutionWell(const BVector &x, BVectorWell &xw) const
Recover well solution.
Definition: StandardWellEquations.cpp:180
void clear()
Set all coefficients to 0.
Definition: StandardWellEquations.cpp:121
void sumDistributed(Parallel::Communication comm)
Sum with off-process contribution.
Definition: StandardWellEquations.cpp:412
void solve(BVectorWell &dx_well) const
Apply inverted D matrix to residual and store in vector.
Definition: StandardWellEquations.cpp:167
void init(const int numWellEq, const int numPerfs, const std::vector< int > &cells)
Setup sparsity pattern for the matrices.
Definition: StandardWellEquations.cpp:57