tidy3d.plugins.adjoint.JaxSimulationData#
- class JaxSimulationData[source]#
Bases:
SimulationData,JaxObjectA
SimulationDataregistered with jax.- Parameters:
attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrsare mutable. For example, the following is allowed for setting anattrobj.attrs['foo'] = bar. Also note that Tidy3D` will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare serializable by callingobj.json().simulation (JaxSimulation) – The jax-compatible simulation corresponding to the data.
data (Tuple[Annotated[Union[tidy3d.components.data.monitor_data.FieldData, tidy3d.components.data.monitor_data.FieldTimeData, tidy3d.components.data.monitor_data.PermittivityData, tidy3d.components.data.monitor_data.ModeSolverData, tidy3d.components.data.monitor_data.ModeData, tidy3d.components.data.monitor_data.FluxData, tidy3d.components.data.monitor_data.FluxTimeData, tidy3d.components.data.monitor_data.AuxFieldTimeData, tidy3d.components.data.monitor_data.FieldProjectionKSpaceData, tidy3d.components.data.monitor_data.FieldProjectionCartesianData, tidy3d.components.data.monitor_data.FieldProjectionAngleData, tidy3d.components.data.monitor_data.DiffractionData, tidy3d.components.data.monitor_data.DirectivityData], FieldInfo(default=PydanticUndefined, discriminator='type', extra={})], ...]) – List of
MonitorDatainstances associated with the monitors of the originalSimulation.log (Optional[str] = None) – A string containing the log information from the simulation run.
diverged (bool = False) – A boolean flag denoting whether the simulation run diverged.
output_data (Tuple[Union[JaxModeData, JaxDiffractionData, JaxFieldData], ...] = ()) – Tuple of Jax-compatible data associated with output monitors.
grad_data (Tuple[FieldData, ...] = ()) – Tuple of monitor data storing fields associated with the input structures.
grad_eps_data (Tuple[PermittivityData, ...] = ()) – Tuple of monitor data storing epsilon associated with the input structures.
task_id (Optional[str] = None) – Optional field storing the task_id for the original JaxSimulation.
Attributes
self.grad_databut withsymmetry_expanded_copyapplied.self.grad_eps_databut withsymmetry_expanded_copyapplied.Dictionary of
.output_datamonitor.nameto the corresponding data.Dictionary of
.output_datamonitor.nameto the corresponding data.logCustom logger to avoid the complexities of the logging module
Methods
from_sim_data(sim_data, jax_info[, task_id])Construct a
JaxSimulationDatainstance from aSimulationData.get_poynting_vector(field_monitor_name)return
xarray.Datasetof the Poynting vector at Yee cell centers.make_adjoint_simulation(fwidth, run_time)Make an adjoint simulation out of the data provided (generally, the vjp sim data).
Make copy of jax_sim_data with grad_data (fields) normalized by adjoint sources.
split_data(mnt_data, jax_info)Split list of monitor data into data, output_data, grad_data, and grad_eps_data.
split_fwd_sim_data(sim_data, jax_info)Split a
SimulationDatainto two parts, containing user and gradient data.Inherited Common Usage
- output_data#
- grad_data#
- grad_eps_data#
- simulation#
- task_id#
- get_poynting_vector(field_monitor_name)[source]#
return
xarray.Datasetof the Poynting vector at Yee cell centers.Calculated values represent the instantaneous Poynting vector for time-domain fields and the complex vector for frequency-domain:
S = 1/2 E × conj(H).Only the available components are returned, e.g., if the indicated monitor doesn’t include field component “Ex”, then “Sy” and “Sz” will not be calculated.
- Parameters:
field_monitor_name (str) – Name of field monitor used in the original
Simulation.- Returns:
DataArray containing the Poynting vector calculated based on the field components colocated at the center locations of the Yee grid.
- Return type:
xarray.DataArray
- property grad_data_symmetry#
self.grad_databut withsymmetry_expanded_copyapplied.
- property grad_eps_data_symmetry#
self.grad_eps_databut withsymmetry_expanded_copyapplied.
- property output_monitor_data#
Dictionary of
.output_datamonitor.nameto the corresponding data.
- property monitor_data#
Dictionary of
.output_datamonitor.nameto the corresponding data.
- static split_data(mnt_data, jax_info)[source]#
Split list of monitor data into data, output_data, grad_data, and grad_eps_data.
- classmethod from_sim_data(sim_data, jax_info, task_id=None)[source]#
Construct a
JaxSimulationDatainstance from aSimulationData.
- classmethod split_fwd_sim_data(sim_data, jax_info)[source]#
Split a
SimulationDatainto two parts, containing user and gradient data.
- make_adjoint_simulation(fwidth, run_time)[source]#
Make an adjoint simulation out of the data provided (generally, the vjp sim data).
- normalize_adjoint_fields()[source]#
Make copy of jax_sim_data with grad_data (fields) normalized by adjoint sources.
- __hash__()#
Hash method.