Run the 09_Turbine Chrono Example

In this tutorial we will show you how to use the Inductiva API to run an advanced DualSPHysics case that requires significant computing power.

Objective

The goal of this tutorial is to demonstrate how to run the 09_Turbine use case from the examples/chrono directory, available in the DualSPHysics package.

Prerequisites

Download the DualSPHysics package

Download the required files from DualSPHysics_v5.4.2.zip here. You will be working within this directory and writing the Inductiva Python script there.

Update the simulation script of the 09_Turbine example

Before running the simulation, you will need to adjust the simulation script located at examples/chrono/09_Turbine/xCaseTurbine_linux64_GPU.sh.

Make the following adjustments:

  1. Update the dirbin variable: Modify the xCaseTurbine_linux64_GPU.sh script to point to the correct binaries directory:
    export dirbin=/DualSPHysics/bin/linux/
    
  2. Remove user input prompt: To enable automated execution, delete the final line in the script, which waits for user input:
    read -n1 -r -p "Press any key to continue..." key
    

These modifications will prepare the script for seamless automated execution.

Running Your Simulation

Here is the code required to run a DualSPHysics simulation using the Inductiva API:

"""DualSPHysics example."""
import inductiva

# Allocate cloud machine on Google Cloud Platform
cloud_machine = inductiva.resources.MachineGroup(
    provider="GCP",
    machine_type="g2-standard-32",
    spot=True,
    data_disk_gb=200)

# Initialize the Simulator
dualsphysics = inductiva.simulators.DualSPHysics( \
    version="5.4.1")

# Run simulation
task = dualsphysics.run(
    input_dir="/Path/to/09_Turbine",
    shell_script="xCaseTurbine_linux64_GPU.sh",
    on=cloud_machine)

# Wait for the simulation to finish and download the results
task.wait()
task.download_outputs()

cloud_machine.terminate()

task.print_summary()

This simulation runs in spot mode on a g2-standard-32 machine, featuring 32 virtual CPUs, 1 NVIDIA L4 GPU, and a 200 GB data disk.

Note: Setting spot=True enables the use of spot machines, which are available at substantial discounts. However, your simulation may be interrupted if the cloud provider reclaims the machine.

When the simulation is complete, we terminate the machine, download the results and print a summary of the simulation as shown below.

Task status: Success

Timeline:
    Waiting for Input         at 08/05, 16:23:13      0.968 s
    In Queue                  at 08/05, 16:23:14      73.641 s
    Preparing to Compute      at 08/05, 16:24:28      21.629 s
    In Progress               at 08/05, 16:24:49      64.281 s
        └> 64.128 s        bash xCaseTurbine_linux64_GPU.sh
    Finalizing                at 08/05, 16:25:54      16.345 s
    Success                   at 08/05, 16:26:10

Data:
    Size of zipped output:    3.52 GB
    Size of unzipped output:  4.92 GB
    Number of output files:   2033

Total estimated cost (US$): 0.028 US$
    Estimated computation cost (US$): 0.018 US$
    Task orchestration fee (US$): 0.010 US$

Note: A per-run orchestration fee (0.010 US$) applies to tasks run from 01 Dec 2025, in addition to the computation costs.
Learn more about costs at: https://inductiva.ai/guides/how-it-works/basics/how-much-does-it-cost

As you can see in the "In Progress" line, the part of the timeline that represents the actual execution of the simulation, the core computation time of this simulation was approximately 64.2 seconds.

Download the Results to Your Local Machine

You can donwload the results to your local machine using Inductiva's CLI:

inductiva tasks download u8v7p1v7wfyvvkyc0iq0s632k

Downloading and decompressing data may take a few minutes, depending on your network connection:

Downloading simulation outputs to inductiva_output/u8v7p1v7wfyvvkyc0iq0s632k/output.zip...
100%|█████████████████████████████████████████████████████████████████████████████| 3.52G/3.52G [04:43<00:00, 12.4MB/s]
Uncompressing the outputs to u8v7p1v7wfyvvkyc0iq0s632k...

The results will be stored in the inductiva_output folder, within a subfolder named after the task. Earlier, we set a variable for the internal directory where all outputs would be stored (dirout), which was instantiated as CaseTurbine_out. Let’s check its contents:

ls -las inductiva_output/u8v7p1v7wfyvvkyc0iq0s632k/outputs/CaseTurbine_out
total 36080
   0 drwxr-xr-x@   22 paulobarbosa  staff      704 Apr  9 10:55 .
   0 drwxr-xr-x@    5 paulobarbosa  staff      160 Apr  9 10:55 ..
9888 -rw-r--r--@    1 paulobarbosa  staff  5058947 Apr  9 10:54 CaseTurbine.bi4
  16 -rw-r--r--@    1 paulobarbosa  staff     4523 Apr  9 10:54 CaseTurbine.out
  24 -rw-r--r--@    1 paulobarbosa  staff    10830 Apr  9 10:54 CaseTurbine.xml
9432 -rw-r--r--@    1 paulobarbosa  staff  4827935 Apr  9 10:54 CaseTurbine_All.vtk
1280 -rw-r--r--@    1 paulobarbosa  staff   653967 Apr  9 10:54 CaseTurbine_Bound.vtk
8160 -rw-r--r--@    1 paulobarbosa  staff  4174240 Apr  9 10:54 CaseTurbine_Fluid.vtk
 752 -rw-r--r--@    1 paulobarbosa  staff   382901 Apr  9 10:54 CaseTurbine_MkCells.vtk
2488 -rw-r--r--@    1 paulobarbosa  staff  1272363 Apr  9 10:54 CaseTurbine__Actual.vtk
   8 -rw-r--r--@    1 paulobarbosa  staff      583 Apr  9 10:54 CaseTurbine_dbg-fillbox.vtk
   8 -rw-r--r--@    1 paulobarbosa  staff     1947 Apr  9 10:54 CfgChrono_Scheme.vtk
   8 -rw-r--r--@    1 paulobarbosa  staff      854 Apr  9 10:54 CfgInit_Domain.vtk
  16 -rw-r--r--@    1 paulobarbosa  staff     4155 Apr  9 10:54 CfgInit_MapCells.vtk
   8 -rw-r--r--@    1 paulobarbosa  staff     2371 Apr  9 10:54 Floating_Materials.xml
3880 -rw-r--r--@    1 paulobarbosa  staff  1985884 Apr  9 10:54 Rotor.stl
   8 -rw-r--r--@    1 paulobarbosa  staff      983 Apr  9 10:54 Run.csv
 104 -rw-r--r--@    1 paulobarbosa  staff    51408 Apr  9 10:54 Run.out
   0 drwxr-xr-x@  504 paulobarbosa  staff    16128 Apr  9 10:55 boundary
   0 drwxr-xr-x@  508 paulobarbosa  staff    16256 Apr  9 10:55 data
   0 drwxr-xr-x@ 1006 paulobarbosa  staff    32192 Apr  9 10:55 particles
   0 drwxr-xr-x@  503 paulobarbosa  staff    16096 Apr  9 10:55 surface

The folders boundary, particles, and surface contain data that can be loaded into ParaView for visualization — just like the sample animation shown above.