mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
* Add support for appending dates keyword at end of file * Make sure well group from job is used * Increase well groups in welldims in case a new group is made * GUI cleanup
144 lines
5.2 KiB
C++
144 lines
5.2 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2025 Equinor ASA
|
|
//
|
|
// 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.
|
|
//
|
|
// 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.
|
|
//
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include "RimGenericJob.h"
|
|
|
|
#include "cafPdmPtrField.h"
|
|
|
|
#include <string>
|
|
|
|
class RimEclipseCase;
|
|
class RimWellPath;
|
|
class RifOpmFlowDeckFile;
|
|
class RimEclipseCaseEnsemble;
|
|
class RimSummaryEnsemble;
|
|
class RimKeywordWconprod;
|
|
class RimKeywordWconinje;
|
|
|
|
//==================================================================================================
|
|
///
|
|
///
|
|
//==================================================================================================
|
|
class RimOpmFlowJob : public RimGenericJob
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
enum class WellOpenType
|
|
{
|
|
OPEN_BY_POSITION,
|
|
OPEN_AT_DATE
|
|
};
|
|
|
|
enum class DateAppendType
|
|
{
|
|
ADD_DAYS,
|
|
ADD_MONTHS
|
|
};
|
|
|
|
public:
|
|
RimOpmFlowJob();
|
|
~RimOpmFlowJob() override;
|
|
|
|
void setWorkingDirectory( QString workDir );
|
|
void setEclipseCase( RimEclipseCase* eCase );
|
|
void setInputDataFile( QString filename );
|
|
|
|
QString deckName();
|
|
|
|
protected:
|
|
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
|
void initAfterRead() override;
|
|
|
|
QString title() override;
|
|
QStringList command() override;
|
|
std::map<QString, QString> environment() override;
|
|
QString workingDirectory() const override;
|
|
bool onPrepare() override;
|
|
bool onRun() override;
|
|
void onCompleted( bool success ) override;
|
|
|
|
bool openDeckFile();
|
|
bool copyUnrstFileToWorkDir();
|
|
|
|
private:
|
|
RimEclipseCase* findExistingCase( QString filename );
|
|
QString deckExtension() const;
|
|
QString wellTempFile( int timeStep = -1, bool includeMSW = false, bool includeLGR = false ) const;
|
|
QString baseDeckName() const;
|
|
QString restartDeckName() const;
|
|
|
|
std::vector<QDateTime> datesInFileDeck();
|
|
std::vector<QString> wellgroupsInFileDeck();
|
|
|
|
std::vector<QString> dateStrings();
|
|
std::vector<QDateTime> dateTimes();
|
|
std::vector<QDateTime> addedDateTimes();
|
|
|
|
static QString readFileContent( QString filename );
|
|
|
|
void exportBasicWellSettings();
|
|
std::string exportMswWellSettings( int timeStep );
|
|
void selectOpenWellPosition();
|
|
|
|
private:
|
|
caf::PdmField<caf::FilePath> m_deckFileName;
|
|
caf::PdmField<caf::FilePath> m_workDir;
|
|
caf::PdmField<bool> m_runButton;
|
|
caf::PdmField<bool> m_openSelectButton;
|
|
caf::PdmField<int> m_openWellDeckPosition;
|
|
|
|
caf::PdmField<bool> m_pauseBeforeRun;
|
|
caf::PdmField<bool> m_addToEnsemble;
|
|
caf::PdmField<int> m_currentRunId;
|
|
caf::PdmField<bool> m_resetRunIdButton;
|
|
caf::PdmField<bool> m_useRestart;
|
|
|
|
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
|
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
|
caf::PdmPtrField<RimEclipseCaseEnsemble*> m_gridEnsemble;
|
|
caf::PdmPtrField<RimSummaryEnsemble*> m_summaryEnsemble;
|
|
caf::PdmField<int> m_openTimeStep;
|
|
caf::PdmField<bool> m_endTimeStepEnabled;
|
|
caf::PdmField<int> m_endTimeStep;
|
|
caf::PdmField<bool> m_addNewWell;
|
|
caf::PdmField<caf::AppEnum<WellOpenType>> m_wellOpenType;
|
|
caf::PdmField<bool> m_includeMSWData;
|
|
caf::PdmField<QString> m_wellGroupName;
|
|
|
|
caf::PdmField<bool> m_appendNewDates;
|
|
caf::PdmField<int> m_newDatesInterval;
|
|
caf::PdmField<int> m_numberOfNewDates;
|
|
caf::PdmField<caf::AppEnum<DateAppendType>> m_dateAppendType;
|
|
|
|
caf::PdmChildField<RimKeywordWconprod*> m_wconprodKeyword;
|
|
caf::PdmChildField<RimKeywordWconinje*> m_wconinjeKeyword;
|
|
|
|
caf::PdmField<QString> m_wellOpenKeyword;
|
|
|
|
QString m_deckName;
|
|
std::unique_ptr<RifOpmFlowDeckFile> m_deckFile;
|
|
bool m_fileDeckHasDates;
|
|
bool m_fileDeckIsRestart;
|
|
};
|