equel init: pass the type tag to the InitialStateComputer

also, get rid of Opm::extractPvtTableIndex()
This commit is contained in:
Andreas Lauser 2018-01-02 12:43:56 +01:00
parent 028a8c808b
commit 3f875fb8f2
3 changed files with 42 additions and 21 deletions

View File

@ -93,10 +93,10 @@ public:
unsigned numCartesianElems = gridManager.cartesianSize();
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
EQUIL::DeckDependent::InitialStateComputer<FluidSystem> initialState(materialLawManager,
gridManager.eclState(),
gridManager.grid(),
simulator.problem().gravity()[dimWorld - 1]);
EQUIL::DeckDependent::InitialStateComputer<TypeTag> initialState(materialLawManager,
gridManager.eclState(),
gridManager.grid(),
simulator.problem().gravity()[dimWorld - 1]);
// copy the result into the array of initial fluid states
initialFluidStates_.resize(numCartesianElems);

View File

@ -26,8 +26,8 @@
* \brief Auxiliary routines that to solve the ODEs that emerge from the hydrostatic
* equilibrium problem
*/
#ifndef EWOMS_EQUILIBRATIONHELPERS_HEADER_INCLUDED
#define EWOMS_EQUILIBRATIONHELPERS_HEADER_INCLUDED
#ifndef EWOMS_EQUILIBRATIONHELPERS_HH
#define EWOMS_EQUILIBRATIONHELPERS_HH
#include <opm/core/utility/linearInterpolation.hpp>
#include <opm/core/utility/RegionMapping.hpp>

View File

@ -26,13 +26,14 @@
* \brief Routines that actually solve the ODEs that emerge from the hydrostatic
* equilibrium problem
*/
#ifndef EWOMS_INITSTATEEQUIL_HEADER_INCLUDED
#define EWOMS_INITSTATEEQUIL_HEADER_INCLUDED
#ifndef EWOMS_INITSTATEEQUIL_HH
#define EWOMS_INITSTATEEQUIL_HH
#include "EquilibrationHelpers.hpp"
#include "RegionMapping.hpp"
#include <opm/core/utility/extractPvtTableIndex.hpp>
#include <ewoms/common/propertysystem.hh>
#include <dune/grid/cpgrid/GridHelpers.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@ -292,10 +293,10 @@ assign(const Grid& grid ,
}
}
template < class FluidSystem,
class Grid,
class Region,
class CellRange>
template <class FluidSystem,
class Grid,
class Region,
class CellRange>
void
water(const Grid& grid ,
const Region& reg ,
@ -919,10 +920,15 @@ equilnum(const Opm::EclipseState& eclipseState,
return eqlnum;
}
template<class FluidSystem>
class InitialStateComputer {
template<class TypeTag>
class InitialStateComputer
{
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
public:
template<class MaterialLawManager, class Grid>
template<class MaterialLawManager>
InitialStateComputer(MaterialLawManager& materialLawManager,
const Opm::EclipseState& eclipseState,
const Grid& grid ,
@ -1060,11 +1066,26 @@ private:
Vec rv_;
Vec swat_init_;
template<class Grid, class RMap>
void setRegionPvtIdx(const Grid& grid, const Opm::EclipseState& eclipseState, const RMap& reg) {
template<class RMap>
void setRegionPvtIdx(const Grid& grid, const Opm::EclipseState& eclState, const RMap& reg)
{
size_t numCompressed = grid.size(/*codim=*/0);
const auto* globalCell = Opm::UgGridHelpers::globalCell(grid);
std::vector<int> cellPvtRegionIdx(numCompressed);
//Get the PVTNUM data
const std::vector<int>& pvtnumData = eclState.get3DProperties().getIntGridProperty("PVTNUM").getData();
// Convert PVTNUM data into an array of indices for compressed cells. Remember
// that Eclipse uses Fortran-style indices which start at 1 instead of 0, so we
// need to subtract 1.
for (size_t cellIdx = 0; cellIdx < numCompressed; ++ cellIdx) {
size_t cartesianCellIdx = globalCell[cellIdx];
assert(cartesianCellIdx < pvtnumData.size());
size_t pvtRegionIdx = pvtnumData[cartesianCellIdx] - 1;
cellPvtRegionIdx[cellIdx] = pvtRegionIdx;
}
std::vector<int> cellPvtRegionIdx;
extractPvtTableIndex(cellPvtRegionIdx, eclipseState, grid.size(/*codim=*/0), Opm::UgGridHelpers::globalCell(grid));
for (const auto& r : reg.activeRegions()) {
const auto& cells = reg.cells(r);
const int cell = *(cells.begin());
@ -1072,7 +1093,7 @@ private:
}
}
template <class RMap, class MaterialLawManager, class Grid>
template <class RMap, class MaterialLawManager>
void
calcPressSatRsRv(const RMap& reg ,
const std::vector< Opm::EquilRecord >& rec ,