Back to all tutorials

Sloshing Tank - CFD Simulation SimFlow Tutorial

1. Introduction

In this tutorial, we will explore the phenomenon of water sloshing inside a cistern during braking. This occurs due to the inertial force that pushes the water. We will conduct two analyses: the first one will involve studying the tank without any support structure, while the second one will involve analyzing the tank with internal baffles. You will learn how to simulate rigid body motion and model an internal 2D wall within the mesh. Finally, we will compare the forces acting on the cistern for both cases and plot them on one chart.

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 sloshing tank no baffles

  1. Click New
  2. Provide name sloshing tank no baffles
  3. Click Create to open a new case

4. Import Geometry - Tank

Firstly we need to Download GeometriesBaffle_1Baffle_2Tank

Although the baffles are not involved in the first simulation we will import them at this stage. We can omit them when creating the first mesh and include them in the second simulation.

  1. Click Import Geometry
  2. Select geometry files: baffle_1.stl baffle_2.stl tank.stl
  3. Click Open
Sloshing Tank 02 Import geometry

5. Imported Geometry Units

The STL format does not contain the unit information which are defined during the geometry export. If we do not know the exported unit, we can estimate it based on the total size of the model. The size is displayed next to Geometry size label. In our case, the default unit meter is correct.

  1. To confirm default unit meter, press OK
Sloshing Tank 02 unit

6. Display Geometry

Inside the tank, there are two baffles. To view the baffles we will reduce tank opacity.

  1. Click Fit View and orient the model using mouse buttons
  2. Hold the Ctrl key and select the tank geometry by clicking on it with the left mouse button. Selected geometry will be highlighted in red
  3. Click Change Object Display Properties button
  4. Switch the tab to Opacity
  5. Set the opacity to 40%
  6. Approve by clicking OK
Sloshing Tank 03 Geometry check

7. Split Geometry - Tank (I)

The imported geometry is made up of a single surface. We need to split it into multiple faces for further processing.

  1. Extend Options list next to the tank geometry
  2. Select Split
Sloshing Tank 04 Geometry Split

8. Split Geometry - Tank (II)

  1. Select Split
Sloshing Tank 05 Geometry Split 2

9. Extract Geometry - Tank (I)

To make sharp edges visible, we will use Extract Features operation. These edges will indicate additional mesh refinement regions.

  1. Extend Options list next to the tank geometry
  2. Select Extract Features
Sloshing Tank 06 Geometry Features 1

10. Extract Geometry - Tank (II)

  1. Select Extract
Sloshing Tank 07 Geometry Features 2

11. Meshing Parameters - Tank

In order to create the mesh, we need to specify geometries options used during the meshing. In this tutorial, we will analyze two configurations: with and without baffles. We will start with the tank itself and skip baffles for now.

  1. Go to Hex Meshing panel
  2. Select tank
  3. Enable Mesh Geometry
  4. Set Refinement to Min 1 Max 1
Sloshing Tank 08 Hex Meshing

12. Base Mesh

Now we will define the base mesh. The box geometry determines the background mesh.

  1. Go to Base tab
  2. Click on Autosize
  3. Define the number of divisions
Sloshing Tank 09 Base Mesh

13. Material Point

Material Point indicates the meshing algorithm on which side of the geometry the mesh is to be retained. Since we are considering fluid inside the tank we need to place the material point inside the geometry.

  1. Go to Point tab
  2. Specify location inside tank geometry
    Material Point402

You can specify the point location from the 3D view. Hold the CTRL key and drag the arrows to the destination.

Sloshing Tank 10 Material Point

14. Start Meshing

Everything is now configured and ready to be meshed.

  1. Go to Mesh tab
  2. Press the Mesh button to start meshing process
Sloshing Tank 11 Meshing

15. Examine Mesh

After the meshing is finished the mesh will appear in the graphics window. The mesh should consist of only a single boundary.

  1. Click Fit View
Sloshing Tank 12 Mesh check

16. Select Solver - Inter

To analyze water behavior we will use Inter (interFoam) solver. This solver is dedicated to model two-phase flow with interface capturing capabilities.

  1. Go to SETUP panel
  2. Select Transient filter
  3. Select Multiphase model filter
  4. Pick Inter (interFoam) solver
  5. Select solver
Sloshing Tank 13 Select Solver

17. Dynamic Mesh

To model tank deceleration we will use a dynamic mesh feature. The dynamic mesh allows transforming mesh by moving its nodes. There are several types of mesh deformation available. In this tutorial, we will use the Rigid type to model mesh translation as a whole.

The external file displacement.dat stores the motion data that we will import to SimFlow. The data describes deceleration from the initial velocity 11.853 m/s to 0 m/s within 5 s .

  1. Go to Dynamic Mesh panel
  2. Select Rigid as a Dynamic Mesh Type
  3. Extend the motion list and select Tabulated
  4. Indicate the path to the file displacement.dat
Sloshing Tank 14 Dynamic Mesh

18. Turbulence

In the turbulence panel, enable turbulence modeling and select Raynolds Averaged Navier Stokes (RANS). For the purpose of this tutorial, we will model the turbulence phenomenon using the \(k{-} \varepsilon\) model.

  1. Go to Turbulence panel
  2. Set the RANS turbulence formulation
Sloshing Tank 15 Turbulence

19. Transport Properties

In the transport properties panel we will define water and air properties. We will leave the default values for phase1 (water) and phase2 (air). To assign each of the materials to the domain, the phase fraction parameter \(\alpha_{phase}\) is used. The parameter determines the proportion of each fluid in the given point in space. The phase fraction value varies in range from 0 to 1, where \(alpha_{phase1}=1\) denotes phase1, while \(alpha_{phase1}=0\) denotes remaining fluid - the second phase.

  1. Go to Transport Properties panel
  2. Rename the phases as appropriate
    phase1 \(\rightarrow\) water
    phase2 \(\rightarrow\) air
Sloshing Tank 16 Transport properties

20. Boundary Conditions - Tank (Flow)

The mesh consists of only one tank wall boundary. For this boundary, we will apply the velocity that matches the initial velocity of the tank.

  1. Go to Boundary Conditions panel
  2. Select the tank boundary
  3. 4 Set the velocity type and value accordingly
    \(U \quad Type\)Moving Wall Velocity
    \(U \quad Value\) \({\sf [m/s]}\)-11.853
Sloshing Tank 18 Bounadry Conditions

21. Create Geometry - Water

Before we will set the initial condition we need to define the water region. For this purpose, we will create a box that will indicate the initial location of water.

  1. Go to Geometry panel
  2. Select Create Box
  3. Change geometry name from box_1 to water
    (double click to edit name and press Enter to confirm)
  4. Set the origin and box dimensions
    Origin \({\sf [m]}\)1-1.50.4
    Dimensions \({\sf [m]}\)1431.8
Sloshing Tank 19 Geometry water

22. Initial Conditions - Basic

Before we will start the calculation we need to define the fluid state at the time zero. We will specify velocity to be equal to -11.853 m/s which corresponds to the initial tank velocity. Phase fraction \(\alpha_{water} =0\) tells us that the whole domain is filled with air by default.

  1. Go to Initial Conditions panel
  2. Set the initial velocity
Sloshing Tank 20 Initial Conditions

23. Initial Conditions - Patch

Using the water geometry, we will overwrite the phase fraction value inside it. We will set the \(\alpha_{water}\) to 1 to fill the patched geometry with water.

  1. Switch to Patch tab
  2. Check the water geometry
  3. Expand the Fields
  4. Check \(\alpha_{water}\)
  5. Set initial value of \(\alpha_{water}\) to 1
Sloshing Tank 21 Initial Condition Patch

24. Monitors - Create Slice

During calculation, we can observe intermediate results on a section plane. To add sampling data on a plane we need to define plane properties and also select variables that will be sampled. Note that runtime post-processing can only be defined before starting calculations and can not be changed later on.

  1. Go to Monitors panel
  2. Switch to Sampling tab
  3. Select Create Slice
  4. Expand Fields list
  5. Select the water phase \(\alpha_{water}\)
  6. Set the normal along Y axis
    Normal \({\sf [-]}\)010
Sloshing Tank 22 Monitors Slice

25. Monitors - Forces

In order to track the sloshing force on the tank boundary, we will use the force monitor.

  1. Switch to Forces tab
  2. Expand Monitored Boundaries list and check tank
Sloshing Tank 23 Monitors Force

26. Run - Time Control

For any simulation, it is very convenient to let the solver automatically determine the proper time step value. To use this option we need to define time step constraints by providing the initial time step (adjusted by the solver during computations), maximal time step value and Courant number.

  1. Go to RUN panel
  2. Set the Simulation Time [s] to 5
  3. Change Time Stepping to Automatic
  4. Set initial time step, maximum time step and Courant number accordingly
    Initial \(\Delta t\) \({\sf [s]}\)1e-04
    (solver will start computation with this value and adjust it in the next iterations)
    Max \(\Delta t\) \({\sf [s]}\)0.05
    Max Co \({\sf [-]}\)1
Sloshing Tank 24 Run Time

27. Run - Output

We can control how often results should be saved on the hard drive. Only this data will be available for postprocessing.

  1. Switch to Output tab
  2. Set the Interval [s] to 0.05
Sloshing Tank 25 Run Output

28. Run - CPU

To speed up the calculation process increase the number of CPUs basing on your PC capability. We recommend using at least 4 cores for this tutorial. If you are using a free version you can use the contact form to Request 30-day Trial

Estimated computation time for 2 processors: 50 minutes

  1. Switch to CPU tab
  2. Change the solver to parallel
  3. Define the number of processors
  4. Click Run Simulation button
Sloshing Tank 25 Run CPU

29. Results - Slice

Slices tab appears next to Residuals. Under this tab, we can preview results on the defined slice planes. The results preview is available during the calculation and we can track it on a regular basis. The newly calculated time step will be actualized automatically as long as the time selector points to the latest time step.

  1. Change tab to Slice
  2. Set the View XY
  3. Choose alpha.water field to display the water phase
  4. Click Adjust range to data
  5. Play with animation buttons to view the results of the analysis
Sloshing Tank 26 Slice no baffle

30. Results - Force

Additional force tab appears next to Slices . Under this tab, we can view force plots. The results preview is available during the calculation and we can use it to track the progress of the simulation as well.

  1. Change tab to Force
Sloshing Tank 27 Force no baffles

31. Save model

We will use this simulation as a starting point for the second configuration. To do so we will save the current model under a new name without the results.

  1. Extend File options from top menu
  2. Select Save as…​
  3. Type new name sloshing_tank_baffles
  4. The model will be saved in the same workspace (parent folder) by the default
  5. Press OK
  6. Go to Launcher
Sloshing Tank 28 Save

32. Load model

After saving, we will open a new case.

  1. Select a case sloshing tank baffles from launcher
  2. Open the case in New Window
Sloshing Tank 29 Open

33. Meshing Parameters - Baffle 1

In the new case, we will add the baffles inside the tank. The baffles geometries are already loaded in SimFlow but have not been used yet. We can just turn them on and remesh the model.

  1. Go to Hex Meshing panel
  2. Select the baffle_1
  3. Enable Mesh Geometry
  4. Set Refinement to Min 1 Max 2
  5. Check Create Baffle option
Sloshing Tank 30 Mesh parameters baffles 1

34. Meshing Parameters - Baffle 2

Repeat these steps for the second baffle.

  1. Select the baffle_2
  2. Enable Mesh Geometry
  3. Set Refinement to Min 1 Max 2
  4. Check Create Baffle option
Sloshing Tank 31 Mesh parameters baffles 2

35. Start Meshing - Second Case

We will use the same base mesh setup so we can go directly to the meshing step.

  1. Go to Mesh tab
  2. Press the Mesh button to start meshing process
Sloshing Tank 32 Meshing baffles

36. Boundary Conditions - Copy (I)

We have already defined the initial velocity of the tank. Now, we need to assign the velocities to the remaining walls. We will copy the boundary conditions from the tank to the others.

  1. Go to Boundary Conditions panel
  2. Select the tank boundary
Sloshing Tank 33 Boundary Conditions buffles

37. Boundary Conditions - Copy (II)

  1. Press Copy Boundary Conditions
  2. Extend the list next to Copy to and press Select All . All boundaries will be checked
  3. Press Copy
Sloshing Tank 34 Boundary Conditions buffles2

38. Monitors - Forces (2nd Case)

Previously fluid was acting only on the tank boundary. In the current mesh, we have additional walls that should participate in force calculation as well.

  1. Go to Monitors panel
  2. Switch to Forces tab
  3. Expand the list of Monitored Boundaries
  4. Check all boundaries
Sloshing Tank 35 Monitors Forces baffles

39. Run Second Case

Finally, we can run the simulation using the same parameters as previously.

  1. Go to RUN panel
  2. Click Run Simulation button
Sloshing Tank 36 Run baffles

40. Results - Slice (2nd Case)

We can view the results on the slice.

  1. Switch to Slice tab
  2. Select alpha.water field to display the water phase
  3. Click Adjust range to data
  4. Play with animation buttons to view the results of the analysis
Sloshing Tank 37 Slice baffles

41. Results - Force (2nd Case)

Under the force tab, we will display the resultant force acting on a tank caused by fluid deceleration. We will add the results from the previous simulation (without the baffles) and compare them on the same chart.

  1. Change tab to Force
  2. Click on Fit Axes
  3. Click on Chart Setup
  4. Set the name of the axis:
    X Label to Time [s]
    Y Label to Force [N]
  5. To close the panel press Chart Setup button once again or press Esc key
  6. Clisk Plot Data from File button
Sloshing Tank 38 Force baffles

42. Import Results

  1. Navigate to the folder with a previous simulation sloshing_tank_no_baffles . The forces were automatically saved under the following path
  2. Select the file force.dat
  3. Press Open
Sloshing Tank 39 Import Force

43. Results Summary

New data series will be added to the chart. We will hide the unnecessary data series for clarity.

  1. Select Data Series
Sloshing Tank 40 Force baffles a

44. Results - Data Series

We will leave only the sloshing force (force along X direction).

  1. Hide all series except Fx and total_x
  2. Change series name accordingly
    Fx \(\rightarrow\) Fx_baffles
    total_x \(\rightarrow\) Fx_no_baffles
  3. Click on Options next to Fx_no_baffles
  4. Set the color of the series to blue
  5. Click Data Series to exit or press Esc key
Sloshing Tank 41 Force chart props

45. Results Comparison

Finally, we can compare the results from both configurations. We can see that the peak force was reduced by 30% by using baffles.

Sloshing Tank 42 Force chart comparison

46. Advanced Postprocessing with ParaView

This concludes the tutorial, covering all the aspects we intended to showcase. To create a finely tuned presentation of the results, you may take advantage of the seamless integration with ParaView. You can easily open simulation results in ParaView with a single click from SimFlow.

In ParaView, you can perform typical and advanced postprocessing tasks such as displaying streamlines, contour plots, vector fields, line or time plots, and calculating volume or surface integrals.

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.