====== Dam Break ====== This is one of the most simple cases to create. It will create a cube of water spreading out in a box. The result should be like this: {{ ::dam-break-result.png |}} This simulation consists in a 1 meter * 0.5 meter roofless box that contains a resting body of water in a shape of a cube, that will fall to the floor once the simulation starts. These are the steps to get to that. ==== Step 1 - Creating a new case ==== First of all, lets run FreeCAD and run this software. Make sure DesignSPHysics is installed. For that, you can check the [[installation|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: {{ ::case-limits.png?300 |}} 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. ==== Step 2 - Setting the Inter-particle distance ==== Change the Inter-particle distance text input box to **0.025**. It will look something like this: {{ ::dp-set.png |}} This will set the case to generate a particle every **0.025** meters. For this case is an appropiate value for quick-simulation. ==== Step 3 - Adjusting the case limits and creating the boundaries ==== The next step is to adjust the case limits. We need to make the case limits at least be 1 meter on the X axis, and 0.5 meters in the Y axis. 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 meter, 0.5 meters and 0.7 meters** respectively. It should look like this: {{ ::case-limits-size.png |}} 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 **LargeWall1**: * Length: 1m * Width: 10mm * Height: 0,5m * Position (x, y, z): 0 mm, 0 mm, 0 mm **LargeWall2**: * Length: 1m * Width: 10mm * Height: 0,5m * Position (x, y, z): 0 mm, 0,49 m, 0 mm **ShortWall1**: * Length: 10 mm * Width: 0,5 m * Height: 0,5 m * Position (x, y, z): 0 mm, 0 mm, 0 mm **ShortWall2**: * Length: 10 mm * Width: 0,5 m * Height: 0,5 m * Position (x, y, z): 0,99 m, 0 mm, 0 mm **Floor**: * Length: 1 m * Width: 0,5 m * Height: 10 mm * Position (x, y, z): 0 mm, 0 mm, 0 mm 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. ==== Step 4 - Creating the fluid ==== To create the fluid the first we're going to do is hide one of the faces in FreeCAD, to see better what is inside the box we've created. To do this select the face you want to hide and press space, or right click -> toggle visibility (this does nothing to the scene or simulation). I chose **LargeWall1** to do this. Then, 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**: * Length: 0,3 m * Width: 0,3 m * Height: 0,3 m * Position (x, y, z): 0 mm, 0,2 m, 0 mm 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: {{ :completed-scene.png |}} ==== Final Step: Simulating and exporting ==== You can now save your project. This will generate a GenCase export and tell you how many particles you have to simulate. 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/