Run Your First Simulation

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

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

We will cover the publicly available WRF benchmark, based on the Pre-Thanksgiving Winter Storm of 2019, to help you get started with simulations.

We will also demonstrate Inductiva’s ability to efficiently scale this use case on a more powerful machine.

Animation with the RAINNC values of the simulation.

Prerequisites

Download the required files here and place them in a folder called SimulationFiles. Then, you’ll be ready to send your simulation to the Cloud.

Running a WRF Simulation

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

"""WRF Simulation."""
import inductiva

# Allocate cloud machine on Google Cloud Platform
cloud_machine = inductiva.resources.MachineGroup( \
    provider="GCP",
    machine_type="c2d-standard-16",
    spot=True)

# Initialize the Simulator
wrf = inductiva.simulators.WRF( \
    version="4.6.1")

# Run simulation
task = wrf.run( \
    input_dir=input_dir,
    case_name="em_real",
    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 (c2d-highcpu-16) equipped with 16 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 WRF simulations, replace input_dir with the path to your WRF input files and set the case_name accordingly. Be sure to specify the WRF version compatible with your input files.

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 29/05, 17:44:37      333.949 s
    In Queue                  at 29/05, 17:50:11      0.008 s
    Preparing to Compute      at 29/05, 17:50:11      27.198 s
    In Progress               at 29/05, 17:50:38      1924.838 s
        ├> 2.09 s          /scripts/create_links.sh /WRF/test/em_real
        ├> 1888.972 s      /opt/openmpi/4.1.6/bin/mpirun --use-hwthread-cpus ./wrf.exe
        └> 1.079 s         /scripts/delete_links.sh
    Finalizing                at 29/05, 18:22:43      52.533 s
    Success                   at 29/05, 18:23:36

Data:
    Size of zipped output:    3.62 GB
    Size of unzipped output:  3.66 GB
    Number of output files:   52

Total estimated cost (US$): 0.082 US$
    Estimated computation cost (US$): 0.072 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/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 1924.8 seconds (32 minutes).

Although it's short, there's still room for improvement to reduce the processing time.

Scaling Up Your Simulation

Scaling up your simulation is as simple as updating the machine_type parameter to a 56 vCPU machine (c2d-highcpu-56).

By increasing the number of vCPUs, we can substantially decrease the simulation time.

Here are the results of running the same simulation on a few machines:

Machine TypeVirtual CPUsExecution TimeEstimated Cost (USD)
c2d-highcpu-161632 min, 5 s0.072
c2d-highcpu-565614 min, 15s0.11
c2d-highcpu-1121128 min, 37s0.14

Still in the testing phase? No problem! Just skip this step for now and start with a machine with fewer vCPUs. Once you're satisfied with your results, you can seamlessly scale your WRF simulation.

Summary

We’ve walked through the essential steps for setting up and running a WRF simulation using the Inductiva API.

By following this guide, you should now have a clear understanding of how to configure and efficiently run WRF simulations on Inductiva.