2016-01-05 12:32:36 -06:00
|
|
|
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
// vi: set et ts=4 sw=4 sts=4:
|
|
|
|
/*
|
|
|
|
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 2 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/>.
|
2016-03-14 07:21:47 -05:00
|
|
|
|
|
|
|
Consult the COPYING file in the top-level source directory of this
|
|
|
|
module for the precise wording of the license and the list of
|
|
|
|
copyright holders.
|
2016-01-05 12:32:36 -06:00
|
|
|
*/
|
|
|
|
/*!
|
|
|
|
* \file
|
2019-09-05 10:04:39 -05:00
|
|
|
* \copydoc Opm::EclPolyhedralGridVanguard
|
2016-01-05 12:32:36 -06:00
|
|
|
*/
|
2018-02-01 09:26:58 -06:00
|
|
|
#ifndef EWOMS_ECL_POLYHEDRAL_GRID_VANGUARD_HH
|
|
|
|
#define EWOMS_ECL_POLYHEDRAL_GRID_VANGUARD_HH
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2021-05-05 05:13:25 -05:00
|
|
|
#include <opm/models/common/multiphasebaseproperties.hh>
|
|
|
|
|
2018-02-01 09:26:58 -06:00
|
|
|
#include "eclbasevanguard.hh"
|
2019-12-11 15:04:40 -06:00
|
|
|
#include "ecltransmissibility.hh"
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2018-02-08 05:20:17 -06:00
|
|
|
#include <opm/grid/polyhedralgrid.hh>
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2019-09-05 10:04:39 -05:00
|
|
|
namespace Opm {
|
2016-01-05 12:32:36 -06:00
|
|
|
template <class TypeTag>
|
2018-02-01 09:26:58 -06:00
|
|
|
class EclPolyhedralGridVanguard;
|
2018-06-14 09:06:05 -05:00
|
|
|
}
|
|
|
|
|
2020-08-21 06:42:08 -05:00
|
|
|
namespace Opm::Properties {
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2020-08-27 03:30:29 -05:00
|
|
|
namespace TTag {
|
|
|
|
struct EclPolyhedralGridVanguard {
|
|
|
|
using InheritsFrom = std::tuple<EclBaseVanguard>;
|
|
|
|
};
|
|
|
|
}
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
// declare the properties
|
2020-08-27 04:38:38 -05:00
|
|
|
template<class TypeTag>
|
|
|
|
struct Vanguard<TypeTag, TTag::EclPolyhedralGridVanguard> {
|
|
|
|
using type = Opm::EclPolyhedralGridVanguard<TypeTag>;
|
|
|
|
};
|
|
|
|
template<class TypeTag>
|
|
|
|
struct Grid<TypeTag, TTag::EclPolyhedralGridVanguard> {
|
|
|
|
using type = Dune::PolyhedralGrid<3, 3>;
|
|
|
|
};
|
|
|
|
template<class TypeTag>
|
|
|
|
struct EquilGrid<TypeTag, TTag::EclPolyhedralGridVanguard> {
|
|
|
|
using type = GetPropType<TypeTag, Properties::Grid>;
|
|
|
|
};
|
2018-06-14 09:06:05 -05:00
|
|
|
|
2020-08-21 06:42:08 -05:00
|
|
|
} // namespace Opm::Properties
|
2018-06-14 09:06:05 -05:00
|
|
|
|
2019-09-05 10:04:39 -05:00
|
|
|
namespace Opm {
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \ingroup EclBlackOilSimulator
|
|
|
|
*
|
|
|
|
* \brief Helper class for grid instantiation of ECL file-format using problems.
|
|
|
|
*
|
2016-11-11 08:02:34 -06:00
|
|
|
* This class uses Dune::PolyhedralGrid as the simulation grid.
|
2016-01-05 12:32:36 -06:00
|
|
|
*/
|
|
|
|
template <class TypeTag>
|
2018-02-01 09:26:58 -06:00
|
|
|
class EclPolyhedralGridVanguard : public EclBaseVanguard<TypeTag>
|
2016-01-05 12:32:36 -06:00
|
|
|
{
|
2018-02-01 09:26:58 -06:00
|
|
|
friend class EclBaseVanguard<TypeTag>;
|
2022-08-10 05:34:29 -05:00
|
|
|
using ParentType = EclBaseVanguard<TypeTag>;
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2021-05-05 05:13:25 -05:00
|
|
|
using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>;
|
2020-08-26 03:49:52 -05:00
|
|
|
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
|
|
|
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
public:
|
2020-08-26 03:49:52 -05:00
|
|
|
using Grid = GetPropType<TypeTag, Properties::Grid>;
|
|
|
|
using EquilGrid = GetPropType<TypeTag, Properties::EquilGrid>;
|
|
|
|
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
2021-05-15 06:35:21 -05:00
|
|
|
using TransmissibilityType = EclTransmissibility<Grid, GridView, ElementMapper, Scalar>;
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
private:
|
2022-08-10 05:34:29 -05:00
|
|
|
using GridPointer = Grid*;
|
|
|
|
using EquilGridPointer = EquilGrid*;
|
|
|
|
using CartesianIndexMapper = Dune::CartesianIndexMapper<Grid>;
|
|
|
|
using CartesianIndexMapperPointer = std::unique_ptr<CartesianIndexMapper>;
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
public:
|
2019-10-01 14:18:17 -05:00
|
|
|
EclPolyhedralGridVanguard(Simulator& simulator)
|
2019-12-11 15:04:40 -06:00
|
|
|
: EclBaseVanguard<TypeTag>(simulator),
|
|
|
|
simulator_( simulator )
|
2019-10-01 14:18:17 -05:00
|
|
|
{
|
|
|
|
this->callImplementationInit();
|
|
|
|
}
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2018-02-01 09:26:58 -06:00
|
|
|
~EclPolyhedralGridVanguard()
|
2016-01-05 12:32:36 -06:00
|
|
|
{
|
|
|
|
delete grid_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Return a reference to the simulation grid.
|
|
|
|
*/
|
|
|
|
Grid& grid()
|
|
|
|
{ return *grid_; }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Return a reference to the simulation grid.
|
|
|
|
*/
|
|
|
|
const Grid& grid() const
|
|
|
|
{ return *grid_; }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a refefence to the grid which should be used by the EQUIL
|
|
|
|
* initialization code.
|
|
|
|
*
|
|
|
|
* The EQUIL keyword is used to specify the initial condition of the reservoir in
|
|
|
|
* hydrostatic equilibrium. Since the code which does this is not accepting arbitrary
|
|
|
|
* DUNE grids (the code is part of the opm-core module), this is not necessarily the
|
|
|
|
* same as the grid which is used for the actual simulation.
|
|
|
|
*/
|
|
|
|
const EquilGrid& equilGrid() const
|
2016-11-11 08:02:34 -06:00
|
|
|
{ return *grid_; }
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Indicates that the initial condition has been computed and the memory used
|
|
|
|
* by the EQUIL grid can be released.
|
|
|
|
*
|
|
|
|
* Depending on the implementation, subsequent accesses to the EQUIL grid lead to
|
|
|
|
* crashes.
|
|
|
|
*/
|
|
|
|
void releaseEquilGrid()
|
2016-11-11 08:02:34 -06:00
|
|
|
{ /* do nothing: The EQUIL grid is the simulation grid! */ }
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Distribute the simulation grid over multiple processes
|
|
|
|
*
|
|
|
|
* (For parallel simulation runs.)
|
|
|
|
*/
|
|
|
|
void loadBalance()
|
2016-11-11 08:02:34 -06:00
|
|
|
{ /* do nothing: PolyhedralGrid is not parallel! */ }
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the object which maps a global element index of the simulation grid
|
|
|
|
* to the corresponding element index of the logically Cartesian index.
|
|
|
|
*/
|
|
|
|
const CartesianIndexMapper& cartesianIndexMapper() const
|
|
|
|
{ return *cartesianIndexMapper_; }
|
|
|
|
|
2016-01-17 14:15:18 -06:00
|
|
|
/*!
|
|
|
|
* \brief Returns mapper from compressed to cartesian indices for the EQUIL grid
|
2016-11-11 08:02:34 -06:00
|
|
|
*
|
|
|
|
* Since PolyhedralGrid is not parallel, that's always the same as
|
|
|
|
* cartesianIndexMapper().
|
2016-01-17 14:15:18 -06:00
|
|
|
*/
|
|
|
|
const CartesianIndexMapper& equilCartesianIndexMapper() const
|
2016-11-11 08:02:34 -06:00
|
|
|
{ return *cartesianIndexMapper_; }
|
2016-01-17 14:15:18 -06:00
|
|
|
|
2019-12-11 15:04:40 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Free the memory occupied by the global transmissibility object.
|
|
|
|
*
|
|
|
|
* After writing the initial solution, this array should not be necessary anymore.
|
|
|
|
*/
|
|
|
|
void releaseGlobalTransmissibilities()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unordered_set<std::string> defunctWellNames() const
|
|
|
|
{ return defunctWellNames_; }
|
|
|
|
|
2021-05-05 05:13:25 -05:00
|
|
|
const TransmissibilityType& globalTransmissibility() const
|
2019-12-11 15:04:40 -06:00
|
|
|
{
|
|
|
|
return simulator_.problem().eclTransmissibilities();
|
|
|
|
}
|
|
|
|
|
2021-09-30 04:50:22 -05:00
|
|
|
/*!
|
|
|
|
* \brief Get function to query cell centroids for a distributed grid.
|
|
|
|
*
|
|
|
|
* Currently this only non-empty for a loadbalanced CpGrid.
|
|
|
|
* It is a function return the centroid for the given element
|
|
|
|
* index.
|
|
|
|
*/
|
|
|
|
std::function<std::array<double,dimensionworld>(int)>
|
|
|
|
cellCentroids() const
|
|
|
|
{
|
|
|
|
return this->cellCentroids_(this->cartesianIndexMapper());
|
|
|
|
}
|
2021-12-01 07:00:21 -06:00
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
protected:
|
|
|
|
void createGrids_()
|
|
|
|
{
|
2020-11-10 01:54:44 -06:00
|
|
|
grid_ = new Grid(this->eclState().getInputGrid(), this->eclState().fieldProps().porv(true));
|
2021-09-30 04:50:22 -05:00
|
|
|
cartesianIndexMapper_ = std::make_unique<CartesianIndexMapper>(*grid_);
|
2020-12-08 09:09:01 -06:00
|
|
|
this->updateCartesianToCompressedMapping_();
|
|
|
|
this->updateCellDepths_();
|
2016-01-05 12:32:36 -06:00
|
|
|
}
|
|
|
|
|
2018-06-28 08:49:45 -05:00
|
|
|
void filterConnections_()
|
2018-02-07 04:21:57 -06:00
|
|
|
{
|
|
|
|
// not handling the removal of completions for this type of grid yet.
|
|
|
|
}
|
|
|
|
|
2019-12-11 15:04:40 -06:00
|
|
|
Simulator& simulator_;
|
|
|
|
|
2016-11-11 08:02:34 -06:00
|
|
|
GridPointer grid_;
|
|
|
|
CartesianIndexMapperPointer cartesianIndexMapper_;
|
2019-12-11 15:04:40 -06:00
|
|
|
|
|
|
|
std::unordered_set<std::string> defunctWellNames_;
|
2016-01-05 12:32:36 -06:00
|
|
|
};
|
|
|
|
|
2019-09-05 10:04:39 -05:00
|
|
|
} // namespace Opm
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
#endif
|