This commit is contained in:
Elyes Ahmed
2021-12-01 14:00:21 +01:00
parent 2e11d7a13a
commit 5c2b60bcd0
35 changed files with 898 additions and 243 deletions

View File

@@ -1588,26 +1588,27 @@ class InitialStateComputer
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Element = typename GridView::template Codim<0>::Entity;
using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
using Grid = GetPropType<TypeTag, Properties::Grid>;
using CartesianIndexMapper = Dune::CartesianIndexMapper<Grid>;
public:
template<class MaterialLawManager>
InitialStateComputer(MaterialLawManager& materialLawManager,
const EclipseState& eclipseState,
const GridView& gridView,
const Opm::EclipseState& eclipseState,
const Vanguard& vanguard,
const CartesianIndexMapper& cartMapper,
const double grav = unit::gravity,
const double grav = Opm::unit::gravity,
const bool applySwatInit = true)
: temperature_(gridView.size(/*codim=*/0)),
saltConcentration_(gridView.size(/*codim=*/0)),
saltSaturation_(gridView.size(/*codim=*/0)),
: temperature_(vanguard.grid().size(/*codim=*/0)),
saltConcentration_(vanguard.grid().size(/*codim=*/0)),
saltSaturation_(vanguard.grid().size(/*codim=*/0)),
pp_(FluidSystem::numPhases,
std::vector<double>(gridView.size(/*codim=*/0))),
std::vector<double>(vanguard.grid().size(/*codim=*/0))),
sat_(FluidSystem::numPhases,
std::vector<double>(gridView.size(/*codim=*/0))),
rs_(gridView.size(/*codim=*/0)),
rv_(gridView.size(/*codim=*/0)),
std::vector<double>(vanguard.grid().size(/*codim=*/0))),
rs_(vanguard.grid().size(/*codim=*/0)),
rv_(vanguard.grid().size(/*codim=*/0)),
cartesianIndexMapper_(cartMapper)
{
//Check for presence of kw SWATINIT
@@ -1620,13 +1621,14 @@ public:
// Querry cell depth, cell top-bottom.
// numerical aquifer cells might be specified with different depths.
const auto& num_aquifers = eclipseState.aquifer().numericalAquifers();
updateCellProps_(gridView, num_aquifers);
updateCellProps_(vanguard, num_aquifers);
const Grid& grid = vanguard.grid();
// Get the equilibration records.
const std::vector<EquilRecord> rec = getEquil(eclipseState);
const auto& tables = eclipseState.getTableManager();
// Create (inverse) region mapping.
const RegionMapping<> eqlmap(equilnum(eclipseState, gridView));
const RegionMapping<> eqlmap(equilnum(eclipseState, grid));
const int invalidRegion = -1;
regionPvtIdx_.resize(rec.size(), invalidRegion);
setRegionPvtIdx(eclipseState, eqlmap);
@@ -1737,11 +1739,11 @@ public:
updateInitialSaltSaturation_(eclipseState, eqlmap);
// Compute pressures, saturations, rs and rv factors.
const auto& comm = gridView.comm();
const auto& comm = grid.comm();
calcPressSatRsRv(eqlmap, rec, materialLawManager, comm, grav);
// modify the pressure and saturation for numerical aquifer cells
applyNumericalAquifers_(gridView, num_aquifers, eclipseState.runspec().co2Storage());
applyNumericalAquifers_(vanguard, num_aquifers, eclipseState.runspec().co2Storage());
// Modify oil pressure in no-oil regions so that the pressures of present phases can
// be recovered from the oil pressure and capillary relations.
@@ -1835,10 +1837,12 @@ private:
std::vector<std::pair<double,double>> cellZSpan_;
std::vector<std::pair<double,double>> cellZMinMax_;
void updateCellProps_(const GridView& gridView,
void updateCellProps_(const Vanguard& vanguard,
const NumericalAquifers& aquifer)
{
const auto& gridView = vanguard.gridView();
ElementMapper elemMapper(gridView, Dune::mcmgElementLayout());
//const auto& elemMapper = gridView.elementMapper();
int numElements = gridView.size(/*codim=*/0);
cellCenterDepth_.resize(numElements);
cellZSpan_.resize(numElements);
@@ -1869,14 +1873,15 @@ private:
}
}
void applyNumericalAquifers_(const GridView& gridView,
void applyNumericalAquifers_(const Vanguard& vanguard,
const NumericalAquifers& aquifer,
const bool co2store)
{
const auto num_aqu_cells = aquifer.allAquiferCells();
if (num_aqu_cells.empty()) return;
const auto& gridView = vanguard.gridView();
ElementMapper elemMapper(gridView, Dune::mcmgElementLayout());
//const auto& elemMapper = vanguard.gridView().elementMapper();;
auto elemIt = gridView.template begin</*codim=*/0>();
const auto& elemEndIt = gridView.template end</*codim=*/0>();
for (; elemIt != elemEndIt; ++elemIt) {