In this tutorial we will create a floating cube falling into a body of water. It uses most of the simple DesignSPHysics tools and gives a glance at the float property. The result should be something like this:
This simulation consists in a roofless fishtank that contains a resting body of water, partially filling it, and a heavy cube that will fall into the water.
These are the steps to get to that.
First of all, lets run FreeCAD and run this software. Make sure DesignSPHysics is installed. For that, you can check the installation page.
Once in DesignSPHysics, use the New Case button to create a new case. If you have opened FreeCAD files, DesignSPHysics will prompt you to close them automatically.
Once created you should see something like this:
This red lines represent the Case Limits, in which elements that are part of the simulation will be contained.
Make sure your plugin is configured correctly, pressing “Setup Plugin” and establishing the proper executables in the configuration window that appears.
Change the Inter-particle distance text input box to 0.025. It will look something like this:
This will set the case to generate a particle every 0.025 meters. For this case is an appropiate value for quick-simulation.
The next step is to adjust the case limits, so let's do that.
First of all select Case_Limits from FreeCAD's combo view. You will see the FreeCAD objects properties in the properties table. There, edit the Length, Width and Height to match 1,2 meters, 0.6 meters and 1 meter respectively. It should look like this:
Once done that, we will create the boundaries. To create a wall (or a floor), just create a box and fill it with the appropiate parameters in the FreeCAD properties table. Create 5 boxes with this properties
LongWall1:
LongWall2:
ShortWall1:
ShortWall2:
Floor:
Now select all of them in the Combo view (Control + Click each one) and press “Add all possible to DSPH Simulation” In the DSPH Object Properties.
Now, for each one of them, press in it and change the property MKBound to 0, as we want all the boundaries to be part of the same object (a external case). You should see that the type of object is bound by default.
Also, we want to see what's inside the fishtank, so we will make it look like glass in FreeCAD. For that, select all of the created walls and the floor in the Combo View. Then, press in one of them with the mouse right click, and select Appearance. In the window that appears, and without deselecting anything, set the Shape color to complete white and the Transparency value to something around 80.
That will make it look like glass. You should see something like this.
We're going to create a new cube and rename it to “Water”. For that, press in the cube icon on the top of the screen, select the generated cube, and press F2 (or right click → rename) to rename it.
We need to resize this body, so press in it and in FreeCAD's property table input, as before, this values:
Water:
We need to mark this object as part of the simulation. Press the Add to DSPH Simulation button in the DSPH Object Properties
Now we will set this body to be fluid. For that, select it and in the DualSPHysics property table set the Type of Object to: Fluid. Also, if is not set yet, put the MKFluid value to 0
You will see that the body turns blue, representing water. You should have something like this on your screen:
To create a cube, press in the cube icon at the top of the screen. Select it and input the following properties:
Cube:
Add the object to the DualSPHysics simulation. To do that press the Add to DSPH Simulation button in the DSPH Object Properties
We don't want this cube to be part of the fishtank, so we have to change its MKBound value. Set it to 1, if it is not yet set correctly.
We want to enable the float state for this object and give it properties. To do that, press the Configure button in the Float state DSPH property.
Select True in the Set floating field, and set the Mass/Density to massbody and 10 kilograms. You should be seeing something like this:
You can now save your project. This will generate a GenCase export and tell you how many particles you have to simulate.
Your case should be something like this:
From there you can just select your preferred processor in the simulation group (CPU or GPU[Nvidia only]) and press “Simulate Case”. Once finished you can export the data to VTK with the button “Export data to VTK”.
To see the resulting animation you can open all the data generated with a visualization software, like Paraview. Your simulation data is in the folder you saved the project, under [project name]_Out/