Parallel Transient Simulation in Water Networks
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
To get a local copy up and running follow these simple steps. PTSNET can be downloaded via pip
We highly encourage using a conda environment for the installation, so that dependencies such as OpenMPI don't have to be manually installed.
-
Install conda
# Linux https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html
# Windows https://conda.io/projects/conda/en/latest/user-guide/install/windows.html
-
Install the conda environment with all the necessary dependencies, by opening a terminal and running the following commands
- Execute
conda activate
to start conda - Execute
conda config --add channels conda-forge
to add theconda-forge
channel - Download the requirements.txt
- In the command line
cd
to the location where the requirements.txt file was downloaded - Execute
conda create -n ptsnet
to create a new conda environment - Activate the environment with
conda activate ptsnet
- Install the requirements using
conda install --file requirements.txt
- Install h5py
- For Linux/Mac:
conda install "h5py>=2.9=mpi*"
- For Windows:
conda install h5py
- For Linux/Mac:
- Install PTSNET:
pip install ptsnet
- Execute
Create a file called named simulation.py
with the following contents:
import matplotlib.pyplot as plt
from ptsnet.simulation.sim import PTSNETSimulation
from ptsnet.utils.io import get_example_path
sim = PTSNETSimulation(
workspace_name = 'TNET3_VALVE',
inpfile = get_example_path('TNET3'))
sim.define_valve_operation('VALVE-179', initial_setting=1, final_setting=0, start_time=1, end_time=2)
sim.run(); print(sim)
plt.plot(sim['time'], sim['node'].head['JUNCTION-73'])
plt.show()
After creating the file, you can execute the code from the command line.
If you have Linux/Mac execute the following command on the terminal:
mpiexec -n 4 python simulation.py
The number of processors is defined by the parameter -n
in the command, in this case 4.
If you have Windows you can still run the simulation as shown below, but you will not have access to PTSNET's parallel capabilities:
python simulation.py
For more examples, please refer to the jupyter notebooks.
If PTSNET has been useful for your research and you are ready to publish your paper, please cite the paper below:
@article{riano2022distributed,
title={Distributed and vectorized method of characteristics for fast transient simulations in water distribution systems},
author={Ria{\~n}o-Brice{\~n}o, Gerardo and Sela, Lina and Hodges, Ben R},
journal={Computer-Aided Civil and Infrastructure Engineering},
year={2022},
publisher={Wiley Online Library}
}
Distributed under the Unlicense License. See LICENSE
for more information.
Gerardo Riano - [email protected]
Lina Sela - [email protected]
Project Link: https://github.com/gandresr/PTSNET
The authors acknowledge the Texas Advanced Computing Center (TACC) at The University of Texas at Austin for providing HPC resources that have contributed to the research results reported within this publication. This work was supported in part by NSF under award 2015658 and Cooperative Agreement No. 83595001 awarded by the U.S. Environmental Protection Agency to The University of Texas at Austin. It has not been formally reviewed by EPA. The views expressed in this presentation are solely those of the authors, and do not necessarily reflect those of the Agency. EPA does not endorse any products or commercial services mentioned in this publication.