2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2012-05-18 02:45:23 -05:00
|
|
|
// ResInsight 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2012-05-18 02:45:23 -05:00
|
|
|
// ResInsight 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-05-18 02:45:23 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-06-18 06:03:48 -05:00
|
|
|
#include "RifEclipseReportKeywords.h"
|
2017-08-24 23:51:56 -05:00
|
|
|
|
2024-06-18 06:03:48 -05:00
|
|
|
#include "RiaDefines.h"
|
|
|
|
#include "RiaPorosityModel.h"
|
|
|
|
|
|
|
|
#include "ert/ecl/ecl_file_view.h"
|
|
|
|
#include "ert/ecl/ecl_grid.h"
|
2017-08-24 23:51:56 -05:00
|
|
|
#include "ert/ecl/ecl_util.h"
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "cvfObject.h"
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#include <QDateTime>
|
2012-05-18 02:45:23 -05:00
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
|
2017-08-24 23:51:56 -05:00
|
|
|
#include <vector>
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2023-04-14 07:07:45 -05:00
|
|
|
using ecl_file_type = struct ecl_file_struct;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2017-08-24 23:51:56 -05:00
|
|
|
class RifEclipseRestartDataAccess;
|
2023-08-28 05:17:34 -05:00
|
|
|
class RigEclipseTimeStepInfo;
|
|
|
|
class RigActiveCellInfo;
|
2024-06-18 06:03:48 -05:00
|
|
|
class RigEclipseCaseData;
|
|
|
|
|
2019-03-18 06:52:01 -05:00
|
|
|
class QByteArray;
|
2013-01-30 07:13:50 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//==================================================================================================
|
|
|
|
//
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2012-05-18 02:45:23 -05:00
|
|
|
//
|
|
|
|
//==================================================================================================
|
2013-02-05 03:51:32 -06:00
|
|
|
class RifEclipseOutputFileTools
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
public:
|
2012-06-26 09:10:41 -05:00
|
|
|
RifEclipseOutputFileTools();
|
|
|
|
virtual ~RifEclipseOutputFileTools();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2024-06-18 06:03:48 -05:00
|
|
|
static std::vector<RifEclipseKeywordValueCount> keywordValueCounts( const std::vector<ecl_file_type*>& ecl_files );
|
2023-02-26 03:48:40 -06:00
|
|
|
|
2024-06-18 06:03:48 -05:00
|
|
|
static void createResultEntries( const std::vector<RifEclipseKeywordValueCount>& fileKeywordInfo,
|
|
|
|
const std::vector<RigEclipseTimeStepInfo>& timeStepInfo,
|
|
|
|
RiaDefines::ResultCatType resultCategory,
|
|
|
|
RigEclipseCaseData* eclipseCaseData,
|
|
|
|
size_t totalTimeSteps );
|
2023-08-28 05:17:34 -05:00
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
static bool keywordData( const ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<double>* values );
|
|
|
|
static bool keywordData( const ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<int>* values );
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static void timeSteps( const ecl_file_type* ecl_file,
|
|
|
|
std::vector<QDateTime>* timeSteps,
|
2020-04-06 05:15:28 -05:00
|
|
|
std::vector<double>* daysSinceSimulationStart,
|
|
|
|
size_t* perTimeStepHeaderKeywordCount );
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static bool isValidEclipseFileName( const QString& fileName );
|
|
|
|
static QByteArray md5sum( const QString& fileName );
|
|
|
|
static bool findSiblingFilesWithSameBaseName( const QString& fileName, QStringList* fileSet );
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static QString firstFileNameOfType( const QStringList& fileSet, ecl_file_enum fileType );
|
|
|
|
static QStringList filterFileNamesOfType( const QStringList& fileSet, ecl_file_enum fileType );
|
2013-04-07 09:33:45 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static void readGridDimensions( const QString& gridFileName, std::vector<std::vector<int>>& gridDimensions );
|
2014-08-27 07:05:29 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static int readUnitsType( const ecl_file_type* ecl_file );
|
2016-07-14 06:35:32 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static cvf::ref<RifEclipseRestartDataAccess> createDynamicResultAccess( const QString& fileName );
|
2017-08-24 23:51:56 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static QString createIndexFileName( const QString& resultFileName );
|
2017-08-24 23:51:56 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static std::set<RiaDefines::PhaseType> findAvailablePhases( const ecl_file_type* ecl_file );
|
2017-11-10 02:43:51 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static void transferNncFluxData( const ecl_grid_type* grid,
|
|
|
|
const ecl_file_view_type* summaryView,
|
|
|
|
std::vector<double>* waterFlux,
|
|
|
|
std::vector<double>* oilFlux,
|
|
|
|
std::vector<double>* gasFlux );
|
2017-11-14 03:43:14 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static bool isExportedFromIntersect( const ecl_file_type* ecl_file );
|
2018-11-13 02:28:13 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static FILE* fopen( const QString& filePath, const QString& mode );
|
2019-03-18 06:52:01 -05:00
|
|
|
|
2023-08-28 05:17:34 -05:00
|
|
|
static bool assignActiveCellData( std::vector<std::vector<int>>& actnumValuesPerGrid, RigEclipseCaseData* eclipseCaseData );
|
|
|
|
|
2024-06-18 06:03:48 -05:00
|
|
|
static std::vector<RifEclipseKeywordValueCount>
|
|
|
|
validKeywordsForPorosityModel( const std::vector<RifEclipseKeywordValueCount>& keywordItemCounts,
|
|
|
|
const RigActiveCellInfo* activeCellInfo,
|
|
|
|
const RigActiveCellInfo* fractureActiveCellInfo,
|
|
|
|
RiaDefines::PorosityModelType matrixOrFracture,
|
|
|
|
size_t timeStepCount );
|
|
|
|
|
|
|
|
static void extractResultValuesBasedOnPorosityModel( RigEclipseCaseData* eclipseCaseData,
|
|
|
|
RiaDefines::PorosityModelType matrixOrFracture,
|
|
|
|
std::vector<double>* values,
|
|
|
|
const std::vector<double>& fileValues );
|
|
|
|
|
2016-07-14 06:35:32 -05:00
|
|
|
private:
|
2024-06-18 06:03:48 -05:00
|
|
|
static void getDayMonthYear( const ecl_kw_type* intehead_kw, int* day, int* month, int* year );
|
|
|
|
static RifEclipseReportKeywords createReportStepsMetaData( const std::vector<ecl_file_type*>& ecl_files );
|
2012-05-18 02:45:23 -05:00
|
|
|
};
|