Still juggling simulations between two machines and a prayer? Scale up in minutes with Inductiva.
This tutorial will show you how to run Deft3D simulations using the Inductiva API.
We will cover the 01_standard use case from the examples available in the Delft3D Subversion repository,
Download the required files here and save them to a folder named SimulationFiles. Then, youโll be ready to
send your simulation to the Cloud.
Here is the code required to run the Delft3D simulation using the Inductiva API:
"""Delft3D Simulation."""
import inductiva
# Allocate a machine on Google Cloud Platform
cloud_machine = inductiva.resources.MachineGroup( \
provider="GCP",
machine_type="c2-standard-4",
spot=True)
# Initialize the Simulator
delft3d = inductiva.simulators.Delft3D(\
version="6.04.00")
# Run simulation
task = delft3d.run( \
input_dir="/Path/to/SimulationFiles",
commands = ["mpirun -np 4 d_hydro.exe config_d_hydro.xml"],
on=cloud_machine)
# Wait for the simulation to finish and download the results
task.wait()
cloud_machine.terminate()
task.download_outputs()
task.print_summary()
In this basic example, we're using a cloud machine (c2-standard-4) equipped with 4 virtual CPUs.
For larger or more compute-intensive simulations, consider adjusting the machine_type parameter to select a machine with more virtual CPUs and increased memory capacity. You can explore the full range of available machines here.
Note: Setting
spot=Trueenables the use of spot machines, which are available at substantial discounts. However, your simulation may be interrupted if the cloud provider reclaims the machine.
To adapt this script for your own simulations:
input_dir path with the location of your Delft3D input files.commands to match your specific configuration.โ ๏ธ Important: If you change the number of virtual CPUs in the machine, make sure to update the corresponding value in the mpirun command (e.g., -np 16).
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 10/04, 14:17:59 0.695 s
In Queue at 10/04, 14:18:00 36.277 s
Preparing to Compute at 10/04, 14:18:36 2.832 s
In Progress at 10/04, 14:18:39 5.191 s
โ> 5.073 s mpirun -np 4 d_hydro.exe config_d_hydro.xml
Finalizing at 10/04, 14:18:44 0.449 s
Success at 10/04, 14:18:45
Data:
Size of zipped output: 433.45 KB
Size of unzipped output: 1.04 MB
Number of output files: 15
Total estimated cost (US$): 0.01017 US$
Estimated computation cost (US$): 0.00017 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 5.2 seconds.