Skip to content

Commit b4b72ad

Browse files
committed
Add: Normalization to Txz and Szz
1 parent 0102a08 commit b4b72ad

1 file changed

Lines changed: 29 additions & 9 deletions

File tree

src/weac/analysis/analyzer.py

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def Sxx(self, Z, phi, dz=2, unit="kPa", normalize: bool = False):
291291
return convert[unit] * Sxx_MPa
292292

293293
@track_analyzer_call
294-
def Txz(self, Z, phi, dz=2, unit="kPa"):
294+
def Txz(self, Z, phi, dz=2, unit="kPa", normalize: bool = False):
295295
"""
296296
Compute shear stress in slab layers.
297297
@@ -305,6 +305,8 @@ def Txz(self, Z, phi, dz=2, unit="kPa"):
305305
Element size along z-axis (mm). Default is 2 mm.
306306
unit : {'kPa', 'MPa'}, optional
307307
Desired output unit. Default is 'kPa'.
308+
normalize : bool, optional
309+
Toggle normalization. Default is False.
308310
309311
Returns
310312
-------
@@ -342,14 +344,22 @@ def Txz(self, Z, phi, dz=2, unit="kPa"):
342344

343345
# Integrate -dsxx_dx along z and add cumulative weight load
344346
# to obtain shear stress Txz in MPa
345-
Txz = cumulative_trapezoid(dsxx_dx, zi, axis=0, initial=0)
346-
Txz += cumulative_trapezoid(qt, zi, initial=0)[:, None]
347+
Txz_MPa = cumulative_trapezoid(dsxx_dx, zi, axis=0, initial=0)
348+
Txz_MPa += cumulative_trapezoid(qt, zi, initial=0)[:, None]
349+
350+
# Normalize shear stresses to tensile strength
351+
if normalize:
352+
tensile_strength_kPa = zmesh["tensile_strength"]
353+
tensile_strength_MPa = tensile_strength_kPa / 1e3
354+
# Normalize shear stress to layers' tensile strength
355+
normalized_Txz = Txz_MPa / tensile_strength_MPa[:, None]
356+
return normalized_Txz
347357

348358
# Return shear stress Txz in specified unit
349-
return convert[unit] * Txz
359+
return convert[unit] * Txz_MPa
350360

351361
@track_analyzer_call
352-
def Szz(self, Z, phi, dz=2, unit="kPa"):
362+
def Szz(self, Z, phi, dz=2, unit="kPa", normalize: bool = False):
353363
"""
354364
Compute transverse normal stress in slab layers.
355365
@@ -363,6 +373,8 @@ def Szz(self, Z, phi, dz=2, unit="kPa"):
363373
Element size along z-axis (mm). Default is 2 mm.
364374
unit : {'kPa', 'MPa'}, optional
365375
Desired output unit. Default is 'kPa'.
376+
normalize : bool, optional
377+
Toggle normalization. Default is False.
366378
367379
Returns
368380
-------
@@ -402,11 +414,19 @@ def Szz(self, Z, phi, dz=2, unit="kPa"):
402414
# Integrate dsxx_dxdx twice along z to obtain transverse
403415
# normal stress Szz in MPa
404416
integrand = cumulative_trapezoid(dsxx_dxdx, zi, axis=0, initial=0)
405-
Szz = cumulative_trapezoid(integrand, zi, axis=0, initial=0)
406-
Szz += cumulative_trapezoid(-qn, zi, initial=0)[:, None]
417+
Szz_MPa = cumulative_trapezoid(integrand, zi, axis=0, initial=0)
418+
Szz_MPa += cumulative_trapezoid(-qn, zi, initial=0)[:, None]
419+
420+
# Normalize tensile stresses to tensile strength
421+
if normalize:
422+
tensile_strength_kPa = zmesh["tensile_strength"]
423+
tensile_strength_MPa = tensile_strength_kPa / 1e3
424+
# Normalize transverse normal stress to layers' tensile strength
425+
normalized_Szz = Szz_MPa / tensile_strength_MPa[:, None]
426+
return normalized_Szz
407427

408-
# Return shear stress txz in specified unit
409-
return convert[unit] * Szz
428+
# Return transverse normal stress Szz in specified unit
429+
return convert[unit] * Szz_MPa
410430

411431
@track_analyzer_call
412432
def principal_stress_slab(

0 commit comments

Comments
 (0)