Knowing where to catch mussels is critical to improving the success and efficiency of harvesting activities. Pictured above is a New Zealand green mussel. (Image by Richard Giddins from Wikimedia Commons)

Predicting patterns among kaimoana species

"I wouldn’t have been able to operate at the scale I am now without NeSI's help."
The below case study shares some of the technical details and outcomes of the scientific and HPC-focused programming support provided to a research project through NeSI’s Consultancy Service.
This service supports projects across a range of domains, with an aim to lift researchers’ productivity, efficiency, and skills in research computing. If you are interested to learn more or apply for Consultancy support, visit our Consultancy Service page.


Research background

New Zealand green mussels are an important export species, 75% being caught wild. Knowing where to catch the mussels is critical to improving the success and efficiency of harvesting activities. For many marine invertebrates whose adult stage is largely immobile, the primary opportunity for dispersal and gene flow occurs during a pelagic larval state. Using a Langrangian particle simulation, it is possible to use oceanographic models to predict larval dispersal and predict patterns of gene flow. 

Victoria University of Wellington PhD candidate Calvin Quigley is using OpenDrift, a particle simulation program, together with national scale oceanographic models produced by the Moana Project to construct a nationwide connectivity matrix that allows him to predict patterns of gene flow in marine invertebrate species, including multigenerational transport through stepping stone populations. This ability to quantify the connectivity in gene flow across mussel populations in New Zealand will help identify important source populations that supply larvae.


Project challenges

Calvin runs simulations that follow the trajectories of large numbers of mussel larvae using realistic ocean currents. The simulations are computationally intensive and Calvin called for NeSI’s help to improve the productivity of his research.


What was done

By profiling Calvin's Opendrift code, NeSI Research Software Engineers (RSEs) identified the most time-consuming component: the part that reads and interpolates the velocity and other fields. Increasing the time step was recognised as being one way to reduce the execution time. However, it was not clear by how much the time step could be increased without running into numerical stability issues. So, NeSI performed  a numerical stability analysis of the Runge-Kutta trajectory integrator to determine the maximum allowable time step.


Main outcomes

Through this Consultancy project, Calvin learned how to execute many parallel jobs using job arrays and how to parse command line arguments in Python. The maximum time step could be increased 4x without adverse effects, which reduces the execution time by 60%. For a more technical overview of the work performed, refer to this summary report 'Maximum time step for Runge-Kutta schemes when using OpenDrift with ocean velocity data'.

Below is an animation of the particle simulations:


Researcher feedback

"Alex and Maxime were incredibly helpful in helping me make my code more modular so that I could efficiently use the Slurm batch scheduler to scale up my simulations as needed. They also helped me test numerical parameters of the model that would have taken me months to calculate, allowing me to be confident in the configurations I used and saving me valuable time. I wouldn’t have been able to operate at the scale I am now without NeSI's help."

- Calvin Quigley, Victoria University of Wellington PhD candidate

Do you have a research project that could benefit from working with NeSI research software engineers or a data engineer? Learn more about what kind of support they can offer and get in touch by emailing


Next Case Study

Satellite image of the Alpine Garden landslide in Fox Glacier/Te Moeka o Tūawe valley.

Modern mapping that detects and monitors landscape changes

“To compare and process these images, we need a large amount of processing power and memory."