top of page

Updates & Feature Requests

Public·6 members

Automation & Running through Python

As more people are using the model, a common desired workflow looks like: 1) Create and fine-tune the model setup using the Web interface

2) Run various different cases, including modifications to water levels, waves, bathy/topo etc Right now step 2) is laborious, requiring alot of manual interaction, including loading the files for each case, clicking Run, setting up the desired output, and then curating (copying, processing) the output. With Chrome, it is possible to automate / script all of step 2). Chrome distributes a "chromedriver" browser application, which can be controlled externally via a library in Python (e.g. Selenium). An example script on how to do this is given below. Right now, the automation abilities allow the user to:

  • Create an animated gif, starting at some specified time with a specified frame interval

  • Output 2D surfaces of model data (e.g. free surface elevation, velocity) between some start and end times, at a specified time increment

  • Output wave height and water level statistics. The user needs to specify a time to start determining the mean water level (this should be the time when the simulation has reached quasi-steady conditions, usually between 5-15 minutes, depending on the bathymetry), a time to start determining the wave height statistics (usually 10-15 minutes later), and finally a time to write the wave height surfaces, after which the simulation will terminate.


An example Python script with required files is attached, and a more complete (and living) example can be found at the github (https://github.com/plynett/plynett.github.io) in the "automation" directory. As you will see from the example, you will need to download the "chromedriver" application, which can be found here for various OS's:

https://googlechromelabs.github.io/chrome-for-testing/ I recommend using the "Stable" version, and download the "chromedriver" zip for your system. Hopefully the Python script is fairly understandable. You can see that running any configuration that does not need interactivity during the simulation can easily be configured with this script. It should also be straightfoward to use this script, or a variant of it, within a batch-type workflow, running many simulations in sequence.



97 Views
JoseB
JoseB
May 07

A note here to warn folks that if/when Chrome updates, you also need to update chromedriver... Chrome updates automatically, chromedriver doesn't.

University of Southern California

213-740-3133

© 2024 by Patrick Lynett

bottom of page