Detector and Interface Management¶
Detector Updates¶
fdtdx.fdtd.update.update_detector_states(time_step, arrays, objects, H_prev, inverse)
¶
Updates detector states based on current field values.
Handles field interpolation for accurate detector measurements. By default, interpolation is disabled for performance during optimization, but can be enabled for final evaluation. Interpolation is needed due to the staggered nature of E and H fields on the Yee grid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_step
|
Array
|
Current simulation time step |
required |
arrays
|
ArrayContainer
|
Container with E, H fields and material properties |
required |
objects
|
ObjectContainer
|
Container with detectors and other simulation objects |
required |
H_prev
|
Array
|
Previous H field values for interpolation |
required |
inverse
|
bool
|
Whether this is a forward or reverse update |
required |
Returns:
Type | Description |
---|---|
ArrayContainer
|
Updated ArrayContainer with new detector states |
Source code in src/fdtdx/fdtd/update.py
Interface Handling¶
fdtdx.fdtd.update.collect_interfaces(time_step, arrays, objects, config, key)
¶
Collects field values at PML interfaces for gradient computation.
Part of the memory-efficient automatic differentiation implementation. Saves field values at boundaries between PML and inner simulation volume since PML updates are not time-reversible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_step
|
Array
|
Current simulation time step |
required |
arrays
|
ArrayContainer
|
Container with fields and material properties |
required |
objects
|
ObjectContainer
|
Container with PML and other simulation objects |
required |
config
|
SimulationConfig
|
Simulation configuration with gradient settings |
required |
key
|
Array
|
Random key for compression |
required |
Returns:
Type | Description |
---|---|
ArrayContainer
|
Updated ArrayContainer with recorded interface values |
Source code in src/fdtdx/fdtd/update.py
fdtdx.fdtd.update.add_interfaces(time_step, arrays, objects, config, key)
¶
Adds previously collected interface values back to the fields.
Part of the memory-efficient automatic differentiation implementation. Restores saved field values at PML boundaries during reverse propagation since PML updates are not time-reversible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_step
|
Array
|
Current simulation time step |
required |
arrays
|
ArrayContainer
|
Container with fields and material properties |
required |
objects
|
ObjectContainer
|
Container with PML and other simulation objects |
required |
config
|
SimulationConfig
|
Simulation configuration with gradient settings |
required |
key
|
Array
|
Random key for decompression |
required |
Returns:
Type | Description |
---|---|
ArrayContainer
|
Updated ArrayContainer with restored interface values |