weac 2.6.3__py3-none-any.whl → 3.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.
- weac/__init__.py +2 -14
- weac/constants.py +37 -0
- weac/logging_config.py +39 -0
- {weac-2.6.3.dist-info → weac-3.0.0.dist-info}/METADATA +194 -62
- weac-3.0.0.dist-info/RECORD +8 -0
- weac/eigensystem.py +0 -658
- weac/inverse.py +0 -51
- weac/layered.py +0 -64
- weac/mixins.py +0 -2083
- weac/plot.py +0 -675
- weac/tools.py +0 -334
- weac-2.6.3.dist-info/RECORD +0 -12
- {weac-2.6.3.dist-info → weac-3.0.0.dist-info}/WHEEL +0 -0
- {weac-2.6.3.dist-info → weac-3.0.0.dist-info}/licenses/LICENSE +0 -0
- {weac-2.6.3.dist-info → weac-3.0.0.dist-info}/top_level.txt +0 -0
weac/tools.py
DELETED
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
# pylint: disable=C0103
|
|
2
|
-
"""Helper functions for the WEak Layer AntiCrack nucleation model."""
|
|
3
|
-
|
|
4
|
-
# Standard library imports
|
|
5
|
-
from timeit import default_timer as timer
|
|
6
|
-
|
|
7
|
-
# Third party imports
|
|
8
|
-
import numpy as np
|
|
9
|
-
|
|
10
|
-
import weac
|
|
11
|
-
|
|
12
|
-
try:
|
|
13
|
-
from IPython import get_ipython
|
|
14
|
-
except ImportError:
|
|
15
|
-
get_ipython = None
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def time():
|
|
19
|
-
"""Return current time in milliseconds."""
|
|
20
|
-
return 1e3 * timer()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def isnotebook():
|
|
24
|
-
"""Identify shell environment."""
|
|
25
|
-
try:
|
|
26
|
-
if get_ipython is None:
|
|
27
|
-
return False
|
|
28
|
-
shell = get_ipython().__class__.__name__
|
|
29
|
-
if shell == "ZMQInteractiveShell":
|
|
30
|
-
return True # Jupyter notebook or qtconsole
|
|
31
|
-
elif shell == "TerminalInteractiveShell":
|
|
32
|
-
return False # Terminal running IPython
|
|
33
|
-
else:
|
|
34
|
-
return False # Other type
|
|
35
|
-
except (NameError, AttributeError):
|
|
36
|
-
return False # Probably standard Python interpreter
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def load_dummy_profile(profile_id):
|
|
40
|
-
"""Define standard layering types for comparison."""
|
|
41
|
-
# Layers [density (kg/m^3), thickness (mm), Young's modulus (N/mm^2)]
|
|
42
|
-
soft = [180.0, 120.0, 5]
|
|
43
|
-
medium = [270.0, 120.0, 30]
|
|
44
|
-
hard = [350.0, 120.0, 93.8]
|
|
45
|
-
# soft = [120., 120., 0.3]
|
|
46
|
-
# medium = [180., 120., 1.5]
|
|
47
|
-
# hard = [270., 120., 7.5]
|
|
48
|
-
|
|
49
|
-
# Database (top to bottom)
|
|
50
|
-
database = {
|
|
51
|
-
# Layered
|
|
52
|
-
"a": [hard, medium, soft],
|
|
53
|
-
"b": [soft, medium, hard],
|
|
54
|
-
"c": [hard, soft, hard],
|
|
55
|
-
"d": [soft, hard, soft],
|
|
56
|
-
"e": [hard, soft, soft],
|
|
57
|
-
"f": [soft, soft, hard],
|
|
58
|
-
# Homogeneous
|
|
59
|
-
"h": [medium, medium, medium],
|
|
60
|
-
"soft": [soft, soft, soft],
|
|
61
|
-
"medium": [medium, medium, medium],
|
|
62
|
-
"hard": [hard, hard, hard],
|
|
63
|
-
# Comparison
|
|
64
|
-
"comp": [
|
|
65
|
-
[240.0, 200.0, 5.23],
|
|
66
|
-
],
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
# Load profile
|
|
70
|
-
try:
|
|
71
|
-
profile = np.array(database[profile_id.lower()])
|
|
72
|
-
except KeyError:
|
|
73
|
-
raise ValueError(f"Profile {profile_id} is not defined.") from None
|
|
74
|
-
|
|
75
|
-
# Prepare output
|
|
76
|
-
layers = profile[:, 0:2]
|
|
77
|
-
E = profile[:, 2]
|
|
78
|
-
|
|
79
|
-
return layers, E
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def calc_center_of_gravity(layers):
|
|
83
|
-
"""
|
|
84
|
-
Calculate z-coordinate of the center of gravity.
|
|
85
|
-
|
|
86
|
-
Arguments
|
|
87
|
-
---------
|
|
88
|
-
layers : ndarray
|
|
89
|
-
2D list of layer densities and thicknesses. Columns are
|
|
90
|
-
density (kg/m^3) and thickness (mm). One row corresponds
|
|
91
|
-
to one layer.
|
|
92
|
-
|
|
93
|
-
Returns
|
|
94
|
-
-------
|
|
95
|
-
H : float
|
|
96
|
-
Total slab thickness (mm).
|
|
97
|
-
zs : float
|
|
98
|
-
Z-coordinate of center of gravity (mm).
|
|
99
|
-
"""
|
|
100
|
-
# Layering info for center of gravity calculation (bottom to top)
|
|
101
|
-
n = layers.shape[0] # Number of layers
|
|
102
|
-
rho = 1e-12 * np.flipud(layers[:, 0]) # Layer densities (kg/m^3 -> t/mm^3)
|
|
103
|
-
h = np.flipud(layers[:, 1]) # Layer thicknesses
|
|
104
|
-
H = sum(h) # Total slab thickness
|
|
105
|
-
# Layer center coordinates (bottom to top)
|
|
106
|
-
zi = [H / 2 - sum(h[0:j]) - h[j] / 2 for j in range(n)]
|
|
107
|
-
# Z-coordinate of the center of gravity
|
|
108
|
-
zs = sum(zi * h * rho) / sum(h * rho)
|
|
109
|
-
# Return slab thickness and center of gravity
|
|
110
|
-
return H, zs
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def calc_vertical_bc_center_of_gravity(slab, phi):
|
|
114
|
-
"""
|
|
115
|
-
Calculate center of gravity of triangular slab segements for vertical PSTs.
|
|
116
|
-
|
|
117
|
-
Parameters
|
|
118
|
-
----------
|
|
119
|
-
slab : ndarray
|
|
120
|
-
List of layer densities, thicknesses, and elastic properties.
|
|
121
|
-
Columns are density (kg/m^3), thickness (mm), Young's modulus
|
|
122
|
-
(MPa), shear modulus (MPa), and Poisson's ratio. One row corresponds
|
|
123
|
-
to one layer.
|
|
124
|
-
phi : fload
|
|
125
|
-
Slope angle (deg).
|
|
126
|
-
|
|
127
|
-
Returns
|
|
128
|
-
-------
|
|
129
|
-
xs : float
|
|
130
|
-
Horizontal coordinate of center of gravity (mm).
|
|
131
|
-
zs : float
|
|
132
|
-
Vertical coordinate of center of gravity (mm).
|
|
133
|
-
w : ndarray
|
|
134
|
-
Weight of the slab segment that is cut off or added (t).
|
|
135
|
-
"""
|
|
136
|
-
# Convert slope angle to radians
|
|
137
|
-
phi = np.deg2rad(phi)
|
|
138
|
-
|
|
139
|
-
# Catch flat-field case
|
|
140
|
-
if phi == 0:
|
|
141
|
-
xs = 0
|
|
142
|
-
zs = 0
|
|
143
|
-
w = 0
|
|
144
|
-
else:
|
|
145
|
-
# Layering info for center of gravity calculation (top to bottom)
|
|
146
|
-
n = slab.shape[0] # Number of slab
|
|
147
|
-
rho = 1e-12 * slab[:, 0] # Layer densities (kg/m^3 -> t/mm^3)
|
|
148
|
-
hi = slab[:, 1] # Layer thicknesses
|
|
149
|
-
H = sum(hi) # Total slab thickness
|
|
150
|
-
# Layer coordinates z_i (top to bottom)
|
|
151
|
-
z = np.array([-H / 2 + sum(hi[0:j]) for j in range(n + 1)])
|
|
152
|
-
zi = z[:-1] # z_i
|
|
153
|
-
zii = z[1:] # z_{i+1}
|
|
154
|
-
# Center of gravity of all layers (top to bottom)
|
|
155
|
-
zsi = zi + hi / 3 * (3 / 2 * H - zi - 2 * zii) / (H - zi - zii)
|
|
156
|
-
# Surface area of all layers (top to bottom)
|
|
157
|
-
Ai = hi / 2 * (H - zi - zii) * np.tan(phi)
|
|
158
|
-
# Center of gravity in vertical direction
|
|
159
|
-
zs = sum(zsi * rho * Ai) / sum(rho * Ai)
|
|
160
|
-
# Center of gravity in horizontal direction
|
|
161
|
-
xs = (H / 2 - zs) * np.tan(phi / 2)
|
|
162
|
-
# Weight of added or cut off slab segments (t)
|
|
163
|
-
w = sum(Ai * rho)
|
|
164
|
-
|
|
165
|
-
# Return center of gravity and weight of slab segment
|
|
166
|
-
return xs, zs, w
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
def scapozza(rho):
|
|
170
|
-
"""
|
|
171
|
-
Compute Young's modulus (MPa) from density (kg/m^3).
|
|
172
|
-
|
|
173
|
-
Arguments
|
|
174
|
-
---------
|
|
175
|
-
rho : float or ndarray
|
|
176
|
-
Density (kg/m^3).
|
|
177
|
-
|
|
178
|
-
Returns
|
|
179
|
-
-------
|
|
180
|
-
E : float or ndarray
|
|
181
|
-
Young's modulus (MPa).
|
|
182
|
-
"""
|
|
183
|
-
rho = rho * 1e-12 # Convert to t/mm^3
|
|
184
|
-
rho0 = 917e-12 # Desity of ice in t/mm^3
|
|
185
|
-
E = 5.07e3 * (rho / rho0) ** 5.13 # Young's modulus in MPa
|
|
186
|
-
return E
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def gerling(rho, C0=6.0, C1=4.6):
|
|
190
|
-
"""
|
|
191
|
-
Compute Young's modulus from density according to Gerling et al. 2017.
|
|
192
|
-
|
|
193
|
-
Arguments
|
|
194
|
-
---------
|
|
195
|
-
rho : float or ndarray
|
|
196
|
-
Density (kg/m^3).
|
|
197
|
-
C0 : float, optional
|
|
198
|
-
Multiplicative constant of Young modulus parametrization
|
|
199
|
-
according to Gerling et al. (2017). Default is 6.0.
|
|
200
|
-
C1 : float, optional
|
|
201
|
-
Exponent of Young modulus parameterization according to
|
|
202
|
-
Gerling et al. (2017). Default is 4.6.
|
|
203
|
-
|
|
204
|
-
Returns
|
|
205
|
-
-------
|
|
206
|
-
E : float or ndarray
|
|
207
|
-
Young's modulus (MPa).
|
|
208
|
-
"""
|
|
209
|
-
return C0 * 1e-10 * rho**C1
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
def bergfeld(rho, rho0=916.7, C0=6.5, C1=4.4):
|
|
213
|
-
"""
|
|
214
|
-
Compute Young's modulus from density according to Bergfeld et al. (2023).
|
|
215
|
-
|
|
216
|
-
Arguments
|
|
217
|
-
---------
|
|
218
|
-
rho : float or ndarray
|
|
219
|
-
Density (kg/m^3).
|
|
220
|
-
rho0 : float, optional
|
|
221
|
-
Density of ice (kg/m^3). Default is 917.
|
|
222
|
-
C0 : float, optional
|
|
223
|
-
Multiplicative constant of Young modulus parametrization
|
|
224
|
-
according to Bergfeld et al. (2023). Default is 6.5.
|
|
225
|
-
C1 : float, optional
|
|
226
|
-
Exponent of Young modulus parameterization according to
|
|
227
|
-
Bergfeld et al. (2023). Default is 4.4.
|
|
228
|
-
|
|
229
|
-
Returns
|
|
230
|
-
-------
|
|
231
|
-
E : float or ndarray
|
|
232
|
-
Young's modulus (MPa).
|
|
233
|
-
"""
|
|
234
|
-
return C0 * 1e3 * (rho / rho0) ** C1
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
def tensile_strength_slab(rho, unit="kPa"):
|
|
238
|
-
"""
|
|
239
|
-
Estimate the tensile strength of a slab layer from its density.
|
|
240
|
-
|
|
241
|
-
Uses the density parametrization of Sigrist (2006).
|
|
242
|
-
|
|
243
|
-
Arguments
|
|
244
|
-
---------
|
|
245
|
-
rho : ndarray, float
|
|
246
|
-
Layer density (kg/m^3).
|
|
247
|
-
unit : str, optional
|
|
248
|
-
Desired output unit of the layer strength. Default is 'kPa'.
|
|
249
|
-
|
|
250
|
-
Returns
|
|
251
|
-
-------
|
|
252
|
-
ndarray
|
|
253
|
-
Tensile strength in specified unit.
|
|
254
|
-
"""
|
|
255
|
-
convert = {"kPa": 1, "MPa": 1e-3, "m": 1, "mm": 1e3, "cm": 1e2}
|
|
256
|
-
rho_ice = 917
|
|
257
|
-
# Sigrist's equation is given in kPa
|
|
258
|
-
value = convert[unit] * 240 * (rho / rho_ice) ** 2.44
|
|
259
|
-
return value
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
def touchdown_distance(
|
|
263
|
-
layers: np.ndarray | str | None = None,
|
|
264
|
-
C0: float = 6.5,
|
|
265
|
-
C1: float = 4.4,
|
|
266
|
-
Ewl: float = 0.25,
|
|
267
|
-
t: float = 10,
|
|
268
|
-
phi: float = 0,
|
|
269
|
-
):
|
|
270
|
-
"""
|
|
271
|
-
Calculate cut length at first contanct and steady-state touchdown distance.
|
|
272
|
-
|
|
273
|
-
Arguments
|
|
274
|
-
---------
|
|
275
|
-
layers : list, optional
|
|
276
|
-
2D list of layer densities and thicknesses. Columns are
|
|
277
|
-
density(kg/m ^ 3) and thickness(mm). One row corresponds
|
|
278
|
-
to one layer. Default is [[240, 200], ].
|
|
279
|
-
C0 : float, optional
|
|
280
|
-
Multiplicative constant of Young modulus parametrization
|
|
281
|
-
according to Bergfeld et al. (2023). Default is 6.5.
|
|
282
|
-
C1 : float, optional
|
|
283
|
-
Exponent of Young modulus parameterization according to
|
|
284
|
-
Bergfeld et al. (2023). Default is 4.4.
|
|
285
|
-
Ewl : float, optional
|
|
286
|
-
Young's modulus of the weak layer (MPa). Default is 0.25.
|
|
287
|
-
t : float, optional
|
|
288
|
-
Thickness of the weak layer (mm). Default is 10.
|
|
289
|
-
phi : float, optional
|
|
290
|
-
Inclination of the slab (°). Default is 0.
|
|
291
|
-
|
|
292
|
-
Returns
|
|
293
|
-
-------
|
|
294
|
-
first_contact : float
|
|
295
|
-
Cut length at first contact (mm).
|
|
296
|
-
full_contact : float
|
|
297
|
-
Cut length at which the slab comes into full contact (more than
|
|
298
|
-
a singular point) with the base layer (mm).
|
|
299
|
-
steady_state : float
|
|
300
|
-
Steady-state touchdown distance (mm).
|
|
301
|
-
"""
|
|
302
|
-
# Check if layering is defined
|
|
303
|
-
layers = (
|
|
304
|
-
layers
|
|
305
|
-
if layers
|
|
306
|
-
else [
|
|
307
|
-
[240, 200],
|
|
308
|
-
]
|
|
309
|
-
)
|
|
310
|
-
|
|
311
|
-
# Initialize model with user input
|
|
312
|
-
touchdown = weac.Layered(system="pst-", touchdown=True)
|
|
313
|
-
|
|
314
|
-
# Set material properties
|
|
315
|
-
touchdown.set_foundation_properties(E=Ewl, t=t, update=True)
|
|
316
|
-
touchdown.set_beam_properties(layers=layers, C0=C0, C1=C1, update=True)
|
|
317
|
-
|
|
318
|
-
# Assemble very long dummy PST to compute crack length where the slab
|
|
319
|
-
# first comes in contact with base layer after weak-layer collapse
|
|
320
|
-
touchdown.calc_segments(L=1e5, a=0, phi=phi)
|
|
321
|
-
first_contact = touchdown.calc_a1()
|
|
322
|
-
|
|
323
|
-
# Compute ut length at which the slab comes into full contact (more
|
|
324
|
-
# than a singular point) with the base layer
|
|
325
|
-
full_contact = touchdown.calc_a2()
|
|
326
|
-
|
|
327
|
-
# Compute steady-state touchdown distance in a dummy PST with a cut
|
|
328
|
-
# of 5 times the first contact distance
|
|
329
|
-
touchdown.calc_segments(L=1e5, a=5 * first_contact, phi=phi)
|
|
330
|
-
steady_state = touchdown.calc_lC()
|
|
331
|
-
|
|
332
|
-
# Return first-contact cut length, full-contact cut length,
|
|
333
|
-
# and steady-state touchdown distance (mm)
|
|
334
|
-
return first_contact, full_contact, steady_state
|
weac-2.6.3.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
weac/__init__.py,sha256=r770J6EkbjWyMYLvvtVngRDXyCE-XFujSzxvvUK6j5A,345
|
|
2
|
-
weac/eigensystem.py,sha256=dooypI10GrLXWMGKly-Ym4RrhQ750CsIuPHN0lfDke8,22836
|
|
3
|
-
weac/inverse.py,sha256=IUDtvbioKrkdya5kPWwAeSxgSkV7-iHXNk_W86YnUM8,1890
|
|
4
|
-
weac/layered.py,sha256=CwRx6cVfRqh51vrUCo7EutmghyMM0dW34pUVF8AJX9Q,2086
|
|
5
|
-
weac/mixins.py,sha256=fw1tAJJr7ZSVqeaCzKdm3SYfuSf1J-hqh4KbSjbUq6U,69369
|
|
6
|
-
weac/plot.py,sha256=0g7MsmssonqVt2tevxdyloKCuA7wOAZ877Hbr7i-44c,21122
|
|
7
|
-
weac/tools.py,sha256=MZ_QrmuWlPiallUu1FH66I-gi0gvWdL3A0LsppkMK0Q,9960
|
|
8
|
-
weac-2.6.3.dist-info/licenses/LICENSE,sha256=CZlY87tZ1Kq7QxKLVrMknnDXGpc1yEZ8SKoXMAk-d4k,1463
|
|
9
|
-
weac-2.6.3.dist-info/METADATA,sha256=eESGIZNF70ntOuG0RtKbIAe41lYW2zzd9fXYm_0MLXE,20132
|
|
10
|
-
weac-2.6.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
-
weac-2.6.3.dist-info/top_level.txt,sha256=8tyXUHPFU4Ba_5kPtpwvXo5l6GjJmOnODVBJFygpdeE,5
|
|
12
|
-
weac-2.6.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|