|
| 1 | +Configuration Reference |:clipboard:| |
| 2 | +==================================== |
| 3 | + |
| 4 | +All configuration for ``tidy3d`` is organized into named sections reachable |
| 5 | +through ``from tidy3d.config import config``. This page lists every built-in |
| 6 | +section and the options they expose so you can see everything that is |
| 7 | +configurable in one place. |
| 8 | + |
| 9 | +How to read this page |
| 10 | +--------------------- |
| 11 | + |
| 12 | +- Environment variable overrides always win. Use the pattern |
| 13 | + ``TIDY3D_<SECTION>__<FIELD>`` (additional ``__`` segments follow the same |
| 14 | + nesting, for example ``TIDY3D_PLUGINS__SAMPLE__ENABLED``). |
| 15 | +- Fields tagged with **[persisted]** are written to the active ``config.toml`` |
| 16 | + (base or profile) when you call ``config.save()``. Fields without the tag are |
| 17 | + runtime-only and revert to their defaults on the next import unless you use |
| 18 | + ``config.save(include_defaults=True)`` or set them via environment variables |
| 19 | + or profiles. |
| 20 | +- Types reference Python objects unless noted otherwise. Literal values are |
| 21 | + quoted and tuples use the ``(x, y, z)`` notation seen in the API. |
| 22 | + |
| 23 | + |
| 24 | +Logging (``config.logging``) |
| 25 | +---------------------------- |
| 26 | + |
| 27 | +Controls the verbosity and suppression behaviour of the global logger. |
| 28 | + |
| 29 | +``level`` — ``LogLevel``, default ``"WARNING"`` **[persisted]** |
| 30 | + Lowest logging level that will be emitted. Accepts ``"DEBUG"``, ``"SUPPORT"``, |
| 31 | + ``"USER"``, ``"INFO"``, ``"WARNING"``, ``"ERROR"``, and ``"CRITICAL"``. |
| 32 | + |
| 33 | +``suppression`` — ``bool``, default ``True`` |
| 34 | + Suppresses repeated log messages when ``True`` so only the first occurrence |
| 35 | + of identical messages is shown. |
| 36 | + |
| 37 | + |
| 38 | +Simulation (``config.simulation``) |
| 39 | +---------------------------------- |
| 40 | + |
| 41 | +Optional overrides that tweak solver behaviour at runtime. |
| 42 | + |
| 43 | +``use_local_subpixel`` — ``bool | None``, default ``None`` |
| 44 | + Forces or disables the local subpixel averaging routine. ``True`` enables |
| 45 | + the algorithm, ``False`` disables it, and ``None`` keeps the solver default. |
| 46 | + |
| 47 | + |
| 48 | +Microwave (``config.microwave``) |
| 49 | +-------------------------------- |
| 50 | + |
| 51 | +Applies to the microwave solver add-on. |
| 52 | + |
| 53 | +``suppress_rf_license_warning`` — ``bool``, default ``False`` |
| 54 | + When ``True`` the microwave solver skips the warning about RF license |
| 55 | + availability. |
| 56 | + |
| 57 | + |
| 58 | +Adjoint (``config.adjoint``) |
| 59 | +---------------------------- |
| 60 | + |
| 61 | +Parameters that shape autograd (adjoint) behaviour, including local execution |
| 62 | +settings and numerical tolerances. |
| 63 | + |
| 64 | +``min_wvl_fraction`` — ``float``, default ``0.05`` |
| 65 | + Minimum fraction of the smallest wavelength used when discretizing cylinders |
| 66 | + for autograd derivatives. Must be ``>= 0``. |
| 67 | + |
| 68 | +``points_per_wavelength`` — ``int``, default ``10`` |
| 69 | + Default number of material sample points per wavelength for cylinder |
| 70 | + discretization. Must be positive. |
| 71 | + |
| 72 | +``default_wavelength_fraction`` — ``float``, default ``0.1`` |
| 73 | + Fallback fraction of the minimum wavelength when adaptive spacing is needed. |
| 74 | + Must be ``>= 0``. |
| 75 | + |
| 76 | +``minimum_spacing_fraction`` — ``float``, default ``0.01`` |
| 77 | + Smallest normalized spacing allowed when constructing adaptive finite |
| 78 | + difference stencils. Must be ``>= 0``. |
| 79 | + |
| 80 | +``local_gradient`` — ``bool``, default ``False`` **[persisted]** |
| 81 | + Enables local gradient evaluation. Remote gradients ignore the other adjoint |
| 82 | + overrides unless this is ``True``. |
| 83 | + |
| 84 | +``local_adjoint_dir`` — ``pathlib.Path``, default ``"adjoint_data"`` **[persisted]** |
| 85 | + Directory (relative to the working directory) where intermediate gradient |
| 86 | + artifacts are stored when ``local_gradient`` is enabled. |
| 87 | + |
| 88 | +``gradient_precision`` — ``Literal["single", "double"]``, default ``"single"`` |
| 89 | + Floating-point precision used for gradient calculations. |
| 90 | + |
| 91 | +``monitor_interval_poly`` — ``tuple[int, int, int]``, default ``(1, 1, 1)`` |
| 92 | + Cell spacing between samples for polynomial autograd monitors. |
| 93 | + |
| 94 | +``monitor_interval_custom`` — ``tuple[int, int, int]``, default ``(1, 1, 1)`` |
| 95 | + Cell spacing between samples for custom autograd monitors. |
| 96 | + |
| 97 | +``quadrature_sample_fraction`` — ``float``, default ``0.4`` |
| 98 | + Fraction of uniform samples reused when building Gauss quadrature nodes. |
| 99 | + Must be between ``0`` and ``1``. |
| 100 | + |
| 101 | +``gauss_quadrature_order`` — ``int``, default ``7`` |
| 102 | + Maximum Gauss–Legendre order used in composite quadrature rules. Must be |
| 103 | + positive. |
| 104 | + |
| 105 | +``edge_clip_tolerance`` — ``float``, default ``1e-9`` |
| 106 | + Padding tolerance used when clipping polygon edges during surface |
| 107 | + integrations. Must be ``>= 0``. |
| 108 | + |
| 109 | +``solver_freq_chunk_size`` — ``int | None``, default ``None`` |
| 110 | + Upper bound on the number of frequencies processed per chunk during gradient |
| 111 | + evaluation. ``None`` disables chunking. |
| 112 | + |
| 113 | +``max_traced_structures`` — ``int``, default ``500`` |
| 114 | + Maximum number of structures whose fields may be traced in an adjoint run. |
| 115 | + |
| 116 | +``max_adjoint_per_fwd`` — ``int``, default ``10`` |
| 117 | + Maximum number of adjoint simulations dispatched per forward solve. |
| 118 | + |
| 119 | + |
| 120 | +Web (``config.web``) |
| 121 | +-------------------- |
| 122 | + |
| 123 | +Settings for the cloud API client and related environment overrides. |
| 124 | + |
| 125 | +``apikey`` — ``SecretStr | None``, default ``None`` **[persisted]** |
| 126 | + API key used for authentication. The value is masked when serialized. Also |
| 127 | + accepts ``SIMCLOUD_APIKEY`` as a shortcut environment variable. |
| 128 | + |
| 129 | +``ssl_verify`` — ``bool``, default ``True`` |
| 130 | + Verifies SSL certificates for API requests. |
| 131 | + |
| 132 | +``enable_caching`` — ``bool``, default ``True`` **[persisted]** |
| 133 | + Allows the web service to return cached simulation results when available. |
| 134 | + |
| 135 | +``api_endpoint`` — ``str``, default ``"https://tidy3d-api.simulation.cloud"`` **[persisted]** |
| 136 | + Base URL for API calls. Must be an HTTP or HTTPS URL. |
| 137 | + |
| 138 | +``website_endpoint`` — ``str``, default ``"https://tidy3d.simulation.cloud"`` **[persisted]** |
| 139 | + Base URL for the Tidy3D website. Must be an HTTP or HTTPS URL. |
| 140 | + |
| 141 | +``s3_region`` — ``str``, default ``"us-gov-west-1"`` |
| 142 | + AWS region used by the platform’s S3 storage. |
| 143 | + |
| 144 | +``timeout`` — ``int``, default ``120`` |
| 145 | + HTTP request timeout in seconds. Must be between ``0`` and ``300``. |
| 146 | + |
| 147 | +``ssl_version`` — ``ssl.TLSVersion | None``, default ``None`` |
| 148 | + Explicit TLS version to enforce. Accepts values such as |
| 149 | + ``ssl.TLSVersion.TLSv1_2``. ``None`` lets ``requests`` negotiate the version. |
| 150 | + |
| 151 | +``env_vars`` — ``dict[str, str]``, default ``{}`` |
| 152 | + Additional environment variables exported before API calls. Handy for proxy |
| 153 | + or credential helpers. |
| 154 | + |
| 155 | + |
| 156 | +Local Cache (``config.local_cache``) |
| 157 | +------------------------------------ |
| 158 | + |
| 159 | +Controls the optional on-disk cache for simulation artifacts. |
| 160 | + |
| 161 | +``enabled`` — ``bool``, default ``False`` **[persisted]** |
| 162 | + Turns the local cache on or off. When enabled, results are reused if the |
| 163 | + inputs match. |
| 164 | + |
| 165 | +``directory`` — ``pathlib.Path``, default ``<base>/cache/simulations`` **[persisted]** |
| 166 | + Directory where cached artifacts are stored. The path is expanded, resolved, |
| 167 | + and created if missing. ``<base>`` comes from ``TIDY3D_BASE_DIR`` when set, |
| 168 | + otherwise ``XDG_CACHE_HOME`` on Unix or ``~/.cache`` on other systems, so the |
| 169 | + default resolves to ``~/.cache/tidy3d/simulations``. |
| 170 | + |
| 171 | +``max_size_gb`` — ``float``, default ``10.0`` **[persisted]** |
| 172 | + Maximum cache size in gigabytes. ``0`` disables the size limit. |
| 173 | + |
| 174 | +``max_entries`` — ``int``, default ``0`` **[persisted]** |
| 175 | + Maximum number of cached simulations retained. ``0`` means no limit and the |
| 176 | + cache falls back to size-based eviction. |
| 177 | + |
| 178 | + |
| 179 | +Plugins (``config.plugins``) |
| 180 | +---------------------------- |
| 181 | + |
| 182 | +Acts as a container for plugin-defined sections. After a plugin calls |
| 183 | +``@register_plugin("name")``, its configuration becomes available under |
| 184 | +``config.plugins.<name>`` and follows the same persistence and environment |
| 185 | +variable rules described above (for example ``TIDY3D_PLUGINS__NAME__FIELD``). |
0 commit comments