How Do I Reuse Structural Preprocessing in a Source Sweep?

How Do I Reuse Structural Preprocessing in a Source Sweep?#

Date

Category

2026-08-21

Parameter Sweep

When many FDTD simulations use the same geometry, materials, grid, and boundaries, Tidy3D can store the structural preprocessing from one simulation and reuse it in compatible child simulations. This is most useful when preprocessing complex geometry, such as a detailed STL, is expensive compared with time stepping.

The producer is an ordinary FDTD task: it still runs to completion and returns normal SimulationData. Set store_preprocess_cache=True on a web.Job, run it, and retain its task ID:

from tidy3d import web

producer = web.Job(
    simulation=base_simulation,
    task_name="cache_producer",
    store_preprocess_cache=True,
)
producer_data = producer.run()
producer_task_id = producer.task_id

Pass that task ID as the single parent of each compatible child. The same parent can serve an entire sweep:

from tidy3d import web

simulations = {
    "x_pol": base_simulation.updated_copy(sources=[source_x]),
    "y_pol": base_simulation.updated_copy(sources=[source_y]),
}

batch = web.Batch(
    simulations=simulations,
    parent_tasks={name: (producer_task_id,) for name in simulations},
)
results = batch.run(path_dir="source_sweep_results")

Each child repeats source setup, monitor setup, and time stepping, but skips the reusable C++ structural preprocessing. Children may use different compute resources or MPI chunking from the producer. Their results remain ordinary SimulationData objects.

Tidy3D checks compatibility before starting a child. Audited source controls such as position, polarization, amplitude, phase, waveform timing, and custom waveform or spatial-profile data may differ. Run time, shutoff, result normalization, low-frequency smoothing, and eligible monitor definitions may also differ. Inputs that determine structural preprocessing must remain compatible, including geometry, media, grid, boundaries, source classes and order, and source frequency support. The center of a mode source with a PEC frame is structural and therefore cannot change. Producer and child simulations must also use the same Tidy3D client version. Upgrading Tidy3D changes the compatibility signature, even when the physical inputs are unchanged.

Preprocessing caches currently support only ordinary, non-autograd FDTD simulations. Custom media, surface-field monitors, monitors that require medium-output preprocessing, and point-cloud field monitors requesting displacement fields are not supported. The client reports these eligibility or compatibility problems before allocating the child solver task.

The cache is an internal task artifact rather than a downloadable simulation result. The producer must finish successfully before its children are submitted, and the artifact must still be retained when a child runs.