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.
- morphogen/__init__.py +60 -0
- morphogen/__main__.py +7 -0
- morphogen/_platform.py +55 -0
- morphogen/_public.py +153 -0
- morphogen/_utils.py +80 -0
- morphogen/_version.py +1 -0
- morphogen/analysis/__init__.py +174 -0
- morphogen/analysis/anisotropy.py +135 -0
- morphogen/analysis/basic.py +38 -0
- morphogen/analysis/cells.py +54 -0
- morphogen/analysis/connectivity.py +156 -0
- morphogen/analysis/correlation.py +195 -0
- morphogen/analysis/covariance.py +80 -0
- morphogen/analysis/fractal.py +54 -0
- morphogen/analysis/measures.py +188 -0
- morphogen/analysis/morphology.py +265 -0
- morphogen/analysis/particles.py +160 -0
- morphogen/analysis/percolation.py +2034 -0
- morphogen/analysis/power_laws.py +143 -0
- morphogen/analysis/random_sets.py +351 -0
- morphogen/analysis/stereology.py +289 -0
- morphogen/analysis/surface.py +107 -0
- morphogen/analysis/topology.py +92 -0
- morphogen/automata/__init__.py +74 -0
- morphogen/automata/engine.py +211 -0
- morphogen/automata/growth.py +686 -0
- morphogen/automata/lattice.py +143 -0
- morphogen/automata/reaction.py +255 -0
- morphogen/automata/rules.py +353 -0
- morphogen/automata/tilings.py +1715 -0
- morphogen/cli.py +3526 -0
- morphogen/config.py +2167 -0
- morphogen/contact/__init__.py +113 -0
- morphogen/contact/experiments.py +368 -0
- morphogen/contact/hertz.py +104 -0
- morphogen/contact/kernels.py +827 -0
- morphogen/contact/periodic.py +278 -0
- morphogen/contact/problem.py +578 -0
- morphogen/contact/surfaces.py +310 -0
- morphogen/coupling/__init__.py +43 -0
- morphogen/coupling/ageing.py +143 -0
- morphogen/coupling/diffusion.py +226 -0
- morphogen/coupling/fenicsx.py +484 -0
- morphogen/coupling/oxidation.py +447 -0
- morphogen/coupling/plates.py +247 -0
- morphogen/design/__init__.py +51 -0
- morphogen/design/csp.py +616 -0
- morphogen/design/frames.py +277 -0
- morphogen/design/search.py +287 -0
- morphogen/design/tiles.py +336 -0
- morphogen/distributions.py +312 -0
- morphogen/domain.py +203 -0
- morphogen/dynamics/__init__.py +179 -0
- morphogen/dynamics/model.py +638 -0
- morphogen/dynamics/openradioss.py +643 -0
- morphogen/dynamics/results.py +515 -0
- morphogen/fracture/__init__.py +170 -0
- morphogen/fracture/bulk.py +349 -0
- morphogen/fracture/cohesive.py +1614 -0
- morphogen/fracture/ductile.py +557 -0
- morphogen/fracture/lefm.py +1168 -0
- morphogen/fracture/mixed.py +1178 -0
- morphogen/fracture/periodic.py +733 -0
- morphogen/fracture/phasefield.py +714 -0
- morphogen/fracture/phasefield_finite.py +368 -0
- morphogen/fracture/surface.py +572 -0
- morphogen/fracture/toughness.py +566 -0
- morphogen/gpu.py +108 -0
- morphogen/gui/__init__.py +8 -0
- morphogen/gui/api.py +1927 -0
- morphogen/gui/desktop.py +387 -0
- morphogen/gui/icon.png +0 -0
- morphogen/gui/index.html +1909 -0
- morphogen/gui/server.py +229 -0
- morphogen/gui/tools/__init__.py +629 -0
- morphogen/gui/tools/compare.py +149 -0
- morphogen/gui/tools/contact.py +391 -0
- morphogen/gui/tools/couplings.py +1085 -0
- morphogen/gui/tools/crackfront.py +245 -0
- morphogen/gui/tools/design.py +224 -0
- morphogen/gui/tools/dynamics.py +824 -0
- morphogen/gui/tools/fracture.py +2586 -0
- morphogen/gui/tools/interop.py +1654 -0
- morphogen/gui/tools/learning.py +595 -0
- morphogen/gui/tools/mechanics.py +3881 -0
- morphogen/gui/tools/nonlocal_damage.py +1321 -0
- morphogen/gui/tools/phasefield.py +215 -0
- morphogen/gui/tools/physics.py +597 -0
- morphogen/gui/tools/stability.py +1756 -0
- morphogen/gui/tools/statistics.py +1408 -0
- morphogen/gui/viewer.js +1100 -0
- morphogen/homogenization/__init__.py +210 -0
- morphogen/homogenization/acoustics.py +566 -0
- morphogen/homogenization/amg.py +1005 -0
- morphogen/homogenization/apparent.py +1046 -0
- morphogen/homogenization/behaviours.cu +2285 -0
- morphogen/homogenization/behaviours.py +944 -0
- morphogen/homogenization/beremin.py +263 -0
- morphogen/homogenization/bifurcation.py +1085 -0
- morphogen/homogenization/bloch.py +507 -0
- morphogen/homogenization/bounds.py +226 -0
- morphogen/homogenization/core.py +458 -0
- morphogen/homogenization/coupled.py +1135 -0
- morphogen/homogenization/crystal.py +2967 -0
- morphogen/homogenization/dilatation.py +454 -0
- morphogen/homogenization/elements.py +157 -0
- morphogen/homogenization/fatigue.py +768 -0
- morphogen/homogenization/fe.py +1739 -0
- morphogen/homogenization/fenicsx.py +307 -0
- morphogen/homogenization/fft.py +499 -0
- morphogen/homogenization/fft_nonlinear.py +391 -0
- morphogen/homogenization/finite.py +613 -0
- morphogen/homogenization/flow.py +361 -0
- morphogen/homogenization/frames.py +1125 -0
- morphogen/homogenization/gpu.py +1241 -0
- morphogen/homogenization/harmonic.py +427 -0
- morphogen/homogenization/identification.py +579 -0
- morphogen/homogenization/kernels.py +760 -0
- morphogen/homogenization/laws.py +2061 -0
- morphogen/homogenization/materials.py +1080 -0
- morphogen/homogenization/mfront.py +589 -0
- morphogen/homogenization/networks.py +880 -0
- morphogen/homogenization/nonlinear.py +2612 -0
- morphogen/homogenization/ntfa.py +577 -0
- morphogen/homogenization/paths.py +476 -0
- morphogen/homogenization/photonic.py +467 -0
- morphogen/homogenization/poroelastic.py +212 -0
- morphogen/homogenization/porous.py +1120 -0
- morphogen/homogenization/postprocess.py +290 -0
- morphogen/homogenization/solvers.py +1140 -0
- morphogen/homogenization/tensors.py +240 -0
- morphogen/homogenization/voxel_fe.py +457 -0
- morphogen/homogenization/xfem.py +1016 -0
- morphogen/homogenization/zmat.py +1258 -0
- morphogen/iga/__init__.py +48 -0
- morphogen/iga/analysis.py +508 -0
- morphogen/iga/basis.py +214 -0
- morphogen/iga/geometry.py +501 -0
- morphogen/iga/homogenization.py +219 -0
- morphogen/iga/optimization.py +700 -0
- morphogen/iga/shapes.py +331 -0
- morphogen/image.py +128 -0
- morphogen/io/__init__.py +246 -0
- morphogen/io/amitex.py +741 -0
- morphogen/io/ebsd.py +881 -0
- morphogen/io/export.py +196 -0
- morphogen/io/geometry.py +158 -0
- morphogen/io/medit.py +147 -0
- morphogen/io/meshes.py +844 -0
- morphogen/io/metaimage.py +97 -0
- morphogen/io/mfront.py +1104 -0
- morphogen/io/native.py +57 -0
- morphogen/io/radioss.py +764 -0
- morphogen/io/solvers.py +371 -0
- morphogen/io/tables.py +278 -0
- morphogen/io/tiff.py +66 -0
- morphogen/io/vtk.py +701 -0
- morphogen/io/xdmf.py +200 -0
- morphogen/kernels/__init__.py +5 -0
- morphogen/kernels/annealing.py +192 -0
- morphogen/kernels/cells.py +69 -0
- morphogen/kernels/collective.py +87 -0
- morphogen/kernels/force_biased.py +595 -0
- morphogen/kernels/implicit.py +145 -0
- morphogen/kernels/leaves.py +132 -0
- morphogen/kernels/packing.py +304 -0
- morphogen/kernels/raster.py +279 -0
- morphogen/kernels/rsa.py +371 -0
- morphogen/kernels/union.py +135 -0
- morphogen/kernels/watershed.py +190 -0
- morphogen/laser/__init__.py +234 -0
- morphogen/laser/architectures.py +375 -0
- morphogen/laser/bending.py +216 -0
- morphogen/laser/cells.py +1694 -0
- morphogen/laser/design.py +940 -0
- morphogen/laser/figures.py +227 -0
- morphogen/laser/heat.py +804 -0
- morphogen/laser/materials.py +691 -0
- morphogen/laser/mechanics.py +1670 -0
- morphogen/laser/metallurgy.py +615 -0
- morphogen/laser/patterns.py +828 -0
- morphogen/laser/periodic.py +392 -0
- morphogen/laser/process.py +362 -0
- morphogen/laser/run.py +534 -0
- morphogen/laser/solid.py +216 -0
- morphogen/laser/specimen.py +200 -0
- morphogen/laser/structures.py +708 -0
- morphogen/learning/__init__.py +81 -0
- morphogen/learning/behaviour.py +398 -0
- morphogen/learning/data.py +328 -0
- morphogen/learning/learned.cpp +668 -0
- morphogen/learning/logarithmic.py +202 -0
- morphogen/learning/mfront.py +409 -0
- morphogen/learning/networks.py +767 -0
- morphogen/learning/run.py +212 -0
- morphogen/learning/standard.py +814 -0
- morphogen/learning/training.py +235 -0
- morphogen/mesh/__init__.py +29 -0
- morphogen/mesh/conforming.py +1423 -0
- morphogen/mesh/curved.py +600 -0
- morphogen/mesh/exact.py +1717 -0
- morphogen/mesh/octree.py +350 -0
- morphogen/mesh/polycrystal.py +1041 -0
- morphogen/mesh/polyhedra.py +677 -0
- morphogen/mesh/regularize.py +570 -0
- morphogen/mesh/surface.py +97 -0
- morphogen/mesh/tetra.py +512 -0
- morphogen/mesh/voxel.py +124 -0
- morphogen/micromorphic/__init__.py +31 -0
- morphogen/micromorphic/damage.py +359 -0
- morphogen/micromorphic/ductile.py +534 -0
- morphogen/micromorphic/finite.py +220 -0
- morphogen/micromorphic/microfoam.py +787 -0
- morphogen/micromorphic/space.py +341 -0
- morphogen/models/__init__.py +195 -0
- morphogen/models/affine.py +384 -0
- morphogen/models/automata.py +592 -0
- morphogen/models/base.py +500 -0
- morphogen/models/boolean.py +310 -0
- morphogen/models/bouligand.py +331 -0
- morphogen/models/branching.py +241 -0
- morphogen/models/combination.py +430 -0
- morphogen/models/deadleaves.py +766 -0
- morphogen/models/design.py +289 -0
- morphogen/models/ebsd.py +206 -0
- morphogen/models/fibers.py +1476 -0
- morphogen/models/foam.py +594 -0
- morphogen/models/gaussian.py +314 -0
- morphogen/models/growth.py +459 -0
- morphogen/models/hardcore.py +317 -0
- morphogen/models/hierarchical.py +269 -0
- morphogen/models/honeycomb.py +749 -0
- morphogen/models/implicit.py +177 -0
- morphogen/models/laminate.py +470 -0
- morphogen/models/lattice.py +351 -0
- morphogen/models/lattice_field.py +345 -0
- morphogen/models/levelset_foam.py +563 -0
- morphogen/models/nacre.py +411 -0
- morphogen/models/nested.py +924 -0
- morphogen/models/osteons.py +374 -0
- morphogen/models/pieces.py +167 -0
- morphogen/models/planar.py +126 -0
- morphogen/models/reconstruction.py +203 -0
- morphogen/models/scale_rich.py +1409 -0
- morphogen/models/scale_rich_3d.py +1616 -0
- morphogen/models/tessellation.py +735 -0
- morphogen/models/tiling_field.py +302 -0
- morphogen/models/tpms.py +197 -0
- morphogen/models/transparent.py +406 -0
- morphogen/models/union.py +141 -0
- morphogen/optimization/__init__.py +43 -0
- morphogen/optimization/cell.py +295 -0
- morphogen/optimization/filters.py +115 -0
- morphogen/optimization/mma.py +226 -0
- morphogen/optimization/run.py +219 -0
- morphogen/optimization/topology.py +632 -0
- morphogen/orientations.py +568 -0
- morphogen/parallel.py +599 -0
- morphogen/pipeline.py +978 -0
- morphogen/primitives.py +188 -0
- morphogen/results.py +564 -0
- morphogen/rve/__init__.py +73 -0
- morphogen/rve/report.py +627 -0
- morphogen/rve/scaling.py +363 -0
- morphogen/rve/study.py +1054 -0
- morphogen/rve/windows.py +345 -0
- morphogen/seeding.py +51 -0
- morphogen/settings.py +118 -0
- morphogen/stopping.py +48 -0
- morphogen/symmetry.py +384 -0
- morphogen/templates/activator_inhibitor.yaml +22 -0
- morphogen/templates/aggregation.yaml +23 -0
- morphogen/templates/boolean_cylinders.yaml +20 -0
- morphogen/templates/boolean_spheres.yaml +22 -0
- morphogen/templates/bouligand.yaml +28 -0
- morphogen/templates/cellular_automaton.yaml +25 -0
- morphogen/templates/coated_spheres.yaml +26 -0
- morphogen/templates/contact_fibers.yaml +27 -0
- morphogen/templates/cox_nanocomposite.yaml +22 -0
- morphogen/templates/cross_linked_fibers.yaml +26 -0
- morphogen/templates/curved_arcs.yaml +28 -0
- morphogen/templates/curved_fibers.yaml +24 -0
- morphogen/templates/dead_leaves.yaml +22 -0
- morphogen/templates/delaunay_network.yaml +22 -0
- morphogen/templates/dense_packing.yaml +22 -0
- morphogen/templates/diffusion.yaml +33 -0
- morphogen/templates/ebsd.yaml +34 -0
- morphogen/templates/ebsd_map.ctf +3087 -0
- morphogen/templates/fracture_composite.yaml +42 -0
- morphogen/templates/fracture_rubber.yaml +47 -0
- morphogen/templates/gaussian_excursion.yaml +17 -0
- morphogen/templates/graded_lattice.yaml +24 -0
- morphogen/templates/hardcore_fibers.yaml +22 -0
- morphogen/templates/hardcore_spheres.yaml +22 -0
- morphogen/templates/hierarchical_lattice.yaml +22 -0
- morphogen/templates/homogenization_acoustic_foam.yaml +36 -0
- morphogen/templates/homogenization_beremin.yaml +50 -0
- morphogen/templates/homogenization_cleavage.yaml +51 -0
- morphogen/templates/homogenization_cleavage_band.yaml +55 -0
- morphogen/templates/homogenization_contact.yaml +43 -0
- morphogen/templates/homogenization_crack_closure.yaml +49 -0
- morphogen/templates/homogenization_crystal_plasticity.yaml +50 -0
- morphogen/templates/homogenization_crystal_plasticity_fft.yaml +52 -0
- morphogen/templates/homogenization_crystallization.yaml +30 -0
- morphogen/templates/homogenization_debonding.yaml +43 -0
- morphogen/templates/homogenization_detwinning.yaml +58 -0
- morphogen/templates/homogenization_ductile_damage.yaml +47 -0
- morphogen/templates/homogenization_fatigue.yaml +40 -0
- morphogen/templates/homogenization_grain_fracture.yaml +56 -0
- morphogen/templates/homogenization_gyroid.yaml +30 -0
- morphogen/templates/homogenization_intergranular.yaml +43 -0
- morphogen/templates/homogenization_interphase.yaml +42 -0
- morphogen/templates/homogenization_mixed_loading.yaml +33 -0
- morphogen/templates/homogenization_ntfa.yaml +56 -0
- morphogen/templates/homogenization_piezoelectric.yaml +27 -0
- morphogen/templates/homogenization_polycrystal.yaml +30 -0
- morphogen/templates/homogenization_polycrystal_inclusions.yaml +30 -0
- morphogen/templates/homogenization_poroelastic.yaml +26 -0
- morphogen/templates/homogenization_rubber.yaml +40 -0
- morphogen/templates/homogenization_slip_cleavage.yaml +50 -0
- morphogen/templates/homogenization_spheres.yaml +31 -0
- morphogen/templates/homogenization_transport.yaml +29 -0
- morphogen/templates/homogenization_twinning.yaml +54 -0
- morphogen/templates/homogenization_viscoelastic.yaml +34 -0
- morphogen/templates/homogenization_viscoplastic.yaml +42 -0
- morphogen/templates/homogenization_voronoi.yaml +26 -0
- morphogen/templates/homogenization_xfem.yaml +23 -0
- morphogen/templates/hyperuniform_cells.yaml +24 -0
- morphogen/templates/laguerre.yaml +18 -0
- morphogen/templates/laser_bending.yaml +35 -0
- morphogen/templates/laser_cells.yaml +38 -0
- morphogen/templates/laser_corrugated.yaml +36 -0
- morphogen/templates/level_set_foam.yaml +29 -0
- morphogen/templates/menger_sponge.yaml +17 -0
- morphogen/templates/nacre.yaml +25 -0
- morphogen/templates/nucleation_growth.yaml +25 -0
- morphogen/templates/optimize_auxetic.yaml +29 -0
- morphogen/templates/optimize_auxetic_3d.yaml +27 -0
- morphogen/templates/optimize_bulk.yaml +23 -0
- morphogen/templates/optimize_conductivity.yaml +20 -0
- morphogen/templates/osteons.yaml +28 -0
- morphogen/templates/penetrable_spheres.yaml +21 -0
- morphogen/templates/poisson_fibers.yaml +21 -0
- morphogen/templates/random_laminate.yaml +26 -0
- morphogen/templates/random_lattice.yaml +27 -0
- morphogen/templates/random_walk_fibers.yaml +26 -0
- morphogen/templates/reaction_diffusion.yaml +22 -0
- morphogen/templates/reconstruction.yaml +22 -0
- morphogen/templates/rve_cellular_automaton.yaml +23 -0
- morphogen/templates/rve_crystal_plasticity_fft.yaml +51 -0
- morphogen/templates/rve_multiphysics.yaml +43 -0
- morphogen/templates/rve_poisson_fibers.yaml +22 -0
- morphogen/templates/rve_poisson_fibers_fe.yaml +33 -0
- morphogen/templates/rve_voronoi_windows.yaml +20 -0
- morphogen/templates/scale_rich_network.yaml +29 -0
- morphogen/templates/scale_rich_plates.yaml +30 -0
- morphogen/templates/sequential_dead_leaves.yaml +25 -0
- morphogen/templates/strut_lattice.yaml +21 -0
- morphogen/templates/tile_assembly.yaml +28 -0
- morphogen/templates/tpms.yaml +19 -0
- morphogen/templates/trabecular_bone.yaml +29 -0
- morphogen/templates/transparent_dead_leaves.yaml +23 -0
- morphogen/templates/vascular_tree.yaml +23 -0
- morphogen/templates/voronoi.yaml +20 -0
- morphogen/templates/wood.yaml +34 -0
- morphogen/templates/workflow.yaml +56 -0
- morphogen/texture.py +665 -0
- morphogen/theory.py +162 -0
- morphogen/viz/__init__.py +12 -0
- morphogen/viz/export.py +244 -0
- morphogen/viz/figures.py +707 -0
- morphogen/viz/png.py +148 -0
- morphogen/viz/sections.py +696 -0
- morphogen/viz/surfaces.py +1352 -0
- morphogen/viz/video.py +904 -0
- morphogen/viz/workflow.py +488 -0
- morphogen-1.0.0.dist-info/METADATA +2316 -0
- morphogen-1.0.0.dist-info/RECORD +381 -0
- morphogen-1.0.0.dist-info/WHEEL +4 -0
- morphogen-1.0.0.dist-info/entry_points.txt +5 -0
- morphogen-1.0.0.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""The tools of the tab Comparisons: the curves of several runs of the workspace on one
|
|
2
|
+
figure (the loading paths of morphologies and the material points), with the points of a
|
|
3
|
+
test, and their final and extreme values side by side."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
from morphogen.gui.tools import Field, tab, tool
|
|
10
|
+
|
|
11
|
+
tab(
|
|
12
|
+
"compare",
|
|
13
|
+
"Comparisons",
|
|
14
|
+
"The curves of several runs of the workspace on one figure: the responses of "
|
|
15
|
+
"morphologies along their loading paths and of behaviours at material points, with "
|
|
16
|
+
"the points of a test; their final and extreme values side by side.",
|
|
17
|
+
order=95,
|
|
18
|
+
section="share",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
COMPONENTS = ("11", "22", "33", "23", "31", "12")
|
|
22
|
+
STRAINS = (
|
|
23
|
+
("auto", "the strain component that varies most"),
|
|
24
|
+
*[(f"E{c}", f"E{c}") for c in COMPONENTS],
|
|
25
|
+
("time", "the time"),
|
|
26
|
+
)
|
|
27
|
+
QUANTITIES = (
|
|
28
|
+
("auto", "the stress of the strain shown (else the one that varies most)"),
|
|
29
|
+
*[(f"S{c}", f"S{c}") for c in COMPONENTS],
|
|
30
|
+
("p", "the mean cumulated plastic strain p"),
|
|
31
|
+
("f", "the porosity f"),
|
|
32
|
+
)
|
|
33
|
+
#: The colours of the runs (the reference in black)
|
|
34
|
+
COLOURS = ("#2166ac", "#d6604d", "#1b7837", "#762a83", "#e08214", "#35978f", "#8c510a")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _true(rows: list[dict], measures: str) -> bool:
|
|
38
|
+
"""Whether the true measures are shown: asked for, and in the table (finite strains)."""
|
|
39
|
+
return measures == "true" and bool(rows) and "LE11" in rows[0] and "TS11" in rows[0]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _column(rows: list[dict], name: str) -> np.ndarray:
|
|
43
|
+
return np.array([float(r.get(name) or 0.0) for r in rows], dtype=float)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _axes(rows: list[dict], x: str, y: str, true: bool) -> tuple[str, str]:
|
|
47
|
+
"""The columns shown of a table of curves: ``x`` and ``y`` of the form, the automatic
|
|
48
|
+
ones chosen in it (true measures: ``LE``, ``TS``)."""
|
|
49
|
+
e_name, s_name = ("LE", "TS") if true else ("E", "S")
|
|
50
|
+
if x == "auto":
|
|
51
|
+
spans = [np.ptp(_column(rows, e_name + c)) for c in COMPONENTS]
|
|
52
|
+
x = e_name + COMPONENTS[int(np.argmax(spans))]
|
|
53
|
+
elif x.startswith("E") and true:
|
|
54
|
+
x = "L" + x
|
|
55
|
+
if y == "auto":
|
|
56
|
+
if x == "time":
|
|
57
|
+
spans = [np.ptp(_column(rows, s_name + c)) for c in COMPONENTS]
|
|
58
|
+
y = s_name + COMPONENTS[int(np.argmax(spans))]
|
|
59
|
+
else:
|
|
60
|
+
y = s_name + x[-2:]
|
|
61
|
+
elif y.startswith("S") and true:
|
|
62
|
+
y = "T" + y
|
|
63
|
+
return x, y
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@tool(
|
|
67
|
+
"compare_curves",
|
|
68
|
+
"compare",
|
|
69
|
+
"Curves of runs",
|
|
70
|
+
"The curves of loading paths of morphologies and of material points of the workspace "
|
|
71
|
+
"on one figure (a strain component, or the time, against a stress, the plastic strain "
|
|
72
|
+
"or the porosity; the true measures of finite strains), with the points of a test and "
|
|
73
|
+
"the gap of each run to them; the final, largest and smallest values of each.",
|
|
74
|
+
[
|
|
75
|
+
Field(
|
|
76
|
+
"runs",
|
|
77
|
+
"items",
|
|
78
|
+
required=True,
|
|
79
|
+
items=("simulation", "behaviour", "result"),
|
|
80
|
+
needs=("curves",),
|
|
81
|
+
doc="loading paths of morphologies (S), material points and identifications (B, R)",
|
|
82
|
+
),
|
|
83
|
+
Field("x", "choice", "auto", label="along", choices=STRAINS),
|
|
84
|
+
Field("y", "choice", "auto", label="shown", choices=QUANTITIES),
|
|
85
|
+
Field(
|
|
86
|
+
"measures",
|
|
87
|
+
"choice",
|
|
88
|
+
"nominal",
|
|
89
|
+
choices=(
|
|
90
|
+
("nominal", "nominal (small strains, or E and S in finite strains)"),
|
|
91
|
+
("true", "true in finite strains (logarithmic strains, Cauchy stresses)"),
|
|
92
|
+
),
|
|
93
|
+
),
|
|
94
|
+
Field(
|
|
95
|
+
"reference",
|
|
96
|
+
"text",
|
|
97
|
+
label="points of a test",
|
|
98
|
+
doc="x, y of the quantities shown, one pair per line (comma, space or tab; or "
|
|
99
|
+
"semicolons with decimal commas): drawn with the curves, and the gap of each run",
|
|
100
|
+
),
|
|
101
|
+
],
|
|
102
|
+
)
|
|
103
|
+
def compare_curves(p: dict, ctx) -> dict:
|
|
104
|
+
from matplotlib.figure import Figure
|
|
105
|
+
|
|
106
|
+
from morphogen.gui.api import curves_of
|
|
107
|
+
from morphogen.gui.tools.mechanics import _reference
|
|
108
|
+
from morphogen.pipeline import read_rows
|
|
109
|
+
|
|
110
|
+
reference = _reference(p.get("reference"))
|
|
111
|
+
fig = Figure(figsize=(6.4, 4.4), layout="constrained")
|
|
112
|
+
ax = fig.add_subplot()
|
|
113
|
+
table, values, names = [], {}, set()
|
|
114
|
+
for k, item in enumerate(p["runs"]):
|
|
115
|
+
rows = read_rows(curves_of(item, ctx.session.root))
|
|
116
|
+
if not rows:
|
|
117
|
+
raise ValueError(f"{item['title']}: its table of curves is empty")
|
|
118
|
+
x_name, y_name = _axes(rows, p["x"], p["y"], _true(rows, p["measures"]))
|
|
119
|
+
missing = [n for n in (x_name, y_name) if n not in rows[0]]
|
|
120
|
+
if missing:
|
|
121
|
+
raise ValueError(f"{item['title']}: no {' nor '.join(missing)} in its curves")
|
|
122
|
+
x, y = _column(rows, x_name), _column(rows, y_name)
|
|
123
|
+
names.add((x_name, y_name))
|
|
124
|
+
label = item["title"]
|
|
125
|
+
ax.plot(x, y, "-", color=COLOURS[k % len(COLOURS)], lw=1.8, marker=".", ms=3,
|
|
126
|
+
label=label) # fmt: skip
|
|
127
|
+
row = {"run": label, "x": x_name, "y": y_name, "x at the end": x[-1],
|
|
128
|
+
"y at the end": y[-1], "largest y": y.max(), "smallest y": y.min()} # fmt: skip
|
|
129
|
+
if reference is not None:
|
|
130
|
+
order = np.argsort(x, kind="stable")
|
|
131
|
+
inside = (reference[:, 0] >= x.min()) & (reference[:, 0] <= x.max())
|
|
132
|
+
if np.all(np.diff(x) >= 0) or np.all(np.diff(x) <= 0):
|
|
133
|
+
if inside.any():
|
|
134
|
+
gap = np.interp(reference[inside, 0], x[order], y[order]) - reference[inside, 1]
|
|
135
|
+
scale = float(np.abs(reference[:, 1]).max()) or 1.0
|
|
136
|
+
row["relative gap to the test"] = float(np.sqrt(np.mean(gap**2))) / scale
|
|
137
|
+
table.append(row)
|
|
138
|
+
values[f"#{item['number']} {y_name} at the end"] = float(y[-1])
|
|
139
|
+
ctx.progress((k + 1) / (len(p["runs"]) + 1), item["title"])
|
|
140
|
+
if reference is not None:
|
|
141
|
+
ax.plot(reference[:, 0], reference[:, 1], "ko", ms=4, mfc="none", label="test")
|
|
142
|
+
(x_name, y_name), *others = sorted(names)
|
|
143
|
+
ax.set_xlabel(x_name if not others else "x (see the table)")
|
|
144
|
+
ax.set_ylabel(y_name if not others else "y (see the table)")
|
|
145
|
+
ax.grid(alpha=0.3)
|
|
146
|
+
ax.legend(fontsize=8, frameon=False)
|
|
147
|
+
ctx.figure(fig, "curves", "curves of the runs")
|
|
148
|
+
ctx.table(table, "runs", "the runs compared")
|
|
149
|
+
return {"title": f"Curves of {len(table)} runs", "values": values}
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
"""The tools of the tab Contact of the interface: a morphology of the workspace between
|
|
2
|
+
rigid tools (:mod:`morphogen.contact.experiments`). Its compression between two platens,
|
|
3
|
+
on which it rubs and under which the walls of its pores close on themselves (the nominal
|
|
4
|
+
stress against the strain, the areas in contact), and its indentation by a sphere or a
|
|
5
|
+
cone (the force against the depth, the modulus that it reads)."""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
|
|
11
|
+
from morphogen.gui.tools import Field, tab, tool
|
|
12
|
+
|
|
13
|
+
tab(
|
|
14
|
+
"contact",
|
|
15
|
+
"Contact",
|
|
16
|
+
"A morphology between rigid tools, with the contact and Coulomb's friction of its "
|
|
17
|
+
"surfaces: its compression between two platens until the walls of its pores close on "
|
|
18
|
+
"themselves (a foam, a lattice or a porous solid that densifies), and its indentation "
|
|
19
|
+
"by a sphere or a cone (the force against the depth and the modulus that it reads).",
|
|
20
|
+
order=52,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
AXES = (("2", "z"), ("1", "y"), ("0", "x"))
|
|
24
|
+
POINTS = (("gauss", "inside the faces"), ("nodes", "at the nodes of the faces"))
|
|
25
|
+
ELEMENTS = (
|
|
26
|
+
("1", "4-node tetrahedra (faster, stiffer)"),
|
|
27
|
+
("2", "10-node tetrahedra (curved faces on the interfaces)"),
|
|
28
|
+
)
|
|
29
|
+
KINEMATICS = (
|
|
30
|
+
("finite", "finite strains"),
|
|
31
|
+
("small", "small strains (the gaps are still those of the deformed surfaces)"),
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _sample_fields() -> list[Field]:
|
|
36
|
+
"""The fields of the sample of a test: the morphology, its materials and its mesh."""
|
|
37
|
+
return [
|
|
38
|
+
Field("source", "item", label="morphology", required=True),
|
|
39
|
+
Field(
|
|
40
|
+
"materials",
|
|
41
|
+
"materials",
|
|
42
|
+
of="source",
|
|
43
|
+
doc="isotropic elastic constants of the phases, or voids: the mesh is that of "
|
|
44
|
+
"the solid phases, the surface of the pores free to touch itself",
|
|
45
|
+
),
|
|
46
|
+
Field(
|
|
47
|
+
"size",
|
|
48
|
+
"float",
|
|
49
|
+
label="element size",
|
|
50
|
+
unit="length",
|
|
51
|
+
doc="of the conforming mesh of the sample (blank: a twelfth of its smallest "
|
|
52
|
+
"edge); the tangent of the contacts is factorized: tens of thousands of nodes",
|
|
53
|
+
),
|
|
54
|
+
Field("order", "choice", "1", label="elements", choices=ELEMENTS),
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _sample(p: dict, ctx):
|
|
59
|
+
"""The mesh of the solid of the morphology of a form and the materials of its phases."""
|
|
60
|
+
from morphogen.config import MeshSpec
|
|
61
|
+
from morphogen.gui.tools.mechanics import _elastic
|
|
62
|
+
from morphogen.homogenization.bloch import voxel_tet_mesh
|
|
63
|
+
from morphogen.homogenization.materials import materials_from_config
|
|
64
|
+
from morphogen.mesh.conforming import conforming_mesh
|
|
65
|
+
|
|
66
|
+
elastic = _elastic(p["source"], p.get("materials"))
|
|
67
|
+
materials = materials_from_config(elastic)
|
|
68
|
+
voids = {int(k) for k, m in materials.items() if m.void}
|
|
69
|
+
if len(voids) == len(materials):
|
|
70
|
+
raise ValueError("materials: every phase is a void")
|
|
71
|
+
micro = p["source"]["micro"]
|
|
72
|
+
lengths = np.asarray(micro.domain.lengths, dtype=float)
|
|
73
|
+
size = p.get("size") or float(lengths.min()) / 12.0
|
|
74
|
+
if not 0.0 < size <= 0.5 * float(lengths.min()):
|
|
75
|
+
raise ValueError("element size: positive, at most half the smallest edge of the sample")
|
|
76
|
+
order = int(p["order"])
|
|
77
|
+
ctx.progress(0.03, "mesh")
|
|
78
|
+
options = MeshSpec(size=size, order=order).kwargs(voids)
|
|
79
|
+
options.update(hausdorff=size / 5.0, min_size=size / 3.0, periodic=False, cells="box")
|
|
80
|
+
try:
|
|
81
|
+
mesh = conforming_mesh(micro, **options)
|
|
82
|
+
except ValueError as exc: # no level set: six tetrahedra per voxel of its image
|
|
83
|
+
if "level-set" not in str(exc):
|
|
84
|
+
raise
|
|
85
|
+
mesh = voxel_tet_mesh(micro.voxelize(voxel_size=size))
|
|
86
|
+
mesh = mesh.quadratic() if order == 2 else mesh
|
|
87
|
+
phases = {int(k) for k in np.unique(mesh.phase)}
|
|
88
|
+
solid = sorted(phases - voids)
|
|
89
|
+
if not solid:
|
|
90
|
+
raise ValueError("the mesh of the sample has no solid phase")
|
|
91
|
+
if len(solid) < len(phases):
|
|
92
|
+
mesh = mesh.subset(solid)
|
|
93
|
+
if mesh.n_nodes > 60000:
|
|
94
|
+
raise ValueError(
|
|
95
|
+
f"{mesh.n_nodes} nodes: the tangent of the contacts is factorized (a larger "
|
|
96
|
+
"element size, or 4-node elements)"
|
|
97
|
+
)
|
|
98
|
+
return mesh, materials
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _curve(fig_axes, x, y, xlabel: str, ylabel: str) -> None:
|
|
102
|
+
fig_axes.plot(x, y, "o-", ms=3)
|
|
103
|
+
fig_axes.set_xlabel(xlabel)
|
|
104
|
+
fig_axes.set_ylabel(ylabel)
|
|
105
|
+
fig_axes.grid(True, lw=0.4, alpha=0.5)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@tool(
|
|
109
|
+
"platen_compression",
|
|
110
|
+
"contact",
|
|
111
|
+
"Compression between two platens",
|
|
112
|
+
"The compression of a morphology between two rigid platens across an axis, the lower "
|
|
113
|
+
"one fixed, the upper one brought down: its solid presses on the platens with "
|
|
114
|
+
"Coulomb's friction (none: lubricated platens, the sample widens freely; with friction "
|
|
115
|
+
"it barrels) and, where the walls of its pores, its struts or its sides meet, on "
|
|
116
|
+
"itself (a penalty on the integration points of the faces of the mesh, the nearest "
|
|
117
|
+
"point of the surface that they face). The nominal stress (the force over the section "
|
|
118
|
+
"of the box of the sample) against the nominal strain (the approach of the platens "
|
|
119
|
+
"over its height), the apparent modulus and its rise as the walls close, the areas in "
|
|
120
|
+
"contact and the energy that friction dissipated; the deformed sample with the "
|
|
121
|
+
"pressure of its contacts.",
|
|
122
|
+
[
|
|
123
|
+
*_sample_fields(),
|
|
124
|
+
Field("axis", "choice", "2", label="axis of the compression", choices=AXES),
|
|
125
|
+
Field(
|
|
126
|
+
"strain",
|
|
127
|
+
"float",
|
|
128
|
+
0.1,
|
|
129
|
+
label="compression at the end",
|
|
130
|
+
doc="nominal: the approach of the platens over the height of the sample (0.1: "
|
|
131
|
+
"compressed by 10 %)",
|
|
132
|
+
),
|
|
133
|
+
Field("steps", "int", 20),
|
|
134
|
+
Field(
|
|
135
|
+
"friction",
|
|
136
|
+
"float",
|
|
137
|
+
0.0,
|
|
138
|
+
label="friction of the platens",
|
|
139
|
+
doc="Coulomb's coefficient (0: lubricated)",
|
|
140
|
+
),
|
|
141
|
+
Field(
|
|
142
|
+
"self_contact",
|
|
143
|
+
"bool",
|
|
144
|
+
True,
|
|
145
|
+
label="the sample touches itself",
|
|
146
|
+
doc="the walls of its pores press on each other where they meet (with the "
|
|
147
|
+
"friction below); otherwise they go through each other",
|
|
148
|
+
),
|
|
149
|
+
Field(
|
|
150
|
+
"self_friction",
|
|
151
|
+
"float",
|
|
152
|
+
label="friction of the sample on itself",
|
|
153
|
+
when={"self_contact": [True]},
|
|
154
|
+
doc="blank: that of the platens",
|
|
155
|
+
),
|
|
156
|
+
Field(
|
|
157
|
+
"points",
|
|
158
|
+
"choice",
|
|
159
|
+
"gauss",
|
|
160
|
+
label="contact points",
|
|
161
|
+
choices=POINTS,
|
|
162
|
+
doc="of the faces of the sample: inside them, or at their nodes, for a sample "
|
|
163
|
+
"whose corners and edges meet the platens, or its own walls, first (a lattice "
|
|
164
|
+
"cut through its struts)",
|
|
165
|
+
),
|
|
166
|
+
Field("kinematics", "choice", "finite", choices=KINEMATICS),
|
|
167
|
+
],
|
|
168
|
+
order=1,
|
|
169
|
+
menu="Tests",
|
|
170
|
+
groups=(("Sample", "source"), ("Test", "axis"), ("Contact", "friction")),
|
|
171
|
+
)
|
|
172
|
+
def platen_compression(p: dict, ctx) -> dict:
|
|
173
|
+
from matplotlib.figure import Figure
|
|
174
|
+
|
|
175
|
+
from morphogen.contact import compression
|
|
176
|
+
|
|
177
|
+
strain, steps = p["strain"], p["steps"]
|
|
178
|
+
if not 0.0 < strain < 0.9:
|
|
179
|
+
raise ValueError("compression at the end: between 0 and 0.9")
|
|
180
|
+
if not 1 <= steps <= 400:
|
|
181
|
+
raise ValueError("steps: from 1 to 400")
|
|
182
|
+
if p["friction"] < 0 or (p.get("self_friction") or 0.0) < 0:
|
|
183
|
+
raise ValueError("friction: 0 or more")
|
|
184
|
+
mesh, materials = _sample(p, ctx)
|
|
185
|
+
ctx.progress(0.1, f"compression ({mesh.n_nodes} nodes)")
|
|
186
|
+
res = compression(
|
|
187
|
+
mesh,
|
|
188
|
+
materials,
|
|
189
|
+
-strain,
|
|
190
|
+
axis=int(p["axis"]),
|
|
191
|
+
friction=p["friction"],
|
|
192
|
+
self_contact=p["self_contact"],
|
|
193
|
+
self_friction=p.get("self_friction"),
|
|
194
|
+
points=p["points"],
|
|
195
|
+
steps=steps,
|
|
196
|
+
kinematics=p["kinematics"],
|
|
197
|
+
)
|
|
198
|
+
ctx.progress(0.9, "results")
|
|
199
|
+
ctx.table(res.rows(), "curve", "curve of the compression")
|
|
200
|
+
res.problem.write(ctx.path("compressed"), res.result)
|
|
201
|
+
fig = Figure(figsize=(9.4, 3.9), layout="constrained")
|
|
202
|
+
left, right = fig.subplots(1, 2)
|
|
203
|
+
_curve(left, -res.strain, -res.stress, "nominal compression", "nominal stress")
|
|
204
|
+
right.plot(-res.strain, res.area[:, 0], "o-", ms=3, label="fixed platen")
|
|
205
|
+
right.plot(-res.strain, res.area[:, 1], "s-", ms=3, label="moving platen")
|
|
206
|
+
if p["self_contact"]:
|
|
207
|
+
right.plot(-res.strain, res.self_area, "^-", ms=3, label="the sample with itself")
|
|
208
|
+
right.set_xlabel("nominal compression")
|
|
209
|
+
right.set_ylabel("area in contact")
|
|
210
|
+
right.grid(True, lw=0.4, alpha=0.5)
|
|
211
|
+
right.legend(fontsize=8)
|
|
212
|
+
ctx.figure(fig, "compression", "stress and areas in contact against the compression")
|
|
213
|
+
tangent = res.tangent()
|
|
214
|
+
values = {
|
|
215
|
+
"elements": mesh.n_elements,
|
|
216
|
+
"nodes": mesh.n_nodes,
|
|
217
|
+
"height of the sample": res.height,
|
|
218
|
+
"section of its box": res.section,
|
|
219
|
+
"nominal stress at the end": float(res.stress[-1]),
|
|
220
|
+
"apparent modulus (first step)": res.modulus,
|
|
221
|
+
"tangent modulus at the end": float(tangent[-1]),
|
|
222
|
+
"area in contact with the fixed platen": float(res.area[-1, 0]),
|
|
223
|
+
"area in contact with the moving platen": float(res.area[-1, 1]),
|
|
224
|
+
"area of the sample in contact with itself": float(res.self_area[-1]),
|
|
225
|
+
"energy dissipated by friction": float(res.friction[-1]),
|
|
226
|
+
"Newton iterations": int(np.sum(res.result.iterations)),
|
|
227
|
+
}
|
|
228
|
+
return {"values": values, "title": f"Compression of {p['source']['title']} between platens"}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
@tool(
|
|
232
|
+
"indentation_test",
|
|
233
|
+
"contact",
|
|
234
|
+
"Indentation",
|
|
235
|
+
"The indentation of the upper face of a morphology by a rigid sphere or cone, to a "
|
|
236
|
+
"depth and out again: the force against the depth, the area of the contact (that of "
|
|
237
|
+
"the integration points that press), the mean pressure (the hardness of an elastic "
|
|
238
|
+
"sample) and the reduced modulus E / (1 - ν²) that the force reads by Hertz's law (a "
|
|
239
|
+
"sphere) or Sneddon's (a cone) — that of the sample while the contact is small against "
|
|
240
|
+
"it and large against its heterogeneities; for a sphere, also with the rigid base "
|
|
241
|
+
"under the sample (a layer of finite thickness: Dimitriadis et al.), and from the "
|
|
242
|
+
"slope of the unloading (Oliver and Pharr).",
|
|
243
|
+
[
|
|
244
|
+
*_sample_fields(),
|
|
245
|
+
Field("axis", "choice", "2", label="axis of the indenter", choices=AXES),
|
|
246
|
+
Field(
|
|
247
|
+
"indenter",
|
|
248
|
+
"choice",
|
|
249
|
+
"sphere",
|
|
250
|
+
choices=(("sphere", "sphere"), ("cone", "cone")),
|
|
251
|
+
),
|
|
252
|
+
Field(
|
|
253
|
+
"radius",
|
|
254
|
+
"float",
|
|
255
|
+
label="radius of the sphere",
|
|
256
|
+
unit="length",
|
|
257
|
+
when={"indenter": ["sphere"]},
|
|
258
|
+
doc="blank: a quarter of the smallest edge of the sample",
|
|
259
|
+
),
|
|
260
|
+
Field(
|
|
261
|
+
"half_angle",
|
|
262
|
+
"float",
|
|
263
|
+
70.3,
|
|
264
|
+
label="half-angle of the cone (degrees)",
|
|
265
|
+
when={"indenter": ["cone"]},
|
|
266
|
+
doc="from its axis; 70.3: the cone of the area of the pyramids of Berkovich "
|
|
267
|
+
"and Vickers",
|
|
268
|
+
),
|
|
269
|
+
Field(
|
|
270
|
+
"depth",
|
|
271
|
+
"float",
|
|
272
|
+
label="depth",
|
|
273
|
+
unit="length",
|
|
274
|
+
doc="of the indentation (blank: a hundredth of the radius of the sphere, a "
|
|
275
|
+
"fortieth of the height of the sample for a cone)",
|
|
276
|
+
),
|
|
277
|
+
Field(
|
|
278
|
+
"point",
|
|
279
|
+
"floats",
|
|
280
|
+
label="point of the face",
|
|
281
|
+
doc="its two coordinates along the face (blank: its middle)",
|
|
282
|
+
),
|
|
283
|
+
Field("steps", "int", 8),
|
|
284
|
+
Field(
|
|
285
|
+
"unload",
|
|
286
|
+
"bool",
|
|
287
|
+
True,
|
|
288
|
+
label="then unload",
|
|
289
|
+
doc="withdraw the indenter in as many steps: the slope of the unloading",
|
|
290
|
+
),
|
|
291
|
+
Field(
|
|
292
|
+
"base",
|
|
293
|
+
"choice",
|
|
294
|
+
"fixed",
|
|
295
|
+
label="lower face of the sample",
|
|
296
|
+
choices=(("fixed", "glued to its support"), ("smooth", "sliding on it")),
|
|
297
|
+
),
|
|
298
|
+
Field("friction", "float", 0.0, label="friction of the indenter"),
|
|
299
|
+
Field(
|
|
300
|
+
"poisson",
|
|
301
|
+
"float",
|
|
302
|
+
label="Poisson's ratio of the sample",
|
|
303
|
+
when={"indenter": ["sphere"]},
|
|
304
|
+
doc="to read the modulus with the rigid base under the sample (blank: not read)",
|
|
305
|
+
),
|
|
306
|
+
Field("kinematics", "choice", "finite", choices=KINEMATICS),
|
|
307
|
+
],
|
|
308
|
+
order=2,
|
|
309
|
+
menu="Tests",
|
|
310
|
+
groups=(("Sample", "source"), ("Indenter", "axis"), ("Test", "depth")),
|
|
311
|
+
)
|
|
312
|
+
def indentation_test(p: dict, ctx) -> dict:
|
|
313
|
+
from matplotlib.figure import Figure
|
|
314
|
+
|
|
315
|
+
from morphogen.contact import hertz_sphere, indentation, sneddon_cone
|
|
316
|
+
|
|
317
|
+
steps = p["steps"]
|
|
318
|
+
if not 1 <= steps <= 200:
|
|
319
|
+
raise ValueError("steps: from 1 to 200")
|
|
320
|
+
if p["friction"] < 0:
|
|
321
|
+
raise ValueError("friction: 0 or more")
|
|
322
|
+
mesh, materials = _sample(p, ctx)
|
|
323
|
+
axis = int(p["axis"])
|
|
324
|
+
edges = np.asarray(mesh.size, dtype=float)
|
|
325
|
+
sphere = p["indenter"] == "sphere"
|
|
326
|
+
radius = (p.get("radius") or 0.25 * float(edges.min())) if sphere else None
|
|
327
|
+
depth = p.get("depth") or (0.01 * radius if sphere else edges[axis] / 40.0)
|
|
328
|
+
point = p.get("point") or None
|
|
329
|
+
if point is not None and len(point) != 2:
|
|
330
|
+
raise ValueError("point of the face: its two coordinates along the face")
|
|
331
|
+
poisson = p.get("poisson")
|
|
332
|
+
if poisson is not None and not -1.0 < poisson <= 0.5:
|
|
333
|
+
raise ValueError("Poisson's ratio of the sample: in (-1, 0.5]")
|
|
334
|
+
ctx.progress(0.1, f"indentation ({mesh.n_nodes} nodes)")
|
|
335
|
+
res = indentation(
|
|
336
|
+
mesh,
|
|
337
|
+
materials,
|
|
338
|
+
depth,
|
|
339
|
+
indenter=p["indenter"],
|
|
340
|
+
radius=radius,
|
|
341
|
+
half_angle=p["half_angle"],
|
|
342
|
+
point=point,
|
|
343
|
+
axis=axis,
|
|
344
|
+
friction=p["friction"],
|
|
345
|
+
steps=steps,
|
|
346
|
+
unload=p["unload"],
|
|
347
|
+
base=p["base"],
|
|
348
|
+
kinematics=p["kinematics"],
|
|
349
|
+
)
|
|
350
|
+
ctx.progress(0.9, "results")
|
|
351
|
+
ctx.table(res.rows(), "curve", "curve of the indentation")
|
|
352
|
+
peak = int(np.argmax(res.depth))
|
|
353
|
+
res.problem.write(ctx.path("indented"), res.result, step=peak)
|
|
354
|
+
fig = Figure(figsize=(9.4, 3.9), layout="constrained")
|
|
355
|
+
left, right = fig.subplots(1, 2)
|
|
356
|
+
_curve(left, res.depth, res.force, "depth", "force")
|
|
357
|
+
# the law of the half-space of the modulus read at the largest depth
|
|
358
|
+
h = np.linspace(0.0, float(res.depth[peak]), 50)
|
|
359
|
+
read = float(res.modulus[peak])
|
|
360
|
+
law = [
|
|
361
|
+
0.0 if d <= 0 else (
|
|
362
|
+
hertz_sphere(radius, read, approach=d)["force"] if sphere
|
|
363
|
+
else sneddon_cone(p["half_angle"], read, d)["force"]
|
|
364
|
+
)
|
|
365
|
+
for d in h
|
|
366
|
+
] # fmt: skip
|
|
367
|
+
left.plot(h, law, "--", lw=1.0, label="Hertz" if sphere else "Sneddon")
|
|
368
|
+
left.legend(fontsize=8)
|
|
369
|
+
_curve(right, res.depth[: peak + 1], res.modulus[: peak + 1], "depth", "reduced modulus read")
|
|
370
|
+
ctx.figure(fig, "indentation", "force and modulus read against the depth")
|
|
371
|
+
values = {
|
|
372
|
+
"elements": mesh.n_elements,
|
|
373
|
+
"nodes": mesh.n_nodes,
|
|
374
|
+
"depth": float(res.depth[peak]),
|
|
375
|
+
"force": float(res.force[peak]),
|
|
376
|
+
"area of the contact": float(res.area[peak]),
|
|
377
|
+
"radius of the contact": float(res.radius[peak]),
|
|
378
|
+
"largest pressure": float(res.pressure[peak]),
|
|
379
|
+
"mean pressure (hardness)": float(res.hardness[peak]),
|
|
380
|
+
"reduced modulus read (a half-space)": read,
|
|
381
|
+
}
|
|
382
|
+
if sphere:
|
|
383
|
+
values["radius of the sphere"] = float(radius)
|
|
384
|
+
if poisson is not None:
|
|
385
|
+
values["reduced modulus read (with the base of the sample)"] = float(
|
|
386
|
+
res.layer_modulus(poisson)[peak]
|
|
387
|
+
)
|
|
388
|
+
if res.unloading_modulus is not None:
|
|
389
|
+
values["stiffness of the unloading"] = res.stiffness
|
|
390
|
+
values["reduced modulus of the unloading"] = res.unloading_modulus
|
|
391
|
+
return {"values": values, "title": f"Indentation of {p['source']['title']}"}
|