This Python script converts a TOUGH2 result file to VTK format for visualization with Paraview
Run the script
- modify config.yaml as you wish (see an example of config.yaml below)
- activate conda environment (see the miniconda setup below)
$ conda activate py3
- run the python script
(py3) $ python3 results_to_vtk.py
Install Conda on Mac OS
- go to https://docs.conda.io/en/latest/miniconda.html
- download 64-bit (.pkg installer) for Python 3.7 for MAC OS
- install with .pkg
- open a terminal
$ conda --version
conda 4.6.2
$ conda create -n py3 python=3
$ conda activate py3
Installing required Python packages
$ pip3 install pyyaml
$ pip3 install pyevtk
Config file
The input file config.yaml contains some metadata of the results file.
# Here, we assume all input files are in CSV format and output in the binary VTS format.
input_folder: "/path/to/Results"
output_folder: "/path/to/output"
filenames: [
"openBC_prod_10yr",
"openBC_prod_20yr",
"openBC_prod_30yr",
"openBC_prod_40yr"]
# dimension
npoint_d1: 80
npoint_d2: 40
npoint_d3: 15
# layer thickness only in z direction
layer_top: 5
layer_middle: 5
layer_bottom: 5