morphogen 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. morphogen/__init__.py +60 -0
  2. morphogen/__main__.py +7 -0
  3. morphogen/_platform.py +55 -0
  4. morphogen/_public.py +153 -0
  5. morphogen/_utils.py +80 -0
  6. morphogen/_version.py +1 -0
  7. morphogen/analysis/__init__.py +174 -0
  8. morphogen/analysis/anisotropy.py +135 -0
  9. morphogen/analysis/basic.py +38 -0
  10. morphogen/analysis/cells.py +54 -0
  11. morphogen/analysis/connectivity.py +156 -0
  12. morphogen/analysis/correlation.py +195 -0
  13. morphogen/analysis/covariance.py +80 -0
  14. morphogen/analysis/fractal.py +54 -0
  15. morphogen/analysis/measures.py +188 -0
  16. morphogen/analysis/morphology.py +265 -0
  17. morphogen/analysis/particles.py +160 -0
  18. morphogen/analysis/percolation.py +2034 -0
  19. morphogen/analysis/power_laws.py +143 -0
  20. morphogen/analysis/random_sets.py +351 -0
  21. morphogen/analysis/stereology.py +289 -0
  22. morphogen/analysis/surface.py +107 -0
  23. morphogen/analysis/topology.py +92 -0
  24. morphogen/automata/__init__.py +74 -0
  25. morphogen/automata/engine.py +211 -0
  26. morphogen/automata/growth.py +686 -0
  27. morphogen/automata/lattice.py +143 -0
  28. morphogen/automata/reaction.py +255 -0
  29. morphogen/automata/rules.py +353 -0
  30. morphogen/automata/tilings.py +1715 -0
  31. morphogen/cli.py +3526 -0
  32. morphogen/config.py +2167 -0
  33. morphogen/contact/__init__.py +113 -0
  34. morphogen/contact/experiments.py +368 -0
  35. morphogen/contact/hertz.py +104 -0
  36. morphogen/contact/kernels.py +827 -0
  37. morphogen/contact/periodic.py +278 -0
  38. morphogen/contact/problem.py +578 -0
  39. morphogen/contact/surfaces.py +310 -0
  40. morphogen/coupling/__init__.py +43 -0
  41. morphogen/coupling/ageing.py +143 -0
  42. morphogen/coupling/diffusion.py +226 -0
  43. morphogen/coupling/fenicsx.py +484 -0
  44. morphogen/coupling/oxidation.py +447 -0
  45. morphogen/coupling/plates.py +247 -0
  46. morphogen/design/__init__.py +51 -0
  47. morphogen/design/csp.py +616 -0
  48. morphogen/design/frames.py +277 -0
  49. morphogen/design/search.py +287 -0
  50. morphogen/design/tiles.py +336 -0
  51. morphogen/distributions.py +312 -0
  52. morphogen/domain.py +203 -0
  53. morphogen/dynamics/__init__.py +179 -0
  54. morphogen/dynamics/model.py +638 -0
  55. morphogen/dynamics/openradioss.py +643 -0
  56. morphogen/dynamics/results.py +515 -0
  57. morphogen/fracture/__init__.py +170 -0
  58. morphogen/fracture/bulk.py +349 -0
  59. morphogen/fracture/cohesive.py +1614 -0
  60. morphogen/fracture/ductile.py +557 -0
  61. morphogen/fracture/lefm.py +1168 -0
  62. morphogen/fracture/mixed.py +1178 -0
  63. morphogen/fracture/periodic.py +733 -0
  64. morphogen/fracture/phasefield.py +714 -0
  65. morphogen/fracture/phasefield_finite.py +368 -0
  66. morphogen/fracture/surface.py +572 -0
  67. morphogen/fracture/toughness.py +566 -0
  68. morphogen/gpu.py +108 -0
  69. morphogen/gui/__init__.py +8 -0
  70. morphogen/gui/api.py +1927 -0
  71. morphogen/gui/desktop.py +387 -0
  72. morphogen/gui/icon.png +0 -0
  73. morphogen/gui/index.html +1909 -0
  74. morphogen/gui/server.py +229 -0
  75. morphogen/gui/tools/__init__.py +629 -0
  76. morphogen/gui/tools/compare.py +149 -0
  77. morphogen/gui/tools/contact.py +391 -0
  78. morphogen/gui/tools/couplings.py +1085 -0
  79. morphogen/gui/tools/crackfront.py +245 -0
  80. morphogen/gui/tools/design.py +224 -0
  81. morphogen/gui/tools/dynamics.py +824 -0
  82. morphogen/gui/tools/fracture.py +2586 -0
  83. morphogen/gui/tools/interop.py +1654 -0
  84. morphogen/gui/tools/learning.py +595 -0
  85. morphogen/gui/tools/mechanics.py +3881 -0
  86. morphogen/gui/tools/nonlocal_damage.py +1321 -0
  87. morphogen/gui/tools/phasefield.py +215 -0
  88. morphogen/gui/tools/physics.py +597 -0
  89. morphogen/gui/tools/stability.py +1756 -0
  90. morphogen/gui/tools/statistics.py +1408 -0
  91. morphogen/gui/viewer.js +1100 -0
  92. morphogen/homogenization/__init__.py +210 -0
  93. morphogen/homogenization/acoustics.py +566 -0
  94. morphogen/homogenization/amg.py +1005 -0
  95. morphogen/homogenization/apparent.py +1046 -0
  96. morphogen/homogenization/behaviours.cu +2285 -0
  97. morphogen/homogenization/behaviours.py +944 -0
  98. morphogen/homogenization/beremin.py +263 -0
  99. morphogen/homogenization/bifurcation.py +1085 -0
  100. morphogen/homogenization/bloch.py +507 -0
  101. morphogen/homogenization/bounds.py +226 -0
  102. morphogen/homogenization/core.py +458 -0
  103. morphogen/homogenization/coupled.py +1135 -0
  104. morphogen/homogenization/crystal.py +2967 -0
  105. morphogen/homogenization/dilatation.py +454 -0
  106. morphogen/homogenization/elements.py +157 -0
  107. morphogen/homogenization/fatigue.py +768 -0
  108. morphogen/homogenization/fe.py +1739 -0
  109. morphogen/homogenization/fenicsx.py +307 -0
  110. morphogen/homogenization/fft.py +499 -0
  111. morphogen/homogenization/fft_nonlinear.py +391 -0
  112. morphogen/homogenization/finite.py +613 -0
  113. morphogen/homogenization/flow.py +361 -0
  114. morphogen/homogenization/frames.py +1125 -0
  115. morphogen/homogenization/gpu.py +1241 -0
  116. morphogen/homogenization/harmonic.py +427 -0
  117. morphogen/homogenization/identification.py +579 -0
  118. morphogen/homogenization/kernels.py +760 -0
  119. morphogen/homogenization/laws.py +2061 -0
  120. morphogen/homogenization/materials.py +1080 -0
  121. morphogen/homogenization/mfront.py +589 -0
  122. morphogen/homogenization/networks.py +880 -0
  123. morphogen/homogenization/nonlinear.py +2612 -0
  124. morphogen/homogenization/ntfa.py +577 -0
  125. morphogen/homogenization/paths.py +476 -0
  126. morphogen/homogenization/photonic.py +467 -0
  127. morphogen/homogenization/poroelastic.py +212 -0
  128. morphogen/homogenization/porous.py +1120 -0
  129. morphogen/homogenization/postprocess.py +290 -0
  130. morphogen/homogenization/solvers.py +1140 -0
  131. morphogen/homogenization/tensors.py +240 -0
  132. morphogen/homogenization/voxel_fe.py +457 -0
  133. morphogen/homogenization/xfem.py +1016 -0
  134. morphogen/homogenization/zmat.py +1258 -0
  135. morphogen/iga/__init__.py +48 -0
  136. morphogen/iga/analysis.py +508 -0
  137. morphogen/iga/basis.py +214 -0
  138. morphogen/iga/geometry.py +501 -0
  139. morphogen/iga/homogenization.py +219 -0
  140. morphogen/iga/optimization.py +700 -0
  141. morphogen/iga/shapes.py +331 -0
  142. morphogen/image.py +128 -0
  143. morphogen/io/__init__.py +246 -0
  144. morphogen/io/amitex.py +741 -0
  145. morphogen/io/ebsd.py +881 -0
  146. morphogen/io/export.py +196 -0
  147. morphogen/io/geometry.py +158 -0
  148. morphogen/io/medit.py +147 -0
  149. morphogen/io/meshes.py +844 -0
  150. morphogen/io/metaimage.py +97 -0
  151. morphogen/io/mfront.py +1104 -0
  152. morphogen/io/native.py +57 -0
  153. morphogen/io/radioss.py +764 -0
  154. morphogen/io/solvers.py +371 -0
  155. morphogen/io/tables.py +278 -0
  156. morphogen/io/tiff.py +66 -0
  157. morphogen/io/vtk.py +701 -0
  158. morphogen/io/xdmf.py +200 -0
  159. morphogen/kernels/__init__.py +5 -0
  160. morphogen/kernels/annealing.py +192 -0
  161. morphogen/kernels/cells.py +69 -0
  162. morphogen/kernels/collective.py +87 -0
  163. morphogen/kernels/force_biased.py +595 -0
  164. morphogen/kernels/implicit.py +145 -0
  165. morphogen/kernels/leaves.py +132 -0
  166. morphogen/kernels/packing.py +304 -0
  167. morphogen/kernels/raster.py +279 -0
  168. morphogen/kernels/rsa.py +371 -0
  169. morphogen/kernels/union.py +135 -0
  170. morphogen/kernels/watershed.py +190 -0
  171. morphogen/laser/__init__.py +234 -0
  172. morphogen/laser/architectures.py +375 -0
  173. morphogen/laser/bending.py +216 -0
  174. morphogen/laser/cells.py +1694 -0
  175. morphogen/laser/design.py +940 -0
  176. morphogen/laser/figures.py +227 -0
  177. morphogen/laser/heat.py +804 -0
  178. morphogen/laser/materials.py +691 -0
  179. morphogen/laser/mechanics.py +1670 -0
  180. morphogen/laser/metallurgy.py +615 -0
  181. morphogen/laser/patterns.py +828 -0
  182. morphogen/laser/periodic.py +392 -0
  183. morphogen/laser/process.py +362 -0
  184. morphogen/laser/run.py +534 -0
  185. morphogen/laser/solid.py +216 -0
  186. morphogen/laser/specimen.py +200 -0
  187. morphogen/laser/structures.py +708 -0
  188. morphogen/learning/__init__.py +81 -0
  189. morphogen/learning/behaviour.py +398 -0
  190. morphogen/learning/data.py +328 -0
  191. morphogen/learning/learned.cpp +668 -0
  192. morphogen/learning/logarithmic.py +202 -0
  193. morphogen/learning/mfront.py +409 -0
  194. morphogen/learning/networks.py +767 -0
  195. morphogen/learning/run.py +212 -0
  196. morphogen/learning/standard.py +814 -0
  197. morphogen/learning/training.py +235 -0
  198. morphogen/mesh/__init__.py +29 -0
  199. morphogen/mesh/conforming.py +1423 -0
  200. morphogen/mesh/curved.py +600 -0
  201. morphogen/mesh/exact.py +1717 -0
  202. morphogen/mesh/octree.py +350 -0
  203. morphogen/mesh/polycrystal.py +1041 -0
  204. morphogen/mesh/polyhedra.py +677 -0
  205. morphogen/mesh/regularize.py +570 -0
  206. morphogen/mesh/surface.py +97 -0
  207. morphogen/mesh/tetra.py +512 -0
  208. morphogen/mesh/voxel.py +124 -0
  209. morphogen/micromorphic/__init__.py +31 -0
  210. morphogen/micromorphic/damage.py +359 -0
  211. morphogen/micromorphic/ductile.py +534 -0
  212. morphogen/micromorphic/finite.py +220 -0
  213. morphogen/micromorphic/microfoam.py +787 -0
  214. morphogen/micromorphic/space.py +341 -0
  215. morphogen/models/__init__.py +195 -0
  216. morphogen/models/affine.py +384 -0
  217. morphogen/models/automata.py +592 -0
  218. morphogen/models/base.py +500 -0
  219. morphogen/models/boolean.py +310 -0
  220. morphogen/models/bouligand.py +331 -0
  221. morphogen/models/branching.py +241 -0
  222. morphogen/models/combination.py +430 -0
  223. morphogen/models/deadleaves.py +766 -0
  224. morphogen/models/design.py +289 -0
  225. morphogen/models/ebsd.py +206 -0
  226. morphogen/models/fibers.py +1476 -0
  227. morphogen/models/foam.py +594 -0
  228. morphogen/models/gaussian.py +314 -0
  229. morphogen/models/growth.py +459 -0
  230. morphogen/models/hardcore.py +317 -0
  231. morphogen/models/hierarchical.py +269 -0
  232. morphogen/models/honeycomb.py +749 -0
  233. morphogen/models/implicit.py +177 -0
  234. morphogen/models/laminate.py +470 -0
  235. morphogen/models/lattice.py +351 -0
  236. morphogen/models/lattice_field.py +345 -0
  237. morphogen/models/levelset_foam.py +563 -0
  238. morphogen/models/nacre.py +411 -0
  239. morphogen/models/nested.py +924 -0
  240. morphogen/models/osteons.py +374 -0
  241. morphogen/models/pieces.py +167 -0
  242. morphogen/models/planar.py +126 -0
  243. morphogen/models/reconstruction.py +203 -0
  244. morphogen/models/scale_rich.py +1409 -0
  245. morphogen/models/scale_rich_3d.py +1616 -0
  246. morphogen/models/tessellation.py +735 -0
  247. morphogen/models/tiling_field.py +302 -0
  248. morphogen/models/tpms.py +197 -0
  249. morphogen/models/transparent.py +406 -0
  250. morphogen/models/union.py +141 -0
  251. morphogen/optimization/__init__.py +43 -0
  252. morphogen/optimization/cell.py +295 -0
  253. morphogen/optimization/filters.py +115 -0
  254. morphogen/optimization/mma.py +226 -0
  255. morphogen/optimization/run.py +219 -0
  256. morphogen/optimization/topology.py +632 -0
  257. morphogen/orientations.py +568 -0
  258. morphogen/parallel.py +599 -0
  259. morphogen/pipeline.py +978 -0
  260. morphogen/primitives.py +188 -0
  261. morphogen/results.py +564 -0
  262. morphogen/rve/__init__.py +73 -0
  263. morphogen/rve/report.py +627 -0
  264. morphogen/rve/scaling.py +363 -0
  265. morphogen/rve/study.py +1054 -0
  266. morphogen/rve/windows.py +345 -0
  267. morphogen/seeding.py +51 -0
  268. morphogen/settings.py +118 -0
  269. morphogen/stopping.py +48 -0
  270. morphogen/symmetry.py +384 -0
  271. morphogen/templates/activator_inhibitor.yaml +22 -0
  272. morphogen/templates/aggregation.yaml +23 -0
  273. morphogen/templates/boolean_cylinders.yaml +20 -0
  274. morphogen/templates/boolean_spheres.yaml +22 -0
  275. morphogen/templates/bouligand.yaml +28 -0
  276. morphogen/templates/cellular_automaton.yaml +25 -0
  277. morphogen/templates/coated_spheres.yaml +26 -0
  278. morphogen/templates/contact_fibers.yaml +27 -0
  279. morphogen/templates/cox_nanocomposite.yaml +22 -0
  280. morphogen/templates/cross_linked_fibers.yaml +26 -0
  281. morphogen/templates/curved_arcs.yaml +28 -0
  282. morphogen/templates/curved_fibers.yaml +24 -0
  283. morphogen/templates/dead_leaves.yaml +22 -0
  284. morphogen/templates/delaunay_network.yaml +22 -0
  285. morphogen/templates/dense_packing.yaml +22 -0
  286. morphogen/templates/diffusion.yaml +33 -0
  287. morphogen/templates/ebsd.yaml +34 -0
  288. morphogen/templates/ebsd_map.ctf +3087 -0
  289. morphogen/templates/fracture_composite.yaml +42 -0
  290. morphogen/templates/fracture_rubber.yaml +47 -0
  291. morphogen/templates/gaussian_excursion.yaml +17 -0
  292. morphogen/templates/graded_lattice.yaml +24 -0
  293. morphogen/templates/hardcore_fibers.yaml +22 -0
  294. morphogen/templates/hardcore_spheres.yaml +22 -0
  295. morphogen/templates/hierarchical_lattice.yaml +22 -0
  296. morphogen/templates/homogenization_acoustic_foam.yaml +36 -0
  297. morphogen/templates/homogenization_beremin.yaml +50 -0
  298. morphogen/templates/homogenization_cleavage.yaml +51 -0
  299. morphogen/templates/homogenization_cleavage_band.yaml +55 -0
  300. morphogen/templates/homogenization_contact.yaml +43 -0
  301. morphogen/templates/homogenization_crack_closure.yaml +49 -0
  302. morphogen/templates/homogenization_crystal_plasticity.yaml +50 -0
  303. morphogen/templates/homogenization_crystal_plasticity_fft.yaml +52 -0
  304. morphogen/templates/homogenization_crystallization.yaml +30 -0
  305. morphogen/templates/homogenization_debonding.yaml +43 -0
  306. morphogen/templates/homogenization_detwinning.yaml +58 -0
  307. morphogen/templates/homogenization_ductile_damage.yaml +47 -0
  308. morphogen/templates/homogenization_fatigue.yaml +40 -0
  309. morphogen/templates/homogenization_grain_fracture.yaml +56 -0
  310. morphogen/templates/homogenization_gyroid.yaml +30 -0
  311. morphogen/templates/homogenization_intergranular.yaml +43 -0
  312. morphogen/templates/homogenization_interphase.yaml +42 -0
  313. morphogen/templates/homogenization_mixed_loading.yaml +33 -0
  314. morphogen/templates/homogenization_ntfa.yaml +56 -0
  315. morphogen/templates/homogenization_piezoelectric.yaml +27 -0
  316. morphogen/templates/homogenization_polycrystal.yaml +30 -0
  317. morphogen/templates/homogenization_polycrystal_inclusions.yaml +30 -0
  318. morphogen/templates/homogenization_poroelastic.yaml +26 -0
  319. morphogen/templates/homogenization_rubber.yaml +40 -0
  320. morphogen/templates/homogenization_slip_cleavage.yaml +50 -0
  321. morphogen/templates/homogenization_spheres.yaml +31 -0
  322. morphogen/templates/homogenization_transport.yaml +29 -0
  323. morphogen/templates/homogenization_twinning.yaml +54 -0
  324. morphogen/templates/homogenization_viscoelastic.yaml +34 -0
  325. morphogen/templates/homogenization_viscoplastic.yaml +42 -0
  326. morphogen/templates/homogenization_voronoi.yaml +26 -0
  327. morphogen/templates/homogenization_xfem.yaml +23 -0
  328. morphogen/templates/hyperuniform_cells.yaml +24 -0
  329. morphogen/templates/laguerre.yaml +18 -0
  330. morphogen/templates/laser_bending.yaml +35 -0
  331. morphogen/templates/laser_cells.yaml +38 -0
  332. morphogen/templates/laser_corrugated.yaml +36 -0
  333. morphogen/templates/level_set_foam.yaml +29 -0
  334. morphogen/templates/menger_sponge.yaml +17 -0
  335. morphogen/templates/nacre.yaml +25 -0
  336. morphogen/templates/nucleation_growth.yaml +25 -0
  337. morphogen/templates/optimize_auxetic.yaml +29 -0
  338. morphogen/templates/optimize_auxetic_3d.yaml +27 -0
  339. morphogen/templates/optimize_bulk.yaml +23 -0
  340. morphogen/templates/optimize_conductivity.yaml +20 -0
  341. morphogen/templates/osteons.yaml +28 -0
  342. morphogen/templates/penetrable_spheres.yaml +21 -0
  343. morphogen/templates/poisson_fibers.yaml +21 -0
  344. morphogen/templates/random_laminate.yaml +26 -0
  345. morphogen/templates/random_lattice.yaml +27 -0
  346. morphogen/templates/random_walk_fibers.yaml +26 -0
  347. morphogen/templates/reaction_diffusion.yaml +22 -0
  348. morphogen/templates/reconstruction.yaml +22 -0
  349. morphogen/templates/rve_cellular_automaton.yaml +23 -0
  350. morphogen/templates/rve_crystal_plasticity_fft.yaml +51 -0
  351. morphogen/templates/rve_multiphysics.yaml +43 -0
  352. morphogen/templates/rve_poisson_fibers.yaml +22 -0
  353. morphogen/templates/rve_poisson_fibers_fe.yaml +33 -0
  354. morphogen/templates/rve_voronoi_windows.yaml +20 -0
  355. morphogen/templates/scale_rich_network.yaml +29 -0
  356. morphogen/templates/scale_rich_plates.yaml +30 -0
  357. morphogen/templates/sequential_dead_leaves.yaml +25 -0
  358. morphogen/templates/strut_lattice.yaml +21 -0
  359. morphogen/templates/tile_assembly.yaml +28 -0
  360. morphogen/templates/tpms.yaml +19 -0
  361. morphogen/templates/trabecular_bone.yaml +29 -0
  362. morphogen/templates/transparent_dead_leaves.yaml +23 -0
  363. morphogen/templates/vascular_tree.yaml +23 -0
  364. morphogen/templates/voronoi.yaml +20 -0
  365. morphogen/templates/wood.yaml +34 -0
  366. morphogen/templates/workflow.yaml +56 -0
  367. morphogen/texture.py +665 -0
  368. morphogen/theory.py +162 -0
  369. morphogen/viz/__init__.py +12 -0
  370. morphogen/viz/export.py +244 -0
  371. morphogen/viz/figures.py +707 -0
  372. morphogen/viz/png.py +148 -0
  373. morphogen/viz/sections.py +696 -0
  374. morphogen/viz/surfaces.py +1352 -0
  375. morphogen/viz/video.py +904 -0
  376. morphogen/viz/workflow.py +488 -0
  377. morphogen-1.0.0.dist-info/METADATA +2316 -0
  378. morphogen-1.0.0.dist-info/RECORD +381 -0
  379. morphogen-1.0.0.dist-info/WHEEL +4 -0
  380. morphogen-1.0.0.dist-info/entry_points.txt +5 -0
  381. morphogen-1.0.0.dist-info/licenses/LICENSE +674 -0
@@ -0,0 +1,457 @@
1
+ """The trilinear voxel elements of the FFT solvers assembled on the voxels of the materials,
2
+ and solved by conjugate gradients preconditioned by a sparse factorization.
3
+
4
+ The FFT solvers (:mod:`morphogen.homogenization.fft`) discretize the periodic cell by
5
+ trilinear hexahedra on the voxels and solve the equilibrium ``K w = f`` of the fluctuation
6
+ without assembling ``K``, by conjugate gradients preconditioned by the inverse of the
7
+ stiffness ``K0`` of a homogeneous reference medium (Schneider, Merkert & Kabel 2017). On a
8
+ sparse phase surrounded by void near its rigidity threshold the preconditioner is a poor
9
+ one: the energy of ``K0`` spreads a displacement of the phase over the void around it,
10
+ while the clusters of voxels pinned together at their corners and edges turn about them at
11
+ an energy that vanishes with their rigidity, so that the iterations grow as about ``45 L``
12
+ on planar images of ``L`` pixels (2,885 on 64²) and do not converge within ``50 L + 1000``
13
+ in 3-D (12³ to 16³ voxels of sites of the cubic lattice stop at relative residuals of
14
+ ``1e-6`` to ``2e-4``, with moduli off by 5 to 16 %).
15
+
16
+ These problems solve the same discrete equations (the element matrices, loads, averages
17
+ and fields of the FFT problems, which they extend) with the matrix assembled: the element
18
+ matrices of the voxels that carry a material are summed into the sparse matrix of the
19
+ degrees of freedom of their nodes (the void voxels, and the nodes that only they touch, are
20
+ left out: their rows of ``K`` vanish), and ``K w = f`` is solved by conjugate gradients
21
+ preconditioned by the sparse LU factorization (SuperLU, minimum-degree ordering of ``A^T +
22
+ A``, the pivots on the diagonal) of ``K + delta I``, ``delta`` being ``shift`` (``1e-12``)
23
+ times the mean of the diagonal. ``K`` itself is singular: the clusters that do not wrap
24
+ around the periodic box float, and the floppy clusters, hinged at their corners and edges,
25
+ have mechanisms (zero energy, zero strain at every Gauss point; at least 400 on a box of
26
+ 24³ voxels of sites of the cubic lattice at its rigidity threshold), but the loads are
27
+ orthogonal to them and the shifted factorization, which keeps the modes of ``K`` and maps
28
+ its range onto itself, only preconditions: the iterates stay in the range of ``K``, the
29
+ moduli are those of ``K`` to the tolerance of the iterations, and the round-off that the
30
+ factorization leaves in the mechanisms strains no voxel. The modes softer than ``delta``
31
+ take a few more iterations, the iterations restart from the true residual every
32
+ :data:`CYCLE` (the recursion accumulates the round-off of the mechanisms, which the
33
+ preconditioner amplifies by ``1 / delta``), and one to three iterations suffice on the
34
+ planar images and the boxes of up to 48³ voxels of the sites at their rigidity threshold.
35
+ A larger shift is not safer: with ``1e-10`` one image of 24³ voxels in 558 stalled at a
36
+ relative residual of ``5e-7`` after 2,200 iterations (its modulus off by 0.1 %), with
37
+ ``1e-8`` at ``2e-5``, where ``1e-12`` takes 3 iterations to ``1e-8`` and 10 to ``1e-10``.
38
+ The factorization is made once per problem, at the first solution (its time is the
39
+ ``setup_s`` of the solutions), and serves all the loadings. The floppy images whose
40
+ mechanisms take large displacements for a unit strain (``1e3`` to ``7e5`` on planar boxes
41
+ of 96² to 256² pixels at their rigidity threshold) are not resolved by their stress
42
+ averages: the round-off of the element matrices, the same in every voxel, acts on these
43
+ displacements, and the stress average, linear in the error of the solution, strays to
44
+ ``-1e-10``, ``-1e-7`` and ``-6e-7`` where it should vanish, at any tolerance
45
+ (``-1.30e-7`` at ``1e-10`` as at ``5e-12``, the floor of the residual, on 128² pixels);
46
+ the energy, the mean of ``sigma : epsilon`` from the strains of the voxels, stationary, is
47
+ an upper bound of the modulus whose error is of second order (``3.6e-9`` there, ``1e-20``
48
+ to ``1e-11`` for most; :func:`morphogen.analysis.percolation.rigidity_threshold` decides
49
+ by it), and perturbing the element matrices at their round-off scatters it by 17 to 50 %
50
+ for the floppy images, by 1.4e-3 at most for those that bear, whose stress averages agree
51
+ with their energies within 30 % (``3e-4`` from ``1e-7`` up). :func:`load_bearing` keeps
52
+ the voxels that bear alone, exactly: at their rigidity thresholds 79 to 82 % of the sites
53
+ of the cubic lattice on 24³ to 64³ voxels (75 to 79 % of the degrees of freedom), 70 to
54
+ 94 % of those of the square lattice on 32² and 48² pixels.
55
+
56
+ Its cost is that of the fill-in, which the FFT solvers do not have, and the fill grows
57
+ steeply with the fraction of the voxels. On one process (the laptop on mains, otherwise
58
+ idle), at the rigidity threshold of the sites of the cubic lattice (0.1307), the
59
+ factorization takes 0.38 s on 32³ voxels (2.9 million entries in the factors, 0.03 GiB),
60
+ 0.79 s on 40³, 1.5 s on 48³ (0.12 GiB), 2.6 s on 56³ and 4.1 s on 64³ (25 million, 0.28
61
+ GiB), the assembly 0.14 to 1.2 s and a solution with the factors 0.02 to 0.15 s; the
62
+ voxels that bear alone take 0.30 s on 32³ and 3.5 s on 64³ (0.24 GiB), and finding them
63
+ (:func:`load_bearing`) 0.1 s on 64³ and 0.7 s on 96³ (it took 0.5 s on 48³ and 2.5 s on
64
+ 64³ while the union of its parts, a plain forest, grew chains as long as the parts).
65
+ SuperLU commits its first guess of the fill, 20 times the entries of the matrix in four
66
+ arrays (37 bytes per entry: 9.1 GiB on 64³ voxels at the threshold, 31 GiB on 96³), of
67
+ which the factors fill 1.5 to 1.8 times the entries in 3-D and 2.1 to 2.4 in 2-D; Windows
68
+ charges the untouched pages against the commit of the machine (its memory and page file),
69
+ and a factorization that fails for want of memory does not free its arrays (SciPy 1.18):
70
+ processes running side by side on large boxes want the commit of each factorization
71
+ limited, between the guesses of 2.5 and 5 times the entries, which SuperLU meets by halving
72
+ its guess (the same factors; 2.4 GiB on 64³). Above the
73
+ threshold the factors fill in: on 48³ voxels 2.8 s at a fraction of 0.15, 12.8 s at 0.17
74
+ and 122 s (1.28 GiB) at 0.2096, the upper bound of the bisections of the first
75
+ measurements, whose 7 s on 40³ voxels and 30 s on 48³ per solution were those of these
76
+ images (the bisection of the rigidity threshold now tries its bounds last). The ordering
77
+ is that of minimum degree on ``A^T + A``, the matrix symmetric (``SymmetricMode``,
78
+ diagonal pivots): on 24³ voxels at the threshold it fills 1.2 million entries in 0.45 s,
79
+ where the column ordering COLAMD fills 3.8 million in 1.2 s, minimum degree on ``A^T A``
80
+ 1.8 million in 1.0 s and a nested dissection by planes of nodes (two per periodic axis,
81
+ then the natural order) 13.7 million in 12.8 s, the planes cutting through a sparse random
82
+ structure that minimum degree follows; SuperLU's relaxed supernodes and panels (``relax``
83
+ 3, ``panel_size`` 16) change nothing. The factors of one image do not precondition the
84
+ next of a bisection, a few voxels apart (48³ voxels near the threshold, 345 to 727 voxels
85
+ added or removed: 500 to 2,500 iterations without converging, 34 to 123 s, against 0.7 to
86
+ 3.7 s for new factors and one iteration): the voxels added or removed change the
87
+ mechanisms, which the shifted factors amplify by the inverse of the shift. Boolean discs
88
+ of 4 pixels of radius at 0.61 take 4.8 s on 256² pixels and 22 s on 512² (0.47 GiB),
89
+ spheres of 3 voxels of radius at 0.21 7.9 s on 48³ voxels (0.32 GiB; the machine
90
+ loaded). In 2-D, at the rigidity threshold of the sites of the square lattice, the
91
+ factorization and its solutions take 0.08 to 0.15 s on 64² pixels (against 2.8 to 7.8 s
92
+ for 1,310 to 2,665 iterations of the FFT solver, CPU and GPU), 0.6 s on 128² (16 to 58 s
93
+ for 7,000 to 7,400 iterations, most at the bound with a residual of ``3e-5``) and 4 s on
94
+ 256², on the CPU, which the problems use. On a dense phase the FFT solvers converge in a
95
+ few dozen iterations where the factors fill in (sites at 0.5: 0.14 s against 12.8 s on
96
+ 16³ voxels, 0.8 s, 0.27 s on the GPU, against more than 8 min and 3.6 GB on 32³), and the
97
+ voxels of the other phases at a contrast instead of void are all assembled (more than 6
98
+ min on 24³ voxels): these problems are for sparse phases surrounded by void, near their
99
+ rigidity threshold.
100
+ """
101
+
102
+ from __future__ import annotations
103
+
104
+ import logging
105
+ import time
106
+
107
+ import numpy as np
108
+ import scipy.sparse as sp
109
+ import scipy.sparse.linalg as spla
110
+ from numba import njit
111
+
112
+ from morphogen.homogenization import kernels
113
+ from morphogen.homogenization.fft import FFTElasticProblem, FFTThermalProblem
114
+ from morphogen.homogenization.solvers import NEGLIGIBLE, SolveInfo, conjugate_gradient, norm
115
+
116
+ log = logging.getLogger("morphogen")
117
+
118
+ #: The shift of the diagonal of the matrix factorized for the preconditioner, over the mean
119
+ #: of its diagonal
120
+ SHIFT = 1e-12
121
+ #: The iterations of a cycle of the conjugate gradients, which then restart from the residual
122
+ #: of their iterate
123
+ CYCLE = 100
124
+
125
+
126
+ def _folded(shape, matrices: np.ndarray, nd: int) -> tuple[np.ndarray, np.ndarray]:
127
+ """The corners of the voxel element that stay distinct on the periodic grid ``shape``
128
+ (its two nodes along an axis one voxel thick are one) and the element matrices folded
129
+ onto them: ``F^T K F``, ``F`` copying the values of the corners kept to the others."""
130
+ corners = kernels.CORNERS.copy()
131
+ corners[:, np.asarray(shape) == 1] = 0
132
+ rep = kernels.CORNER_INDEX[corners[:, 0], corners[:, 1], corners[:, 2]]
133
+ kept = np.unique(rep)
134
+ fold = np.zeros((8 * nd, kept.size * nd))
135
+ for q, k in enumerate(np.searchsorted(kept, rep).tolist()):
136
+ fold[q * nd : (q + 1) * nd, k * nd : (k + 1) * nd] = np.eye(nd)
137
+ return kept, np.einsum("ai,mab,bj->mij", fold, matrices, fold, optimize=True)
138
+
139
+
140
+ def voxel_stiffness(shape, mat, matrices, nd: int) -> tuple[sp.csr_matrix, np.ndarray]:
141
+ """The matrix of the voxel elements of the periodic grid ``shape`` whose material
142
+ ``mat`` (one per voxel, C order) is not void (-1), ``matrices[m]`` being the element
143
+ matrix (8 nd x 8 nd, the corners in the order of
144
+ :data:`morphogen.homogenization.kernels.CORNERS`) of material ``m``, summed on the
145
+ degrees of freedom of their nodes alone; with these degrees of freedom, ``node * nd +
146
+ component`` on the grid (increasing): the rows and columns of the matrix."""
147
+ nx, ny, nz = (int(s) for s in shape)
148
+ mat = np.asarray(mat).ravel()
149
+ elements = np.flatnonzero(mat >= 0)
150
+ kept, folded = _folded((nx, ny, nz), np.asarray(matrices, dtype=float), nd)
151
+ i, j, k = np.unravel_index(elements, (nx, ny, nz))
152
+ c = kernels.CORNERS[kept]
153
+ nodes = ((i[:, None] + c[:, 0]) % nx * ny + (j[:, None] + c[:, 1]) % ny) * nz + (
154
+ k[:, None] + c[:, 2]
155
+ ) % nz
156
+ used, local = np.unique(nodes, return_inverse=True)
157
+ m = kept.size * nd
158
+ dofs = (local.reshape(nodes.shape)[:, :, None] * nd + np.arange(nd)).reshape(-1, m)
159
+ rows = np.broadcast_to(dofs[:, :, None], (elements.size, m, m)).ravel()
160
+ cols = np.broadcast_to(dofs[:, None, :], (elements.size, m, m)).ravel()
161
+ n = used.size * nd
162
+ matrix = sp.coo_matrix((folded[mat[elements]].ravel(), (rows, cols)), shape=(n, n)).tocsr()
163
+ matrix.sum_duplicates()
164
+ return matrix, (used[:, None] * nd + np.arange(nd)).ravel()
165
+
166
+
167
+ @njit(cache=True)
168
+ def _edge_blocks(indptr, dst, eid, n_edges):
169
+ """The biconnected components of an undirected graph (Hopcroft & Tarjan 1973, by an
170
+ iterative depth-first search): the block of each edge, the edges numbered ``eid`` in the
171
+ adjacency lists ``dst[indptr[v]:indptr[v + 1]]`` of the vertices (each edge in the lists
172
+ of its two ends), and the number of blocks."""
173
+ n = indptr.size - 1
174
+ disc = np.full(n, -1, np.int64)
175
+ low = np.zeros(n, np.int64)
176
+ parent = np.full(n, -1, np.int64) # the edge of the search that reached the vertex
177
+ nxt = indptr[:-1].copy()
178
+ block = np.full(n_edges, -1, np.int64)
179
+ path = np.empty(n, np.int64)
180
+ edges = np.empty(n_edges, np.int64)
181
+ t = nb = top_e = 0
182
+ for root in range(n):
183
+ if disc[root] >= 0:
184
+ continue
185
+ disc[root] = low[root] = t
186
+ t += 1
187
+ top = 0
188
+ path[0] = root
189
+ while top >= 0:
190
+ v = path[top]
191
+ if nxt[v] < indptr[v + 1]:
192
+ k = nxt[v]
193
+ nxt[v] += 1
194
+ w, e = dst[k], eid[k]
195
+ if e == parent[v]:
196
+ continue
197
+ if disc[w] < 0:
198
+ edges[top_e] = e
199
+ top_e += 1
200
+ parent[w] = e
201
+ disc[w] = low[w] = t
202
+ t += 1
203
+ top += 1
204
+ path[top] = w
205
+ elif disc[w] < disc[v]: # a back edge, to an ancestor
206
+ edges[top_e] = e
207
+ top_e += 1
208
+ low[v] = min(low[v], disc[w])
209
+ else:
210
+ top -= 1
211
+ if top >= 0:
212
+ u = path[top]
213
+ low[u] = min(low[u], low[v])
214
+ if low[v] >= disc[u]: # u cuts the edges stacked since parent[v] off
215
+ while True:
216
+ top_e -= 1
217
+ block[edges[top_e]] = nb
218
+ if edges[top_e] == parent[v]:
219
+ break
220
+ nb += 1
221
+ return block, nb
222
+
223
+
224
+ @njit(cache=True, inline="always")
225
+ def _find(root, a):
226
+ """The root of ``a`` in the forest ``root``, halving the path to it."""
227
+ while root[a] != a:
228
+ root[a] = root[root[a]]
229
+ a = root[a]
230
+ return a
231
+
232
+
233
+ @njit(cache=True)
234
+ def _parts(block, nb, nc):
235
+ """The blocks of the incidences of the voxels to their ``nc`` nodes merged where they
236
+ share a voxel (union-find, by size with the paths halved, in near-linear time where the
237
+ plain forest grew chains as long as the parts: 2.5 s on the 34,000 voxels of the sites of
238
+ a box of 64³ at the rigidity threshold, against 0.02 s): the part of each voxel,
239
+ numbered from 0 in the order of their first voxels, and their number."""
240
+ root = np.arange(nb)
241
+ size = np.ones(nb, np.int64)
242
+ nv = block.size // nc
243
+ for v in range(nv):
244
+ a = _find(root, block[v * nc])
245
+ for q in range(1, nc):
246
+ b = _find(root, block[v * nc + q])
247
+ if b != a:
248
+ if size[a] < size[b]:
249
+ a, b = b, a
250
+ root[b] = a
251
+ size[a] += size[b]
252
+ label = np.full(nb, -1, np.int64)
253
+ part = np.empty(nv, np.int64)
254
+ count = 0
255
+ for v in range(nv):
256
+ a = _find(root, block[v * nc])
257
+ if label[a] < 0:
258
+ label[a] = count
259
+ count += 1
260
+ part[v] = label[a]
261
+ return part, count
262
+
263
+
264
+ @njit(cache=True)
265
+ def _windings(local, node_ptr, node_inc, corners, part, n_parts):
266
+ """Whether a cycle of each part winds around the periodic grid along each axis: the
267
+ voxels of a part reached through the nodes they share (a voxel at the lift ``P`` and a
268
+ corner ``c`` reach a voxel sharing that node at its corner ``d`` at ``P + c - d``), a
269
+ voxel reached at two lifts closing a cycle whose winding is their difference."""
270
+ nv, nc = local.shape
271
+ lift = np.zeros((nv, 3), np.int64)
272
+ seen = np.zeros(nv, np.bool_)
273
+ queue = np.empty(nv, np.int64)
274
+ winds = np.zeros((n_parts, 3), np.bool_)
275
+ for start in range(nv):
276
+ if seen[start]:
277
+ continue
278
+ seen[start] = True
279
+ queue[0] = start
280
+ head, tail = 0, 1
281
+ while head < tail:
282
+ v = queue[head]
283
+ head += 1
284
+ for q in range(nc):
285
+ n = local[v, q]
286
+ for k in range(node_ptr[n], node_ptr[n + 1]):
287
+ w, r = node_inc[k] // nc, node_inc[k] % nc
288
+ if part[w] != part[v]:
289
+ continue
290
+ if not seen[w]:
291
+ seen[w] = True
292
+ for a in range(3):
293
+ lift[w, a] = lift[v, a] + corners[q, a] - corners[r, a]
294
+ queue[tail] = w
295
+ tail += 1
296
+ else:
297
+ for a in range(3):
298
+ if lift[w, a] != lift[v, a] + corners[q, a] - corners[r, a]:
299
+ winds[part[v], a] = True
300
+ return winds
301
+
302
+
303
+ def load_bearing(mask, axis: int) -> np.ndarray:
304
+ """The voxels of ``mask`` (a periodic image, ``True`` where the material is, the others
305
+ void) that bear a uniaxial strain, or conduct a gradient, along the axis number
306
+ ``axis``: the others carry no load in the exact solution, and the moduli and
307
+ conductivities of the image along the axis are those of these voxels alone.
308
+
309
+ The trilinear voxels meet at the nodes they share. Cut at the nodes that join them
310
+ alone (the articulation points of the graph of the voxels and their nodes), the voxels
311
+ fall into parts, the biconnected components of that graph merged where they share a
312
+ voxel, which meet one another at single nodes and form a tree: any part can translate
313
+ (its temperature shift) as a whole to follow the node by which it hangs from the rest
314
+ of its branch, at no energy, so that the parts bear independently. A part through
315
+ which no cycle winds around the box along the axis takes the macroscopic strain
316
+ (gradient) as a rigid translation of its lift, single-valued, at zero energy: it
317
+ bears nothing, whether it dangles from a single corner, floats or lies between parts
318
+ that bear, and is left out; those through which a cycle winds along the axis are kept.
319
+ This is exact: the clusters hinged at two nodes (in 3-D an edge, a hinge), which may
320
+ bear as bars between them, are kept with the part they belong to. An axis one voxel
321
+ thick, whose two nodes the periodic grid folds into one, keeps every voxel."""
322
+ mask = np.asarray(mask, dtype=bool)
323
+ if mask.ndim == 2:
324
+ mask = mask[:, :, None]
325
+ shape = np.asarray(mask.shape)
326
+ if shape[axis] == 1 or not mask.any():
327
+ return mask.copy()
328
+ nx, ny, nz = (int(s) for s in shape)
329
+ corners = kernels.CORNERS.copy()
330
+ corners[:, shape == 1] = 0
331
+ kept = np.unique(kernels.CORNER_INDEX[corners[:, 0], corners[:, 1], corners[:, 2]])
332
+ c = corners[kept]
333
+ nc = kept.size
334
+ voxels = np.flatnonzero(mask.ravel())
335
+ i, j, k = np.unravel_index(voxels, mask.shape)
336
+ nodes = ((i[:, None] + c[:, 0]) % nx * ny + (j[:, None] + c[:, 1]) % ny) * nz + (
337
+ k[:, None] + c[:, 2]
338
+ ) % nz
339
+ _, local = np.unique(nodes, return_inverse=True)
340
+ local = local.reshape(nodes.shape).astype(np.int64)
341
+ nv, nn = voxels.size, int(local.max()) + 1
342
+ owner = np.repeat(np.arange(nv, dtype=np.int64), nc)
343
+ src = np.concatenate([owner, nv + local.ravel()])
344
+ dst = np.concatenate([nv + local.ravel(), owner])
345
+ eid = np.tile(np.arange(nv * nc, dtype=np.int64), 2)
346
+ order = np.argsort(src, kind="stable")
347
+ indptr = np.concatenate([[0], np.cumsum(np.bincount(src, minlength=nv + nn))])
348
+ block, nb = _edge_blocks(indptr.astype(np.int64), dst[order], eid[order], nv * nc)
349
+ part, n_parts = _parts(block, nb, nc)
350
+ by_node = np.argsort(local.ravel(), kind="stable").astype(np.int64)
351
+ node_ptr = np.concatenate([[0], np.cumsum(np.bincount(local.ravel(), minlength=nn))])
352
+ winds = _windings(local, node_ptr.astype(np.int64), by_node, c.astype(np.int64), part,
353
+ n_parts) # fmt: skip
354
+ out = np.zeros(mask.size, dtype=bool)
355
+ out[voxels[winds[part, axis]]] = True
356
+ return out.reshape(mask.shape)
357
+
358
+
359
+ def _restarted(apply, precondition, rhs, tol: float, maxiter: int, cycle: int = CYCLE):
360
+ """Conjugate gradients in cycles of at most ``cycle`` iterations, each from the residual
361
+ ``rhs - apply(x)`` of the iterate of the last, until it falls below ``tol`` times the
362
+ norm of ``rhs``, after ``maxiter`` iterations in all, or after a cycle that leaves it no
363
+ smaller (the iterate before it kept): (x, iterations, relative residual). A long run of
364
+ the recursion accumulates the round-off of the preconditioner of a singular matrix
365
+ shifted, which amplifies its null space by the inverse of the shift; the cycles start
366
+ again from the true residual."""
367
+ norm_b = norm(rhs)
368
+ x, r, res, total = np.zeros_like(rhs), rhs, 1.0, 0
369
+ while total < maxiter and res > tol:
370
+ dx, it, _ = conjugate_gradient(apply, precondition, r, tol / res,
371
+ min(cycle, maxiter - total)) # fmt: skip
372
+ total += it
373
+ trial = x + dx
374
+ r_trial = rhs - apply(trial)
375
+ res_trial = norm(r_trial) / norm_b
376
+ if it == 0 or res_trial >= res:
377
+ break
378
+ x, r, res = trial, r_trial, res_trial
379
+ return x, total, res
380
+
381
+
382
+ def _factorize(shifted: sp.csr_matrix):
383
+ """The sparse LU factors of a shifted matrix (positive definite): minimum-degree ordering
384
+ of ``A^T + A``, the pivots on the diagonal (those of its Cholesky factorization, stable
385
+ without pivoting), or partial pivoting if one vanishes."""
386
+ matrix = shifted.tocsc()
387
+ try:
388
+ return spla.splu(matrix, permc_spec="MMD_AT_PLUS_A", diag_pivot_thresh=0.0,
389
+ options={"SymmetricMode": True}) # fmt: skip
390
+ except RuntimeError: # pragma: no cover - a pivot cancelled to zero
391
+ return spla.splu(matrix, permc_spec="MMD_AT_PLUS_A", options={"SymmetricMode": True})
392
+
393
+
394
+ class _AssembledProblem:
395
+ """The linear solutions of an FFT problem by its assembled matrix (see the module)."""
396
+
397
+ def __init__(
398
+ self,
399
+ image,
400
+ materials,
401
+ bc: str = "periodic",
402
+ *,
403
+ tol: float = 1e-8,
404
+ maxiter: int | None = None,
405
+ grains=None,
406
+ orientations=None,
407
+ shift: float = SHIFT,
408
+ ):
409
+ if not (np.isfinite(shift) and 0.0 < shift < 1.0):
410
+ raise ValueError(f"shift: expected 0 < shift < 1, got {shift!r}")
411
+ super().__init__(image, materials, bc, tol=tol, maxiter=maxiter, grains=grains,
412
+ orientations=orientations, device="cpu") # fmt: skip
413
+ self.shift = float(shift)
414
+ self._factors = None
415
+
416
+ def _factorized(self):
417
+ """The matrix, its degrees of freedom, the factors of the shifted matrix and the time
418
+ taken (made at the first solution)."""
419
+ if self._factors is None:
420
+ t0 = time.perf_counter()
421
+ matrix, dofs = voxel_stiffness(self.shape, self.mat, self.element_matrices, self.nd)
422
+ diagonal = matrix.diagonal()
423
+ shifted = matrix + sp.diags(np.full(dofs.size, self.shift * float(diagonal.mean())))
424
+ factors = _factorize(shifted)
425
+ self._factors = (matrix, dofs, factors, time.perf_counter() - t0)
426
+ return self._factors
427
+
428
+ def _solve(self, rhs, scale: float):
429
+ if norm(rhs) <= NEGLIGIBLE * scale:
430
+ return np.zeros_like(rhs), SolveInfo("fe-voxels", 0, 0, 0.0, 0.0, 0.0)
431
+ matrix, dofs, factors, setup = self._factorized()
432
+ t0 = time.perf_counter()
433
+ maxiter = self.maxiter or 20 * int(max(self.shape)) + 1000
434
+ x, it, res = _restarted(matrix.dot, factors.solve, np.ascontiguousarray(rhs[dofs]),
435
+ self.tol, maxiter) # fmt: skip
436
+ if res > self.tol:
437
+ log.warning("voxel FE solver stopped at relative residual %.2e after %d iterations",
438
+ res, it) # fmt: skip
439
+ out = np.zeros_like(rhs)
440
+ out[dofs] = x
441
+ return out, SolveInfo("fe-voxels", dofs.size, it, res, setup, time.perf_counter() - t0)
442
+
443
+
444
+ class VoxelFEElasticProblem(_AssembledProblem, FFTElasticProblem):
445
+ """Periodic linear elasticity of a voxel image, the discrete problem of
446
+ :class:`~morphogen.homogenization.fft.FFTElasticProblem` (trilinear voxels), assembled on
447
+ the voxels of the materials and solved by conjugate gradients preconditioned by the
448
+ sparse factorization of its matrix shifted by ``shift`` times its mean diagonal, on the
449
+ CPU (see :mod:`morphogen.homogenization.voxel_fe`): the same solutions, to the tolerance
450
+ ``tol``, in a few iterations where the FFT solver needs thousands (sparse phases near
451
+ their rigidity threshold, the other phases void)."""
452
+
453
+
454
+ class VoxelFEThermalProblem(_AssembledProblem, FFTThermalProblem):
455
+ """Periodic steady heat conduction of a voxel image, the discrete problem of
456
+ :class:`~morphogen.homogenization.fft.FFTThermalProblem`, assembled on the voxels of the
457
+ materials and solved as :class:`VoxelFEElasticProblem`."""