weac 2.4.1__py3-none-any.whl → 2.5.1__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.
weac/plot.py CHANGED
@@ -2,14 +2,16 @@
2
2
  # pylint: disable=invalid-name,too-many-locals,too-many-branches
3
3
  # pylint: disable=too-many-arguments,too-many-statements
4
4
 
5
- # Third party imports
5
+ # Standard library imports
6
6
  import os
7
- import numpy as np
8
- import matplotlib.pyplot as plt
9
- import matplotlib.colors as mc
10
7
  import colorsys
11
8
 
12
- # Project imports
9
+ # Third party imports
10
+ import matplotlib.colors as mc
11
+ import matplotlib.pyplot as plt
12
+ import numpy as np
13
+
14
+ # Local application imports
13
15
  from weac.tools import isnotebook
14
16
 
15
17
  # === SET PLOT STYLES =========================================================
@@ -173,7 +175,7 @@ def slab_profile(instance):
173
175
  ax1.set_xlim(500, 0)
174
176
 
175
177
  ax1.fill_betweenx(y, 0, x)
176
-
178
+
177
179
  # Save figure
178
180
  save_plot(name='profile')
179
181
 
@@ -188,7 +190,8 @@ def slab_profile(instance):
188
190
 
189
191
  def deformed(instance, xsl, xwl, z, phi, dz=2, scale=100,
190
192
  window=np.inf, pad=2, levels=300, aspect=2,
191
- field='principal', normalize=True, dark=False):
193
+ field='principal', normalize=True, dark=False,
194
+ filename='cont'):
192
195
  """
193
196
  Plot 2D deformed solution with displacement or stress fields.
194
197
 
@@ -378,7 +381,7 @@ def deformed(instance, xsl, xwl, z, phi, dz=2, scale=100,
378
381
 
379
382
  # Plot labels
380
383
  plt.gca().set_xlabel(r'lateral position $x$ (cm) $\longrightarrow$')
381
- plt.gca().set_ylabel('depth below surface\n' r'$\longleftarrow $ $d$ (cm)')
384
+ plt.gca().set_ylabel('depth below surface\n' + r'$\longleftarrow $ $d$ (cm)')
382
385
  plt.title(fr'${scale}\!\times\!$ scaled deformations (cm)', size=10)
383
386
 
384
387
  # Show colorbar
@@ -387,7 +390,10 @@ def deformed(instance, xsl, xwl, z, phi, dz=2, scale=100,
387
390
  label=label, aspect=35)
388
391
 
389
392
  # Save figure
390
- save_plot(name='cont')
393
+ save_plot(name=filename)
394
+
395
+ # Clear Canvas
396
+ plt.close()
391
397
 
392
398
  # Reset plot styles
393
399
  plt.rcdefaults()
@@ -490,6 +496,9 @@ def plot_data(
490
496
  # Save figure
491
497
  save_plot(name)
492
498
 
499
+ # Clear canvas
500
+ plt.close()
501
+
493
502
  # Reset plot styles
494
503
  plt.rcdefaults()
495
504
 
@@ -497,7 +506,7 @@ def plot_data(
497
506
  # === PLOT WRAPPERS ===========================================================
498
507
 
499
508
 
500
- def displacements(instance, x, z, **segments):
509
+ def displacements(instance, x, z, i='', **segments):
501
510
  """Wrap for dispalcements plot."""
502
511
  data = [
503
512
  [x/10, instance.u(z, z0=0, unit='mm'), r'$u_0\ (\mathrm{mm})$'],
@@ -505,10 +514,10 @@ def displacements(instance, x, z, **segments):
505
514
  [x/10, instance.psi(z, unit='degrees'), r'$\psi\ (^\circ)$ '],
506
515
  ]
507
516
  plot_data(ax1label=r'Displacements', ax1data=data,
508
- name='disp', **segments)
517
+ name='disp' + str(i), **segments)
509
518
 
510
519
 
511
- def section_forces(instance, x, z, **segments):
520
+ def section_forces(instance, x, z, i='', **segments):
512
521
  """Wrap section forces plot."""
513
522
  data = [
514
523
  [x/10, instance.N(z), r'$N$'],
@@ -516,17 +525,17 @@ def section_forces(instance, x, z, **segments):
516
525
  [x/10, instance.V(z), r'$V$']
517
526
  ]
518
527
  plot_data(ax1label=r'Section forces', ax1data=data,
519
- name='forc', **segments)
528
+ name='forc' + str(i), **segments)
520
529
 
521
530
 
522
- def stresses(instance, x, z, **segments):
531
+ def stresses(instance, x, z, i='', **segments):
523
532
  """Wrap stress plot."""
524
533
  data = [
525
534
  [x/10, instance.tau(z, unit='kPa'), r'$\tau$'],
526
535
  [x/10, instance.sig(z, unit='kPa'), r'$\sigma$']
527
536
  ]
528
537
  plot_data(ax1label=r'Stress (kPa)', ax1data=data,
529
- name='stress', **segments)
538
+ name='stress' + str(i), **segments)
530
539
 
531
540
 
532
541
  def stress_criteria(x, stress, **segments):
@@ -605,7 +614,7 @@ def save_plot(name):
605
614
  name : string
606
615
  Name for the figure.
607
616
  """
608
- filename = name + '.pdf'
617
+ filename = name + '.png'
609
618
  # Show figure if on jupyter notebook
610
619
  if isnotebook():
611
620
  plt.show()
weac/tools.py CHANGED
@@ -7,6 +7,7 @@ from IPython import get_ipython
7
7
 
8
8
  # Third party imports
9
9
  import numpy as np
10
+ import weac
10
11
 
11
12
 
12
13
  def time():
@@ -249,3 +250,62 @@ def tensile_strength_slab(rho, unit='kPa'):
249
250
  rho_ice = 917
250
251
  # Sigrist's equation is given in kPa
251
252
  return convert[unit]*240*(rho/rho_ice)**2.44
253
+
254
+ def touchdown_distance(
255
+ layers: np.ndarray | str | None = None,
256
+ C0: float = 6.5,
257
+ C1: float = 4.4,
258
+ Ewl: float = 0.25,
259
+ t: float = 10,
260
+ phi: float = 0):
261
+ """
262
+ Calculate cut length at first contanct and steady-state touchdown distance.
263
+
264
+ Arguments
265
+ ---------
266
+ layers : list, optional
267
+ 2D list of layer densities and thicknesses. Columns are
268
+ density(kg/m ^ 3) and thickness(mm). One row corresponds
269
+ to one layer. Default is [[240, 200], ].
270
+ C0 : float, optional
271
+ Multiplicative constant of Young modulus parametrization
272
+ according to Bergfeld et al. (2023). Default is 6.5.
273
+ C1 : float, optional
274
+ Exponent of Young modulus parameterization according to
275
+ Bergfeld et al. (2023). Default is 4.4.
276
+ Ewl : float, optional
277
+ Young's modulus of the weak layer (MPa). Default is 0.25.
278
+ t : float, optional
279
+ Thickness of the weak layer (mm). Default is 10.
280
+ phi : float, optional
281
+ Inclination of the slab (°). Default is 0.
282
+
283
+ Returns
284
+ -------
285
+ first_contact : float
286
+ Cut length at first contact (mm).
287
+ steady_state : float
288
+ Steady-state touchdown distance (mm).
289
+ """
290
+ # Check if layering is defined
291
+ layers = layers if layers else [[240, 200], ]
292
+
293
+ # Initialize model with user input
294
+ touchdown = weac.Layered(system='pst-', touchdown=True)
295
+
296
+ # Set material properties
297
+ touchdown.set_foundation_properties(E=Ewl, t=t, update=True)
298
+ touchdown.set_beam_properties(layers=layers, C0=C0, C1=C1, update=True)
299
+
300
+ # Assemble very long dummy PST to compute crack length where the slab
301
+ # first comes in contact with base layer after weak-layer collapse
302
+ touchdown.calc_segments(L=1e5, a=0, phi=phi)
303
+ first_contact = touchdown.calc_a1()
304
+
305
+ # Compute steady-state touchdown distance in a dummy PST with a cut
306
+ # of 5 times the first contact distance
307
+ touchdown.calc_segments(L=1e5, a=5*first_contact, phi=phi)
308
+ steady_state = touchdown.calc_lC()
309
+
310
+ # Return first-contact cut length and steady-state touchdown distance (mm)
311
+ return first_contact, steady_state
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: weac
3
- Version: 2.4.1
3
+ Version: 2.5.1
4
4
  Summary: Weak layer anticrack nucleation model
5
5
  Home-page: https://github.com/2phi/weac
6
6
  Author: 2phi GbR
@@ -109,7 +109,7 @@ WEAC implements closed-form analytical models for the [mechanical analysis of dr
109
109
 
110
110
  Cite the repository as:
111
111
  ```
112
- Rosendahl, P. L. & Weissgraeber, P. (2022). Weak Layer Anticrack Nucleation Model (WEAC). Zenodo. https://doi.org/10.5281/zenodo.5773113
112
+ Rosendahl, P. L., Schneider, J., & Weissgraeber, P. (2022). Weak Layer Anticrack Nucleation Model (WEAC). Zenodo. https://doi.org/10.5281/zenodo.5773113
113
113
  ```
114
114
 
115
115
  Read the [📄 white paper](https://doi.org/10.5194/tc-17-1475-2023) for model derivations, illustrations, dimensions, material properties, and kinematics:
@@ -213,15 +213,18 @@ x_cm, tau_kPa = skier.get_weaklayer_shearstress(x=xwl, z=z, unit='kPa')
213
213
 
214
214
  See the [open issues](https://github.com/2phi/weac/issues) for a list of proposed features and known issues.
215
215
 
216
- ### v2.5
216
+ ### v2.6
217
217
  - [ ] Finite fracture mechanics implementation for layered snow covers
218
218
 
219
- ### v2.4
219
+ ### v2.5
220
220
  - [ ] Implement anistropic weak layer
221
221
  - [ ] Add demo gif
222
222
 
223
223
  ## Release history
224
224
 
225
+ ### v2.4
226
+ - Choose between slope-normal (`'-pst'`, `'pst-'`) or vertial (`'-vpst'`, `'vpst-'`) PST boundary conditions
227
+
225
228
  ### v2.3
226
229
  - Stress plots on deformed contours
227
230
  - PSTs now account for slab touchdown
@@ -271,12 +274,18 @@ See the [open issues](https://github.com/2phi/weac/issues) for a list of propose
271
274
  5. Open a pull request
272
275
 
273
276
 
277
+ <!-- LICENSE -->
278
+ ## Workflows
279
+ [![Publish Python 🐍 releases 📦 to PyPI ](https://github.com/2phi/weac/actions/workflows/release.yml/badge.svg)](https://github.com/2phi/weac/actions/workflows/release.yml)<br>
280
+ [![Build and publish Sphinx 🪬 documentation ](https://github.com/2phi/weac/actions/workflows/docs.yml/badge.svg)](https://github.com/2phi/weac/actions/workflows/docs.yml)
281
+
282
+
274
283
  <!-- LICENSE -->
275
284
  ## License
276
285
 
277
- Copyright 2phi GbR, 2020-2023.
286
+ Copyright 2phi GbR, 2020-2024.
278
287
 
279
- We currently do not offer an open source license. Please contact us for private licensing options.
288
+ We currently do not offer an open-source license. Please contact us for private licensing options.
280
289
 
281
290
 
282
291
  <!-- CONTACT -->
@@ -0,0 +1,12 @@
1
+ weac/__init__.py,sha256=5_KHE81CCZ6C9a_-12Ln7Trbla2nVy6ZP4_Mi6frgPQ,359
2
+ weac/eigensystem.py,sha256=a-RBqON9Sta2c0z412BXgrfxM96heDKNyfiD0PbYLmM,22476
3
+ weac/inverse.py,sha256=pfpE5PaMgKA2sMVk4t-Q6mPJisA-Yyo873XCKI_-HtA,1980
4
+ weac/layered.py,sha256=S18d1PwGrj9K6HFu2u1JBiA94zzM8mX_JiKBGaph9_I,2064
5
+ weac/mixins.py,sha256=NPkhZVwYpcxhMkS9t3ismvfgeQdZZNTg4rz7Y1DH6EQ,70269
6
+ weac/plot.py,sha256=-s0aOV-c2KEgMa5HypiLgIgASsNVz0BR80_7h8J5o68,20705
7
+ weac/tools.py,sha256=CtZQgzsJtODSPyYLNHhehn24ma13rNGfyYhUVcdp9mk,9605
8
+ weac-2.5.1.dist-info/LICENSE,sha256=kZ_nAN1upf01GX0XTvH6LSOveV_dXX1xazrr-fI1qj8,129
9
+ weac-2.5.1.dist-info/METADATA,sha256=w62iA_tpWfPxqkzb61PS5dzGYppsqOsQM9WDsus4mzg,17290
10
+ weac-2.5.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
11
+ weac-2.5.1.dist-info/top_level.txt,sha256=8tyXUHPFU4Ba_5kPtpwvXo5l6GjJmOnODVBJFygpdeE,5
12
+ weac-2.5.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- weac/__init__.py,sha256=li9Z4iHEswBMz3C2vgjEWVKAhoIKBc5PsBPvAbMYB0g,359
2
- weac/eigensystem.py,sha256=-TkOdGqnzxLJJMIcHCXxQCLNUZnT4-KLlK8LUbVoJBI,27015
3
- weac/inverse.py,sha256=pfpE5PaMgKA2sMVk4t-Q6mPJisA-Yyo873XCKI_-HtA,1980
4
- weac/layered.py,sha256=ivotD-YhY-yM-VGn6uY5LhtjaFn7uQRbRrd81W0mfD8,1903
5
- weac/mixins.py,sha256=cE8lf1bCneP81XCfFz87EnYVLVBuSZqzWXqH9FtGN8U,55622
6
- weac/plot.py,sha256=JCMbikfnevxgi9lA7kT47q73BlTAn9c3_zYW1iYxu7s,20520
7
- weac/tools.py,sha256=3_fh4lTMlmReHTcPXZhBR_aA6gjPCkqus9zLYWTcsk4,7423
8
- weac-2.4.1.dist-info/LICENSE,sha256=kZ_nAN1upf01GX0XTvH6LSOveV_dXX1xazrr-fI1qj8,129
9
- weac-2.4.1.dist-info/METADATA,sha256=eWgGguyQRLNfYRDU-ZGy4TxBTn8Nd1Gbcq0i-kwqHKc,16767
10
- weac-2.4.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
11
- weac-2.4.1.dist-info/top_level.txt,sha256=8tyXUHPFU4Ba_5kPtpwvXo5l6GjJmOnODVBJFygpdeE,5
12
- weac-2.4.1.dist-info/RECORD,,
File without changes