weac.core.system_model module

This module defines the system model for the WEAC simulation. The system model is the heart of the WEAC simulation. All data sources are bundled into the system model. The system model initializes and calculates all the parameterizations and passes relevant data to the different components.

We utilize the pydantic library to define the system model.

class weac.core.system_model.SystemModel(model_input, config=None)[source]

Bases: object

The heart of the WEAC simulation system for avalanche release modeling.

This class orchestrates all components of the WEAC simulation, including slab mechanics, weak layer properties, touchdown calculations, and the solution of unknown constants for beam-on-elastic-foundation problems.

The SystemModel follows a lazy evaluation pattern using cached properties, meaning expensive calculations (eigensystem, touchdown, unknown constants) are only computed when first accessed and then cached for subsequent use.

Extracting Unknown Constants:

The primary output of the SystemModel is the unknown_constants matrix, which contains the solution constants for the beam segments:

```python # Basic usage system = SystemModel(model_input=model_input, config=config) constants = system.unknown_constants # Shape: (6, N) where N = number of segments

# Each column represents the 6 constants for one segment: # constants[:, i] = [C1, C2, C3, C4, C5, C6] for segment i # These constants define the beam deflection solution within that segment ```

Calculation Flow:

  1. Eigensystem: Computes eigenvalues/eigenvectors for the beam-foundation system

  2. Slab Touchdown (if enabled): Calculates touchdown behavior and updates segment lengths

  3. Unknown Constants: Solves the linear system for beam deflection constants

Touchdown Behavior:

When config.touchdown=True, the system automatically: - Calculates touchdown mode (A: free-hanging, B: point contact, C: in contact) - Determines touchdown length based on slab-foundation interaction - Redefines scenario segments to use touchdown length instead of crack length - This matches the behavior of the original WEAC implementation

Performance Notes:

  • First access to unknown_constants triggers all necessary calculations

  • Subsequent accesses return cached results instantly

  • Use update_* methods to modify parameters and invalidate caches as needed

Example Usage:

```python from weac.components import ModelInput, Layer, Segment, Config from weac.core.system_model import SystemModel

# Define system components layers = [Layer(rho=200, h=150), Layer(rho=300, h=100)] segments = [Segment(length=10000, has_foundation=True, m=0),

Segment(length=4000, has_foundation=False, m=0)]

# Create system system = SystemModel(model_input=model_input, config=Config(touchdown=True))

# Solve system and extract results constants = system.unknown_constants # Solution constants (6 x N_segments) touchdown_info = system.slab_touchdown # Touchdown analysis (if enabled) eigensystem = system.eigensystem # Eigenvalue problem solution ```

Parameters:
config

Configuration settings including touchdown enable/disable

Type:

weac.components.config.Config

slab

Slab properties (thickness, material properties per layer)

Type:

weac.core.slab.Slab

weak_layer

Weak layer properties (stiffness, thickness, etc.)

Type:

weac.components.layer.WeakLayer

scenario

Scenario definition (segments, loads, boundary conditions)

Type:

weac.core.scenario.Scenario

eigensystem

Eigenvalue problem solution (computed lazily)

Type:

weac.core.eigensystem.Eigensystem

slab_touchdown

Touchdown analysis results (computed lazily if enabled)

Type:

weac.core.slab_touchdown.SlabTouchdown | None

unknown_constants

Solution constants matrix (computed lazily)

Type:

numpy.ndarray

__init__(model_input, config=None)[source]
Parameters:
config: Config
weak_layer: WeakLayer
slab: Slab
scenario: Scenario
property fq: FieldQuantities

Compute the field quantities.

property eigensystem: Eigensystem

Solve for the eigensystem.

property slab_touchdown: SlabTouchdown | None

Solve for the slab touchdown. Modifies the scenario object in place by replacing the undercut segment with a new segment of length equal to the touchdown distance if the system is a PST or VPST.

property unknown_constants: ndarray

Solve for the unknown constants matrix defining beam deflection in each segment.

This is the core solution of the WEAC beam-on-elastic-foundation problem. The unknown constants define the deflection, slope, moment, and shear force distributions within each beam segment.

Returns:

np.ndarray: Solution constants matrix of shape (6, N_segments)

Each column contains the 6 constants for one segment: [C1, C2, C3, C4, C5, C6]

These constants are used in the general solution: u(x) = Σ Ci * φi(x) + up(x)

Where φi(x) are the homogeneous solutions and up(x) is the particular solution.

Notes

  • For touchdown systems, segment lengths are automatically adjusted based on touchdown calculations before solving

  • The solution accounts for boundary conditions, load transmission between segments, and foundation support

  • Results are cached after first computation for performance

Example

```python system = SystemModel(model_input, config) C = system.unknown_constants # Shape: (6, 2) for 2-segment system

# Constants for first segment segment_0_constants = C[:, 0]

# Use with eigensystem to compute field quantities x = 1000 # Position in mm segment_length = system.scenario.li[0] ```

property uncracked_unknown_constants: ndarray

Solve for the uncracked unknown constants. This is the solution for the case where the slab is cracked nowhere.

update_weak_layer(weak_layer)[source]

Update the weak layer.

Parameters:

weak_layer (WeakLayer)

update_layers(new_layers)[source]

Update the layers.

Parameters:

new_layers (List[Layer])

update_scenario(segments=None, scenario_config=None)[source]

Update fields on scenario_config (if present) or on the Scenario object itself, then refresh and invalidate constants.

Parameters:
toggle_touchdown(touchdown)[source]

Toggle the touchdown.

Parameters:

touchdown (bool)

z(x, C, length, phi, has_foundation=True, qs=0)[source]

Assemble solution vector at positions x.

Parameters:
  • x (float or sequence) – Horizontal coordinate (mm). Can be sequence of length N.

  • C (ndarray) – Vector of constants (6xN) at positions x.

  • length (float) – Segment length (mm).

  • phi (float) – Inclination (degrees).

  • has_foundation (bool) – Indicates whether segment has foundation (True) or not (False). Default is True.

  • qs (float) – Surface Load [N/mm]

Returns:

z – Solution vector (6xN) at position x.

Return type:

ndarray