Skip to content

Commit f8c5938

Browse files
momchil-flexdaquinteroflex
authored andcommitted
Expand double precision explanation
1 parent 2dba0f1 commit f8c5938

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

tidy3d/components/simulation.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,17 +2139,6 @@ class Simulation(AbstractYeeGridSimulation):
21392139
gt=0.0,
21402140
le=1.0,
21412141
)
2142-
2143-
precision: Literal["hybrid", "double"] = pydantic.Field(
2144-
"hybrid",
2145-
title="Floating-point Precision",
2146-
description="Floating point precision to use in the computations. By default, Tidy3D uses "
2147-
"a hybrid approach that offers a good balance of speed and accuracy for almost all "
2148-
"simulations. However, for large simulations (or simulations with a long run time), "
2149-
"where very high accuracy is needed, the precision can be set to double everywhere. "
2150-
"Note that this doubles the FlexCredit cost of the simulation.",
2151-
)
2152-
21532142
"""The Courant-Friedrichs-Lewy (CFL) stability factor :math:`C`, controls time step to spatial step ratio. A
21542143
physical wave has to propagate slower than the numerical information propagation in a Yee-cell grid. This is
21552144
because in this spatially-discrete grid, information propagates over 1 spatial step :math:`\\Delta x`
@@ -2222,6 +2211,24 @@ class Simulation(AbstractYeeGridSimulation):
22222211
* `Numerical dispersion in FDTD <https://www.flexcompute.com/fdtd101/Lecture-8-Numerical-dispersion-in-FDTD/>`_
22232212
"""
22242213

2214+
precision: Literal["hybrid", "double"] = pydantic.Field(
2215+
"hybrid",
2216+
title="Floating-point Precision",
2217+
description="Floating point precision to use in the computations.",
2218+
)
2219+
"""
2220+
By default, Tidy3D uses
2221+
a hybrid approach that offers a good balance of speed and accuracy for almost all
2222+
simulations. However, for large simulations (or simulations with a long run time),
2223+
where very high accuracy is needed, the precision can be set to double everywhere.
2224+
Note that this doubles the FlexCredit cost of the simulation. Note that this argument
2225+
affects not only the fields in the time stepping, but also the the structure
2226+
discretization on the grid. Thus, results stored in a ``PermittivityMonitor`` or a
2227+
``ModeSolverMonitor`` can be affected. For the latter, note also that the precision set
2228+
here affects the structure discretization, and is independent from the
2229+
``ModeSpec.precision`` argument, which only affects the eigenvalue solver.
2230+
"""
2231+
22252232
lumped_elements: tuple[LumpedElementType, ...] = pydantic.Field(
22262233
(),
22272234
title="Lumped Elements",

0 commit comments

Comments
 (0)