Command File

The command file interface allows a sequence of specified commands to be run in order from the command line. The interface is used by supplying the command file as a command line parameter. Once the command file is finished executing, ResInsight will exit.

It is possible to use these commands directly from a Python script. For further details, please see the ResInsight Python API.

Syntax

The command file is comprised of a set of commands to be executed in order. Each command must begin on a separate line, i.e. there cannot be two commands on the same line.

The line starts with the command name, followed by parenthesis. Within the parenthesis, parameters can be supplied. Each parameter must be named, followed by an equals sign and its value.

As an example; openProject(path="/path/to/ResInsightProject.rsp") will execute the command openProject with the parameter path. path is a string, see Types for a list of all types a parameter can have.

Not all parameters are required, in which case they can be omitted and their value will be defaulted. The order of parameters does not matter.

Command file examples are displayed in sections like this.


Types

There are different types of parameters that can be supplied.

TypeInputExample
IntegerNumber5
DoubleDecimal number3.14
StringSequence of characters contained in quotes ("")1“/path/to/file”
EnumChoice of a set of given optionsALL
Booleantrue or falsetrue
ListMultiple choices of another type, written within square brackets ([]) separated by a comma (,)[1, 2, 3]

1 The backslash (\) character is used as an escape character within strings, so to use a quote within a string, use "escape \" with \"". To input a literal backslash character, use "\\".

Case Control Commands

openProject

Opens a ResInsight project file.

ParameterDescriptionTypeRequired
pathFile path to the project fileString
openProject(path="/home/user/ResInsightProject.rsp")


closeProject

Closes the current open project.

closeProject()


setStartDir

Set startup directory.

ParameterDescriptionTypeRequired
pathPath to directory to use as startup directoryString
setStartDir(path="/home/user")


Import Eclipse case from file.

ParameterDescriptionTypeRequired
pathFile path to the case to loadString
loadCase(path="/home/user/reservoir.EGRID")


createGridCaseGroup

Create a Grid Case Group from a list of files.

ParameterDescriptionTypeRequired
casePathsList of Paths to Case FilesString

createStatisticsCase

Create a Statistics Case in a Grid Case Group.

ParameterDescriptionTypeRequired
caseGroupIdID to the Case GroupInteger
createGridCaseGroup(path=["/home/user/reservoir.EGRID", "/home/user/other_reservoir.EGRID"])
createStatisticsCase(caseGroupId=0)


replaceCase

Replaces a case in the current project with the specified new case.

openProject must be called before this command to set which project file is to be used when replacing cases. This command re-opens the project with the new case replaced. To replace more than one case at the same time, use replaceSourceCases.

ParameterDescriptionTypeRequired
newGridFileFile path to the new grid file to replace withString
caseIdID of the case to replace. Defaults to first caseInteger
replaceCase(newGridFile="/home/user/otherReservoir.EGRID", caseId=4)


replaceSourceCases

Replaces multiple source cases in the current project.

openProject must be called before this command to set which project file is to be used when replacing cases. This command re-opens tje project with the cases replaced.

ParameterDescriptionTypeRequired
gridListFileFile path to file containing list of cases to replace withString
caseGroupIdID of group to replace cases in. Defaults to first groupInteger
replaceSourceCases(gridListFile="C:/resinsight/replacement_files.txt")


Export Commands

exportMultiCaseSnapshots

Replaces the first case in the current project with each case in the given file and saves snapshots of all views.

openProject must be called before this command to set which project file is to be used when replacing cases.

Folder to output snapshots should be set using setExportFolder with SNAPSHOTS type.

ParameterDescriptionTypeRequired
gridListFileFile path to file containing list of cases to create snapshots ofString
exportMultiCaseSnapshots(gridListFile="C:\\resinsight\\replacement_files.txt")


exportSnapshots

Export snapshots of specified type.

Folder to output snapshots should be set using setExportFolder with SNAPSHOTS type.

ParameterDescriptionTypeRequired
typeType of snapshots to export. Choices: ALL, VIEWS, PLOTS. Defaults to ALLEnum
prefixExported file name prefix. Defaults to no prefixString
caseIdID of case for export, defaults to -1 meaning all casesInteger
exportSnapshots(type=PLOTS)


exportProperty

Exports property values for all cells in the grid to file in Eclipse format.

ParameterDescriptionTypeRequired
caseIdID of case for exportInteger
timeStepThe time step index for exportInteger
propertyName of property to exportString
eclipseKeywordEclipse keyword used as text in export header. Defaults to the value of property parameterString
undefinedValueValue to use for undefined values. Defaults to 0.0Double
exportFileFilename for export. Defaults to the value of property parameterString
exportProperty(caseId=1, timeStep=4, property="SOIL")


exportPropertyInViews

Exports property values for all cells in the grid to file in Eclipse format. Use specified cell result in view to define the export property. One file per view will be exported.

ParameterDescriptionTypeRequired
caseIdID of case to export property fromInteger
viewNamesName of views to export from. If not specified, all views are exportedList of String
undefinedValueValue to use for undefined values. Defaults to 0.0Double
exportPropertyInViews(caseId=1)

exportPropertyInViews(caseId=1, viewNames=["view A", "view 4"])


exportWellPathCompletions

Export well path completions.

ParameterDescriptionTypeRequired
caseIdID of case to export well paths forInteger
timeStepThe time step to export completions forInteger
wellPathNamesNames of well paths to export for. Defaults to all checked wells. If a list of well names are provided, those wells are included even if uncheckedList of String
fileSplitHow the files are split. Choices: UNIFIED_FILE, SPLIT_ON_WELL, SPLIT_ON_WELL_AND_COMPLETION_TYPE. Defaults to SPLIT_ON_WELL_AND_COMPLETION_TYPEEnum
compdatExportChose whether transmissibilities are exported. Choices: TRANSMISSIBILITIES, WPIMULT_AND_DEFAULT_CONNECTION_FACTORS. Defaults to TRANSMISSIBILITIESEnum
includePerforationsWhether main bore perforations should be included. Defaults to trueBoolean
includeFishbonesWhether fishbones should be included. Defaults to trueBoolean
excludeMainBoreForFishbonesWhether main bore completions should be excluded for cells with fishbones. Defaults to falseBoolean
combinationModeCombination mode. Choices: INDIVIDUALLY, COMBINED. Defaults to INDIVIDUALLYEnum
exportWellPathCompletions(caseId=3, timeStep=5, includeFishbones=false)


exportSimWellFractureCompletions

Export fracture completions for simulation wells.

ParameterDescriptionTypeRequired
caseIdID of case to export simulation well fracture completions forInteger
viewNameThe name of the view to export simulation well fracture completions for. Since view names are not unique, all views sharing the given name will be usedString
timeStepThe time step to export completions forInteger
simulationWellNamesNames of simulation wells to export for. Defaults to all checked wells. If a list of names are provided, those wells are included even if uncheckedList of String
fileSplitHow the files are split. Choices: UNIFIED_FILE, SPLIT_ON_WELL, SPLIT_ON_WELL_AND_COMPLETION_TYPE. Defaults to UNIFIED_FILEEnum
compdatExportChose whether transmissibilities are exported. Choices: TRANSMISSIBILITIES, WPIMULT_AND_DEFAULT_CONNECTION_FACTORS. Defaults to TRANSMISSIBILITIESEnum
exportSimWellFractureCompletions(caseId=3, viewName="View 2", timeStep=5)


exportMsw

Export multi-segment wells.

ParameterDescriptionTypeRequired
caseIdID of case to export well paths forInteger
wellPathName of well path to export well segments forString
exportMsw(caseId=1, wellPath="MainWell")


exportWellPaths

Export well paths.

ParameterDescriptionTypeRequired
wellPathNamesNames of well paths to export for. Defaults to all checked wells. If a list of well names are provided, those wells are included even if uncheckedList of String
mdStepSizeSpacing (measured depth) between each sample along the well path. Default to 5.0Double
exportWellPaths(wellPathNames=["B-1H", "B-2H"], mdStepSize=1.5)


exportVisibleCells

Export visible cells

ParameterDescriptionTypeRequired
caseIdID of case to export cells forInteger
viewNameName of the view associated with the specified caseDouble
exportKeywordThe keyword to export. Choices: FLUXNUM or MULTNUM. Default: FLUXNUMEnum
visibleActiveCellsValueValue to use for visible active cells. Default: 1Integer
hiddenActiveCellsValueValue to use for hidden active cells. Default: 0Integer
inactiveCellsValueValue to use for inactive cells. Default: 0Integer
exporVisibleCells(caseId=0, viewName="View 1", exportKeyword=MULTNUM)


exportFlowCharacteristics

Export Flow Characteristics data to text file in CSV format

ParameterDescriptionTypeRequired
caseIdID of caseInteger
timeStepsTime step indicesList of Integer
injectorsInjector namesList of Strings
producersProducer namesList of Strings
fileNameExport file nameInteger
minimumCommunicationMinimum Communication, defaults to 0.0Integer
aquiferCellThresholdAquifer Cell Threshold, defaults to 0.1Integer
exportFlowCharacteristics(caseId=0, timeSteps=[1, 5, 6], injectors=["INJA", "INJB"], producers=["PROD_F"], fileName="myData.csv")


setExportFolder

Set the folder to export different types of data to. Set this before attempting to export data to ensure it is exported to desired location.

ParameterDescriptionTypeRequired
typeType of export folder to set. Choices: COMPLETIONS, SNAPSHOTS, PROPERTIES, STATISTICSEnum
pathDirectory to export the given type toString
createFolderIf true, create the folder when required. Default false.Boolean
setExportFolder(type=SNAPSHOTS, path="/home/user/snapshots")


Other

runOctaveScript

Execute an Octave script.

ParameterDescriptionTypeRequired
pathPath to the octave script to executeInteger
caseIdsThe cases to run the octave script on. Defaults to running the script without a specified caseList of Integer
runOctaveScript(path="/home/user/octave/something.m", caseIds=[1,2,6])


setMainWindowSize

Resize the main window to the specified size.

ParameterDescriptionTypeRequired
widthThe width to set for the main windowInteger
heightThe height to set for the main windowInteger
setMainWindowSize(width=1920, height=1200)


computeCaseGroupStatistics

Compute statistics for statistics cases.

ParameterDescriptionTypeRequired
caseIdsIDs of statistics cases to compute. Default is all statistics casesList of Integer
computeCaseGroupStatistics(caseIds=[5])

computeCaseGroupStatistics(caseIds=[2,4,8])


setTimeStep

Set the time step for a given case. The time step is used for all views on the case.

ParameterDescriptionTypeRequired
caseIdID of case to set time step forInteger
timeStepIndex of time step to switch toInteger
setTimeStep(caseId=1, timeStep=8)


scaleFractureTemplate

Scale fracture template parameters.

ParameterDescriptionTypeRequired
idID of fracture templateInteger
halfLengthHalf Length scale factorDouble
heightHeight scale factorDouble
dFactorD-factor scale factorDouble
conductivityConductivity scale factorDouble
scaleFractureTemplate(id=1, width=2, height=1.5)


setFractureContainment

Set fracture template containment parameters.

ParameterDescriptionTypeRequired
idID of fracture templateInteger
topLayerTop layer containmentInteger
baseLayerBase layer containmentInteger
setFractureContainment(id=1, topLayer=2, baseLayer=7)


createMultipleFractures

Create multiple fractures on one or more well paths.

ParameterDescriptionTypeRequired
caseIdCase IDInteger
templateIdFracture template idInteger
wellPathNamesWell path names. Default: All well pathsList of Strings
minDistFromWellTdMin distance from well path tip. Default: 100.0 mDouble
maxFracturesPerWellMax fractures per well. Default: 100Integer
topLayerTop K layer. Default: Top layer from current modelInteger
baseLayerBase K layer. Default: Bottom layer from current modelInteger
spacingDistance between fractures. Default: 300.0 mDouble
actionHow to handle existing fractures. Choices: APPEND_FRACTURES, REPLACE_FRACTURES. The replace option will delete all existing fractures before adding new ones. Default: APPEND_FRACTURESEnum
createMultipleFractures(caseId=0, templateId=1, wellPathNames=["B-1H", "B-2H"], action=REPLACE_FRACTURES)


createLgrForCompletions

Create temporary LGRs for completions on the selected well paths. The splitType parameter controls which main grid cells to split into LGRs. The LGR_PER_CELL option splits only those main grid cells that intersect with a completion. The LGR_PER_COMPLETION option splits all main grid cells that are located within an IJK bounding box covering all intersected cells for each completion. The LGR_PER_WELL works like the previous option, but the bounding box covers intersected cells for all completions on a well path.

ParameterDescriptionTypeRequired
caseIdID of case to create LGRs forInteger
timeStepThe time step to create LGRs forInteger
wellPathNamesNames of well paths to export for. Defaults to all checked wells. If a list of well names are provided, those wells are included even if uncheckedList of String
refinementISize of the LGR along the I axis, in each main grid cell.Integer
refinementJSize of the LGR along the J axis, in each main grid cell.Integer
refinementKSize of the LGR along the K axis, in each main grid cell.Integer
splitTypeHow to split the LGRs. Options: LGR_PER_CELL, LGR_PER_COMPLETION, LGR_PER_WELL. Default option is LGR_PER_COMPLETIONEnum
createLgrForCompletions(caseId=0, timeStep=0, wellPathNames=["B-1H", "B-2H"], refinementI=2, refinementJ=3, refinementK=4, splitType=LGR_PER_WELL)


createSaturationPressurePlots

Create saturation pressure plots for the specified cases.

ParameterDescriptionTypeRequired
caseIdsIDs of cases to create plots for. Default is all casesList of Integer
createSaturationPressurePlots(caseIds=[0])