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,113 @@
1
+ """Contact, self-contact and friction of the surfaces of a mesh, between themselves and
2
+ with rigid obstacles, in small and finite strains.
3
+
4
+ *Surfaces.* A :class:`Surface` is a set of faces of a tetrahedral mesh (three nodes, or
5
+ six on 10-node elements, which may be curved), their normals out of the body: the free
6
+ faces of the mesh (:meth:`Surface.of`), all or some. A :class:`Pair` is a slave surface
7
+ and a master surface that may touch, or one surface that may touch itself (the walls of
8
+ pores, the struts of a lattice); an :class:`Obstacle` a rigid plane, sphere, cylinder or
9
+ cone that moves with the load factor. Bodies meshed apart are brought into one mesh by
10
+ :func:`assemble`.
11
+
12
+ *Discretization.* The contact is enforced at the integration points of the faces of the
13
+ slave surface (three per face of three nodes, six per face of six), each with its share of
14
+ the reference area: its position ``x_s``, the nearest point ``x_m`` of the master surface
15
+ (the nearest point of a face among the master faces nearest by their centroids: Ericson's
16
+ regions on a triangle, Newton's method on a curved face of six nodes and on its edges),
17
+ the outward normal ``n`` of the master there and the gap ``g = (x_s - x_m) · n``. A point
18
+ presses when ``p = <λ - ε g>`` is positive (``ε`` the penalty, ``λ`` the multiplier of the
19
+ augmented Lagrangian, zero for the penalty alone); the force ``w (p n - t)`` goes to the
20
+ nodes of its face by their functions, and its opposite to those of the master face by
21
+ theirs at ``x_m``. Only master faces that face the slave point (opposite normals) and
22
+ that it has not passed by more than a given depth are looked at: a point further behind
23
+ a face is across a wall, not through it; a surface against itself also leaves out the
24
+ faces that share a node with that of the point. The tangent of the forces of a point is
25
+ taken by central differences on the nodes of its two faces.
26
+
27
+ *Corners and edges.* The points inside the faces leave the corners and the edges of a
28
+ body without a point: a corner that lands on a face enters it until the points next to it
29
+ press. With ``points="nodes"`` (of a :class:`Pair`, an :class:`Obstacle`, a
30
+ :class:`ContactCell`, :func:`compression`) the slave points are at the nodes of the faces
31
+ instead (their vertices; the middles of their edges and their centroids as well on faces
32
+ of six nodes). The weight of such a point is the share of its face that the other surface
33
+ sees (the cosine of the angle of their normals): the sides of a block that stands on a
34
+ plane, which share the nodes of the edges of its base, carry nothing.
35
+
36
+ *Friction* (Coulomb; Laursen & Simo 1993 for the frame-indifferent slip). The slip of a
37
+ point over a step is the move of ``x_m`` from the place, now, of the point of the master
38
+ that faced it at the end of the last step (the same material point of the master: no
39
+ slip under a rigid motion of the two bodies), in the tangent plane. The traction of the
40
+ last step, turned into that plane with its norm, plus the stick ``ε_t`` times the slip,
41
+ is returned radially to Coulomb's cone ``|t| <= μ p``; what is cut off is the slip that
42
+ dissipates. A point rubs from the step after that in which it came into contact.
43
+
44
+ *Solution.* :class:`ContactProblem` is the quasi-static solver of the cohesive zones
45
+ (:class:`~morphogen.fracture.cohesive.CohesiveProblem`: prescribed displacements, dead
46
+ loads, loadings in stages, an elastic or neo-Hookean bulk or the behaviours of
47
+ morphoGen's points, cohesive interfaces as well) with these forces. The faces that each
48
+ slave point sees are searched again at each evaluation. The first tangent of a step is
49
+ that of a predictor in which the points that touched at its start stay closed and stick.
50
+ With ``augmentations``, the multipliers are updated (Uzawa: ``λ <- <λ - ε g>``) and the
51
+ step solved again until no point penetrates deeper than a tolerance.
52
+
53
+ *Periodic cells.* :class:`ContactCell` is the periodic element of the nonlinear
54
+ homogenization with the contact of the walls of its pores, between themselves and with
55
+ their images across the faces of the cell (:mod:`morphogen.contact.periodic`): loading
56
+ paths in strains and stresses, the behaviours of morphoGen's points, the macroscopic
57
+ stress with the part that the contacts carry through the faces.
58
+
59
+ *Ready-made tests* (:mod:`morphogen.contact.experiments`). :func:`compression`: a sample
60
+ between two rigid platens, on which it rubs, its walls free to close on themselves (the
61
+ nominal stress against the nominal strain, the areas in contact); :func:`indentation`:
62
+ a sphere or a cone pressed into its upper face, and out again (the force against the
63
+ depth, the area of the contact, and the reduced modulus that the force reads by Hertz's
64
+ or Sneddon's law, or by the slope of the unloading).
65
+
66
+ The results (:class:`ContactResult`): at each step, the area in contact, the largest
67
+ pressure and the force of each contact, the works (those of the bulk and of the contact
68
+ add up to that of the grips), the energy that friction dissipated and the work of the
69
+ obstacles; at the end the pressure, traction and gap of each slave point. The closed
70
+ forms of :mod:`morphogen.contact.hertz` (Hertz, Sneddon, Cattaneo-Mindlin) are those of
71
+ the checks.
72
+ """
73
+
74
+ from morphogen.contact.experiments import (
75
+ CompressionResult,
76
+ IndentationResult,
77
+ compression,
78
+ indentation,
79
+ )
80
+ from morphogen.contact.hertz import (
81
+ effective_modulus,
82
+ flat_punch,
83
+ hertz_cylinder,
84
+ hertz_sphere,
85
+ layer_correction,
86
+ mindlin_stick_radius,
87
+ sneddon_cone,
88
+ )
89
+ from morphogen.contact.periodic import ContactCell, walls
90
+ from morphogen.contact.problem import ContactProblem, ContactResult
91
+ from morphogen.contact.surfaces import Obstacle, Pair, Surface, assemble
92
+
93
+ __all__ = [
94
+ "CompressionResult",
95
+ "ContactCell",
96
+ "ContactProblem",
97
+ "ContactResult",
98
+ "IndentationResult",
99
+ "Obstacle",
100
+ "Pair",
101
+ "Surface",
102
+ "assemble",
103
+ "compression",
104
+ "effective_modulus",
105
+ "flat_punch",
106
+ "hertz_cylinder",
107
+ "hertz_sphere",
108
+ "indentation",
109
+ "layer_correction",
110
+ "mindlin_stick_radius",
111
+ "sneddon_cone",
112
+ "walls",
113
+ ]
@@ -0,0 +1,368 @@
1
+ """Ready-made tests of a sample between rigid tools (see :mod:`morphogen.contact`): its
2
+ compression between two platens, on which it rubs and under which its own walls may close
3
+ on themselves (a foam, a lattice, a porous solid that densifies), and its indentation by a
4
+ sphere or a cone.
5
+
6
+ Both build a :class:`~morphogen.contact.problem.ContactProblem` of the mesh of the sample
7
+ with rigid obstacles, follow it in steps and give the curves that the tests measure: the
8
+ nominal stress against the nominal strain of a compression, the force against the depth
9
+ of an indentation with the modulus that it reads (Hertz, Sneddon; the slope of the
10
+ unloading: Oliver and Pharr 1992).
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import math
16
+ from dataclasses import dataclass, field
17
+
18
+ import numpy as np
19
+
20
+ from morphogen.contact.hertz import hertz_sphere, layer_correction, sneddon_cone
21
+ from morphogen.contact.problem import ContactProblem, ContactResult
22
+ from morphogen.contact.surfaces import Obstacle, Pair, Surface
23
+ from morphogen.mesh.tetra import TetMesh
24
+
25
+ #: The indenters of :func:`indentation`
26
+ INDENTERS = ("sphere", "cone")
27
+
28
+
29
+ def _plane_axes(axis: int) -> tuple[int, int]:
30
+ if axis not in (0, 1, 2):
31
+ raise ValueError("axis: 0, 1 or 2")
32
+ return tuple(a for a in range(3) if a != axis)
33
+
34
+
35
+ def _pins(mesh: TetMesh, axis: int) -> list[tuple]:
36
+ """Prescribed displacements that hold a sample against the three rigid motions that
37
+ its platens leave it (two translations along them and the rotation about their
38
+ normal), on two nodes of its base: the one nearest the middle of the base (both
39
+ components along the platens) and the one furthest from it along the first of their
40
+ axes (the component along the second)."""
41
+ b, c = _plane_axes(axis)
42
+ x = mesh.nodes
43
+ height = float(mesh.size[axis])
44
+ base = np.flatnonzero(x[:, axis] <= x[:, axis].min() + 0.02 * height)
45
+ middle = x[base][:, [b, c]].mean(axis=0)
46
+ first = base[np.argmin(np.linalg.norm(x[base][:, [b, c]] - middle, axis=1))]
47
+ second = base[np.argmax(np.abs(x[base, b] - x[first, b]))]
48
+ if second == first or abs(x[second, b] - x[first, b]) < 1e-9 * height:
49
+ raise ValueError("the base of the sample is a point: nothing to hold it by")
50
+ return [(np.array([first]), [b, c], 0.0), (np.array([second]), c, 0.0)]
51
+
52
+
53
+ @dataclass
54
+ class CompressionResult:
55
+ """The compression of a sample between two platens. At each step: the nominal
56
+ ``strain`` (the approach of the platens over the height of the sample: negative), the
57
+ ``force`` that the sample exerts on the moving platen (positive), the nominal
58
+ ``stress`` (minus this force over the section of the box of the sample: negative), the
59
+ ``area`` in contact with the platens (steps x 2: the fixed one, the moving one;
60
+ reference area), the area of the walls of the sample in contact with themselves
61
+ (``self_area``, of one of the two sides) and the energy that friction dissipated
62
+ (``friction``). ``section`` and ``height``: those of the box of the sample.
63
+ ``result``: the steps of the problem (:class:`~morphogen.contact.problem.
64
+ ContactResult`: reactions, works, the slave points at the end); ``problem``: the
65
+ problem (:meth:`~morphogen.contact.problem.ContactProblem.write` for its fields)."""
66
+
67
+ strain: np.ndarray
68
+ stress: np.ndarray
69
+ force: np.ndarray
70
+ area: np.ndarray
71
+ self_area: np.ndarray
72
+ friction: np.ndarray
73
+ section: float
74
+ height: float
75
+ result: ContactResult = field(repr=False)
76
+ problem: ContactProblem = field(repr=False)
77
+
78
+ @property
79
+ def modulus(self) -> float:
80
+ """The apparent modulus of the first step: its stress over its strain."""
81
+ return float(self.stress[1] / self.strain[1])
82
+
83
+ def tangent(self) -> np.ndarray:
84
+ """The tangent modulus of each step: the change of the stress over that of the
85
+ strain (one value per step; stiffening as the walls close)."""
86
+ return np.diff(self.stress) / np.diff(self.strain)
87
+
88
+ def rows(self) -> list[dict]:
89
+ """One row per step: strain, stress, force, the areas in contact (with the fixed
90
+ platen, with the moving one, of the sample with itself) and the energy dissipated
91
+ by friction."""
92
+ return [
93
+ {
94
+ "strain": float(self.strain[k]),
95
+ "stress": float(self.stress[k]),
96
+ "force": float(self.force[k]),
97
+ "area_fixed": float(self.area[k, 0]),
98
+ "area_moving": float(self.area[k, 1]),
99
+ "self_area": float(self.self_area[k]),
100
+ "friction": float(self.friction[k]),
101
+ }
102
+ for k in range(len(self.strain))
103
+ ]
104
+
105
+
106
+ def compression(
107
+ mesh: TetMesh,
108
+ materials,
109
+ strain: float,
110
+ *,
111
+ axis: int = 2,
112
+ friction: float = 0.0,
113
+ self_contact: bool = True,
114
+ self_friction: float | None = None,
115
+ steps: int = 20,
116
+ kinematics: str = "finite",
117
+ fields: bool = False,
118
+ stiffness: float | None = None,
119
+ points: str = "gauss",
120
+ **options,
121
+ ) -> CompressionResult:
122
+ """Compress a sample between two rigid platens across ``axis``: the platens are the
123
+ planes of the two faces of the box of the ``mesh`` (that of the solid of a porous
124
+ sample: ``conforming_mesh(..., phases="solid")``), the lower one fixed, the upper one
125
+ brought down by ``-strain`` times the height of the box (``strain``: the nominal
126
+ strain, negative) in ``steps`` steps.
127
+
128
+ The free surface of the sample presses on the platens with Coulomb's ``friction``
129
+ (0: lubricated platens, the sample widens freely; with friction it barrels) and, with
130
+ ``self_contact``, on itself with ``self_friction`` (by default that of the platens):
131
+ the walls of the pores that close, the struts of a lattice that meet. ``stiffness``:
132
+ the penalty of all these contacts (see :class:`~morphogen.contact.surfaces.Pair`);
133
+ ``points``: their contact points, ``"gauss"`` or ``"nodes"`` (a sample that meets a
134
+ platen, or itself, by corners or edges); ``kinematics``: ``"finite"`` strains (the
135
+ default) or ``"small"`` ones; ``fields``: keep
136
+ the displacements of each step. The other ``options``: those of
137
+ :class:`~morphogen.contact.problem.ContactProblem` (``bulk``, ``augmentations``,
138
+ ``tolerance``, ``neighbours``) and of its :meth:`run` (``tol``, ``max_newton``,
139
+ ``max_cuts``).
140
+
141
+ Two nodes of the base hold the sample against the rigid motions along the platens
142
+ (the forces that they take are those that the platens would otherwise have to: none
143
+ for a sample that widens evenly)."""
144
+ if not (math.isfinite(strain) and -1.0 < strain < 0.0):
145
+ raise ValueError("compression: a nominal strain between -1 and 0 (the platens close)")
146
+ if steps < 1:
147
+ raise ValueError("compression: at least one step")
148
+ b, c = _plane_axes(axis)
149
+ skin = Surface.of(mesh)
150
+ if not skin.n_faces:
151
+ raise ValueError("compression: the mesh has no free surface")
152
+ normal = np.zeros(3)
153
+ normal[axis] = 1.0
154
+ height = float(mesh.size[axis])
155
+ section = float(mesh.size[b] * mesh.size[c])
156
+ contact = {"friction": friction, "stiffness": stiffness, "points": points}
157
+ fixed = Obstacle.plane(skin, tuple(mesh.lower), tuple(normal), name="fixed", **contact)
158
+ moving = Obstacle.plane(
159
+ skin, tuple(mesh.upper), tuple(-normal), name="moving",
160
+ motion=tuple(strain * height * normal), **contact,
161
+ ) # fmt: skip
162
+ pairs = []
163
+ if self_contact:
164
+ rub = friction if self_friction is None else self_friction
165
+ pairs.append(Pair(skin, friction=rub, stiffness=stiffness, points=points))
166
+ build = {k: options.pop(k) for k in ("bulk", "augmentations", "tolerance", "neighbours")
167
+ if k in options} # fmt: skip
168
+ problem = ContactProblem(mesh, materials, pairs, [fixed, moving], kinematics=kinematics,
169
+ **build) # fmt: skip
170
+ res = problem.run(_pins(mesh, axis), steps=steps, fields=fields, **options)
171
+ first = len(pairs) # the contacts: the pair of the surface with itself, then the platens
172
+ force = res.forces[:, first + 1, axis]
173
+ return CompressionResult(
174
+ strain=strain * res.loads,
175
+ stress=-force / section,
176
+ force=force,
177
+ area=res.area[:, first : first + 2],
178
+ self_area=res.area[:, 0] if pairs else np.zeros(len(res.loads)),
179
+ friction=np.asarray(res.work["friction"]),
180
+ section=section,
181
+ height=height,
182
+ result=res,
183
+ problem=problem,
184
+ )
185
+
186
+
187
+ @dataclass
188
+ class IndentationResult:
189
+ """The indentation of a sample. At each step: the ``depth`` of the indenter under the
190
+ surface, the ``force`` on it, the ``area`` of the contact (the reference area of the
191
+ points that press), its ``radius`` (of the disc of the same area), the largest
192
+ ``pressure`` and the ``hardness`` (the mean pressure, force over area); ``modulus``:
193
+ the reduced modulus ``E / (1 - ν²)`` of the homogeneous half-space that would take the
194
+ force at that depth (Hertz for a sphere, Sneddon for a cone: that of the sample while
195
+ the contact is small against it and against its heterogeneities). With an unloading:
196
+ ``stiffness``, the slope of the force at its start, and ``unloading_modulus``, ``S
197
+ sqrt(π) / (2 sqrt(A))`` (Oliver and Pharr 1992: the area is that of the points, known
198
+ to a ring of them). ``radius_of_indenter`` (a sphere), ``thickness`` (of the sample
199
+ under its face) and ``base``: those of the test. ``result`` and ``problem``: as for a
200
+ compression."""
201
+
202
+ depth: np.ndarray
203
+ force: np.ndarray
204
+ area: np.ndarray
205
+ pressure: np.ndarray
206
+ modulus: np.ndarray
207
+ indenter: str
208
+ stiffness: float | None
209
+ unloading_modulus: float | None
210
+ radius_of_indenter: float | None
211
+ thickness: float
212
+ base: str
213
+ result: ContactResult = field(repr=False)
214
+ problem: ContactProblem = field(repr=False)
215
+
216
+ def layer_modulus(self, poisson: float) -> np.ndarray:
217
+ """The reduced modulus read from the force of a sphere with the base of the sample
218
+ taken into account: ``modulus`` over the factor by which a rigid base under a
219
+ layer of the thickness of the sample, of Poisson's ratio ``poisson``, multiplies
220
+ Hertz's force (:func:`~morphogen.contact.hertz.layer_correction`: bonded for a
221
+ fixed base, free to slide for a smooth one). A sample wide against its
222
+ thickness."""
223
+ if self.indenter != "sphere":
224
+ raise ValueError("layer_modulus: the correction is that of a sphere")
225
+ bonded = self.base == "fixed"
226
+ factor = np.array(
227
+ [
228
+ layer_correction(self.radius_of_indenter, h, self.thickness, poisson, bonded)
229
+ for h in self.depth
230
+ ]
231
+ )
232
+ return self.modulus / factor
233
+
234
+ @property
235
+ def radius(self) -> np.ndarray:
236
+ return np.sqrt(self.area / math.pi)
237
+
238
+ @property
239
+ def hardness(self) -> np.ndarray:
240
+ with np.errstate(divide="ignore", invalid="ignore"):
241
+ return np.where(self.area > 0, self.force / self.area, 0.0)
242
+
243
+ def rows(self) -> list[dict]:
244
+ """One row per step: depth, force, area and radius of the contact, largest and
245
+ mean pressures, and the reduced modulus read from the force."""
246
+ radius, hardness = self.radius, self.hardness
247
+ return [
248
+ {
249
+ "depth": float(self.depth[k]),
250
+ "force": float(self.force[k]),
251
+ "area": float(self.area[k]),
252
+ "radius": float(radius[k]),
253
+ "pressure": float(self.pressure[k]),
254
+ "hardness": float(hardness[k]),
255
+ "modulus": float(self.modulus[k]),
256
+ }
257
+ for k in range(len(self.depth))
258
+ ]
259
+
260
+
261
+ def indentation(
262
+ mesh: TetMesh,
263
+ materials,
264
+ depth: float,
265
+ *,
266
+ indenter: str = "sphere",
267
+ radius: float | None = None,
268
+ half_angle: float = 70.3,
269
+ point=None,
270
+ axis: int = 2,
271
+ friction: float = 0.0,
272
+ steps: int = 10,
273
+ unload: bool = False,
274
+ base: str = "fixed",
275
+ kinematics: str = "finite",
276
+ fields: bool = False,
277
+ stiffness: float | None = None,
278
+ **options,
279
+ ) -> IndentationResult:
280
+ """Indent the upper face of a sample (across ``axis``) to a ``depth`` by a rigid
281
+ ``indenter``: a ``"sphere"`` of ``radius``, or a ``"cone"`` of ``half_angle`` (degrees
282
+ from its axis; 70.3: the cone of the same area as the pyramids of Berkovich and
283
+ Vickers), at ``point`` of the face (two coordinates along it; by default its middle),
284
+ in ``steps`` steps, then out again in as many with ``unload``.
285
+
286
+ ``base``: the lower face is ``"fixed"`` (glued) or ``"smooth"`` (it slides on its
287
+ support); the other faces are free. ``friction``: that of the indenter. ``stiffness``,
288
+ ``kinematics``, ``fields`` and the other ``options``: as for :func:`compression`."""
289
+ if indenter not in INDENTERS:
290
+ raise ValueError(f"indentation: an indenter among {', '.join(INDENTERS)}")
291
+ if not (math.isfinite(depth) and depth > 0):
292
+ raise ValueError("indentation: a positive depth")
293
+ if indenter == "sphere" and not (radius is not None and radius > depth):
294
+ raise ValueError("indentation: the radius of the sphere, larger than the depth")
295
+ if base not in ("fixed", "smooth"):
296
+ raise ValueError("indentation: a base 'fixed' or 'smooth'")
297
+ if steps < 1:
298
+ raise ValueError("indentation: at least one step")
299
+ b, c = _plane_axes(axis)
300
+ x = mesh.nodes
301
+ height = float(mesh.size[axis])
302
+ top = float(mesh.upper[axis])
303
+ faces = Surface.of(mesh, lambda at: np.abs(at[:, axis] - top) < 1e-6 * height)
304
+ if not faces.n_faces:
305
+ raise ValueError("indentation: no face of the sample on the upper face of its box")
306
+ where = np.array(mesh.lower + 0.5 * mesh.size, dtype=float)
307
+ if point is not None:
308
+ where[[b, c]] = np.asarray(point, dtype=float).reshape(2)
309
+ where[axis] = top
310
+ normal = np.zeros(3)
311
+ normal[axis] = 1.0
312
+
313
+ def motion(t, down=-depth * normal):
314
+ return (t if t <= 1.0 else 2.0 - t) * down
315
+
316
+ contact = {"friction": friction, "stiffness": stiffness, "motion": motion}
317
+ if indenter == "sphere":
318
+ tool = Obstacle.sphere(faces, tuple(where + radius * normal), radius, **contact)
319
+ else:
320
+ tool = Obstacle.cone(faces, tuple(where), tuple(normal), half_angle, **contact)
321
+ under = np.flatnonzero(x[:, axis] < float(mesh.lower[axis]) + 1e-6 * height)
322
+ if not under.size:
323
+ raise ValueError("indentation: no node of the sample on the lower face of its box")
324
+ if base == "fixed":
325
+ prescribed = [(under, [0, 1, 2], 0.0)]
326
+ else:
327
+ prescribed = [(under, axis, 0.0), *_pins(mesh, axis)]
328
+ build = {k: options.pop(k) for k in ("bulk", "augmentations", "tolerance", "neighbours")
329
+ if k in options} # fmt: skip
330
+ problem = ContactProblem(mesh, materials, obstacles=[tool], kinematics=kinematics, **build)
331
+ load, count = (2.0, 2 * steps) if unload else (1.0, steps)
332
+ res = problem.run(prescribed, load=load, steps=count, fields=fields, **options)
333
+ t = res.loads
334
+ sunk = depth * np.where(t <= 1.0, t, 2.0 - t)
335
+ force = res.forces[:, 0, axis] # the sample pushes the indenter up
336
+ unit = np.array(
337
+ [
338
+ 0.0 if h <= 0 else (
339
+ hertz_sphere(radius, 1.0, approach=h)["force"] if indenter == "sphere"
340
+ else sneddon_cone(half_angle, 1.0, h)["force"]
341
+ )
342
+ for h in sunk
343
+ ]
344
+ ) # fmt: skip
345
+ with np.errstate(divide="ignore", invalid="ignore"):
346
+ modulus = np.where(unit > 0, force / unit, 0.0)
347
+ slope = reduced = None
348
+ if unload:
349
+ peak = int(np.argmin(np.abs(t - 1.0)))
350
+ if peak + 1 < len(t) and sunk[peak] > sunk[peak + 1]:
351
+ slope = float((force[peak] - force[peak + 1]) / (sunk[peak] - sunk[peak + 1]))
352
+ if res.area[peak, 0] > 0:
353
+ reduced = slope * math.sqrt(math.pi) / (2.0 * math.sqrt(res.area[peak, 0]))
354
+ return IndentationResult(
355
+ depth=sunk,
356
+ force=force,
357
+ area=res.area[:, 0],
358
+ pressure=res.pressure[:, 0],
359
+ modulus=modulus,
360
+ indenter=indenter,
361
+ stiffness=slope,
362
+ unloading_modulus=reduced,
363
+ radius_of_indenter=float(radius) if indenter == "sphere" else None,
364
+ thickness=height,
365
+ base=base,
366
+ result=res,
367
+ problem=problem,
368
+ )
@@ -0,0 +1,104 @@
1
+ """Closed forms of the contact of elastic bodies, against which the solver is checked:
2
+ Hertz's sphere and cylinder, Sneddon's cone and flat punch, the stick zone of Cattaneo and
3
+ Mindlin (Johnson 1985), and the sphere on a layer of finite thickness (Dimitriadis et
4
+ al. 2002)."""
5
+
6
+ from __future__ import annotations
7
+
8
+ import math
9
+
10
+
11
+ def effective_modulus(young: float, poisson: float, young_other: float | None = None,
12
+ poisson_other: float = 0.0) -> float: # fmt: skip
13
+ """The modulus of the contact of two isotropic bodies, ``1/E* = (1 - ν1²)/E1 + (1 -
14
+ ν2²)/E2``; of one body against a rigid one without ``young_other``."""
15
+ inverse = (1.0 - poisson**2) / young
16
+ if young_other is not None:
17
+ inverse += (1.0 - poisson_other**2) / young_other
18
+ return 1.0 / inverse
19
+
20
+
21
+ def hertz_sphere(radius: float, modulus: float, *, force: float | None = None,
22
+ approach: float | None = None) -> dict: # fmt: skip
23
+ """Hertz's contact of a sphere of ``radius`` and a plane (or of two spheres: ``1/R =
24
+ 1/R1 + 1/R2``) of effective ``modulus`` E*, under a ``force`` or an ``approach`` of the
25
+ two bodies: ``F = 4/3 E* sqrt(R) δ^(3/2)``, the radius of the contact ``a = sqrt(R δ)``
26
+ and the largest pressure ``p0 = 3 F / (2 π a²)``, with the pressure ``p0 sqrt(1 - r² /
27
+ a²)``."""
28
+ if (force is None) == (approach is None):
29
+ raise ValueError("hertz_sphere: a force or an approach")
30
+ if approach is None:
31
+ approach = (3.0 * force / (4.0 * modulus * math.sqrt(radius))) ** (2.0 / 3.0)
32
+ force = 4.0 / 3.0 * modulus * math.sqrt(radius) * approach**1.5
33
+ contact = math.sqrt(radius * approach)
34
+ return {"force": force, "approach": approach, "radius": contact,
35
+ "pressure": 3.0 * force / (2.0 * math.pi * contact**2)} # fmt: skip
36
+
37
+
38
+ def layer_correction(radius: float, depth: float, thickness: float, poisson: float,
39
+ bonded: bool = True) -> float: # fmt: skip
40
+ """The factor by which the rigid base of a layer of ``thickness`` multiplies Hertz's
41
+ force of a sphere of ``radius`` pressed to a ``depth`` into it (Dimitriadis et al.
42
+ 2002): with ``χ = sqrt(R δ) / h``, the radius of the contact over the thickness,
43
+
44
+ ``1 - (2 α0/π) χ + (4 α0²/π²) χ² - (8/π³)(α0³ + 4π² β0/15) χ³ + (16 α0/π⁴)(α0³ + 3π²
45
+ β0/5) χ⁴``
46
+
47
+ (the fourth order with the sign corrected by Garcia and Garcia 2018), where, for a
48
+ layer ``bonded`` to its base, ``α0 = -(1.2876 - 1.4678 ν + 1.3442 ν²) / (1 - ν)`` and
49
+ ``β0 = (0.6387 - 1.0277 ν + 1.5164 ν²) / (1 - ν)``, and for one free to slide on it,
50
+ ``α0 = -0.347 (3 - 2 ν) / (1 - ν)`` and ``β0 = 0.056 (5 - 2 ν) / (1 - ν)``. A layer
51
+ wide against its thickness, a contact smaller than it (``χ`` below 1)."""
52
+ if not (radius > 0 and depth >= 0 and thickness > 0):
53
+ raise ValueError("layer_correction: a radius, a depth and a thickness")
54
+ if not -1.0 < poisson <= 0.5:
55
+ raise ValueError("layer_correction: a Poisson's ratio in (-1, 0.5]")
56
+ chi = math.sqrt(radius * depth) / thickness
57
+ if bonded:
58
+ alpha = -(1.2876 - 1.4678 * poisson + 1.3442 * poisson**2) / (1.0 - poisson)
59
+ beta = (0.6387 - 1.0277 * poisson + 1.5164 * poisson**2) / (1.0 - poisson)
60
+ else:
61
+ alpha = -0.347 * (3.0 - 2.0 * poisson) / (1.0 - poisson)
62
+ beta = 0.056 * (5.0 - 2.0 * poisson) / (1.0 - poisson)
63
+ pi = math.pi
64
+ return (
65
+ 1.0
66
+ - 2.0 * alpha / pi * chi
67
+ + 4.0 * alpha**2 / pi**2 * chi**2
68
+ - 8.0 / pi**3 * (alpha**3 + 4.0 * pi**2 * beta / 15.0) * chi**3
69
+ + 16.0 * alpha / pi**4 * (alpha**3 + 3.0 * pi**2 * beta / 5.0) * chi**4
70
+ )
71
+
72
+
73
+ def hertz_cylinder(radius: float, modulus: float, force: float) -> dict:
74
+ """Hertz's contact of a cylinder of ``radius`` and a plane along a line, under a
75
+ ``force`` per unit length: the half-width of the contact ``b = sqrt(4 F R / (π E*))``
76
+ and the largest pressure ``p0 = 2 F / (π b)``, with the pressure ``p0 sqrt(1 - x² /
77
+ b²)``."""
78
+ width = math.sqrt(4.0 * force * radius / (math.pi * modulus))
79
+ return {"force": force, "half_width": width, "pressure": 2.0 * force / (math.pi * width)}
80
+
81
+
82
+ def sneddon_cone(half_angle: float, modulus: float, depth: float) -> dict:
83
+ """Sneddon's indentation of a half-space of effective ``modulus`` by a rigid cone of
84
+ ``half_angle`` (degrees, from its axis) to a ``depth``: ``F = 2/π E* tan(α) h²`` and
85
+ the radius of the contact ``a = 2/π h tan(α)``."""
86
+ tangent = math.tan(math.radians(half_angle))
87
+ return {"force": 2.0 / math.pi * modulus * tangent * depth**2, "depth": depth,
88
+ "radius": 2.0 / math.pi * depth * tangent} # fmt: skip
89
+
90
+
91
+ def flat_punch(radius: float, modulus: float, depth: float) -> dict:
92
+ """The indentation of a half-space by a rigid flat punch of ``radius`` to a ``depth``:
93
+ ``F = 2 a E* h``."""
94
+ return {"force": 2.0 * radius * modulus * depth, "depth": depth, "radius": radius}
95
+
96
+
97
+ def mindlin_stick_radius(radius: float, friction: float, normal: float, tangential: float):
98
+ """The radius of the stick zone of a Hertz contact of radius ``radius`` under a
99
+ tangential force below ``μ N`` (Cattaneo 1938; Mindlin 1949): ``c = a (1 - T / (μ
100
+ N))^(1/3)``, a ring of slip around it."""
101
+ ratio = tangential / (friction * normal)
102
+ if not 0.0 <= ratio <= 1.0:
103
+ raise ValueError("mindlin_stick_radius: a tangential force of at most μ N")
104
+ return radius * (1.0 - ratio) ** (1.0 / 3.0)