2014-03-31 14:19:34 +02:00
|
|
|
/*
|
|
|
|
|
Copyright 2014 Statoil ASA.
|
|
|
|
|
|
|
|
|
|
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 ECLIPSE_GRID_HPP_
|
|
|
|
|
#define ECLIPSE_GRID_HPP_
|
|
|
|
|
|
2014-08-21 10:30:47 +02:00
|
|
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
2014-03-31 14:19:34 +02:00
|
|
|
#include <opm/parser/eclipse/Deck/Section.hpp>
|
|
|
|
|
|
|
|
|
|
#include <ert/ecl/ecl_grid.h>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace Opm {
|
|
|
|
|
|
|
|
|
|
class EclipseGrid {
|
|
|
|
|
public:
|
2014-08-21 10:30:47 +02:00
|
|
|
explicit EclipseGrid(const std::string& filename);
|
|
|
|
|
explicit EclipseGrid(const ecl_grid_type * src_ptr);
|
|
|
|
|
explicit EclipseGrid(std::shared_ptr<const Deck> deck);
|
2014-07-17 21:20:09 +02:00
|
|
|
|
2014-08-22 12:12:37 +02:00
|
|
|
static bool hasCornerPointKeywords(std::shared_ptr<const Deck> deck);
|
|
|
|
|
static bool hasCartesianKeywords(std::shared_ptr<const Deck> deck);
|
2014-06-02 16:48:37 +02:00
|
|
|
size_t getNumActive( ) const;
|
|
|
|
|
size_t getNX( ) const;
|
|
|
|
|
size_t getNY( ) const;
|
|
|
|
|
size_t getNZ( ) const;
|
|
|
|
|
size_t getCartesianSize( ) const;
|
2014-08-20 09:23:32 +02:00
|
|
|
bool isPinchActive( ) const;
|
|
|
|
|
double getPinchThresholdThickness( ) const;
|
2014-08-25 11:15:39 +02:00
|
|
|
bool isMinpvActive( ) const;
|
|
|
|
|
double getMinpvValue( ) const;
|
2014-04-22 00:20:03 +02:00
|
|
|
|
2014-06-10 19:52:22 +02:00
|
|
|
void assertGlobalIndex(size_t globalIndex) const;
|
|
|
|
|
void assertIJK(size_t i , size_t j , size_t k) const;
|
|
|
|
|
std::tuple<double,double,double> getCellCenter(size_t i,size_t j, size_t k) const;
|
|
|
|
|
std::tuple<double,double,double> getCellCenter(size_t globalIndex) const;
|
|
|
|
|
double getCellVolume(size_t globalIndex) const;
|
|
|
|
|
double getCellVolume(size_t i , size_t j , size_t k) const;
|
|
|
|
|
|
2014-04-22 01:14:34 +02:00
|
|
|
void exportMAPAXES( std::vector<double>& mapaxes) const;
|
2014-04-22 00:20:03 +02:00
|
|
|
void exportCOORD( std::vector<double>& coord) const;
|
|
|
|
|
void exportZCORN( std::vector<double>& zcorn) const;
|
|
|
|
|
void exportACTNUM( std::vector<int>& actnum) const;
|
2014-07-16 09:21:05 +02:00
|
|
|
void resetACTNUM( const int * actnum);
|
2014-04-27 23:17:50 +02:00
|
|
|
bool equal(const EclipseGrid& other) const;
|
2014-07-16 12:29:31 +02:00
|
|
|
void fwriteEGRID( const std::string& filename ) const;
|
|
|
|
|
const ecl_grid_type * c_ptr() const;
|
2014-03-31 14:19:34 +02:00
|
|
|
private:
|
|
|
|
|
std::shared_ptr<ecl_grid_type> m_grid;
|
2014-08-20 13:05:21 +02:00
|
|
|
bool m_pinchActive;
|
|
|
|
|
double m_pinchThresholdThickness;
|
2014-08-25 11:15:39 +02:00
|
|
|
bool m_minpvActive;
|
|
|
|
|
double m_minpvValue;
|
2014-03-31 14:19:34 +02:00
|
|
|
|
2014-08-22 12:12:37 +02:00
|
|
|
void initCartesianGrid(const std::vector<int>& dims , DeckConstPtr deck);
|
|
|
|
|
void initCornerPointGrid(const std::vector<int>& dims , DeckConstPtr deck);
|
|
|
|
|
void assertCornerPointKeywords( const std::vector<int>& dims , DeckConstPtr deck ) const ;
|
|
|
|
|
void initDTOPSGrid(const std::vector<int>& dims , DeckConstPtr deck);
|
|
|
|
|
void initDVDEPTHZGrid(const std::vector<int>& dims , DeckConstPtr deck);
|
|
|
|
|
void initGrid( const std::vector<int>& dims , DeckConstPtr deck );
|
|
|
|
|
static bool hasDVDEPTHZKeywords(DeckConstPtr deck);
|
|
|
|
|
static bool hasDTOPSKeywords(DeckConstPtr deck);
|
2014-04-27 23:17:50 +02:00
|
|
|
static void assertVectorSize(const std::vector<double>& vector , size_t expectedSize , const std::string& msg);
|
2014-08-22 12:12:37 +02:00
|
|
|
std::vector<double> createTOPSVector(const std::vector<int>& dims , const std::vector<double>& DZ , DeckConstPtr deck);
|
|
|
|
|
std::vector<double> createDVector(const std::vector<int>& dims , size_t dim , const std::string& DKey , const std::string& DVKey, DeckConstPtr deck);
|
2014-03-31 14:19:34 +02:00
|
|
|
void scatterDim(const std::vector<int>& dims , size_t dim , const std::vector<double>& DV , std::vector<double>& D);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::shared_ptr<EclipseGrid> EclipseGridPtr;
|
|
|
|
|
typedef std::shared_ptr<const EclipseGrid> EclipseGridConstPtr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|