Run and compare design variants
Run a controlled set of variants from one parameterized request builder, preserving the input and outcome of every case.
This guide builds on the run_simulation.py script from Automate a simulation with Python, reusing it to submit each variant, follow its progress, and download its results.
Define the study
In run_simulation.py, expose only the inputs being compared as arguments to build_request. Keep the domain, mesh, numerics, stopping criteria, and monitors unchanged unless one of them is the study variable.
The example uses heatsink fin count and power only to demonstrate the pattern. Replace these names and values with any parameters accepted by your own build_request function, such as dimensions, material properties, boundary inputs, or component choices.
VARIANTS = {
"8-fins-40-w": {"num_fins": 8, "power": 40.0},
"10-fins-40-w": {"num_fins": 10, "power": 40.0},
"8-fins-50-w": {"num_fins": 8, "power": 50.0},
"10-fins-50-w": {"num_fins": 10, "power": 50.0},
}
Submit the variants
Place your customized run_simulation.py beside this driver and import both the request builder and simulation runner from it:
import json
import os
from pathlib import Path
from run_simulation import build_request, run_simulation
STUDY_DIRECTORY = Path("results/design-study")
REQUEST_DIRECTORY = STUDY_DIRECTORY / "requests"
REQUEST_DIRECTORY.mkdir(parents=True, exist_ok=True)
api_key = os.environ["VANELLUS_API_KEY"]
for name, parameters in VARIANTS.items():
request = build_request(**parameters)
(REQUEST_DIRECTORY / f"{name}.json").write_text(
json.dumps(request, indent=2) + "\n",
encoding="utf-8",
)
try:
run_simulation(
request=request,
api_key=api_key,
output_root=STUDY_DIRECTORY / "results",
output_name=name,
)
except Exception as error:
print(f"{name} failed: {error}")
The request is saved before submission, so a rejected or failed case still has a reproducible input. Successful result directories also contain the submitted and server-normalized requests.
The loop runs serially. If Vanellus has approved your account to run simultaneous jobs, download
run_variants_concurrently.py for a concurrent version. Place it beside
your customized run_simulation.py, then run it with the worker limit shown under
Max parallel simulations in the API dashboard:
python run_variants_concurrently.py --max-workers 2
Keep --max-workers at or below your allowance. Each full simulation still consumes solver credits.
Collect the results
Each successful variant has its own result directory and iteration_info.csv. Use Analyze results with Python to extract the same result columns from each directory into your comparison.
See also
- Automate a simulation with Python explains the imported submission workflow.
- Check a simulation result explains how status affects each variant’s outputs.