weac.analysis.analyzer module

This module provides the Analyzer class, which is used to analyze the results of the WEAC model.

weac.analysis.analyzer.track_analyzer_call(func)[source]

Decorator to track call count and execution time of Analyzer methods.

weac.analysis.analyzer.local_segment_grid(length, n_budget, *, include_right_endpoint, boundary_window=None, boundary_dx=None)[source]

Build monotonic local sample coordinates on a segment [0, length].

Uniform mode (boundary_window is None)

np.linspace with n_budget points (same as historical rasterize).

Boundary-refined mode

Piecewise fine windows of half-width boundary_window and spacing boundary_dx at both segment ends (domain ends and joints), with any remaining n_budget spent on a coarse interior. Fine resolution is preserved even if that makes the point count exceed n_budget.

The right endpoint length is included only when include_right_endpoint is True (last segment). Other segments omit it so the joint is owned by the next segment’s local x = 0.

Parameters:
  • length (float)

  • n_budget (int)

  • include_right_endpoint (bool)

  • boundary_window (float | None)

  • boundary_dx (float | None)

Return type:

ndarray

class weac.analysis.analyzer.Analyzer(system_model, printing_enabled=True)[source]

Bases: object

Provides methods for the analysis of layered slabs on compliant elastic foundations.

Parameters:
__init__(system_model, printing_enabled=True)[source]
Parameters:
sm: SystemModel
printing_enabled: bool = True
get_call_stats()[source]

Returns the call statistics.

print_call_stats(message='Analyzer Call Statistics')[source]

Prints the call statistics in a readable format.

Parameters:

message (str)

rasterize_solution(mode='cracked', num=4000, *, boundary_window=None, boundary_dx=None)[source]

Compute rasterized solution vector.

Parameters:
  • mode (Literal["cracked", "uncracked"]) – Mode of the solution.

  • num (int) – Soft budget for the number of grid points (length-proportional per segment). With boundary refinement, fine windows are always filled even if the realized count exceeds num.

  • boundary_window (float, optional) – Half-width [mm] of piecewise-fine sampling windows at every segment end (domain ends and inter-segment joints). None keeps uniform linspace spacing (historical default).

  • boundary_dx (float, optional) – Target spacing [mm] inside fine windows. Required together with boundary_window.

Returns:

  • xs (ndarray) – Grid point x-coordinates at which solution vector is discretized.

  • zs (ndarray) – Matrix with solution vectors as columns at grid points xs.

  • x_founded (ndarray) – Grid point x-coordinates that lie on a foundation.

get_zmesh(dz=2)[source]

Get z-coordinates of grid points and corresponding elastic properties.

Parameters:

dz (float, optional) – Element size along z-axis (mm). Default is 2 mm.

Returns:

mesh – Mesh along z-axis. Columns are a list of z-coordinates (mm) of grid points along z-axis with at least two grid points (top, bottom) per layer, Young’s modulus of each grid point, shear modulus of each grid point, and Poisson’s ratio of each grid point.

Return type:

ndarray

Sxx(Z, phi, dz=2, unit='kPa', normalize=False)[source]

Compute axial normal stress in slab layers.

Parameters:
  • Z (ndarray) – Solution vector [u(x) u’(x) w(x) w’(x) psi(x), psi’(x)]^T

  • phi (float) – Inclination (degrees). Counterclockwise positive.

  • dz (float, optional) – Element size along z-axis (mm). Default is 2 mm.

  • unit ({'kPa', 'MPa'}, optional) – Desired output unit. Default is ‘kPa’.

  • normalize (bool, optional) – Toggle normalization. If True, normalize stress values to the tensile strength of each layer (dimensionless). When normalized, the unit parameter is ignored and values are returned as ratios. Default is False.

Returns:

Axial slab normal stress in specified unit.

Return type:

ndarray, float

Txz(Z, phi, dz=2, unit='kPa', normalize=False)[source]

Compute shear stress in slab layers.

Parameters:
  • Z (ndarray) – Solution vector [u(x) u’(x) w(x) w’(x) psi(x), psi’(x)]^T

  • phi (float) – Inclination (degrees). Counterclockwise positive.

  • dz (float, optional) – Element size along z-axis (mm). Default is 2 mm.

  • unit ({'kPa', 'MPa'}, optional) – Desired output unit. Default is ‘kPa’.

  • normalize (bool, optional) – Toggle normalization. If True, normalize shear stress values to the tensile strength of each layer (dimensionless). When normalized, the unit parameter is ignored and values are returned as ratios. Default is False.

Returns:

Shear stress at grid points in the slab in specified unit.

Return type:

ndarray

Szz(Z, phi, dz=2, unit='kPa', normalize=False)[source]

Compute transverse normal stress in slab layers.

Parameters:
  • Z (ndarray) – Solution vector [u(x) u’(x) w(x) w’(x) psi(x), psi’(x)]^T

  • phi (float) – Inclination (degrees). Counterclockwise positive.

  • dz (float, optional) – Element size along z-axis (mm). Default is 2 mm.

  • unit ({'kPa', 'MPa'}, optional) – Desired output unit. Default is ‘kPa’.

  • normalize (bool, optional) – Toggle normalization. If True, normalize stress values to the tensile strength of each layer (dimensionless). When normalized, the unit parameter is ignored and values are returned as ratios. Default is False.

Returns:

Transverse normal stress at grid points in the slab in specified unit.

Return type:

ndarray, float

principal_stress_slab(Z, phi, dz=2, unit='kPa', val='max', normalize=False)[source]

Compute maximum or minimum principal stress in slab layers.

Parameters:
  • Z (ndarray) – Solution vector [u(x) u’(x) w(x) w’(x) psi(x), psi’(x)]^T

  • phi (float) – Inclination (degrees). Counterclockwise positive.

  • dz (float, optional) – Element size along z-axis (mm). Default is 2 mm.

  • unit ({'kPa', 'MPa'}, optional) – Desired output unit. Default is ‘kPa’.

  • val (str, optional) – Maximum ‘max’ or minimum ‘min’ principal stress. Default is ‘max’.

  • normalize (bool) – Toggle layerwise normalization to strength.

Returns:

Maximum or minimum principal stress in specified unit.

Return type:

ndarray

Raises:

ValueError – If specified principal stress component is neither ‘max’ nor ‘min’, or if normalization of compressive principal stress is requested.

principal_stress_weaklayer(Z, sc=2.6, unit='kPa', val='min', normalize=False)[source]

Compute maximum or minimum principal stress in the weak layer.

Parameters:
  • Z (ndarray) – Solution vector [u(x) u’(x) w(x) w’(x) psi(x), psi’(x)]^T

  • sc (float) – Weak-layer compressive strength. Default is 2.6 kPa.

  • unit ({'kPa', 'MPa'}, optional) – Desired output unit. Default is ‘kPa’.

  • val (str, optional) – Maximum ‘max’ or minimum ‘min’ principal stress. Default is ‘min’.

  • normalize (bool) – Toggle layerwise normalization to strength.

Returns:

Maximum or minimum principal stress in specified unit.

Return type:

ndarray

Raises:

ValueError – If specified principal stress component is neither ‘max’ nor ‘min’, or if normalization of tensile principal stress is requested.

incremental_ERR(tolerance=1e-6, unit='kJ/m^2')[source]

Compute incremental energy release rate (ERR) of all cracks.

Returns:

List of total, mode I, and mode II energy release rates.

Return type:

ndarray

Parameters:
  • tolerance (float)

  • unit (Literal['kJ/m^2', 'J/m^2'])

differential_ERR(unit='kJ/m^2')[source]

Compute differential energy release rate of all crack tips.

Returns:

List of total, mode I, and mode II energy release rates.

Return type:

ndarray

Parameters:

unit (Literal['kJ/m^2', 'J/m^2'])

total_potential()[source]

Returns total differential potential. Currently only implemented for PST systems.

Returns:

Pi – Total differential potential (Nmm).

Return type:

float