USING THE SMOOTHED PARTICLE HYDRODYNAMICS (SPH)

SPHYSICS CODE TO MODEL OVERTOPPING

Objectives: to use open-source SPH code called SPHysics to study the wave overtopping of coastal structures.

Operational Notes: The SPHysics code is written in the FORTRAN programming language. You will need to use a PC with a Fortran compiler installed. The choice of compiler depends on which operating system is being used (MS Windows, Linux, Mac OS). For simplicity, the instructions here assume you will be using the Silverfrost (formerly Salford) FTN95 compiler on a machine running Microsoft Windows (XP/Vista/7). You will need to edit text files and type commands into the command line of the terminal (cmd.exe).

Pre-requisites: Download the 2-D serial Fortran SPHysics code from the website: http://www.sphysics.org. Extract the zip file into an appropriate directory. This will create the following directories:

SPHYSICS_2D_2.2.001\run_directory\

SPHYSICS_2D_2.2.001\Post-Processing\

SPHYSICS_2D_2.2.001\execs\

SPHYSICS_2D_2.2.001\execs.bak\

SPHYSICS_2D_2.2.001\source\

The case setup to run in the directory \run_directory\Case7, is overtopping of a trapezoidal structure by a solitary wave (see figure at end).

For Visualisation, download and install the free open-source software Paraview from http://www.paraview.org.

The following instructions describe how to setup, run and post process the results

Task 1: Select the correct Fortran Compiler (Silverfrost FNT95)

1.  Open an editor such as Notepad, Notepad++, Wordpad, or TextPad , e.g.

XP: Start à All Programs à Accessories à Notepad

Vista/7: Start à Search: enter ”notepad.exe”

2.  Open the case input file “Case7.txt”, e.g.

C:\My Documents\SPHYSICS_2D_v2.2.001\run_directory

\Case7\Case7.txt

Note: the directory “C:\My Documents” will depend on where you extracted the zip file above.

3.  Select the correct compiler: Change the initial option in the penultimate line from

3 Which compiler is desired: 1=gfortran, 2=ifort, 3=win_ifort, 4=Silverfrost FTN95

With the following line:

4 Which compiler is desired: 1=gfortran, 2=ifort, 3=win_ifort, 4=Silverfrost FTN95

Task 2: Run the code

4.  Start a terminal window (command prompt)

XP: Start à All Programs à Accessories à Command Prompt

Vista/7: Start à Search: enter ”cmd.exe”

5.  Change to the working directory of the Exercise (note do not type the “>” sign), e.g:

cd C:\My Documents\SPHYSICS_2D_v2.2.001\run_directory

\Case7

Note: the directory “C:\My Documents” will depend on where you extracted the zip file above.

6.  Run the code: at the command prompt, type

> Case7_windows_ftn95.bat

The code should now start to run and display the names of the output files, PART_0001, PART_0002, etc. The code should take about 10 minutes to complete the simulation– note down the total time taken for the simulation as printed on the screen.

While you are waiting, start Paraview visualisation software:

XP/Vista/7: Start à All Programs Paraview à Paraview

Note this may take a while (2-3 mins) if it is the first time Paraview is being started.

Task 3: Post-processing & Visualising the results using ParaView

1.  The file “PART2VTU_windows_ftn95.bat” needs to be copied from the directory “SPHYSICS_2D_2.2.001\Post-Processing\fortanRoutines” to the current Case directory:

“SPHYSICS_2D_v2.2.001\run_directory\Case7”

2.  When the code has finished above prepare visualisation files, at the command prompt, type (note do not type the “>” sign):

> PART2VTU_windows_ftn95.bat

If the simulation finished completely, enter 1.

If the simulation was interrupted, enter 0, and then the start and finish numbers of the output frames, e.g. 1 and 100.

This will create ‘vtk’ output files in a new directory called ParaviewFiles\VTU\

3.  Start Paraview visualisation software as indicated above.

4.  Open the PVDinput.pvd file in the output directories from Step 1 you are using,

e.g. in location

C:\My Documents\SPHYSICS_2D_v2.2.001\run_directory\Case7\:

File à Open à

C:\ My Documents\SPHYSICS_2D_v2.2.001\run_directory\Case7\ ParaviewFiles\VTU\VTUinp.pvd

5.  Click “Apply” on the Properties Tab under Object Inspector field (left-hand side)

6.  Click on the “+Y” button on the toolbar

7.  Change Color by “Solid color” to “Pressure”

8.  Under Object Inspector field on the left-hand side, on the “Display” tab click on “Edit Color Map”,

  1. click on “Choose Preset” button and select “Red to Blue Rainbow” preset color field, and click OK.
  2. Change the data range to -1000 to 10000: Deselect “Automatically Rescale …” click Rescale Range, enter values, click Rescale and then Close.

9.  Change the background colour (useful for creating plots for reports!): Edit à View Settings à Choose Color

Choose white, click “Ok” and then “Ok” again

10.  Click play button to see animation.

11.  Save several screen shots by pressing File à Save Screenshot, or alternatively, use the PrintScreen (PrtScn) key. For example, Plot screen shots of frames 20, 40, 60, 80, 100.

NOTE: this simulation is setup to execute within a reasonably short runtime, hence the resolution used is insufficient to generate overtopping. To generate overtopping, a finer resolution is required (smaller ∆x) with a correspondly longer runtime. The resolution and other parameters can be modified in the input file, Case7.txt, include at the end of this appendix.

The motion of the paddle can be changed by modifying the input file FocusWavePaddle.dat.

Further information:

SPHysics – full source code and documentation is available for download at:

http://www.sphysics.org

Paraview – this program can be downloaded at http://www.paraview.org

SPHERIC – a bibliography dedicated to SPH is available online at http://wiki.manchester.ac.uk/spheric


Input File: Case7.txt

0 Choose Starting options: 0=new, 1=restart, 2=new with CheckPointg, 3=restart with CheckPointing

3 Kernel: 1=gaussian, 2=quadratic; 3=cubic; 5=Wendland

3 Time-stepping algorithm: 1=predictor-corrector, 2=verlet, 3=symplectic, 4=Beeman

0 Density Filter: 0=none, 1=Shepard filter, 2=MLS

0 Kernel correction 0=None, 1=Kernel correction, 2=Gradient kernel Correction

2 Viscosity treatment: 1=artificial; 2=laminar; 3=laminar + SPS

1.0e-6 Viscosity value( if visc.treatment=1 it's alpha, if not kinem. visc approx 1.e-6)

0 Vorticity printing ? (1=yes)

1 Equation of State: 1=Tait's equation, 2=Ideal Gas, 3= Morris

0.50 Maximum Depth (h_SWL) to calculate B

30 Coefficient of speed of sound (recommended 10-40 )??

1 Boundary Conditions: 1=Repulsive Force; 2=Dalrymple

8.0e-4 Wall viscosity value for Repulsive Force BC

2 Geometry of the zone: 1=BOX, 2=BEACH, 3=COMPLEX GEOMETRY

1 Initial Fluid Particle Structure: 1= SC, 2= BCC

13.0,0.8 Box dimension LX, LZ?

0.02,0.02 Spacing dx, dz?

1.48 Length of Flat Domain

2.8624 Slope (deg) of the inclined plane ( beta ) ??

0,0,0 Periodic Lateral boundaries in X, Y, & Z-Directions ? (1=yes)

1 If wavemaker will be added, left panel is not needed (1=yes)

1 Add obstacle (1=yes)

2 Choose obstacle: 1=rectangular, 2=trapezoid

9.605,0.40625 Enter (x,z)-start of trapezoid

10.065,0.6085 Enter (x,z)-start of trapezoid top

10.28,0.6085 Enter (x,z)-finish of trapezoid top

10.62,0.457 Enter (x,z)-finish of trapezoid

0 Add another obstacle (1=yes)

3 Enter Paddle-Type: 1=Piston, 2=Piston-flap, 3=Piston with prescribed motion

0.0 X_PaddleCentre

FocusWavePaddle.dat Enter filename of prescribed motion

0.5 paddle_SWL

0.0,0.7 ZZMin, ZZmax of the wavemaker ??

0.0 Initial time of wavemaker = twavemaker ??

1 Number of frequencies ??

0.0 Wavemaker Stroke = 2*Amplitude ??

0 Period ??

0 Phase ??

0 twinitial ??

0 Add another wavemaker inside the beach (1=yes)

0 Add gate (1=yes)

0 Add Sliding Raichlen Wedge (1=yes)

0 Add Floating Body (1=yes)

1 Add water in the flat region ?? (1=yes)

0.0, 1.48 Cube containing particles : XMin, Xmax ??

0.02, 0.50 Cube containing particles : ZMin, Zmax ??

1 Add water in the inclined region ?? (1=yes)

1.50, 9.915 Cube containing particles : XMin, Xmax ??

0.02, 0.50 Cube containing particles : ZMin, Zmax ??

0 Add a solitary wave ?? (1=yes)

12.0,0.040 Input the tmax and out

0.0 initial time of recording

0.0,1.0,-1.0 detailed recording: out_dtrecording, Start time, End Time

0.00005,1 input dt ??, variable dt ??

0.4 CFL number (0.1 - 0.5)

0.92 h=coefficient*sqrt(dx*dx+dy*dy+dz*dz): coefficient???

1 Use of Riemann Solver: 0=None, 1=Conservative (Vila), 2=NonConservative (Parshikov)

1, 1.3 Use TVD Riemann Solver, slope limiter (beta_lim)

4 Which compiler is desired: 1=gfortran, 2=ifort, 3=win_ifort, 4=Silverfrost FTN95

2 Precision of XYZ Variables: 1=Single, 2=Double

Figure: Pressure plot in Case7.

1

Work Package 2.1 Appendix 2 Deliverable 2.2 28.09.2011