Introduction

Tutorials

Reference

Installing WellSim

Tutorial: Running WellSim from the command line

Overview

Normally you run WellSim from its graphical user interface: you start WellSim by double clicking the icon on the desktop, then use the mouse to select options and enter data from the keyboard. This tutorial introduces how to run WellSim another way, from the command line:

  1. Create text files with input data for WellSim to use.
  2. Create a file BatchFiles.ini in your settings folder, with a list of input and result files to be used.
  3. Run WellSim from the command line, using the -b or --batch parameter.
  4. WellSim reads the input data files for each run, does the calculations and writes each result into a text file. It also writes a log file of what it did and any errors that occurred.

The advantage of running from the control line is that WellSim will run unattended. You would typically do this from another program, which would write the input files, run WellSim, then read the result files. For example, if you are doing a reservoir simulation using another program you could use this other program to run WellSim from the command line to:

Options

You can:

At present you can not:

Units and decimal symbol - Important

In the input and result files:

Settings folder

Some command line files are stored in WellSim's settings folder read more. To see the settings folder from WellSim, click Tools, then Open settings folder.

Text editor

Use a text editor, such as Windows Notepad or Notepad++, to create the required text files and to look at the result files.

Tutorial

Example files

When you install this version of WellSim and first run it, it creates example files for you to use as templates to make your own files and to test running WellSim from the command line:

Running WellSim from the command line

This tutorial uses the example files:

  1. Start WellSim normally and set the default units to those required for the example files: In WellSim, go to Tools > Unit preferences. In the UnitTypes tab, set Sets to Metric, then set the units for Pressure to bar abs.

  2. Then, either run WellSim from the Windows Start menu:

    1. Select this path "C:\Program Files (x86)\Gradient\WellSim4\wellsim" -b and type CTRL+C to copy it.
    2. Press Start on your keyboard.
    3. Click in the text box at the bottom, left of the screen (usually it says 'Search programs and files') and press CTRL+V to paste the path.
    4. Press Enter.

    Or run WellSim from a batch (.bat) file:

    1. Select this path "C:\Program Files (x86)\Gradient\WellSim4\wellsim" -b and type CTRL+C to copy it.
    2. Using a text editor, create an empty file.
    3. Click in the empty file press CTRL+V to paste the path.
    4. Save the file to any folder, with any name and with extension .bat. This is your batch file. Ensure your editor doesn't change the ordinary double quotes in the path to 'smart' ones (6s and 9s). Exit the test editor.
    5. In Windows explorer, double click the batch file.

    The screen will flicker as WellSim runs.

  3. Use a text editor to open the log file BatchLog.txt in WellSim's settings folder in. You should see a message that two simulations have run properly. If you dont, check you have

  4. Use a text editor to open the result files (for example RK5Results1.csv is in the folder BatchFiles in WellSim's settings folder). You can also open a csv file in a spreadsheet.

Files

Use WellSim's example files as templates for writing your own files.

The BatchFiles.ini file

To specify the input and result files for each run, create a file called BatchFiles.ini. This must be in your WellSim settings folder see here. A typical BatchFiles.ini file is:

.
[Files]
NumberOfRuns=2 The number of runs to do
[Run\1] Section for first run, a discharge simulation
Geometry=BatchFiles\RK5Geometry.ini - The geometry input file to use
Discharge=BatchFiles\RK5InputDS.ini - The discharge simulation input file to use
Results=BatchFiles\RK5Results1.csv - The result file to use, here a csv file
[Run\2] Section for second run, an output simulation
Geometry=BatchFiles\RK5Geometry.ini - The geometry input file to use
Discharge=BatchFiles\RK5InputDS.ini - The discharge simulation input file to use
Output=BatchFiles\RK5InputOS.ini - The output simulation input file to use
Results=BatchFiles\RK5Results2.ini - The result file to use, here an ini file

Note:

Input files

Log file

When WellSim runs from the command line it creates a log file, BatchLog.txt, in WellSim's settings folder, with any errors that WellSim found. For example:

Result files

When WellSim runs from the command line it creates a result file for each run:

Running WellSim from an external program

When you use an external program to run WellSim, if the path name has spaces then surround the path name with double quotes, for example "C:\Program Files (x86)\Gradient\WellSim4\wellsim" -b. Ensure you don't change the ordinary double quotes in the path to 'smart' ones (6s and 9s) by mistake.