![]() |
PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
|
Functions | |
| list[dict[str, float]] | read_sites (str|os.PathLike[str] csv=CSV) |
| Deck | build_deck (str|os.PathLike[str] output_path="runs/out/", *str preset="short", float|None final_time=None, int|None num_steps=None, int|None output_interval=None, float omega=OMEGA, str|os.PathLike[str] mesh_dir=MESH_DIR, str|os.PathLike[str] csv=CSV) |
| int | main (list[str]|None argv=None) |
| None | validate_sites (list[dict[str, float]] rows) |
| dict[str, object] | pack_geometry (int ncols=NCOLS, int nrows=NROWS, float r=R, float mesh_size=MESH_SIZE) |
| Deck | build_deck (str|os.PathLike[str] output_path="runs/", *int ncols=NCOLS, int nrows=NROWS, float final_time=FINAL_TIME, int num_steps=NUM_STEPS, float mesh_size=MESH_SIZE, int search_interval=SEARCH_INTERVAL, str|os.PathLike[str]|None mesh_dir=None, bool write_mesh=True, bool in_process_mesh=False) |
| Deck | build_deck (str|os.PathLike[str] output_path="runs/", *float final_time=FINAL_TIME, int num_steps=NUM_STEPS, float mesh_size=MESH_SIZE, float|None horizon=None, str|os.PathLike[str]|None mesh_dir=None, tuple[str, str]|None mesh_files=None, bool write_mesh=True, bool in_process_mesh=False) |
| float | _nu (float E_, float K_) |
| list[list[float]] | notch_void_boxes (float h, float notch_half, float notch_w, float notch_depth, float z_lo, float z_hi) |
| Deck | build_deck (str|os.PathLike[str] output_path="runs/out/", *bool dim3=False, bool quick=False, float|None final_time=None, float|None dt=None, int|None num_steps=None, str|os.PathLike[str]|None mesh_dir=None, float v_impact=IMPACT_V) |
| int | seed_prenotch (sim, dict[str, float] info) |
| np.ndarray | run_with_arrival_times (sim, dict[str, float] info, *float threshold=0.30) |
| tuple[float, int, float]|None | crack_speed (sim, np.ndarray arrival, dict[str, float] info) |
| Deck | build_deck (str|os.PathLike[str] output_path="out/", *float final_time=FINAL_TIME, int num_steps=NUM_STEPS, float|None mesh_size=None, float|None horizon=None, bool damping_on=False, float eps=EPSILON, bool zero_ic=False, str|os.PathLike[str]|None mesh_dir=None, bool write_mesh=True, bool in_process_mesh=False) |
| Deck | build_deck (str|os.PathLike[str] output_path="runs/", *float final_time=FINAL_TIME, int num_steps=NUM_STEPS, int output_interval=1000, str|os.PathLike[str]|None mesh=None, float|None mesh_size=None, list[str]|None tags=None) |
| Deck | build_deck (str|os.PathLike[str] output_path="runs/", *float final_time=FINAL_TIME, int num_steps=NUM_STEPS, int output_interval=2000, float mesh_size=MESH_SIZE, float horizon=HORIZON, list[str]|None tags=None) |
Variables | |
| HERE = Path(__file__).resolve().parent | |
| str | MESH_DIR = HERE / "meshes" |
| str | CSV = HERE / "particle_locations_0.csv" |
| float | HORIZON = 6.0e-4 |
| float | DENSITY = 1200.0 |
| float | R_IN = 0.02 |
| R_SMALL | |
| R_LARGE | |
| float | OMEGA = -20.0 * math.pi |
| float | GRAVITY = 10.0 |
| dict | R_REF = {0: R_SMALL, 1: R_SMALL, 2: R_SMALL, 3: R_LARGE, 4: R_LARGE, 5: R_LARGE} |
| list | MESH_FILES |
| list | WALL_PARAMS |
| dict | KN |
| dict | K_MAT = {0: 1.0e4, 1: 1.0e5, 2: 1.0e5} |
| float | KN_FACTOR = 1.0 |
| list | GRAIN_SHAPES |
| dict | PRESETS |
| list | TAGS |
| float | MESH_SIZE = R_SMALL / 5.0 |
| float | R_OUT = R_IN + 1.5 * MESH_SIZE |
| float | L_BAR = 0.005 |
| float | W_BAR = 1.5 * MESH_SIZE |
| tuple | ROT_CENTER = (-0.2 * R_IN, 0.2 * R_IN, 0.0) |
| float | BETA_N_FACTOR = 100.0 |
| float | EPSILON = 0.95 |
| float | CONTACT_RADIUS_FACTOR = 0.95 |
| float | FRICTION_COEFF = 0.5 |
| int | SEARCH_INTERVAL = 40 |
| float | SEARCH_FACTOR = 10.0 |
| float | R = 0.001 |
| float | K = 2.16e7 |
| float | NU = 0.25 |
| float | GC = 50.0 |
| float | WALL_VY = -0.06 |
| NCOLS | |
| NROWS | |
| float | FINAL_TIME = 0.004 |
| int | NUM_STEPS = 20000 |
| float | W = 0.0008 |
| float | H = 0.0012 |
| A_OUT | |
| B_OUT | |
| A_IN | |
| B_IN | |
| float | ELL_THETA = 0.0 |
| float | TIP_GAP = 0.00008 |
| RHO_T | |
| K_T | |
| NU_T | |
| GC_T | |
| RHO_E | |
| K_E | |
| NU_E | |
| GC_E | |
| float | R_CONTACT_FACTOR = 0.95 |
| float | IC_VY = -2.5 |
| str | MESH_TRI = "mesh_triangle.msh" |
| str | MESH_ELL = "mesh_hollow_ellipse.msh" |
| float | NOTCH_DEPTH = 0.050 |
| float | NOTCH_HALF = 0.025 |
| float | NOTCH_W = 0.0015 |
| float | THICKNESS = 0.009 |
| IW | |
| IH | |
| float | IMPACT_V = 32.0 |
| float | IMPACTOR_MASS = 1.57 |
| float | RC_FACTOR = 0.95 |
| float | RHO = 8000.0 |
| float | E = 191.0e9 |
| float | K_BULK = 159.2e9 |
| float | DT = 2.5e-9 |
| QUICK | |
| float | R1 = 0.001 |
| float | PARTICLE_DIST = 0.001 |
| float | RADIUS = 0.003 |
| float | PULL_RATE = 0.005 |
| str | MESH_FILE = "mesh_cir_1_0.msh" |
| float | SIDE = 0.01 |
Attrition sim1: a rotating drum with an inward protrusion. Circles, triangles and drums in two sizes tumble inside a cylinder that is spun by a rotation displacement BC; the protrusion grinds them. This is the deck behind ``attrition_test_sim1.gif`` in the top-level README. The deck is assembled through :class:`peridem.Deck`. The wall is a complex geometry, an outer circle with an inner circle removed and a protrusion rectangle added. It is placed at its signed-volume centroid, computed by the geometry object. The mesh axis is at the origin, so any other site translates the mesh. ``gen_input.py`` next to this file writes the same decks as JSON for ``bin/PeriDEM``. ``python/tests/test_example_parity.py`` compares the two.
Attrition sim2: thin rotating container with an off-centre spin axis. Circles, triangles, drums and hexagons in two sizes inside a thin-walled cylinder with an inward bar. The container spins twice as fast as sim1 and about a point offset from the origin, which throws the pack against the bar. The deck is assembled through :class:`peridem.Deck`. Every parameter whose default changes the result is set here. ``INPUT_DEFAULTS.md`` in this folder records which those are.
Compression of a small circular-grain pack, set up in Python. Parameters from Jha et al., J. Mech. Phys. Solids 151 (2021) 104376, section 4.3: material M1, lc = R/5, horizon = 3 lc, Rc = 0.95 h, C-bar = 100 and plate velocity -0.06 m/s. The pack here is 4 by 3 grains and not the 502 of the paper. The grain positions, the open channel that contains them and the moving plate are derived from R and the pack size, and no deck file is read. ``test/test_data/peridem/jha2021_comp_n50/main.cpp`` builds the same deck in C++. ``python/tests/test_example_parity.py`` compares the two decks key by key.
Hollow ellipse dropped onto a short tip-up triangle, set up in Python. ``main.cpp`` in this folder builds the same deck in C++, with the same geometry, materials and contact parameters. ``python/tests/test_example_parity.py`` compares the two decks key by key, so that the comparison of the two runs is a comparison of the interfaces and not of two problems. Contact at the tip opens a crack. The ring separates into two pieces.
Silling 2003 Kalthoff-Winkler notched-plate impact, 2D and 3D, from Python. A 200 x 100 mm maraging-steel plate with two open 1.5 mm notches is struck edge-on by a rigid 1.57 kg cylinder at 32 m/s. Silling reports cracks running from the notch tips at roughly 900 m/s and about 70 degrees to the notch. This example uses the parts of the interface a pure JSON deck cannot reach: * ``sim.setup()`` builds the model, then ``sim.break_bonds_in_slots(...)`` seeds the pre-notch by cutting the peridynamic bonds that span each slot -- the same operation the C++ driver does between ``init()`` and the time loop; * ``sim.integrate()`` then runs the loop *without* re-initialising, or :func:`run_with_arrival_times` drives the loop step by step from Python to record when each node first becomes damaged, which gives the crack speed. ``Test_PeriDEM_notched_impact_inbuilt`` builds the same deck in C++. ``python/tests/test_example_parity.py`` compares the two decks key by key.
Two deformable circles: one fixed, one dropped onto it. Two grains, one contact pair, gravity and an initial velocity. Both meshes are built by Gmsh in the calling process and nothing is read from disk. ``test/test_data/peridem/twop_circ_inbuilt/main.cpp``, compiled with TWOP_CONTACT_EXAMPLE as the target example_twop_circ_contact, builds the same deck in C++.
Single circular particle: fixed SW patch, linear pull on the NE patch. The deck is built in Python. ``input.json`` next to this file states the same problem as a deck file. ``python/tests/test_example_parity.py`` runs the Python deck through ``bin/PeriDEM`` and through the in-process interface and compares the node fields.
Single rectangular particle pulled diagonally. The south-west corner is fixed and the north-east corner is pulled at a constant rate. The deck is built in Python and the mesh is generated in the calling process, so no ``.msh`` file is read or written.
|
protected |
Definition at line 80 of file problem.py.
Referenced by build_deck().
| Deck problem.build_deck | ( | str | os.PathLike[str] | output_path = "out/", |
| *float | final_time = FINAL_TIME, |
||
| int | num_steps = NUM_STEPS, |
||
| float | None | mesh_size = None, |
||
| float | None | horizon = None, |
||
| bool | damping_on = False, |
||
| float | eps = EPSILON, |
||
| bool | zero_ic = False, |
||
| str | os.PathLike[str] | None | mesh_dir = None, |
||
| bool | write_mesh = True, |
||
| bool | in_process_mesh = False |
||
| ) |
Definition at line 58 of file problem.py.
References build_deck().
| Deck problem.build_deck | ( | str | os.PathLike[str] | output_path = "runs/", |
| *float | final_time = FINAL_TIME, |
||
| int | num_steps = NUM_STEPS, |
||
| float | mesh_size = MESH_SIZE, |
||
| float | None | horizon = None, |
||
| str | os.PathLike[str] | None | mesh_dir = None, |
||
| tuple[str, str] | None | mesh_files = None, |
||
| bool | write_mesh = True, |
||
| bool | in_process_mesh = False |
||
| ) |
Assemble the deck. ``in_process_mesh`` keeps Gmsh output in memory and writes no ``.msh``, which is what the README demo uses. The parity runs instead point both the Python and the C++ side at the same ``.msh`` files under ``mesh_dir``.
Definition at line 66 of file problem.py.
References build_deck().
| Deck problem.build_deck | ( | str | os.PathLike[str] | output_path = "runs/", |
| *float | final_time = FINAL_TIME, |
||
| int | num_steps = NUM_STEPS, |
||
| int | output_interval = 1000, |
||
| str | os.PathLike[str] | None | mesh = None, |
||
| float | None | mesh_size = None, |
||
| list[str] | None | tags = None |
||
| ) |
Assemble the deck. Pass ``mesh_size`` to have Gmsh build the disc in memory (no ``.msh`` on disk); otherwise the committed ``mesh_cir_1_0.msh`` is read, which is what the parity run against ``bin/PeriDEM`` uses.
Definition at line 53 of file problem.py.
References build_deck().
| Deck problem.build_deck | ( | str | os.PathLike[str] | output_path = "runs/", |
| *float | final_time = FINAL_TIME, |
||
| int | num_steps = NUM_STEPS, |
||
| int | output_interval = 2000, |
||
| float | mesh_size = MESH_SIZE, |
||
| float | horizon = HORIZON, |
||
| list[str] | None | tags = None |
||
| ) |
Definition at line 51 of file problem.py.
References build_deck().
| Deck problem.build_deck | ( | str | os.PathLike[str] | output_path = "runs/", |
| *int | ncols = NCOLS, |
||
| int | nrows = NROWS, |
||
| float | final_time = FINAL_TIME, |
||
| int | num_steps = NUM_STEPS, |
||
| float | mesh_size = MESH_SIZE, |
||
| int | search_interval = SEARCH_INTERVAL, |
||
| str | os.PathLike[str] | None | mesh_dir = None, |
||
| bool | write_mesh = True, |
||
| bool | in_process_mesh = False |
||
| ) |
Definition at line 91 of file problem.py.
References build_deck(), and pack_geometry().
| Deck problem.build_deck | ( | str | os.PathLike[str] | output_path = "runs/out/", |
| *bool | dim3 = False, |
||
| bool | quick = False, |
||
| float | None | final_time = None, |
||
| float | None | dt = None, |
||
| int | None | num_steps = None, |
||
| str | os.PathLike[str] | None | mesh_dir = None, |
||
| float | v_impact = IMPACT_V |
||
| ) |
Definition at line 95 of file problem.py.
References _nu(), and notch_void_boxes().
| Deck problem.build_deck | ( | str | os.PathLike[str] | output_path = "runs/out/", |
| *str | preset = "short", |
||
| float | None | final_time = None, |
||
| int | None | num_steps = None, |
||
| int | None | output_interval = None, |
||
| float | omega = OMEGA, |
||
| str | os.PathLike[str] | mesh_dir = MESH_DIR, |
||
| str | os.PathLike[str] | csv = CSV |
||
| ) |
Definition at line 125 of file problem.py.
References read_sites().
Referenced by build_deck(), build_deck(), build_deck(), build_deck(), build_deck(), crack_speed(), main(), and validate_sites().
| tuple[float, int, float] | None problem.crack_speed | ( | sim, | |
| np.ndarray | arrival, | ||
| dict[str, float] | info | ||
| ) |
Least-squares crack-tip speed from the arrival-time field. Fits distance-from-the-right-notch-tip against arrival time over damaged plate nodes below the tip (where the crack runs) and within half the plate height of it. Returns (m/s, points used, correlation). The returned correlation states how well the fit holds. If damage spreads through the plate instead of advancing as a front, the fit has no meaning and the correlation is low. The ``--quick`` settings produce that, on a plate of 40 by 20 mm with E = 1.23 GPa.
Definition at line 264 of file problem.py.
References build_deck(), crack_speed(), run_with_arrival_times(), and seed_prenotch().
Referenced by crack_speed().
| int problem.main | ( | list[str] | None | argv = None | ) |
Definition at line 198 of file problem.py.
References build_deck().
| list[list[float]] problem.notch_void_boxes | ( | float | h, |
| float | notch_half, | ||
| float | notch_w, | ||
| float | notch_depth, | ||
| float | z_lo, | ||
| float | z_hi | ||
| ) |
The two notch slots as boxes, open at the top edge.
Definition at line 84 of file problem.py.
Referenced by build_deck().
| dict[str, object] problem.pack_geometry | ( | int | ncols = NCOLS, |
| int | nrows = NROWS, |
||
| float | r = R, |
||
| float | mesh_size = MESH_SIZE |
||
| ) |
Pack spacing and container dimensions, all derived from R and the mesh. The gap between grains is slightly larger than the contact radius, so that no pair is in contact at t = 0. Gravity and the plate bring pairs into contact.
Definition at line 61 of file problem.py.
Referenced by build_deck().
| list[dict[str, float]] problem.read_sites | ( | str | os.PathLike[str] | csv = CSV | ) |
Packed grain sites: ``zone, x, y, z, r, theta`` per row.
Definition at line 105 of file problem.py.
Referenced by build_deck(), and validate_sites().
| np.ndarray problem.run_with_arrival_times | ( | sim, | |
| dict[str, float] | info, | ||
| *float | threshold = 0.30 |
||
| ) |
Drive the time loop from Python, recording first-damage time per node. The arrival-time field is what gives the crack speed Silling reports. Returns an array of length n_nodes, -1 where the node never damaged.
Definition at line 228 of file problem.py.
Referenced by crack_speed().
| int problem.seed_prenotch | ( | sim, | |
| dict[str, float] | info | ||
| ) |
Cut the peridynamic bonds that span the two notch slots. The slots are already absent from the mesh, but the horizon is twice the slot width, so bonds still reach across them. Must run after ``setup()``.
Definition at line 212 of file problem.py.
Referenced by crack_speed().
| None problem.validate_sites | ( | list[dict[str, float]] | rows | ) |
Reject a pack that starts inside the wall, the bar, or another grain.
Definition at line 129 of file problem.py.
References build_deck(), and read_sites().
| problem.A_IN |
Definition at line 44 of file problem.py.
| problem.A_OUT |
Definition at line 43 of file problem.py.
| problem.B_IN |
Definition at line 44 of file problem.py.
| problem.B_OUT |
Definition at line 43 of file problem.py.
| float problem.BETA_N_FACTOR = 100.0 |
Definition at line 85 of file problem.py.
| float problem.CONTACT_RADIUS_FACTOR = 0.95 |
Definition at line 87 of file problem.py.
| str problem.CSV = HERE / "particle_locations_0.csv" |
Definition at line 45 of file problem.py.
| float problem.DENSITY = 1200.0 |
Definition at line 48 of file problem.py.
| float problem.DT = 2.5e-9 |
Definition at line 68 of file problem.py.
| float problem.E = 191.0e9 |
Definition at line 64 of file problem.py.
| float problem.ELL_THETA = 0.0 |
Definition at line 45 of file problem.py.
| float problem.EPSILON = 0.95 |
Definition at line 86 of file problem.py.
| float problem.FINAL_TIME = 0.004 |
Definition at line 50 of file problem.py.
| float problem.FRICTION_COEFF = 0.5 |
Definition at line 88 of file problem.py.
| float problem.GC = 50.0 |
Definition at line 45 of file problem.py.
| problem.GC_E |
Definition at line 51 of file problem.py.
| problem.GC_T |
Definition at line 49 of file problem.py.
| list problem.GRAIN_SHAPES |
Definition at line 86 of file problem.py.
| float problem.GRAVITY = 10.0 |
Definition at line 52 of file problem.py.
| problem.H = 0.0012 |
Definition at line 40 of file problem.py.
| problem.HERE = Path(__file__).resolve().parent |
Definition at line 33 of file problem.py.
| float problem.HORIZON = 6.0e-4 |
Definition at line 47 of file problem.py.
| float problem.IC_VY = -2.5 |
Definition at line 55 of file problem.py.
| problem.IH |
Definition at line 55 of file problem.py.
| float problem.IMPACT_V = 32.0 |
Definition at line 56 of file problem.py.
| float problem.IMPACTOR_MASS = 1.57 |
Definition at line 57 of file problem.py.
| problem.IW |
Definition at line 55 of file problem.py.
| float problem.K = 2.16e7 |
Definition at line 43 of file problem.py.
| float problem.K_BULK = 159.2e9 |
Definition at line 65 of file problem.py.
| problem.K_E |
Definition at line 51 of file problem.py.
| dict problem.K_MAT = {0: 1.0e4, 1: 1.0e5, 2: 1.0e5} |
Definition at line 82 of file problem.py.
| problem.K_T |
Definition at line 49 of file problem.py.
| dict problem.KN |
Definition at line 74 of file problem.py.
| float problem.KN_FACTOR = 1.0 |
Definition at line 83 of file problem.py.
| float problem.L_BAR = 0.005 |
Definition at line 47 of file problem.py.
| str problem.MESH_DIR = HERE / "meshes" |
Definition at line 44 of file problem.py.
| str problem.MESH_ELL = "mesh_hollow_ellipse.msh" |
Definition at line 63 of file problem.py.
| str problem.MESH_FILE = "mesh_cir_1_0.msh" |
Definition at line 50 of file problem.py.
| tuple problem.MESH_FILES |
Definition at line 57 of file problem.py.
| float problem.MESH_SIZE = R_SMALL / 5.0 |
Definition at line 43 of file problem.py.
| str problem.MESH_TRI = "mesh_triangle.msh" |
Definition at line 62 of file problem.py.
| problem.NCOLS |
Definition at line 49 of file problem.py.
| float problem.NOTCH_DEPTH = 0.050 |
Definition at line 49 of file problem.py.
| float problem.NOTCH_HALF = 0.025 |
Definition at line 50 of file problem.py.
| float problem.NOTCH_W = 0.0015 |
Definition at line 51 of file problem.py.
| problem.NROWS |
Definition at line 49 of file problem.py.
| float problem.NU = 0.25 |
Definition at line 44 of file problem.py.
| problem.NU_E |
Definition at line 51 of file problem.py.
| problem.NU_T |
Definition at line 49 of file problem.py.
| int problem.NUM_STEPS = 20000 |
Definition at line 51 of file problem.py.
| float problem.OMEGA = -20.0 * math.pi |
Definition at line 51 of file problem.py.
| float problem.PARTICLE_DIST = 0.001 |
Definition at line 39 of file problem.py.
| dict problem.PRESETS |
Definition at line 95 of file problem.py.
| float problem.PULL_RATE = 0.005 |
Definition at line 44 of file problem.py.
| problem.QUICK |
Definition at line 75 of file problem.py.
| float problem.R = 0.001 |
Definition at line 40 of file problem.py.
| float problem.R1 = 0.001 |
Definition at line 38 of file problem.py.
| float problem.R_CONTACT_FACTOR = 0.95 |
Definition at line 53 of file problem.py.
| float problem.R_IN = 0.02 |
Definition at line 49 of file problem.py.
| problem.R_LARGE |
Definition at line 50 of file problem.py.
Definition at line 46 of file problem.py.
Definition at line 55 of file problem.py.
| problem.R_SMALL |
Definition at line 50 of file problem.py.
| float problem.RADIUS = 0.003 |
Definition at line 35 of file problem.py.
| float problem.RC_FACTOR = 0.95 |
Definition at line 60 of file problem.py.
| float problem.RHO = 8000.0 |
Definition at line 63 of file problem.py.
| problem.RHO_E |
Definition at line 51 of file problem.py.
| problem.RHO_T |
Definition at line 49 of file problem.py.
Definition at line 53 of file problem.py.
| float problem.SEARCH_FACTOR = 10.0 |
Definition at line 90 of file problem.py.
| int problem.SEARCH_INTERVAL = 40 |
Definition at line 89 of file problem.py.
| float problem.SIDE = 0.01 |
Definition at line 34 of file problem.py.
| list problem.TAGS |
Definition at line 101 of file problem.py.
| float problem.THICKNESS = 0.009 |
Definition at line 52 of file problem.py.
| float problem.TIP_GAP = 0.00008 |
Definition at line 46 of file problem.py.
| problem.W = 0.0008 |
Definition at line 39 of file problem.py.
| float problem.W_BAR = 1.5 * MESH_SIZE |
Definition at line 48 of file problem.py.
| list problem.WALL_PARAMS |
Definition at line 68 of file problem.py.
| float problem.WALL_VY = -0.06 |
Definition at line 46 of file problem.py.