mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Initial State Calculator: Prune Unneeded Steps and Variables
In particular, remove unneeded function parameters and don't form a per-cell PVT zero-based index when we're not going to use the values.
This commit is contained in:
parent
f0ed53a6f1
commit
4b04a36a2f
@ -1468,12 +1468,10 @@ equilnum(const Opm::EclipseState& eclipseState,
|
|||||||
std::vector<int> eqlnum(grid.size(0), 0);
|
std::vector<int> eqlnum(grid.size(0), 0);
|
||||||
|
|
||||||
if (eclipseState.fieldProps().has_int("EQLNUM")) {
|
if (eclipseState.fieldProps().has_int("EQLNUM")) {
|
||||||
const int nc = grid.size(/*codim=*/0);
|
|
||||||
eqlnum.resize(nc);
|
|
||||||
|
|
||||||
const auto& e = eclipseState.fieldProps().get_int("EQLNUM");
|
const auto& e = eclipseState.fieldProps().get_int("EQLNUM");
|
||||||
std::transform(e.begin(), e.end(), eqlnum.begin(), [](int n){ return n - 1;});
|
std::transform(e.begin(), e.end(), eqlnum.begin(), [](int n){ return n - 1;});
|
||||||
}
|
}
|
||||||
|
|
||||||
return eqlnum;
|
return eqlnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1514,7 +1512,7 @@ public:
|
|||||||
const Opm::RegionMapping<> eqlmap(equilnum(eclipseState, grid));
|
const Opm::RegionMapping<> eqlmap(equilnum(eclipseState, grid));
|
||||||
const int invalidRegion = -1;
|
const int invalidRegion = -1;
|
||||||
regionPvtIdx_.resize(rec.size(), invalidRegion);
|
regionPvtIdx_.resize(rec.size(), invalidRegion);
|
||||||
setRegionPvtIdx(grid, eclipseState, eqlmap);
|
setRegionPvtIdx(eclipseState, eqlmap);
|
||||||
|
|
||||||
// Create Rs functions.
|
// Create Rs functions.
|
||||||
rsFunc_.reserve(rec.size());
|
rsFunc_.reserve(rec.size());
|
||||||
@ -1616,7 +1614,7 @@ public:
|
|||||||
updateInitialTemperature_(eclipseState);
|
updateInitialTemperature_(eclipseState);
|
||||||
|
|
||||||
// Compute pressures, saturations, rs and rv factors.
|
// Compute pressures, saturations, rs and rv factors.
|
||||||
calcPressSatRsRv(eclipseState, eqlmap, rec, materialLawManager, grid, grav);
|
calcPressSatRsRv(eqlmap, rec, materialLawManager, grid, grav);
|
||||||
|
|
||||||
// Modify oil pressure in no-oil regions so that the pressures of present phases can
|
// Modify oil pressure in no-oil regions so that the pressures of present phases can
|
||||||
// be recovered from the oil pressure and capillary relations.
|
// be recovered from the oil pressure and capillary relations.
|
||||||
@ -1634,12 +1632,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
void updateInitialTemperature_(const Opm::EclipseState& eclState)
|
void updateInitialTemperature_(const Opm::EclipseState& eclState)
|
||||||
{
|
{
|
||||||
// Get the initial temperature data
|
this->temperature_ = eclState.fieldProps().get_double("TEMPI");
|
||||||
std::vector<double> tempiData = eclState.fieldProps().get_double("TEMPI");
|
|
||||||
temperature_ = tempiData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef EquilReg EqReg;
|
|
||||||
std::vector< std::shared_ptr<Miscibility::RsFunction> > rsFunc_;
|
std::vector< std::shared_ptr<Miscibility::RsFunction> > rsFunc_;
|
||||||
std::vector< std::shared_ptr<Miscibility::RsFunction> > rvFunc_;
|
std::vector< std::shared_ptr<Miscibility::RsFunction> > rvFunc_;
|
||||||
std::vector<int> regionPvtIdx_;
|
std::vector<int> regionPvtIdx_;
|
||||||
@ -1651,29 +1646,18 @@ private:
|
|||||||
Vec swatInit_;
|
Vec swatInit_;
|
||||||
|
|
||||||
template<class RMap>
|
template<class RMap>
|
||||||
void setRegionPvtIdx(const Grid& grid, const Opm::EclipseState& eclState, const RMap& reg)
|
void setRegionPvtIdx(const Opm::EclipseState& eclState, const RMap& reg)
|
||||||
{
|
{
|
||||||
size_t numCompressed = grid.size(/*codim=*/0);
|
|
||||||
std::vector<int> cellPvtRegionIdx(numCompressed);
|
|
||||||
|
|
||||||
//Get the PVTNUM data
|
|
||||||
const auto& pvtnumData = eclState.fieldProps().get_int("PVTNUM");
|
const auto& pvtnumData = eclState.fieldProps().get_int("PVTNUM");
|
||||||
// Save pvt indices of regions. Remember
|
|
||||||
// that Eclipse uses Fortran-style indices which start at 1 instead of 0, so we
|
|
||||||
// need to subtract 1.
|
|
||||||
std::transform(pvtnumData.begin(), pvtnumData.end(),
|
|
||||||
cellPvtRegionIdx.begin(), [](int n){ return n - 1;});
|
|
||||||
|
|
||||||
for (const auto& r : reg.activeRegions()) {
|
for (const auto& r : reg.activeRegions()) {
|
||||||
const auto& cells = reg.cells(r);
|
const auto& cells = reg.cells(r);
|
||||||
const int cell = *(cells.begin());
|
regionPvtIdx_[r] = pvtnumData[*cells.begin()] - 1;
|
||||||
regionPvtIdx_[r] = pvtnumData[cell] - 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class RMap, class MaterialLawManager>
|
template <class RMap, class MaterialLawManager>
|
||||||
void calcPressSatRsRv(const Opm::EclipseState& eclState OPM_UNUSED,
|
void calcPressSatRsRv(const RMap& reg,
|
||||||
const RMap& reg,
|
|
||||||
const std::vector< Opm::EquilRecord >& rec,
|
const std::vector< Opm::EquilRecord >& rec,
|
||||||
MaterialLawManager& materialLawManager,
|
MaterialLawManager& materialLawManager,
|
||||||
const Grid& grid,
|
const Grid& grid,
|
||||||
@ -1697,7 +1681,9 @@ private:
|
|||||||
|
|
||||||
Details::verticalExtent(grid, cells, vspan);
|
Details::verticalExtent(grid, cells, vspan);
|
||||||
|
|
||||||
const EqReg eqreg(rec[r], rsFunc_[r], rvFunc_[r], regionPvtIdx_[r]);
|
const auto eqreg = EquilReg {
|
||||||
|
rec[r], this->rsFunc_[r], this->rvFunc_[r], this->regionPvtIdx_[r]
|
||||||
|
};
|
||||||
|
|
||||||
// Ensure gas/oil and oil/water contacts are within the span for the
|
// Ensure gas/oil and oil/water contacts are within the span for the
|
||||||
// phase pressure calculation.
|
// phase pressure calculation.
|
||||||
|
Loading…
Reference in New Issue
Block a user