Back to all tutorials

Dam Break - CFD Simulation CFD Software Tutorial

1. Introduction

In this tutorial, we will demonstrate a common free surface flow with a Volume of Fluid approach. We will examine the multiphase, immiscible flow of water and air. Increasing the water level will lead to a water flow through the dam. Using ParaView, we will be able to visualize the resulting flow and its effects.

2. Download SimFlow

SimFlow is a general purpose CFD Software

To follow this tutorial, you will need SimFlow free version, you may download it via the following link:
Download SimFlow

3. Create Case

Open SimFlow and create a new case named dam break

  1. Click New
  2. Provide name dam break
  3. Click Create to open a new case
simflow-launcher

4. Import Geometry

Firstly we need to Download GeometryDam

  1. Click Import Geometry
  2. Select geometry file dam.stl
  3. Click Open
db 2 import geometry

5. Imported Geometry Units

The STL geometry format does not store the unit in which the geometry was created. Geometry size shows the overall size of the model in each direction, which is helpful for unit selection. In our case, the default unit meter is correct.

  1. To confirm default unit meter, press OK
db 2 unit

6. Geometry - Dam

After importing geometry, it will appear in the 3D panel.

  1. Click Fit View to zoom the geometry
db 3 geometry 1

7. Enable Geometry Meshing

Now we need to enable meshing for the newly imported geometry.

  1. Go to Hex Meshing panel
  2. Enable meshing on the dam geometry
db 4 geometry meshing

8. Base Mesh

Now we are going to define the computational domain in the Base Mesh panel.

  1. Go to Base tab
  2. Define initial mesh extends
    Min \({\sf [m]}\)-2000
    Max \({\sf [m]}\)303020
  3. Define mesh division
    Division704530
db 5 base mesh

9. Base Mesh Boundaries

To be able to define different conditions on each boundary of the domain we need to assign an individual name to each side of the base mesh.

  1. Define boundary names accordingly
    X- inlet
    X+ outlet
    Y- sides
    Y+ sides
    Z- bottom
    Z+ top
  2. Change boundary type
    Z- wall
db 6 base mesh boundaries

10. Material Point

We need to tell the meshing algorithm where the mesh should be retained.

  1. Go to Point tab
  2. Set coordinates of the material point
    Material Point10155
db 7 material point

11. Start Meshing

Everything is now set up for meshing

  1. Go to Mesh tab
  2. Press Mesh button to start meshing process
db 8 start meshing

12. Mesh

After meshing process is finished the mesh will be loaded and displayed. To show what is inside of mesh, we can zoom in, or hide other meshes.

  1. Click Graphic Object List
  2. Select Mesh to show meshes list
db 9 mesh 1

13. Mesh - Toggle Visibility

You can toggle the visibility of different objects to examine desired ones.

  1. Hide top boundary to look inside the mesh
db 10 hide mesh

14. Setup Solver - Inter

To analyze water flow over a dam we will use Inter (interFoam) solver. This solver is able to model two-phase flow with a free surface.

  1. Go to Setup panel
  2. Select Multiphase filter
  3. Pick Inter (interFoam)
  4. Select solver
db 11 setup solver

15. Boundary Conditions - Inlet (Flow)

At the inlet, we will apply a constant water flow rate in order to simulate water supplied by a river.

  1. Go to Boundary Conditions panel
  2. Select inlet boundary
  3. Set the Mass Flow Inlet character
  4. Set the mass flow rate
    U Flow Rate \({\sf [m^3/s]}\)250
db 12 boundary conditions inlet flow

16. Boundary Conditions - Inlet (Phases)

We will modify the default phase fraction boundary condition to properly interact with the velocity boundary condition.

  1. Go to Phases tab
  2. Select the following boundary condition accordingly
    \(\alpha_{phase1}\) TypeZero Gradient
db 13 boundary conditions inlet phases

17. Boundary Conditions - Outlet (Flow)

On the outlet we want the water to freely flow out of the domain.

  1. Select outlet boundary
  2. Go to Flow tab
  3. 4 Set the following boundary conditions accordingly
    \(p- \rho gh\) TypeFixed Flux Pressure
    \(U\) TypeInlet-Outlet
db 14 boundary conditions outlet flow

18. Boundary Conditions - Sides (Flow)

We want sides to be impermeable but did not provide any friction.

  1. Select sides boundary
  2. 3 Set the following boundary conditions accordingly
    \(p- \rho gh\) TypeZero Gradient
    \(U\) TypeSlip
db 15 boundary conditions sides flow

19. Boundary Conditions - Sides (Phases)

  1. Go to Phases tab
  2. Set the following boundary condition accordingly
    \(\alpha_{phase1}\) TypeZero Gradient
db 16 boundary conditions sides phases

20. Geometry for Initialization

As an initial state, we want some water to already be behind the dam. For this purpose, we need to create geometry defining the initial location of water.

  1. Go to Geometry panel
  2. Create Box geometry
  3. Change name to water_init
  4. Define parameters accordingly
    Origin \({\sf [m]}\)-2000
    Dimensions \({\sf [m]}\)20309
db 18 geometry for initialization 1

21. Geometry - Water Initialization

The gray box behind the broken dam geometry indicates the water we have created for the initialization part

  1. Exit edit mode and Deselect the geometry using buttons or by clicking Esc to have a proper view of the geometry
db 19 geometry water init

22. Initialization

We will use the water_init geometry to select the region where water phase fraction should be applied.

  1. Go to Initial Conditions panel
  2. Switch to Patch tab
  3. Enable initialization on water_init
  4. Expand Fields list
  5. Select \(\alpha_{phase1}\) fraction for initialization
  6. Set initial value of \(\alpha_{phase1}\) to 1
db 20 initialization

23. Slice Monitor (I)

Usually, we do data postprocessing when the computation is finished. However, it is handy to be able to see a preview of the results during the calculation. To do this, we need to use the Monitors panel where we might sample data in a specified point or section plane. In this tutorial, we will add a section plane, going through the center of our mesh.

  1. Go to Monitors panel
  2. Select Sampling tab
  3. Click on Create Slice button to enable sampling data on a section plane
  4. Set slice parameters accordingly
    Normal \({\sf [-]}\)0-10
    Point \({\sf [m]}\)81515.5
db 21 slice

24. Slice Monitor (II)

Finally, we need to choose which data should be sampled on the section plane.

  1. Expand available Fields list
  2. Select \(U\), \(\alpha_{phase1}\) and \(\rho\)
db 22 slice add fields

25. Time Controls

For multiphase simulations, we usually want the solver to automatically determine the proper time step. This should lead to good stability and reduce simulation time.

  1. Go to Run panel
  2. Specify simulation duration to 60 seconds
  3. Change Time Stepping to Automatic
  4. Set initial time step Initial \(\Delta t [s]\) to 1e-02
    (solver will start computation with this value and adjust it in the next iterations)

In some situations, it might be necessary to use smaller time step values than the one provided by default configuration. To force solver reducing it you need to change the Max Co [-] (Courant Number). This property is used by the solver to automatically estimate the desired time step value.

db 24 time controls

26. Run - Write Control

Before we will start computations we will specify intervals for writing data.

  1. Go to Output tab
  2. Set Write Control Interval [s] to 0.5 seconds
    (The results will be written to the hard drive every 0.5 seconds of simulation time)
db 23 run output

27. Run - CPU

To speed up the calculation process, take advantage of parallel computing and increase the number of CPUs based on your PC’s capability. The free version allows you to use only one processor (serial mode). To get the full version, you can use the contact form to Request 30-day Trial

Estimated computation time for serial mode: 35 minutes

  1. Switch to CPU tab
  2. Click Run Simulation button
run cpu serial

28. Residuals

When the calculation is finished we should see a similar residual plot.

db 25 residuals

29. Preview Results on Slice

When the calculation is started SimFlow will automatically open the Residuals plots tab. When data is written to the disk for the first time new tab Slices will appear next to Residuals . Under this tab, we can preview results on the defined slice plane.

  1. Go to Slices tab
  2. Set the XZ orientation View XZ
  3. Click Fit View
  4. Select alpha.phase1 to display the location of the water phase
    alpha.phase1 equal to 1 indicate water phase
    alpha.phase1 equal to 0 indicate air phase
  5. Click Adjust range to data
  6. Play with animation buttons to view the results of the analysis
db 26 preview results slice

30. Postprocessing - ParaView

When the computations are finished start the ParaView software.

  1. Go to Postprocessing panel
  2. Start ParaView

You might also start ParaView when the simulation is still in progress to observe intermediate results

db 27 postprocessing paraview

31. ParaView - Load Results

After opening the ParaView, we have to load the results of the simulation from SimFlow.

  1. Select your case
  2. Click Apply button to load results into ParaView
db 28 paraview load results

32. ParaView - Create Clip

We want to show how the water surface looks like. Additionally, we want the water surface to be colored based on the local velocity to better understand the flow behavior.

  1. Make sure your case is selected dam_break
  2. Create Clip
  3. Set Clip Type to Scalar
  4. Set Scalars to alpha.phase1
  5. Define water surface threshold Value to 0.2
  6. Make sure that Invert option is unchecked
  7. Apply changes
db 29 paraview create clip 1

33. ParaView - Coloring

After the clip is created we can color water surface with velocity and choose color scale preset. While being still in the Properties panel.

  1. Select U (velocity) field
  2. Click Choose Preset button, a new window will appear (next step)
db 31 paraview coloring

34. ParaView - Choose Preset

We can now select Color Preset of your choosing.

  1. Choose the jet preset.
  2. Apply changes
  3. Close Choose Preset window
db 32 paraview choose preset

35. ParaView - Adjust Data Range and Play

  1. Change visible time step to Last Frame
  2. Fit colors range by clicking Rescale to Data Range
  3. Move to the First Frame
  4. Click Play to show simulation results
db 33 paraview adjust data range

36. ParaView - Results

After correctly defining configuration you should be able to see similar results in the graphics 3D view.

db 34 paraview results

37. ParaView - Add Opacity

We can also add an opacity attribute to surface colors.

  1. Select Clip
  2. Click Edit if you do not see the Color Map Editor panel
  3. Check Enable opacity mapping for surfaces
  4. Check Use log scale when mapping data to opacity
db 35 paraview opacity

38. ParaView - Results with Opacity

db 36 paraview results opacity

39. Advanced Postprocessing with ParaView

This concludes the tutorial, covering all the aspects we intended to showcase. For a finely tuned presentation of the results, you may take advantage of the more advanced features.

In ParaView, you can display streamlines, contour plots, vector fields, line or time plots, calculating volume or surface integrals and create animations.

To familiarize yourself with the ParaView capabilities, it’s worth checking out our video tutorial, Paraview CFD Tutorial - Advanced Postprocessing in ParaView, in which we demonstrate some of the most commonly used post-processing techniques.