Upload
delftsoftwaredays
View
222
Download
4
Embed Size (px)
Citation preview
11 November 2014
Python scripting in Delta Shell
Hidde Elzinga
David Rodríguez Aguilera
Goals of this workshop
• Why would you like to use scripting?
• What can be done (better) with scripting?
• Which tools are available for scripting in Delta Shell (DS)?
• How could I live until now without scripting…?
How?
Introduction:
• DS + Plugins
• Goals scripting (advantages)
What can you do with scripting?
How difficult is scripting and can you (and we) make your
life easier with scripting?
Command line scripting
Overview of the workshop exercises:
• SOBEK 3
• Delft3D Flexible Mesh
Scripting editor
On your marks…
Delta Shell
Sta
t
• SOBEK 3 • Delft3D Flexible Mesh
• D-Flow FM • D-Waves
• MorphAn • WFD-Explorer • HABITAT • XBeach
Delta Shell: without scripting
Delta Shell: Is scripting only much faster?
Delta Shell: Is scripting only much faster?
Delta Shell: scripting is faster AND more effective
Delta Shell: scripting is faster AND more effective
What can you use scripting with IronPython for?
Simple (but important!) repetitive tasks
Create new complex functionalities
How difficult is scripting?
Scripts can also be run from the command line
No GUI commands
in scripts can be run in
command line
• Run SOBEK model
• Import measured data
• Get results
• Plot model results vs data
• Enhance charts
• Use objects to calibrate model
• Calibrate a model
• Plot calibration results
• Choose best fit
• Save results as data (spreadsheets) or graphs (images)
• Create SOBEK model:
• Create a SOBEK 3 flow model
• Import branches
• Import cross sections
• Import bridges
• Import lateral sources
• Import weirs
• Set background map
• Adjust data for B.C. and laterals
• Adjust roughness
• Set initial conditions
• Space and time discretization
Option 1: SOBEK 3
• Create SOBEK model:
• Import SOBEK 2.1x model
Option 1: SOBEK 3
Import 2.12
model
Calibration
Set up model
from scratch
Calibration
Import 2.12
model Set up
model from
scratch
Run model
Modify model
Run model
Modify model
Run model
Modify model
Run model
Modify model
track 1 track 2 track 3 track 4
Postprocessing Postprocessing Postprocessing Postprocessing
• Create a Flexible mesh model
• Create a regular grid
• Add bathymetry data (from server) and crop grid
• Add observation point and boundaries
• Add boundary conditions (from server) to the boundaries
• Set spatially varying initial conditions and model parameters
• Run the model
• Extract and visualize output data
Option 2: Delft3D Flexible Mesh
Scripting editor
Let’s get it started... in here!
OPTION 2
OPTION 1
Delft3D
Flexible Mesh
SOBEK 3
SOBEK 3
Delft3D
Flexible Mesh
WORKSHOP: -> search : DeltaShell.Gui.exe
https://publicwiki.deltares.nl/display/TOOLS/Scripting+tutorials
Autocomplete: CTRL + SPACE
Run selection: CTRL + ENTER
Run region: CTRL + SHIFT + ENTER
Clear cached variables
Show local variables
Add watches
Keep your code tidy with regions
Please, provide us with as much FEEDBACK as possible!!