Run more simulations. Spend less time configuring.
This tutorial will show you how to run GX simulations using the Inductiva API.
This tutorial will cover a non-linear use case, available in the GX documentation, to help you get started with simulations.
Download the required files here and place them in a folder called NonlinearExample. Then, youโll be ready to send your simulation to the Cloud.
Here is the code required to run GX simulation using the Inductiva API:
"""GX Simulation"""
import inductiva
# Allocate a machine on Google Cloud Platform
cloud_machine = inductiva.resources.MachineGroup( \
provider="GCP",
machine_type="g2-standard-4",
spot=True)
# Initialize the Simulator
gx = inductiva.simulators.GX(\
version="v.11-2024")
# Run simulation
task = gx.run( \
input_dir="/Path/to/NonlinearExample",
sim_config_filename="cyclone_miller_adiabatic_electrons.in",
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 (g2-standard-4) equipped with 4 virtual CPUs and an NVIDIA L4 GPU.
For larger or more compute-intensive simulations, consider adjusting the machine_type parameter to select
a more powerful GPU machine. 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 other GX simulations, replace input_dir with the
path to your GX input files and set the sim_config_filename accordingly.
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 28/03, 14:26:20 0.787 s
In Queue at 28/03, 14:26:21 31.739 s
Preparing to Compute at 28/03, 14:26:53 20.526 s
In Progress at 28/03, 14:27:14 4.36 s
โ> 4.064 s gx cyclone_miller_adiabatic_electrons.in
Finalizing at 28/03, 14:27:18 0.432 s
Success at 28/03, 14:27:18
Data:
Size of zipped output: 1.63 KB
Size of unzipped output: 9.05 KB
Number of output files: 4
Total estimated cost (US$): 0.0122 US$
Estimated computation cost (US$): 0.0022 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 4 seconds.
Test Your Inductiva Setup
Test your Inductiva.AI setup by running a quick GX simulation in the cloud before moving on to large-scale simulations.
The Inductiva Guide to HEC-RAS
Learn to run and scale HEC-RAS simulations on the Inductiva.AI Cloud HPC platform. Explore tutorials and benchmarks for river & coastal modeling.