mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add gather/scatter support for wells
This commit is contained in:
parent
747badaea8
commit
2dffbb3a70
@ -147,6 +147,7 @@ namespace Opm {
|
||||
, canph_ (active2Canonical(fluid.phaseUsage()))
|
||||
, cells_ (buildAllCells(grid.number_of_cells))
|
||||
, ops_ (grid)
|
||||
, wops_ (wells)
|
||||
, grav_ (gravityOperator(grid_, ops_, geo_))
|
||||
, rq_ (fluid.numPhases())
|
||||
{
|
||||
@ -215,6 +216,34 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
FullyImplicitBlackoilSolver::
|
||||
WellOps::WellOps(const Wells& wells)
|
||||
: w2p(wells.well_connpos[ wells.number_of_wells ],
|
||||
wells.number_of_wells)
|
||||
, p2w(wells.number_of_wells,
|
||||
wells.well_connpos[ wells.number_of_wells ])
|
||||
{
|
||||
const int nw = wells.number_of_wells;
|
||||
const int* const wpos = wells.well_connpos;
|
||||
|
||||
typedef Eigen::Triplet<double> Tri;
|
||||
|
||||
std::vector<Tri> scatter, gather;
|
||||
scatter.reserve(wpos[nw]);
|
||||
gather .reserve(wpos[nw]);
|
||||
|
||||
for (int w = 0, i = 0; w < nw; ++w) {
|
||||
for (; i < wpos[ w + 1 ]; ++i) {
|
||||
scatter.push_back(Tri(i, w, 1.0));
|
||||
gather .push_back(Tri(w, i, 1.0));
|
||||
}
|
||||
}
|
||||
|
||||
w2p.setFromTriplets(scatter.begin(), scatter.end());
|
||||
p2w.setFromTriplets(gather .begin(), gather .end());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FullyImplicitBlackoilSolver::allocateResidual()
|
||||
{
|
||||
|
@ -80,6 +80,12 @@ namespace Opm {
|
||||
ADB Rs;
|
||||
};
|
||||
|
||||
struct WellOps {
|
||||
WellOps(const Wells& wells);
|
||||
M w2p; // well -> perf (scatter)
|
||||
M p2w; // perf -> well (gather)
|
||||
};
|
||||
|
||||
enum { Water = BlackoilPropsAdInterface::Water,
|
||||
Oil = BlackoilPropsAdInterface::Oil ,
|
||||
Gas = BlackoilPropsAdInterface::Gas };
|
||||
@ -95,6 +101,7 @@ namespace Opm {
|
||||
const std::vector<int> canph_;
|
||||
const std::vector<int> cells_; // All grid cells
|
||||
HelperOps ops_;
|
||||
const WellOps wops_;
|
||||
const M grav_;
|
||||
|
||||
std::vector<ReservoirResidualQuant> rq_;
|
||||
|
Loading…
Reference in New Issue
Block a user