mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
adapting to the upstream interface change.
This commit is contained in:
@@ -792,17 +792,20 @@ protected:
|
||||
ElementMapper elemMapper(this->gridView(), Dune::mcmgElementLayout());
|
||||
auto elemIt = this->gridView().template begin</*codim=*/0>();
|
||||
const auto& elemEndIt = this->gridView().template end</*codim=*/0>();
|
||||
|
||||
const auto num_aqu_cells = this->eclState_->aquifer().numericalAquifers().allAquiferCells();
|
||||
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const Element& element = *elemIt;
|
||||
const unsigned int elemIdx = elemMapper.index(element);
|
||||
cellCenterDepth_[elemIdx] = cellCenterDepth(element);
|
||||
|
||||
if (this->eclState_->aquifer().hasNumericalAquifer()) {
|
||||
const auto& num_aquifer = this->eclState_->aquifer().numericalAquifers();
|
||||
const unsigned int global_index = cartesianIndex(elemIdx);
|
||||
if (num_aquifer.hasCell(global_index)) {
|
||||
const auto& cell = num_aquifer.aquiferCells().at(global_index);
|
||||
cellCenterDepth_[elemIdx] = cell.depth;
|
||||
const auto search = num_aqu_cells.find(global_index);
|
||||
if (search != num_aqu_cells.end()) {
|
||||
// updating the cell depth using aquifer cell depth
|
||||
cellCenterDepth_[elemIdx] = search->second->depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,21 +342,14 @@ protected:
|
||||
{
|
||||
grid_.reset(new Dune::CpGrid());
|
||||
|
||||
std::unordered_map<size_t, double> aquifer_cell_volumes;
|
||||
if (this->eclState().aquifer().hasNumericalAquifer()) {
|
||||
aquifer_cell_volumes = this->eclState().aquifer().numericalAquifers().cellVolumes();
|
||||
}
|
||||
grid_->processEclipseFormat(this->eclState(),
|
||||
this->deck(),
|
||||
mpiRank == 0 ? &this->eclState().getInputGrid()
|
||||
grid_->processEclipseFormat(mpiRank == 0 ? &this->eclState().getInputGrid()
|
||||
: nullptr,
|
||||
/*isPeriodic=*/false,
|
||||
this->eclState().getInputNNC(),
|
||||
/*flipNormals=*/false,
|
||||
/*clipZ=*/false,
|
||||
mpiRank == 0 ? this->eclState().fieldProps().porv(true)
|
||||
: std::vector<double>(),
|
||||
aquifer_cell_volumes);
|
||||
this->eclState().getInputNNC());
|
||||
|
||||
// we use separate grid objects: one for the calculation of the initial condition
|
||||
// via EQUIL and one for the actual simulation. The reason is that the EQUIL code
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/SaltvdTable.hpp>
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||
#include <opm/material/fluidstates/SimpleModularFluidState.hpp>
|
||||
@@ -1792,15 +1793,18 @@ private:
|
||||
|
||||
auto elemIt = gridView.template begin</*codim=*/0>();
|
||||
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
||||
const auto num_aqu_cells = aquifer.allAquiferCells();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const Element& element = *elemIt;
|
||||
const unsigned int elemIdx = elemMapper.index(element);
|
||||
cellCenterDepth_[elemIdx] = Details::cellCenterDepth(element);
|
||||
const auto cartIx = cartesianIndexMapper_.cartesianIndex(elemIdx);
|
||||
if (aquifer.hasCell(cartIx)) {
|
||||
const auto& aqu_cells = aquifer.aquiferCells();
|
||||
const auto& aqu_cell = aqu_cells.at(cartIx);
|
||||
cellCenterDepth_[elemIdx] = aqu_cell.depth;
|
||||
if (!num_aqu_cells.empty()) {
|
||||
const auto search = num_aqu_cells.find(cartIx);
|
||||
if (search != num_aqu_cells.end()) {
|
||||
const auto* aqu_cell = num_aqu_cells.at(cartIx);
|
||||
cellCenterDepth_[elemIdx] = aqu_cell->depth;
|
||||
}
|
||||
}
|
||||
cellZSpan_[elemIdx] = Details::cellZSpan(element);
|
||||
cellZMinMax_[elemIdx] = Details::cellZMinMax(element);
|
||||
@@ -1933,8 +1937,8 @@ private:
|
||||
decltype(std::declval<CellPos>().cell)>>;
|
||||
// TODO: might not needed
|
||||
ElementMapper elemMapper(gridView, Dune::mcmgElementLayout());
|
||||
|
||||
this->cellLoop(cells, [this, &eqreg, &ptable, &elemMapper, &aquifer, &psat]
|
||||
const auto num_aqu_cells = aquifer.allAquiferCells();
|
||||
this->cellLoop(cells, [this, &eqreg, &ptable, &elemMapper, &num_aqu_cells, &psat]
|
||||
(const CellID cell,
|
||||
Details::PhaseQuantityValue& pressures,
|
||||
Details::PhaseQuantityValue& saturations,
|
||||
@@ -1946,26 +1950,26 @@ private:
|
||||
};
|
||||
|
||||
saturations = psat.deriveSaturations(pos, eqreg, ptable);
|
||||
pressures = psat.correctedPhasePressures();
|
||||
|
||||
// TODO: not totally sure this is the cartesian Index
|
||||
const auto global_index = cartesianIndexMapper_.cartesianIndex(cell);
|
||||
if (aquifer.hasCell(global_index)) {
|
||||
saturations = {0.0, 0.0, 1.0};
|
||||
const auto &aqu_cell = aquifer.getCell(global_index);
|
||||
std::ostringstream ss;
|
||||
ss << "FOR AQUIFER CELL AT { " << aqu_cell.I + 1 << " " << aqu_cell.J + 1 << " "
|
||||
<< aqu_cell.K + 1 << " } OF NUMERICAL AQUIFER " << aqu_cell.aquifer_id << " with global_index " << global_index << ", "
|
||||
<< "WATER SATURATION IS SET TO BE UNITY";
|
||||
OpmLog::info(ss.str());
|
||||
}
|
||||
pressures = psat.correctedPhasePressures();
|
||||
if (aquifer.hasCell(global_index)) {
|
||||
const auto &aqu_cell = aquifer.getCell(global_index);
|
||||
// TODO: NOT totally sure what we should do here to employ the pressure specified by AQUNUM
|
||||
if (aqu_cell.init_pressure > 0.) {
|
||||
const double pres = aqu_cell.init_pressure;
|
||||
pressures = {pres, pres, pres};
|
||||
if (!num_aqu_cells.empty()) {
|
||||
const auto search = num_aqu_cells.find(global_index);
|
||||
if (search != num_aqu_cells.end()) {
|
||||
const auto* aqu_cell = num_aqu_cells.at(global_index);
|
||||
const auto msg = fmt::format("FOR AQUIFER CELL AT ({}, {}, {}) OF NUMERICAL "
|
||||
"AQUIFER {}, WATER SATURATION IS SET TO BE UNITY",
|
||||
aqu_cell->I+1, aqu_cell->J+1, aqu_cell->K+1, aqu_cell->aquifer_id);
|
||||
OpmLog::info(msg);
|
||||
|
||||
if (aqu_cell->init_pressure) {
|
||||
// TODO: NOT totally sure what we should do here to employ the pressure specified by AQUNUM
|
||||
const double pres = *(aqu_cell->init_pressure);
|
||||
pressures = {pres, pres, pres};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const auto temp = this->temperature_[cell];
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/NumericalAquifer.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Aquifer/NumericalAquifer/NumericalAquifers.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
@@ -59,13 +59,12 @@ public:
|
||||
, cumulative_flux_(0.)
|
||||
, global_cell_(global_cell)
|
||||
{
|
||||
|
||||
this->cell_to_aquifer_cell_idx_.resize(this->ebos_simulator_.gridView().size(/*codim=*/0), -1);
|
||||
const auto& cells = this->aquifer_.cells();
|
||||
|
||||
// TODO: here, the parallisam is obviously ignored
|
||||
for (size_t idx = 0; idx < cells.size(); ++idx) {
|
||||
const int global_idx = cells[idx].global_index;
|
||||
// TODO: here, the parallelisation is obviously ignored
|
||||
for (size_t idx = 0; idx < aquifer.numCells(); ++idx) {
|
||||
const auto& cell = *(aquifer.getCellPrt(idx));
|
||||
const int global_idx = cell.global_index;
|
||||
const int cell_idx = cartesian_to_compressed.at(global_idx);
|
||||
this->cell_to_aquifer_cell_idx_[cell_idx] = idx;
|
||||
}
|
||||
@@ -172,7 +171,7 @@ private:
|
||||
elem_ctx.updateAllExtensiveQuantities();
|
||||
|
||||
const size_t num_interior_faces = elem_ctx.numInteriorFaces(/*timeIdx*/ 0);
|
||||
const auto &problem = elem_ctx.problem();
|
||||
// const auto &problem = elem_ctx.problem();
|
||||
const auto &stencil = elem_ctx.stencil(0);
|
||||
// const auto& inQuants = elem_ctx.intensiveQuantities(0, /*timeIdx*/ 0);
|
||||
|
||||
@@ -182,10 +181,10 @@ private:
|
||||
const size_t i = face.interiorIndex();
|
||||
const size_t j = face.exteriorIndex();
|
||||
// compressed index
|
||||
const size_t I = stencil.globalSpaceIndex(i);
|
||||
// const size_t I = stencil.globalSpaceIndex(i);
|
||||
const size_t J = stencil.globalSpaceIndex(j);
|
||||
|
||||
assert(I == cell_index);
|
||||
assert(stencil.globalSpaceIndex(i) == cell_index);
|
||||
|
||||
// we do not consider the flux within aquifer cells
|
||||
// we only need the flux to the connections
|
||||
|
||||
@@ -195,14 +195,16 @@ BlackoilAquiferModel<TypeTag>::init()
|
||||
}
|
||||
|
||||
if (aquifer.hasNumericalAquifer()) {
|
||||
const auto aquifers = aquifer.numericalAquifers().aquifers();
|
||||
const auto& ugrid = simulator_.vanguard().grid();
|
||||
const int number_of_cells = simulator_.gridView().size(0);
|
||||
const int* global_cell = Opm::UgGridHelpers::globalCell(ugrid);
|
||||
const std::unordered_map<int, int> cartesian_to_compressed = cartesianToCompressed(number_of_cells,
|
||||
global_cell);
|
||||
for (const auto& elem : aquifer.numericalAquifers().aquifers()) {
|
||||
this->aquifers_numerical.emplace_back(elem.second,
|
||||
cartesian_to_compressed, this->simulator_, global_cell);
|
||||
// for (const auto& elem : ers().aquifers()) {
|
||||
for (const auto& [id, aqu] : aquifers) {
|
||||
this->aquifers_numerical.emplace_back(aqu,
|
||||
cartesian_to_compressed, this->simulator_, global_cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +475,9 @@ BOOST_AUTO_TEST_CASE(DeckAllDead)
|
||||
Opm::GridManager gm(eclipseState.getInputGrid());
|
||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(), eclipseState, simulator->vanguard().gridView(), 10.0);
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(),
|
||||
eclipseState, simulator->vanguard().gridView(),
|
||||
simulator->vanguard().cartesianMapper(), 10.0);
|
||||
const auto& pressures = comp.press();
|
||||
BOOST_REQUIRE_EQUAL(pressures.size(), 3U);
|
||||
BOOST_REQUIRE_EQUAL(int(pressures[0].size()), grid.number_of_cells);
|
||||
@@ -552,7 +554,9 @@ BOOST_AUTO_TEST_CASE(DeckWithCapillary)
|
||||
Opm::GridManager gm(eclipseState.getInputGrid());
|
||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(), eclipseState, simulator->vanguard().gridView(), 10.0);
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(),
|
||||
eclipseState, simulator->vanguard().gridView(),
|
||||
simulator->vanguard().cartesianMapper(), 10.0);
|
||||
|
||||
const auto& pressures = comp.press();
|
||||
BOOST_REQUIRE_EQUAL(pressures.size(), 3U);
|
||||
@@ -590,7 +594,9 @@ BOOST_AUTO_TEST_CASE(DeckWithCapillaryOverlap)
|
||||
Opm::GridManager gm(eclipseState.getInputGrid());
|
||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(), eclipseState, simulator->vanguard().gridView(), 9.80665);
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(),
|
||||
eclipseState, simulator->vanguard().gridView(),
|
||||
simulator->vanguard().cartesianMapper(), 9.80665);
|
||||
const auto& pressures = comp.press();
|
||||
BOOST_REQUIRE_EQUAL(pressures.size(), 3U);
|
||||
BOOST_REQUIRE_EQUAL(int(pressures[0].size()), grid.number_of_cells);
|
||||
@@ -649,7 +655,9 @@ BOOST_AUTO_TEST_CASE(DeckWithLiveOil)
|
||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||
|
||||
// Initialize the fluid system
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(), eclipseState, simulator->vanguard().gridView(), 9.80665);
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(),
|
||||
eclipseState, simulator->vanguard().gridView(),
|
||||
simulator->vanguard().cartesianMapper(), 9.80665);
|
||||
const auto& pressures = comp.press();
|
||||
BOOST_REQUIRE_EQUAL(pressures.size(), 3U);
|
||||
BOOST_REQUIRE_EQUAL(int(pressures[0].size()), grid.number_of_cells);
|
||||
@@ -724,7 +732,9 @@ BOOST_AUTO_TEST_CASE(DeckWithLiveGas)
|
||||
Opm::GridManager gm(eclipseState.getInputGrid());
|
||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(), eclipseState, simulator->vanguard().gridView(), 9.80665);
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(),
|
||||
eclipseState, simulator->vanguard().gridView(),
|
||||
simulator->vanguard().cartesianMapper(), 9.80665);
|
||||
const auto& pressures = comp.press();
|
||||
BOOST_REQUIRE_EQUAL(pressures.size(), 3U);
|
||||
BOOST_REQUIRE_EQUAL(int(pressures[0].size()), grid.number_of_cells);
|
||||
@@ -802,7 +812,9 @@ BOOST_AUTO_TEST_CASE(DeckWithRSVDAndRVVD)
|
||||
Opm::GridManager gm(eclipseState.getInputGrid());
|
||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(), eclipseState, simulator->vanguard().gridView(), 9.80665);
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(),
|
||||
eclipseState, simulator->vanguard().gridView(),
|
||||
simulator->vanguard().cartesianMapper(), 9.80665);
|
||||
const auto& pressures = comp.press();
|
||||
BOOST_REQUIRE_EQUAL(pressures.size(), 3U);
|
||||
BOOST_REQUIRE_EQUAL(int(pressures[0].size()), grid.number_of_cells);
|
||||
@@ -900,7 +912,9 @@ BOOST_AUTO_TEST_CASE(DeckWithPBVDAndPDVD)
|
||||
Opm::GridManager gm(eclipseState.getInputGrid());
|
||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(), eclipseState, simulator->vanguard().gridView(), 9.80665);
|
||||
Opm::EQUIL::DeckDependent::InitialStateComputer<TypeTag> comp(*simulator->problem().materialLawManager(),
|
||||
eclipseState, simulator->vanguard().gridView(),
|
||||
simulator->vanguard().cartesianMapper(), 9.80665);
|
||||
const auto& pressures = comp.press();
|
||||
BOOST_REQUIRE_EQUAL(pressures.size(), 3U);
|
||||
BOOST_REQUIRE_EQUAL(int(pressures[0].size()), grid.number_of_cells);
|
||||
|
||||
Reference in New Issue
Block a user