Submarine simulations in one month

Submarine simulations in one month

Hello again and welcome back! Though it’s only been just over a month since my last post, a lot has changed. Here, I’ll try to explain some of the stuff I’ve learnt, what a general computational fluid dynamics (CFD) simulation is and how one is carried out.

The learning process of completing a CFD simulation is made easier by working with examples further down the simulation line and working your way back up. This is how I’ve learnt to complete the simulations. That being said, I’m worried that writing about the process in that order may make things a tad confusing for the reader (let alone for me writing this). Instead, I’ll explain my experience in the order you’d perform a CFD simulation. Just remember, if you’re considering learning how to do these too, do it in reverse!

Relevant xkcd 1 (that’s right there’s more than one) https://what-if.xkcd.com/138/

To begin a CFD simulation, you must first define the geometry of your problem – which quite literally means defining the shapes involved. Fortunately, this can be easy when working with simple shapes, like a cube or sphere. Unfortunately for me, submarines can be quite difficult to draw freehand and I was never very good at art. I was thankful to find out that the submarine we are modelling, the DARPA Suboff, has its geometry specifications online which, with a little Python and a lot of luck, can be used to produce the complete geometry in a format we can use.

However, to perform any simulations on this, we have to specify boundary conditions (BCs). These BCs include where the fluid is coming from (inlet), where it exits (outlet), and where fluid can go (fluid domain) in the simulation (we’ll come back to these later). With just the submarine in the geometry, we cannot specify where the inlet, outlet, or fluid domain are as the only object that exists is the submarine.

The way CFD fixes this, is by using cavities. This involves creating a large volume in the geometry that encases the submarine (such as a cuboid or cylinder), and then making a submarine-shaped hole inside it. This means we can say the inlet is the front face, the outlet is the back face, and the fluid domain is the volume of the shape that remains after removing the submarine. At this point, it’s important to remember, the fluid cannot enter the cavity. Instead, the fluid domain is just the surrounding volume.

Apologies that this one looks so dull, but this is the backbone of the entire simulation. I promise they look cooler further down the post!

After this, we create a mesh from the geometry. Meshing is a form of approximation that allows for the CFD calculation to take place. This involves splitting the geometry into a set of finite chunks so we don’t have to consider a continuous space. The smaller the chunks, the finer the mesh. So far, the default mesh generated by ANSYS has worked perfectly fine (thankfully), but this may change more precise simulations are required.

An example of meshing a sphere. Each level increases the fineness of the mesh.

The next step is to set up the problem. This involves setting up all the BCs. However, there are many more than the ones I mentioned earlier. These BCs include how the fluid should interact with each face of the geometry, the static pressure of the fluid as it leaves the outlet, and the initial velocity of the fluid. And we still haven’t considered the array of different solvers & methods that can be selected. It goes without saying that that there were a lot of important decisions to be made here, which meant I had a lot more to learn! This involved a bit of reading about CFD and a fair amount of trial and error. As I am writing this, the conditions for my final simulations are still undecided, but I know I’m on the right path.

Program display once BCs have been set. You can see here where the inlet and outlet are defined, along with the walls of the simulation.

Once that’s all done, we can begin performing the simulation. Since we have access to an HPC cluster, we can complete such a task much faster with parallelisation – which is quite the upgrade from performing the simulation in serial on your local PC. Those working at the HPC cluster in Luxembourg have done a great job at making the IRIS cluster accessible considering the circumstances. Since most of the heavy lifting has been done in the setup process, at this point the only thing to do is sit back and wait for the cluster to crunch the numbers.

A contour map of the pressure in the water surrounding the submarine down its middle.

Finally, we arrive at the most exciting part of the process. At this point we see if the conditions we set prior have correctly shown the physical properties we were after – or if we’re heading back to the drawing board. Once the files have transferred from the HPC cluster to your local PC (during which time you could learn an instrument, or count the grains of sand at your local beach) the post-processing begins!

Relevant xkcd 2 (an example of incorrect conditions) https://what-if.xkcd.com/138/

While I initially learnt how to post-process in Paraview, I decided to switch to ANSYS since it’s built into the ANSYS workbench. Within these programs, you are able to select the physical quantities calculated (such as fluid velocity, pressure, temperature etc.) and visualise them on the geometry itself. This allows for a very useful sanity check, as we can see if the simulation has given us physical behaviour, plus we can look at some very cool looking pictures and videos! However, we do still have to work out if what we have simulated is the correct physical behaviour. This means outputting the numerical values of our simulation and comparing these to the values to those calculated in the DARPA Suboff model experiment.

How the turbulence surrounding the submarine evolves with time from 0 to 5 seconds. You can see how most of the turbulence is due to the turbine at the back!

As it stands, I have two weeks remaining to complete the project and can already smell the sweet scent of correct BCs in the air. Hopefully all goes to plan… and I’ll provide an update on the final results in a couple of weeks!

Thanks for reading! Any questions, please let me know in the comments below.

Tagged with: , , , , , ,
18 comments on “Submarine simulations in one month
  1. Belen Irureta says:

    Very cool stuff!

  2. Timi says:

    Great read 😉

  3. Jack McGinn says:

    Really interesting read

  4. Elizabeth says:

    Wowie!!

  5. Ben says:

    Good stuff Matt!

  6. Sol says:

    Nice read that, hope it all works out:)

  7. James Asker says:

    Interesting read Matt, keep up the good work!

  8. Sophie says:

    Fabulous

  9. Jonathan says:

    Looking forward to your final results!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.