EclEquilInitializer: make it work for ALUGrid.

This commit is contained in:
Robert Kloefkorn 2015-10-20 16:41:21 +02:00
parent ca4da50902
commit af5cea2add
3 changed files with 32 additions and 11 deletions

View File

@ -76,7 +76,7 @@ public:
: simulator_(simulator) : simulator_(simulator)
{ {
const auto& gridManager = simulator.gridManager(); const auto& gridManager = simulator.gridManager();
const auto& grid = gridManager.grid(); const auto& equilGrid = gridManager.equilGrid();
// create the data structures which are used by initStateEquil() // create the data structures which are used by initStateEquil()
Opm::parameter::ParameterGroup tmpParam; Opm::parameter::ParameterGroup tmpParam;
@ -84,19 +84,21 @@ public:
gridManager.deck(), gridManager.deck(),
gridManager.eclState(), gridManager.eclState(),
materialLawManager, materialLawManager,
Opm::UgGridHelpers::numCells(grid), Opm::UgGridHelpers::numCells(equilGrid),
Opm::UgGridHelpers::globalCell(grid), Opm::UgGridHelpers::globalCell(equilGrid),
Opm::UgGridHelpers::cartDims(grid), Opm::UgGridHelpers::cartDims(equilGrid),
tmpParam); tmpParam);
const int numElems = equilGrid.size(/*codim=*/0);
assert( int(gridManager.grid().size(/*codim=*/0)) == numElems );
// initialize the boiler plate of opm-core the state structure. // initialize the boiler plate of opm-core the state structure.
Opm::BlackoilState opmBlackoilState; Opm::BlackoilState opmBlackoilState;
opmBlackoilState.init(grid.size(/*codim=*/0), opmBlackoilState.init(numElems,
/*numFaces=*/0, // we don't care here /*numFaces=*/0, // we don't care here
numPhases); numPhases);
// do the actual computation. // do the actual computation.
Opm::initStateEquil(gridManager.grid(), Opm::initStateEquil(equilGrid,
opmBlackoilProps, opmBlackoilProps,
gridManager.deck(), gridManager.deck(),
gridManager.eclState(), gridManager.eclState(),
@ -109,7 +111,6 @@ public:
const Scalar MO = FluidSystem::molarMass(oilCompIdx); const Scalar MO = FluidSystem::molarMass(oilCompIdx);
// copy the result into the array of initial fluid states // copy the result into the array of initial fluid states
int numElems = gridManager.gridView().size(/*codim=*/0);
initialFluidStates_.resize(numElems); initialFluidStates_.resize(numElems);
for (int elemIdx = 0; elemIdx < numElems; ++elemIdx) { for (int elemIdx = 0; elemIdx < numElems; ++elemIdx) {
auto &fluidState = initialFluidStates_[elemIdx]; auto &fluidState = initialFluidStates_[elemIdx];

View File

@ -41,6 +41,7 @@
#include <ewoms/models/blackoil/blackoilmodel.hh> #include <ewoms/models/blackoil/blackoilmodel.hh>
#include <ewoms/disc/ecfv/ecfvdiscretization.hh> #include <ewoms/disc/ecfv/ecfvdiscretization.hh>
#include <ewoms/io/polyhedralgridconverter.hh>
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp> #include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
#include <opm/material/fluidstates/CompositionalFluidState.hpp> #include <opm/material/fluidstates/CompositionalFluidState.hpp>
@ -849,9 +850,6 @@ private:
void readEquilInitialCondition_() void readEquilInitialCondition_()
{ {
#if EBOS_USE_ALUGRID
#warning "EQUIL-based initialization cannot yet be used with ALUGrid"
#else
// The EQUIL initializer also modifies the material law manager according to // The EQUIL initializer also modifies the material law manager according to
// SWATINIT (although it does not belong there strictly speaking) // SWATINIT (although it does not belong there strictly speaking)
typedef Ewoms::EclEquilInitializer<TypeTag> EquilInitializer; typedef Ewoms::EclEquilInitializer<TypeTag> EquilInitializer;
@ -868,7 +866,9 @@ private:
auto &elemFluidState = initialFluidStates_[elemIdx]; auto &elemFluidState = initialFluidStates_[elemIdx];
elemFluidState.assign(equilInitializer.initialFluidState(elemIdx)); elemFluidState.assign(equilInitializer.initialFluidState(elemIdx));
} }
#endif
// release the equil grid pointer since it's no longer needed.
this->simulator().gridManager().releaseEquilGrid();
} }
void readExplicitInitialCondition_() void readExplicitInitialCondition_()

View File

@ -1,3 +1,23 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
Copyright 2015 IRIS AS
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_CARTESIANINDEXMAPPER_HEADER #ifndef OPM_CARTESIANINDEXMAPPER_HEADER
#define OPM_CARTESIANINDEXMAPPER_HEADER #define OPM_CARTESIANINDEXMAPPER_HEADER