Changelog¶
All notable changes to ndiffusion are recorded here. The format follows Keep a Changelog and the project uses semantic versioning.
[Unreleased]¶
[1.1.0] - 2026-10-18¶
Added¶
A constrained spline fit for the method of nearby problems on the unstructured mesh: one quintic spline per material region, fit to all regions and groups together with flux and current continuity at the interfaces and the boundary conditions on the boundary, plus corner singular functions where the interfaces meet at a corner.
nearby_fixed_sourceandnearby_k_eigenvalueuse it when givenbc=;fit="local"keeps the per-cell polynomial fit.nearby_k_eigenvalue(adjoint_solver=...)returns a one-shot eigenvalue error estimate from the adjoint flux (k_error_adjoint) and its per-cell contributions (k_error_cells);nearby=Falseskips the nearby solve.unstructured_operator(mats, mesh, bc)assembles the unstructured solvers’ loss and production operators as sparse matrices, non-orthogonal correction included, so a converged solve satisfies them to the solver’s tolerance.nearby_k_eigenvalue(method="direct")factorizes that operator once for the nearby solve and takes the one-shot estimate from the exact discrete adjoint. A solver run on adjoint cross sections does not transpose the non-orthogonal correction, which biases adjoint-weighted estimates by 1-2% on triangles and hexagons.nearby_qoiestimates the error of normalized quantities of interest (ratios of reaction-rate integrals, such as region powers) from a generalized adjoint, with per-cell contributions for adaptation.
Fixed¶
The nearby fit treated a one-group
nusigfas a fission matrix (its size matches both layouts), so a one-groupnearby_k_eigenvaluefailed.A k-eigenvalue solve with an
epsilontighter than round-off allows no longer runs every inner iteration out tomax_inner. The inner sweeps now stop once their change stops shrinking. This mostly hit the CG inner solver on fine meshes: a 247k-cell unstructured mesh atepsilon=1e-12took over 10 minutes per outer iteration and now takes about 40 seconds. Converged results are unchanged.
[1.0.2] - 2026-10-12¶
Fixed¶
An iteration whose flux overflowed reported a relative change of 0 and counted as converged. It now reports NaN, so the solve is not converged.
FixedSourceSolverUnstructured2Drejectsomegaoutside0 < omega < 2, where SOR always diverges. The 1.0.1 divergence check missed this case, because the change per sweep does not grow before the flux overflows.
[1.0.1] - 2026-10-12¶
Changed¶
The unstructured CG solver loosens its within-group tolerance while the non-orthogonal correction is still settling, which makes k-eigenvalue solves on skewed meshes about 3x faster. Results are unchanged.
Fixed¶
FixedSourceSolverUnstructured2Dstops and warns when its SOR iteration diverges, instead of running allmax_innersweeps. An omega that is too large for a non-orthogonal mesh used to cost hours before the ordinary not-converged warning.
[1.0.0] - 2026-10-07¶
The first stable release. The public API is fixed from here on: changes are additive until a 2.0.
Added¶
Delayed neutron precursors in all three time-dependent solvers, with an implicit fission source and
update_materialsfor mid-transient perturbations;make_delayed_data,scale_to_criticaland the Keepin 6-group setDELAYED_U235_6GROUPTheta-weighted time differencing (
theta = 0.5is Crank-Nicolson,theta = 1the default backward Euler)Deferred non-orthogonal correction with least-squares gradients, so the unstructured solvers stay second order on triangles and skewed cells
Polygonal unstructured cells (hexagons and the clipped cells of a symmetry sector), plus
validate_mesh,cell_centroidsandcell_areasassign_materialsandcopy_mesh, so one mesh can carry several material layouts; Gmsh physical-group names are kept on the mesh asregion_namesandbc_namesPeriodic boundary pairs, translational or rotational
ndiffusion.layouts: Cartesian and hex core meshes, symmetry orientations and material paintersndiffusion.materials: one- and two-group builders and the published Ringhals, TWIGL, IAEA and BIBLIS benchmark tablesTransport-to-diffusion cross-section conversion (
make_materials_from_transport,transport_to_diffusion)make_adjoint_materialsfor the adjoint (importance) problemMethod of nearby problems discretization-error estimator (
nearby_*)Within-group CG inner solver for the 2-D k-eigenvalue solvers (
use_cg)Published benchmark regression tests and a C5G7 quarter-core example
Ctrl-C interrupts a running solve instead of waiting for it to finish
ndiffusion.__version__n_cellsandn_groupson every solver, andn_groups(plusn_precursorfor transients) on the result objectsGitHub Actions CI on Linux, macOS and Windows, ruff linting and a sanitizer build of the C++ driver
Robin boundary conditions on the 1-D left edge (
bc_left) and the 2-D structured left and bottom edges (bc_x_left,bc_y_bottom). They default to reflective, the old fixed behavior, so a full core no longer has to be cut to a quarter, and a 1-D cylinder or sphere can have an inner surface. A non-reflective condition on an r = 0 axis raises.ndiffusion.ConvergenceWarning, and aconvergedflag onTimeDependentResult(false once any step has hitmax_inner)Post-processing helpers:
cell_volumes,reaction_rate,power_density,normalize_to_power,region_powers,peaking_factors, andsave_result/load_resultfor.npzfilesA documentation site built with Sphinx - installation, quickstart, user guide and API reference - deployed to GitHub Pages along with the Doxygen C++ reference
A logo, favicon and social preview image
Theory pages (the diffusion equation, the 1-D, structured and unstructured discretizations, the iterative methods, kinetics and the method of nearby problems), an examples gallery with plots, a benchmarks page with published-versus-computed eigenvalues, and figures for the README and quickstart
Two new examples: unstructured meshes and symmetry sectors, and benchmark convergence for TWIGL and IAEA
Prebuilt wheels for Linux (x86_64, aarch64), macOS (Intel, Apple silicon) and Windows, Python 3.9 to 3.14, published to PyPI from tagged releases
CITATION.cff,.zenodo.jsonandCONTRIBUTING.md
Changed¶
The README is shortened to an overview; the detailed usage moved to the documentation, and the 2021 notes in
docs/todocs/archive/The examples are sphinx-gallery scripts with plots;
examples/kinetics.pyplots the power history and the time-differencing convergenceCI tests Python 3.13 too, runs the examples, and reports coverage
Arrays cross into and out of Python as numpy arrays instead of lists.
fluxis shaped(n_cells, n_groups)andprecursors(n_cells, n_precursor); theMaterials,DelayedNeutronDataandUnstructuredMesh2Dfields read back as 1-D arrays. Inputs accept any array-like, and a fixed source, initial flux or initial precursors can be given in the same 2-D shape - a transposed array is rejected rather than read in the wrong order. Thenearby_*results andfission_sourceuse the same shape.make_materialstakesscatter_orientation;descending_energy=Trueis deprecated anddescending_energy=FalseraisesThe 1-D k-eigenvalue
max_innerdefault is 1000, and the C++ solvers are quiet by default like the Python bindingsA bare CMake configure builds Release, and warning flags apply to every target
Convergence warnings go through Python’s
warningsmodule asConvergenceWarninginstead of to stderr, so they can be filtered, recorded or raised. The k-eigenvalue solvers now also warn when power iteration stops atmax_outer, and the fixed-source solvers when they stop atmax_inner. The transient warning is issued after the step completes, so turning it into an exception leaves the solver at a consistent state. The C++ driver still prints to stderr.
Fixed¶
1-D interface coupling now divides by the center-to-center distance, so non-uniform meshes converge at second order
Fixed-source iteration counts no longer overcount by one at the cap
make_materialsderives removal from the solver-ordered scatter matrixmake_delayed_datarejectsChiPromptgiven for only some materialsHigher-order Gmsh elements are imported by their corner nodes rather than silently dropped
Unstructured meshes are validated: the
bcarray must cover every boundary tag, and non-manifold edges, hanging nodes, coincident vertices and zero-area cells are rejectedBoundary faces are emitted in sorted order, so results no longer depend on the standard library’s hash ordering
Time steps must be positive and finite
copy_meshkeeps periodic boundary pairsThe
DelayedNeutronDatadocstring no longer says fission-matrix mode is rejected, or that an emptychi_promptfalls back toMaterials.chiexamples/k_eigenvalue.pyprinted the 20-cell slab reference for its sphere; the sphere is at its critical radius, so the exact eigenvalue is 1
[0.3.0] - 2026-06-22¶
Gmsh import for unstructured meshes. Earlier history is in the git log.