Skip to content

Commit dac8107

Browse files
authored
Adding 'precision' option to Simulation (#2624)
1 parent ebe6a7e commit dac8107

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Add `PointDipole.sources_from_angles()` that constructs a list of `PointDipole` objects needed to emulate a dipole oriented at a user-provided set of polar and azimuthal angles.
1515
- Added `priority` parameter to `web.run()` and related functions to allow vGPU users to set task priority (1-10) in the queue.
1616
- `EMEFieldMonitor` now supports `interval_space`.
17+
- `Simulation.precision` option allows to select `"double"` precision for very high-accuracy results. Note that this is very rarely needed, and doubles the simulation computational weight and correpsondingly FlexCredit cost.
1718

1819
### Changed
1920
- Switched to an analytical gradient calculation for spatially-varying pole-residue models (`CustomPoleResidue`).

tidy3d/components/simulation.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,6 +2127,17 @@ class Simulation(AbstractYeeGridSimulation):
21272127
gt=0.0,
21282128
le=1.0,
21292129
)
2130+
2131+
precision: Literal["hybrid", "double"] = pydantic.Field(
2132+
"hybrid",
2133+
title="Floating-point Precision",
2134+
description="Floating point precision to use in the computations. By default, Tidy3D uses "
2135+
"a hybrid approach that offers a good balance of speed and accuracy for almost all "
2136+
"simulations. However, for large simulations (or simulations with a long run time), "
2137+
"where very high accuracy is needed, the precision can be set to double everywhere. "
2138+
"Note that this doubles the FlexCredit cost of the simulation.",
2139+
)
2140+
21302141
"""The Courant-Friedrichs-Lewy (CFL) stability factor :math:`C`, controls time step to spatial step ratio. A
21312142
physical wave has to propagate slower than the numerical information propagation in a Yee-cell grid. This is
21322143
because in this spatially-discrete grid, information propagates over 1 spatial step :math:`\\Delta x`

0 commit comments

Comments
 (0)