Skip to main content

Workflow

Last updated

13 November 2026

The four steps

Every problem follows the same steps:

  1. Mesh — build the geometry and set boundary conditions.
  2. Exchange factors — quasi-Monte Carlo ray tracing (2D participating media, 3D surface enclosures) or analytical view factors (3D convex surface enclosures), producing exchange factor matrix F_raw.
  3. Smooth — for ray-traced exchange factors, smooth!(domain) enforces reciprocity and energy conservation on F_raw, choosing per bin between alternating projections and Dykstra’s projection, and returns F_smooth with convergence diagnostics. Analytical view factors are already reciprocal to round-off and skip this step.
  4. Solve — solveEquilibrium!(domain, domain.F_smooth), or domain.F_raw for analytical view factors, yields the steady state.

Step 3 is separate because it is a distinct computation with its own cost and diagnostics. Ray-traced exchange factors arrive violating reciprocity at the level of the sampling noise, and smoothing, a least-squares projection in the tradition of Larsen and Howell (1986), restores it to round-off (Example 10). Analytical view factors are exact: their F_raw is already reciprocal to working precision, so it is passed to the solver directly (Examples 7–9). Both matrices remain available on a ray-traced domain, so F_raw can be inspected or exported, but F_smooth is what should be passed to the solver.

Smoothing is cheap relative to the tracing step, so F_raw can be traced once and smoothed repeatedly with different settings.

Precision

Analytical view factors and the grey 3D solve run in any floating-point type: after setprecision(BigFloat, bits), a ViewFactorDomain3D built from BigFloat geometry and boundary conditions carries that precision through the view factors, the solve and the result. Reciprocity, energy conservation and the solved temperatures then all follow the working precision, which shows that the remaining deviations in Float64 are round-off (Example 8).

Spectral and directional models

Spectral problems trace once with mesh(n; method = :pathlength), which builds F_raw for every bin from the recorded paths; with chunk_rays = n the paths are kept and exchangeFactors!(mesh) rebuilds F_raw for new coefficients or bins without retracing (Example 3). With a directional_model set, the same trace also resolves the exchange factors by ray direction (G_raw, G_smooth), and the solver redistributes scattered and reflected power over the direction bins according to each element’s phase and reflection (Example 4). Every solve stores its solution on the domain as J.

On a 2D domain the spectral model and the directional model are independent settings and combine freely; solveEquilibrium! selects the solver from what is set:

no directional_model directional_model set
grey grey solver (Example 1) grey directional (Example 4)
spectral_model set spectral solver (Examples 2, 3) spectral directional

In the combined case the faces are built with their spectral bins as in Example 3 and carry phase and reflection as in Example 4, optionally one descriptor per spectral bin; one pathlength trace resolves the exchange factors by bin and by direction, and the solution is J[k][i, b]. That solver is currently limited in size (see the notes at the end of Example 4).

Sampling and reproducibility

The ray tracers draw emission positions and directions from Sobol sequences (Sobol’ 1967; Joe and Kuo 2008) (quasi-Monte Carlo) by default. Every emitter owns one sequence, digitally shifted by a random mask derived from seeds, so the estimate is unbiased and the stratification of the sequence is kept. At the same ray count the exchange factors come out quieter than with pseudorandom sampling by 2–3× at 4096 rays per emitter, and the gain grows with the ray count, reaching 10× at 65 536 rays per emitter for the pathlength tracer: the same accuracy from up to a hundred times fewer rays.

Two keywords control it, on the 2D domain functor and on RayTracingDomain3D_surfaces:

  • sampler — :sobol, the default wherever every ray consumes a fixed number of random numbers (:exchange, :pathlength, the 3D surface tracer), or :random, one pseudorandom stream per thread. The :direct tracer follows random walks and always samples pseudorandomly.
  • seeds — with :sobol, a single integer selecting the realisation (default 1); runs with different integers are statistically independent. With :random, one seed per thread, or a single integer selecting a block of per-thread seeds.

With the default sampler the result depends only on the geometry, the ray count and seeds: not on the number of threads, and for :pathlength not on chunk_rays. Rays per emitter that are powers of two make the best use of the sequence; other counts work and lose roughly 10–20 % of the gain. Passing rngs, or several seeds, together with the Sobol sampler is an error whose message names the fix.

References

Joe, Stephen, and Frances Y. Kuo. 2008. “Constructing Sobol Sequences with Better Two-Dimensional Projections.” SIAM Journal on Scientific Computing 30 (5): 2635–54. https://doi.org/10.1137/070709359.
Larsen, M. E., and J. R. Howell. 1986. “Least-Squares Smoothing of Direct-Exchange Areas in Zonal Analysis.” Journal of Heat Transfer 108 (1): 239–42. https://doi.org/10.1115/1.3246898.
Sobol’, I. M. 1967. “On the Distribution of Points in a Cube and the Approximate Evaluation of Integrals.” USSR Computational Mathematics and Mathematical Physics 7 (4): 86–112. https://doi.org/10.1016/0041-5553(67)90144-9.