18
11 November 2014 Python scripting in Delta Shell Hidde Elzinga David Rodríguez Aguilera

DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Embed Size (px)

Citation preview

Page 1: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

11 November 2014

Python scripting in Delta Shell

Hidde Elzinga

David Rodríguez Aguilera

Page 2: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

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…?

Page 3: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

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…

Page 4: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Delta Shell

Sta

t

• SOBEK 3 • Delft3D Flexible Mesh

• D-Flow FM • D-Waves

• MorphAn • WFD-Explorer • HABITAT • XBeach

Page 5: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Delta Shell: without scripting

Page 6: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Delta Shell: Is scripting only much faster?

Page 7: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Delta Shell: Is scripting only much faster?

Page 8: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Delta Shell: scripting is faster AND more effective

Page 9: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Delta Shell: scripting is faster AND more effective

Page 10: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares
Page 11: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

What can you use scripting with IronPython for?

Simple (but important!) repetitive tasks

Create new complex functionalities

Page 12: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

How difficult is scripting?

Page 13: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Scripts can also be run from the command line

No GUI commands

in scripts can be run in

command line

Page 14: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

• 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

Page 15: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

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

Page 16: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

• 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

Page 17: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

Scripting editor

Page 18: DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - Python scripting in Delta Shell, Hidde Elzinga & David Rodríguez Aguilera, Deltares

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!!