0:10 FreeCAD Geometry
0:56 FreeCAD Sweep the Box and Circle
1:27 FreeCAD Union of the Box and Circle
1:53 FreeCAD Round all Edges
2:11 Salome Define inlet. outlet and walls
2:48 Salome Define Mesh Size
3:21 OpenFoam Import Mesh
3:36 OpenFoam Adjust controlDict and U files
4:34 paraView Preview
6:11 Final Result :-)
Download OpenFOAM LES Case for OpenFOAM:
Today, we're going to review our workflow for the Fountain project. As always, our first step is to design the geometry in FreeCAD. In this case, we need to create a cube with an inlet. This cube will serve as the mesh and the overall case for our fountain simulation. Additionally, we'll set up an Inlet condition, which you'll see shortly, and an Outlet condition at the top of the cube to release pressure.
Here's my typical workflow: I create the lines in the Sketch module and then use the "Sweep" function in the Parts menu in FreeCAD. This process involves making a box and a circle and sweeping both of them. Then, we combine them into a united geometry, ensuring there are no internal boundaries in the mesh. The bottom of the circle serves as the inlet, while the top opens into the box.
However, this straightforward geometry can lead to calculation errors in OpenFOAM. To avoid this, we must round all the sharp edges in the geometry. In FreeCAD, this process is simple; select the combined geometry and round all the edges, as shown.
Now, we move on to Salome, where we define the inlet, outlet, and walls, which is similar to what I've covered in previous meshing tutorials. Once we've defined these boundaries, we proceed to set up the mesh and its quality. For this example, I used a relatively coarse mesh with large cells, making the animation less visually appealing. In practice, you'd want to create a finer mesh for more realistic simulations.
Next, we're ready for the first run. Before this, we need to convert the U and V files exported from Salome. This step isn't shown in the video, but it's essential. You'll export the U and V files and convert them into the OpenFOAM case format.
For the case setup, I have a default case available on GitHub, and I'll provide the link in the description. You'll need to adjust some settings, particularly the Velocity in the U file and the time steps in the controlDict file based on your computing power and simulation needs. OpenFOAM allows you to perform calculations on multiple CPUs.
I usually stop the calculation after a few steps to get a quick preview in ParaView. In the initial steps, you won't see much happening, as indicated by the red dot in the mesh, which represents the water inlet. The simulation progresses gradually.
When it comes to visualizing your results in ParaView, there are various options. I plan to create a separate tutorial specifically for ParaView, as it offers numerous features, and you only need a subset of them.
Now, we've completed this simulation, and I hope this tutorial has been helpful. Goodbye until next time!