Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ADR 0001: Libraries and licences

Status: accepted (2026-10-13)

Context

FieldCraft is MIT OR Apache-2.0. Everything it links must allow that, and the meshing and solver algorithms, where the obvious open-source implementations are GPL-family, must come from papers.

Decision

Geometry: SolidCraft, as git dependencies pinned by commit (solidcraft-kernel, solidcraft-geom, solidcraft-doc, solidcraft-io; MIT OR Apache-2.0, built on the Apache-2.0 truck crates until v0.30 and on solidcore, an Apache-2.0 Rust port of NVIDIA’s SMLib, from v0.40, with its solidcore-record geometry records from the copy SolidCraft vendors). SolidCraft is the primary geometry source: FieldCraft opens SolidCraft designs and meshes from SolidCraft’s tessellation, and reads face-tagged meshes SolidCraft exports. Other CAD exchange files (STEP, which SolidCraft’s kernel already reads) can be added as secondary inputs through the same crate. Only fieldcraft-geometry may depend on SolidCraft.

Desktop UI: SolidCraft’s UI kit (solidcraft-ui-kit and the solidcraft-theme token contract it draws from; same pinned commit, MIT OR Apache-2.0 from 615a4adc1f on, see below). Decided 2026-11-10 (owner): the desktop UI draws its windows, confirmations, menus, form rows, fields and buttons with the kit instead of FieldCraft’s adapted copies of SolidCraft’s widgets, so the two apps share one implementation and FieldCraft follows SolidCraft’s egui line. FieldCraft installs its own tokens (its teal accent on SolidCraft’s chrome) and keeps what is its own: the viewport, mesh, element, results and setup colours. fieldcraft-ui-egui is the only crate that may use them (cargo xtask layers); it uses nothing else of SolidCraft’s. The kit builds for wasm32-unknown-unknown, so the browser app keeps the same UI. craft-ui (storytold/craft-libs), used before for tabs, icon buttons and widget states, is no longer a dependency. Updated 2026-11-29 (owner approval, #1164): fieldcraft-ui-egui may also use solidcraft-panel-layout (MIT OR Apache-2.0, same pinned commit) for workspace panel layout and persistence alongside solidcraft-ui-kit::panel_runtime.

SolidCraft’s UI code is MIT OR Apache-2.0; its brand artwork is used by written permission. From SolidCraft 615a4adc1f (2026-11-26) on, solidcraft-ui-kit, solidcraft-theme and solidcraft-icon-svg are dual-licensed MIT OR Apache-2.0 like the rest of the workspace, so they need no permission and no deny.toml exception. The SolidCraft Brand and Interface Licence now covers only the SolidCraft name, logo, app icon, brand kit and the icon artwork (the SVG masters) shipped in solidcraft-look; solidcraft-look’s code is MIT OR Apache-2.0, and its licence expression names the brand and font parts ((MIT OR Apache-2.0) AND LicenseRef-SolidCraft-Brand AND OFL-1.1). The permission for that artwork: requested 2026-11-10 by FieldCraft’s owner (GitHub jyviko) for FieldCraft to link and distribute solidcraft-look, and approved by SolidCraft’s maintainer bherbruck in https://github.com/tangency-labs/fieldcraft/pull/872. FieldCraft does not ship the brand artwork, name or logo without it. deny.toml accepts the brand licence for solidcraft-look only (a LicenseRef-SolidCraft-Brand clarification and exception), never in its global allow list; any other crate under that licence needs its own recorded permission before FieldCraft depends on it. FieldCraft does not use solidcraft-look yet: whether it draws SolidCraft’s icons and themes or its own is still the owner’s decision.

Meshing: our own, implemented from published papers (docs/meshing/literature.md). Robust predicates follow Shewchuk’s adaptive-precision arithmetic (the paper; his reference predicates.c is public domain). A permissive crate may be adopted instead after review; record it here. Decided 2026-10-13: our own implementation, fieldcraft_mesh::predicates, written from Shewchuk 1997, Devillers–Teillaud 2011 and Attene 2020 (no unsafe, deterministic, wasm-safe, a validated coordinate domain instead of Shewchuk’s overflow/underflow caveat, and indirect predicates that robust lacks). robust (georust, MIT OR Apache-2.0) and num-bigint / num-rational / num-traits (MIT OR Apache-2.0) are dev-dependencies only: differential test oracles, never linked into FieldCraft.

Linear algebra: our own. Decided 2026-10-13 (implicit solver task): fieldcraft-solver has its own sparse symmetric storage, nested-dissection ordering (George 1973, by coordinate bisection), up-looking sparse Cholesky (Davis 2006, elimination trees per Liu 1990) and shift-invert block Lanczos with full reorthogonalization (Ericsson–Ruhe 1980, Grimes–Lewis–Simon 1994) on a Householder + implicit-QR dense eigensolver (Golub–Van Loan). faer (MIT) was the alternative and is faster on large problems, but it selects SIMD kernels by CPU feature at run time (AVX2, AVX-512, NEON), which changes floating-point reduction order between machines and breaks the bit-for-bit determinism rule; it is also a large dependency tree for the browser build. Our code is sequential with a fixed operation order, unsafe-free and wasm-safe, and its factor size is known (and capped) before any value is computed. Cost if this is wrong: large models (beyond a few hundred thousand equations) factor slower than they could; the remedy is a supernodal factorization of our own, or faer behind the same Factor interface with a stated tolerance instead of bit-identity, as the GPU exception already does. Updated 2026-10-13 (CPU parallelism task): the factorization is now our own supernodal left-looking Cholesky (Liu–Ng–Peyton 1993 fundamental supernodes on a postordered elimination tree, Ng–Peyton 1993, Rothberg–Gupta 1994), multithreaded with a fixed operation order (below). Its rounding differs from the old up-looking factor in the last digits; every oracle fixture stays within its band.

Complex scalars: num-complex (MIT OR Apache-2.0). Decided 2026-11-22 (RFC 0001 phase 1, #881): the sparse matrix and the LDLᵀ factor are generic over a scalar trait, implemented for f64 and num_complex::Complex64, for the complex-symmetric systems of a harmonic response (K − ω²M + iωC): every step transposes and never conjugates. num-complex is pure Rust with no unsafe, builds for wasm, and adds no reduction order of its own (sums stay in the fixed order of the f64 kernels). Rejected: a hand-written complex type (a second arithmetic to verify for no gain) and faer (see above).

Threads: rayon (MIT OR Apache-2.0), in fieldcraft-parallel only (an L0 crate with no workspace dependencies; decided 2026-10-13). The solvers keep the bit-for-bit rule on any number of threads by construction: work is cut into blocks whose sizes are constants of the algorithm, never derived from the thread count; each floating-point value is computed by one task in an order fixed by the input; results come back in block order and every sum over blocks or elements (nodal forces, assembly, wall forces, energies) runs on one thread in the order the sequential algorithm used. No float atomics, no reduce whose tree depends on work stealing: rayon decides only when a block runs. std::thread::scope was the alternative and needs no dependency, but it spawns threads per parallel region; the explicit solver enters several regions per time increment (10⁵–10⁷ increments), so a persistent pool is needed, and writing our own would re-implement rayon’s. rayon was already in the shipped dependency tree (THIRD-PARTY-LICENSES.txt unchanged). In the browser build (wasm32) the crate does not depend on rayon and runs the same blocks one after another, with the same results. The thread count is a session and solve.* parameter (threads, 1–256) whose default is FIELDCRAFT_THREADS or the available cores. Cost if this is wrong: rayon’s pool is a process-wide resource and nested pools add latency; replacing it touches only fieldcraft-parallel.

Machine memory: sysinfo (MIT), in fieldcraft-engine only, desktop and CLI builds (not the browser), with only its system feature, for the physical memory (decided 2026-10-21, #650). It bounds how far a fluid solve’s memory caps may be raised: half the physical memory, or on Linux half the root cgroup’s limit when that is lower (a container’s). std has no such query; the alternatives were our own per-platform code (/proc/meminfo on Linux is plain Rust, but macOS and Windows need sysctl and GlobalMemoryStatusEx through FFI, which unsafe_code = "forbid" rules out) or a crate built on C code. Cost if this is wrong: the bound is a little off on some platform, and the remedy stays inside fieldcraft_engine::machine.

Installed fonts: fontdb (MIT), in fieldcraft-ui-egui only, desktop builds (not the browser), without its fontconfig and memmap features (decided 2026-11-25, #991). A character none of the interface’s faces has (a file, folder or body named in Japanese, Korean or Chinese) is drawn with an installed font that has it: the fonts are listed once on a thread, and an egui font provider answers each missing character (crates/ui-egui/src/fonts.rs, adapted from SolidCraft’s). Shipping a CJK face costs several megabytes per script; eframe’s system_fonts feature (egui_system_font_provider) does the same through the systems’ own fallback but adds seven crates, and fontdb adds two (fontdb, tinyvec; ttf-parser and slotmap were already in the tree). Without fontconfig it reads the font folders, not fontconfig’s settings. The characters a face has are read with skrifa, egui’s own font reader (already in the tree), so a face is offered only for what egui will find in it. Cost if this is wrong: such text depends on the machine’s fonts, and the remedy stays inside fonts.rs.

Allowed: MIT, BSD-2/3, Apache-2.0, ISC, Zlib, Unicode, MPL-2.0 (as an unmodified dependency), CC0 and public domain.

Rejected — never read, copy or link:

ProjectLicenceWould have offered
TetGenAGPL-3.0constrained Delaunay tetrahedralization
CGALGPL-3.0 / LGPL-3.0Delaunay, mesh generation
GmshGPL-2.0+tet and hex meshing
NetgenLGPL-2.1tet meshing
CalculiXGPL-2.0implicit solver, Abaqus-like input
Code_AsterGPL-3.0implicit solver
OpenRadiossAGPL-3.0explicit solver
ElmerGPL-2.0 / LGPL-2.1multiphysics solver
FreeFEM, SalomeLGPLFE libraries, pre-processing
Palabos, OpenLB, waLBerla, lbmpy, VirtualFluids, TCLBAGPL / GPLlattice Boltzmann (implement from the papers)
OpenFOAM, SU2, 4C, DualSPHysics, preCICEGPL / LGPLCFD, FSI coupling, SPH
FluidX3Dnon-commercial onlyGPU lattice Boltzmann
LULESHno licenceexplicit hydrodynamics proxy
OpenCASCADELGPL-2.1B-rep kernel
Attene’s CDT, Indirect_Predicates, VolumeMesherGPL / LGPLrobust CDT, indirect predicates (implement from the papers)
TetWild (original), Evocube, robustPolycube, ultimaille, invertible-mapsGPL-3.0 / AGPL-3.0tet meshing, polycube, injective maps
libHexEx, libHexHex, QGP3D, MC3D, CoMISo, GraphiteGPLinteger-grid-map hex extraction, quantization
Shewchuk’s Trianglenon-commercial only2D meshing
geogram third_party/tetgen, third_party/triangle and their wrappersAGPL / non-commercial(the rest of geogram is BSD-3 and readable)
libigl copyleft/ modulesGPL(libigl core is MPL-2.0 and readable)
OpenVolumeMesh, CGoGNbelieved LGPL, unverifiedtreat as forbidden until checked

deal.II is now dual-licensed Apache-2.0 (with LLVM exception) or LGPL, so it is readable under its Apache-2.0 option. Readable solver references (re-implement from the papers): STLBM (MIT), XLB, lettuce, pylbm, Laghos, MFEM, IBAMR, the Kratos core, MUI, FEBio, SPHinXsys, SPlisHSPlasH, fenris; full table in docs/solvers/literature.md.

Repositories without a licence are all rights reserved: never read them (for example Gao 2019’s octree hex code, LoopyCuts). Readable references for the meshing work (re-implement from the paper, note anything adapted in ATTRIBUTION.md): Shewchuk’s predicates.c (public domain), georust/robust (Apache-2.0), geogram (BSD-3, exclusions above), fTetWild (MPL-2.0), CinoLib, Gen-Adapt-Ref, HexaLab, robust_hex_dominant_meshing (MIT), quartet (ISC). The full table with sources is in docs/meshing/literature.md.

Test geometry follows the same rule as test data: nothing produced with a commercial CAD or CAE product. That excludes ABC (Onshape), MAMBO (files from commercial translators) and the HexMe models that come from ABC, GrabCAD or Siemens NX; HexMe’s Gmsh-made models are allowed (CC-BY-4.0). Thingi10K is not used either (owner decision 2026-10-13: authoring tools unrecorded). The test corpus is our own: parts built with SolidCraft (scripts or designs authored in SolidCraft, committed as their recipes so the geometry is regenerated, not stored) and analytic shapes. Recipes are SolidCraft command scripts run through solidcraft-engine (same pinned commit), a dependency of fieldcraft-geometry only behind its non-default scripts feature, which the test tooling (fieldcraft-testkit) enables; the shipped library opens designs without it.

Commercial products (Abaqus, Nastran, LS-DYNA, LS-PrePost, HyperMesh, ANSA, Femap, Patran, ANSYS) are never run or scripted, and their input files, text and figures are never copied. Deck formats come from the vendors’ public reference manuals, described in our own words with our own examples. Published numerical results (benchmark and verification manuals) may serve as cited reference values for our own models of the same problems (owner decision 2026-10-13; docs/verification.md).

Consequences

  • The tet and hex meshers are significant original work; the literature survey decides the order and the methods.
  • SolidCraft and FieldCraft move together: bumping the pinned commit bumps solidcore-record (from SolidCraft’s repository) and the repeated [patch.crates-io] entries in the same commit. The pin is a SolidCraft release tag’s commit or, when FieldCraft needs a change not yet released, a commit on SolidCraft’s main branch (owner exception 2026-11-27, bare commit until the next tag), and a scheduled check opens designs saved by SolidCraft’s latest release, so a release that saves a design format the pin can’t read is caught before users meet it (docs/architecture.md, “SolidCraft pin”).