Skip to content

v12.1.1

Latest

Choose a tag to compare

@adtzlr adtzlr released this 18 Nov 22:12
· 1 commit to main since this release
2de6e7b

[12.1.1] - 2026-11-18

Changed

  • Import scipy.interpolate, scipy.special and scipy.constants on demand, inside the functions which use them (#1297), i.e. import felupe imports only scipy.sparse and scipy.sparse.linalg of SciPy. Before, these modules (and scipy.optimize, scipy.spatial and scipy.fft, which are imported by scipy.interpolate) were about two thirds of the import time of FElupe, e.g. 0.18 s instead of 0.05 s after import numpy, scipy.sparse.linalg (CPython 3.13), and in Pyodide they also loaded their WebAssembly modules. griddata() is imported by mesh.fill_between(), interp1d() by tools.curve(), erf() by OgdenRoxburgh and the Stefan-Boltzmann constant by SolidBodySurfaceRadiation. The Lagrange polynomials of ArbitraryOrderLagrangeElement use math.factorial() instead of scipy.special.factorial() (the values are identical up to order 24, above, math.factorial() is exact). A test checks that import felupe doesn't import these modules.

Fixed

  • Fix the precision of a region after a reload, e.g. by field.merge() (#1293). Region.astype(dtype) stores the data type in the new attribute Region.dtype (default is None, i.e. the arrays are not casted) and Region.reload() casts the re-evaluated arrays to this data type, i.e. a region keeps its precision. Before, Region.reload() evaluated the arrays in double precision again, i.e. field.merge() (which reloads the regions of the first fields with the merged meshes), Region.copy() and mesh.update(callback=region.reload) promoted a single-precision region to float64, while the fields kept float32, and the items assembled in double precision. The arrays are still evaluated from the undeformed coordinates in double precision and rounded once, also the quantities of the cells of a RegionBoundary, which are evaluated by the private method RegionBoundary._evaluate() now (before, by RegionBoundary.reload()). A copy by Region.astype(dtype) is reloaded with the given data type, i.e. a single-precision region is casted back to double precision without a loss of precision.
  • Fix the default absolute tolerance of newtonraphson(..., atol=None) (#1294), which is an estimate of the round-off errors of the objective function atol = ||(ε_x sqrt((K ∘ K) (x ∘ x)) + ε_K |K (X - X̄)|)_1|| now. Before, it was 10 ||(ε_x |K| |x| + ε_K |K (X - X̄)|)_1||, i.e. about 30 to 170 times the round-off errors of the objective function at the converged solution, e.g. of single-precision models of nearly incompressible rubber and steel. Hence, a single-precision model stopped before it converged, e.g. the forces of a uniaxial material test (u-p-J, bulk modulus 5000, tol=1e-6, five substeps) had a relative error of 1e-3 instead of 4e-7 (with one more iteration per substep). Now, the estimate is about 3 to 13 times the round-off errors: the round-off errors of the unknowns are random, i.e. the root-sum-square of the products of the Jacobian and the unknowns of each row replaces the sums of their absolute values, and the safety factor is 1 (before, 10). The squares of the Jacobian are evaluated in double precision, i.e. they don't overflow in single precision. The machine epsilons are the ones of the lowest instead of the common precision of the Jacobian and of the objective function, e.g. for LinearElasticPlasticIsotropicHardening, which returns its Jacobian in double precision for a single-precision model. Before, the round-off errors of the deformation gradient of such a model were estimated in double precision, i.e. the default absolute tolerance was too small and the model didn't converge for a small tolerance, e.g. tol=1.49e-8.

What's Changed

  • Split changelog files by @adtzlr in #1292
  • Keep the precision of a region after a reload (field.merge()) by @adtzlr in #1295
  • Fix the default absolute tolerance in single precision by @adtzlr in #1296
  • Import scipy.interpolate and scipy.special on demand by @adtzlr in #1298
  • Release 12.1.1 by @adtzlr in #1299

Full Changelog: v12.1.0...v12.1.1