Run Your First Simulation

Step-by-step guide to run your first FUNWAVE simulation on Inductiva.AI. Easily launch, monitor and analyse results.

This tutorial will show you how to run FUNWAVE simulations using the Inductiva API.

We will cover the meteo_tsunami use case from the FUNWAVE GitHub repository to help you get started with simulations.

FUNWAVE simulation visualization

Prerequisites

Download the required files here. The simulation files will be placed inside the FUNWAVE-TVD-Version_3.6/simple_cases/meteo_tsunami folder.

Running a FUNWAVE Simulation

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

"""FUNWAVE example."""
import inductiva

# Allocate a machine on Google Cloud Platform
machine_group = inductiva.resources.MachineGroup(
    provider="GCP",
    machine_type="c3d-highcpu-4",
    spot=True)

# Initialize the Simulator
funwave = inductiva.simulators.FUNWAVE( \
    version="3.6")

# Run simulation
task = funwave.run(
    input_dir="/Path/to/meteo_tsunami",
    sim_config_filename="input.txt",
    METEO=True,
    on=machine_group)

# 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 (c3d-highcpu-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=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.

To adapt this script for other FUNWAVE simulations, replace input_dir with the path to your FUNWAVE input files and set the case_name 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 17/09, 11:53:28      0.843 s
    In Queue                  at 17/09, 11:53:29      36.668 s
    Preparing to Compute      at 17/09, 11:54:06      3.942 s
    In Progress               at 17/09, 11:54:10      316.143 s
        ├> 1.004 s         cp /FUNWAVE-TVD-Version_3.6/Makefile .
        ├> 1.004 s         sed -i 15s/^# *// Makefile
        ├> 12.09 s         make
        ├> 299.351 s       /opt/openmpi/4.1.6/bin/mpirun --np 4 --use-hwthread-cpus funwave-work/compiled_funwave input.txt
        ├> 1.09 s          rm -r funwave-work
        └> 1.081 s         rm Makefile
    Finalizing                at 17/09, 11:59:26      2.311 s
    Success                   at 17/09, 11:59:28

Data:
    Size of zipped output:    75.06 MB
    Size of unzipped output:  325.32 MB
    Number of output files:   352

Total estimated cost (US$): 0.0138 US$
    Estimated computation cost (US$): 0.0038 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 316 seconds (approximately 5 minutes and 16 seconds).

Scaling Up Your Simulation

To run your simulation on a more powerful machine, you'll need to make a few small adjustments to both your input.txt file and your Python script.

Required Changes

To increase the number of virtual CPUs (vCPUs) to 16, update the following parameters:

  • In input.txt:
    • Set PX = 4
    • Set PY = 4
  • In your Python script:
    • Set machine_type = "c3d-highcpu-16"

Note: The product of PX * PY must equal to the number of vCPUs on the machine.

If you're scaling to a machine with more vCPUs or switching to a different machine type, follow the same pattern:

  • Set PX and PY such that PX * PY = number of vCPUs
  • Update machine_type accordingly in your script

Performance Comparison

Below are the results of running the same simulation on different machine configurations:

Machine TypevCPUsExecution TimeEstimated Cost (USD)
c3d-highcpu-445 min, 16s0.0038
c3d-highcpu-16161 min, 52s0.0051
c3d-highcpu-60601 min, 0s0.010

With the Inductiva API, scaling your FUNWAVE simulations is simple and efficient. Whether you're aiming for faster runtimes or reduced costs, experimenting with different machine configurations helps you find the best setup for your specific needs.