CFD and Formula Student: How to start
First of all, I wanted to share the final presentation of my project, in which some of the concepts mentioned in previous articles are explained in a more visual way.
After two articles in which the basics of aerodynamics and CFD in HPC systems were discussed and a presentation in which everything was wrapped up, now it is the perfect occasion to build on top of all that and take a different approach. This article will get more technical than the previous ones and will basically cover how to have a good start in CFD for Formula Student (or any other similar project).
Motivation: Reproducibility of the Results
One of the motives to write this article is to make it easier for anyone wishing to perform a similar study to the one that I have developed during this summer to be able to achieve it. The details regarding the scripts and modified pieces of code used throughout the project will not be shared although, if someone is interested, they can be provided. This means that the article only accounts for the geometry preparation, not the CFD setup itself, for which information is available in many blogs such as CFD Online.
The list of software used along the project contains:
- SolidWorks to handle the CAD files
- Oracle VM VirtualBox Manager to set up a Linux-Ubuntu Virtual Machine
- OpenFOAM to perform all the CFD meshes and simulations
- ParaView and EnSight to carry out the post-processing
How to Start? Pre-processing of the Geometry
The base for obtaining an accurate enough result is building an adequate mesh. But an adequate mesh can never be achieved without a good pre-processing of the solid (car) geometry.
The starting point of the project was a complex CAD version of the TU Ostrava Formula Student car in STP format. However, it must be first acknowledged that CAD formats cannot be used as an input to generate a mesh: what the meshing algorithm needs are a cloud of points defining a surface. CAD files present two problems: (1) they do not contain a set of points, but rather a set of operations and mathematical functions that define the geometry of the solids; and (2) they contain unimportant information, such as material or colour of the different parts, that are meaningless for the CFD process.
The geometry of the car should, therefore, be converted into a more suitable format such as STL. This was achieved by importing the STP file into SolidWorks and then exporting it as an STL file. The exporting process is also important:
- The small details that are not relevant to the solution should be removed. Overall, the geometry must be carefully cleaned. This includes all kind of bolts, nuts and screws in the car, for example. It is true that they can have a small effect on the aerodynamic performance of the car, but it is not significant enough so as to compensate for the associated increase in computational time/resources.
- The file must be exported as an ASCII file type due to functionality reasons.
- The reference coordinates system must be chosen carefully: it will define the absolute coordinates of the file and its location in the mesh.
- The exporting quality should be large enough. Otherwise, it will be possible to observe even at first sight how the geometry is not continuous. The mesh will never improve a bad STL surface quality; at most, it will be able to keep up to it. To get this right, one must analyse the maximum accuracy that is going to be possible to achieve on the surfaces of the body in the meshing process, and then generate the surface file from the CAD in such a way that the characteristic size of its elements is smaller than that of the smallest mesh elements -for the geometry not to be the limiting factor-, but not much smaller -to avoid a very large geometry file that will slow down the whole process-. It could take several iterations to find the sweet point.
- The geometry assembly (in this case the car) should not be saved as a single STL file since this will not allow to then analyse the forces created at each of the parts. The best approach is, therefore, to save the geometry in as many parts as relevant subdivisions the geometry features. In the formula car case, the geometry was split into the following parts:
- Front wheels
- Rear wheels
- Suspension assembly
- Chassis assembly
- Front wing
- Rear wing
- Splitting the geometry into different parts implies that they have to be merged to be input as a single file (the internal split into the different parts will be kept). This is done via a merging bash script.
Once all these steps have been fulfilled, the STL file is ready to be used.
If these steps are followed carefully, a base will have been built to start performing CFD simulations.
The next step would be following one of the numerous OpenFOAM tutorials to install the software. Followingly, one can start running actual simulations and adjusting the parameters of the simulations to improve the modelling of the problem up to the moment in which a satisfactory level of accuracy is reached. This article is just an introduction, but more details can be found both in the final presentation and the final report of the project.