Skip to content

Script-based simulations

The recommended way to use the SDK is the Client API: define geometry, physics, meshing, and simulations through allsolve.Client and high-level SDK classes. See Getting started and the Client API examples in the SDK repository.

This page describes the script-based workflow, where you upload custom Python scripts that run on Allsolve workers on the cloud and control the solver through the Script API. Use this approach when you need custom formulations, fine-grained solver control, or when migrating older SDK projects.

Examples of when to use script-based simulations are as follows:

  • You have custom physics or solver logic written with Script API (quanscient as qs)
  • You are maintaining projects created before Client API supported high-level physics
  • You need capabilities not yet available through the SDK’s physics and interaction classes

For a new project, prefer Client API unless you have a specific reason to write script-based simulations.

A script-based SDK project typically has this structure:

.
├── main.py # SDK script on your machine: manages projects, geometry, mesh, and simulations
├── requirements.txt # Python dependencies
└── sim
└── simulation.py # Simulation script executed on Allsolve workers via the Script API

The local script (main.py) uses SDK calls to create the project, import geometry, define regions and materials, generate a mesh, and attach simulation scripts. The remote script (sim/simulation.py) defines what is simulated, solved, and written as output.

Via SDK calls, you can pass additional inputs (CSV, JSON, and other files) to the remote execution environment.

See the script-based examples in the SDK repository.