weac.analysis package¶
Submodules¶
- weac.analysis.analyzer module
track_analyzer_call()local_segment_grid()AnalyzerAnalyzer.__init__()Analyzer.smAnalyzer.printing_enabledAnalyzer.get_call_stats()Analyzer.print_call_stats()Analyzer.rasterize_solution()Analyzer.get_zmesh()Analyzer.Sxx()Analyzer.Txz()Analyzer.Szz()Analyzer.principal_stress_slab()Analyzer.principal_stress_weaklayer()Analyzer.incremental_ERR()Analyzer.differential_ERR()Analyzer.total_potential()
- weac.analysis.coupled_criterion module
CoupledCriterionHistoryCoupledCriterionHistory.skier_weightsCoupledCriterionHistory.crack_lengthsCoupledCriterionHistory.incr_energiesCoupledCriterionHistory.sigma_maxsCoupledCriterionHistory.tau_maxsCoupledCriterionHistory.g_deltasCoupledCriterionHistory.dist_maxsCoupledCriterionHistory.dist_minsCoupledCriterionHistory.__init__()
CoupledCriterionResultCoupledCriterionResult.convergedCoupledCriterionResult.messageCoupledCriterionResult.self_collapseCoupledCriterionResult.pure_stress_criteriaCoupledCriterionResult.critical_skier_weightCoupledCriterionResult.initial_critical_skier_weightCoupledCriterionResult.crack_lengthCoupledCriterionResult.g_deltaCoupledCriterionResult.dist_ERR_envelopeCoupledCriterionResult.iterationsCoupledCriterionResult.historyCoupledCriterionResult.final_systemCoupledCriterionResult.max_dist_stressCoupledCriterionResult.min_dist_stressCoupledCriterionResult.__init__()
FindMinimumForceResultMaximalStressResultCoupledCriterionEngineCoupledCriterionEngine.__init__()CoupledCriterionEngine.criteria_configCoupledCriterionEngine.fracture_toughness_envelope()CoupledCriterionEngine.stress_envelope()CoupledCriterionEngine.evaluate_coupled_criterion()CoupledCriterionEngine.find_minimum_force()CoupledCriterionEngine.find_minimum_crack_length()CoupledCriterionEngine.check_crack_self_propagation()CoupledCriterionEngine.find_crack_length_for_weight()
- weac.analysis.criteria_evaluator module
CoupledCriterionHistoryCoupledCriterionHistory.skier_weightsCoupledCriterionHistory.crack_lengthsCoupledCriterionHistory.incr_energiesCoupledCriterionHistory.sigma_maxsCoupledCriterionHistory.tau_maxsCoupledCriterionHistory.g_deltasCoupledCriterionHistory.dist_maxsCoupledCriterionHistory.dist_minsCoupledCriterionHistory.__init__()
CoupledCriterionResultCoupledCriterionResult.convergedCoupledCriterionResult.messageCoupledCriterionResult.self_collapseCoupledCriterionResult.pure_stress_criteriaCoupledCriterionResult.critical_skier_weightCoupledCriterionResult.initial_critical_skier_weightCoupledCriterionResult.crack_lengthCoupledCriterionResult.g_deltaCoupledCriterionResult.dist_ERR_envelopeCoupledCriterionResult.iterationsCoupledCriterionResult.historyCoupledCriterionResult.final_systemCoupledCriterionResult.max_dist_stressCoupledCriterionResult.min_dist_stressCoupledCriterionResult.__init__()
CriteriaEvaluatorCriteriaEvaluator.__init__()CriteriaEvaluator.criteria_configCriteriaEvaluator.fracture_toughness_envelope()CriteriaEvaluator.stress_envelope()CriteriaEvaluator.evaluate_coupled_criterion()CriteriaEvaluator.evaluate_SteadyState()CriteriaEvaluator.find_minimum_force()CriteriaEvaluator.find_minimum_crack_length()CriteriaEvaluator.check_crack_self_propagation()CriteriaEvaluator.find_crack_length_for_weight()
FindMinimumForceResultMaximalStressResultSteadyStateResult
- weac.analysis.envelopes module
- weac.analysis.plotter module
MidpointNormalizePlotterPlotter.__init__()Plotter.plot_slab_profile()Plotter.plot_rotated_slab_profile()Plotter.plot_section_forces()Plotter.plot_energy_release_rates()Plotter.plot_deformed()Plotter.plot_visualize_deformation()Plotter.plot_stress_envelope()Plotter.plot_err_envelope()Plotter.plot_analysis()Plotter.plot_displacements()Plotter.plot_stresses()Plotter.plot_stress_criteria()Plotter.plot_ERR_comp()Plotter.plot_ERR_modes()Plotter.plot_fea_disp()Plotter.plot_fea_stress()
- weac.analysis.steady_state module
SteadyStateErrBlockSteadyStateErrBlock.energy_release_rateSteadyStateErrBlock.cut_lengthSteadyStateErrBlock.cut_direction_winnerSteadyStateErrBlock.convergedSteadyStateErrBlock.messageSteadyStateErrBlock.diagnosticsSteadyStateErrBlock.maximal_stress_resultSteadyStateErrBlock.systemSteadyStateErrBlock.__init__()
SteadyStateResultSteadyStateTensileBlockSteadyStateTensileBlock.critical_cut_lengthSteadyStateTensileBlock.cut_direction_winnerSteadyStateTensileBlock.convergedSteadyStateTensileBlock.messageSteadyStateTensileBlock.diagnosticsSteadyStateTensileBlock.maximal_stress_resultSteadyStateTensileBlock.systemSteadyStateTensileBlock.__init__()
evaluate_steady_state()evaluate_steady_state_from_layers()
Module contents¶
This package contains modules for analyzing the results of the WEAC model.
- class weac.analysis.Analyzer(system_model, printing_enabled=True)[source]¶
Bases:
objectProvides methods for the analysis of layered slabs on compliant elastic foundations.
- Parameters:
system_model (SystemModel)
printing_enabled (bool)
- __init__(system_model, printing_enabled=True)[source]¶
- Parameters:
system_model (SystemModel)
printing_enabled (bool)
- sm: SystemModel¶
- printing_enabled: bool = True¶
- 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).
Nonekeeps uniformlinspacespacing (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'])
- class weac.analysis.CriteriaEvaluator(criteria_config)[source]¶
Bases:
objectPublic facade for stability analysis of layered slabs on compliant elastic foundations.
- Parameters:
criteria_config (CriteriaConfig)
- __init__(criteria_config)[source]¶
Initialize the evaluator with criteria configuration.
- Parameters:
criteria_config (CriteriaConfig) – Configuration for failure criteria.
- criteria_config: CriteriaConfig¶
- fracture_toughness_envelope(G_I, G_II, weak_layer)[source]¶
Evaluate the fracture toughness criterion for Mode I / Mode II ERRs.
A value of 1 indicates the boundary of the fracture toughness envelope.
- Parameters:
G_I (float | ndarray)
G_II (float | ndarray)
weak_layer (WeakLayer)
- Return type:
float | ndarray
- stress_envelope(sigma, tau, weak_layer, method=None)[source]¶
Evaluate the stress envelope for given stress components.
Weak Layer failure is defined as the stress envelope crossing 1.
- Parameters:
sigma (float | ndarray)
tau (float | ndarray)
weak_layer (WeakLayer)
method (str | None)
- Return type:
ndarray
- evaluate_coupled_criterion(system, max_iterations=25, damping_ERR=0.0, tolerance_ERR=0.002, tolerance_stress=0.005, print_call_stats=False, _recursion_depth=0, _force_result=None)[source]¶
Evaluate the coupled criterion for anticrack nucleation.
- Parameters:
system (SystemModel)
max_iterations (int)
damping_ERR (float)
tolerance_ERR (float)
tolerance_stress (float)
print_call_stats (bool)
_recursion_depth (int)
_force_result (FindMinimumForceResult | None)
- Return type:
- evaluate_SteadyState(system, print_call_stats=False)[source]¶
Evaluate hybrid steady state from
system.Extracts layers, weak layer, and inclination φ from
SystemModel. Returns a structured result with independenttensileanderrblocks. Does not accept touchdown mode and does not force φ→0.Per-leg
elapsed_s/n_cut_samplesare always recorded inresult.diagnostics; setprint_call_stats=Trueto print them.Breaking change¶
Former flat-touchdown modes (
TouchdownMode/mode=) and the old flatSteadyStateResultfields (touchdown_distance, top-levelenergy_release_rate, singlemaximal_stress_result) are no longer part of this API. Useresult.tensile.critical_cut_lengthandresult.err.energy_release_rateinstead.- Parameters:
system (SystemModel)
print_call_stats (bool)
- Return type:
- find_minimum_force(system, tolerance_stress=0.0005, print_call_stats=False)[source]¶
Find the minimum skier weight to surpass the stress failure envelope.
- Parameters:
system (SystemModel)
tolerance_stress (float)
print_call_stats (bool)
- Return type:
- find_minimum_crack_length(system, search_interval=None, target=1)[source]¶
Find the minimum crack length to surpass the ERR envelope.
- Parameters:
system (SystemModel)
search_interval (tuple[float, float] | None)
target (float)
- Return type:
tuple[float, list[Segment]]
- check_crack_self_propagation(system, rm_skier_weight=False)[source]¶
Evaluate whether a crack will propagate without additional load.
- Parameters:
system (SystemModel)
rm_skier_weight (bool)
- Return type:
tuple[float, bool]
- find_crack_length_for_weight(system, skier_weight)[source]¶
Find anticrack length and segments for a given skier weight.
- Parameters:
system (SystemModel)
skier_weight (float)
- Return type:
tuple[float, list[Segment]]
- class weac.analysis.CoupledCriterionHistory(skier_weights=<factory>, crack_lengths=<factory>, incr_energies=<factory>, sigma_maxs=<factory>, tau_maxs=<factory>, g_deltas=<factory>, dist_maxs=<factory>, dist_mins=<factory>)[source]¶
Bases:
objectStores the history of the coupled criterion evaluation.
Attributes:¶
- skier_weightslist[float]
Skier weights evaluated during the iteration.
- crack_lengthslist[float]
Crack lengths evaluated during the iteration.
- incr_energieslist[np.ndarray]
Incremental energy release rates for each evaluated state.
- sigma_maxslist[float]
Maximum normal stress values in kPa for each evaluated state. After iteration 1, values reuse the iteration-1 sample (uncracked rasterize is skipped; see main-loop stress bookkeeping).
- tau_maxslist[float]
Maximum shear stress values in kPa for each evaluated state. After iteration 1, values reuse the iteration-1 sample.
- g_deltaslist[float]
Fracture toughness envelope values for each evaluated state.
- dist_maxslist[float]
Maximum distances to the stress envelope for each evaluated state. After iteration 1, values reuse the iteration-1 sample.
- dist_minslist[float]
Minimum distances to the stress envelope for each evaluated state. After iteration 1, values reuse the iteration-1 sample.
- skier_weights: list[float]¶
- crack_lengths: list[float]¶
- incr_energies: list[ndarray]¶
- sigma_maxs: list[float]¶
- tau_maxs: list[float]¶
- g_deltas: list[float]¶
- dist_maxs: list[float]¶
- dist_mins: list[float]¶
- __init__(skier_weights=<factory>, crack_lengths=<factory>, incr_energies=<factory>, sigma_maxs=<factory>, tau_maxs=<factory>, g_deltas=<factory>, dist_maxs=<factory>, dist_mins=<factory>)¶
- Parameters:
skier_weights (list[float])
crack_lengths (list[float])
incr_energies (list[ndarray])
sigma_maxs (list[float])
tau_maxs (list[float])
g_deltas (list[float])
dist_maxs (list[float])
dist_mins (list[float])
- Return type:
None
- Parameters:
skier_weights (list[float])
crack_lengths (list[float])
incr_energies (list[ndarray])
sigma_maxs (list[float])
tau_maxs (list[float])
g_deltas (list[float])
dist_maxs (list[float])
dist_mins (list[float])
- class weac.analysis.CoupledCriterionResult(converged, message, self_collapse, pure_stress_criteria, critical_skier_weight, initial_critical_skier_weight, crack_length, g_delta, dist_ERR_envelope, iterations, history, final_system, max_dist_stress, min_dist_stress)[source]¶
Bases:
objectHolds the results of the coupled criterion evaluation.
Attributes:¶
- convergedbool
Whether the algorithm converged.
- messagestr
The message of the evaluation.
- self_collapsebool
Whether the system collapsed.
- pure_stress_criteriabool
Whether the pure stress criteria is satisfied.
- critical_skier_weightfloat
The critical skier weight.
- initial_critical_skier_weightfloat
The initial critical skier weight.
- crack_lengthfloat
The crack length.
- g_deltafloat
The g_delta value.
- dist_ERR_envelopefloat
The distance to the ERR envelope.
- iterationsint
The number of iterations.
- historyCoupledCriterionHistory
The history of the evaluation.
- final_systemSystemModel
The final system model.
- max_dist_stressfloat
Maximum distance to the stress envelope for the returned
final_systemgeometry.- min_dist_stressfloat
Minimum distance to the stress envelope for the returned
final_systemgeometry.
- converged: bool¶
- message: str¶
- self_collapse: bool¶
- pure_stress_criteria: bool¶
- critical_skier_weight: float¶
- initial_critical_skier_weight: float¶
- crack_length: float¶
- g_delta: float¶
- dist_ERR_envelope: float¶
- iterations: int¶
- history: CoupledCriterionHistory | None¶
- final_system: SystemModel¶
- max_dist_stress: float¶
- min_dist_stress: float¶
- __init__(converged, message, self_collapse, pure_stress_criteria, critical_skier_weight, initial_critical_skier_weight, crack_length, g_delta, dist_ERR_envelope, iterations, history, final_system, max_dist_stress, min_dist_stress)¶
- Parameters:
converged (bool)
message (str)
self_collapse (bool)
pure_stress_criteria (bool)
critical_skier_weight (float)
initial_critical_skier_weight (float)
crack_length (float)
g_delta (float)
dist_ERR_envelope (float)
iterations (int)
history (CoupledCriterionHistory | None)
final_system (SystemModel)
max_dist_stress (float)
min_dist_stress (float)
- Return type:
None
- Parameters:
converged (bool)
message (str)
self_collapse (bool)
pure_stress_criteria (bool)
critical_skier_weight (float)
initial_critical_skier_weight (float)
crack_length (float)
g_delta (float)
dist_ERR_envelope (float)
iterations (int)
history (CoupledCriterionHistory | None)
final_system (SystemModel)
max_dist_stress (float)
min_dist_stress (float)
- class weac.analysis.FindMinimumForceResult(success, critical_skier_weight, new_segments, old_segments, iterations, max_dist_stress, min_dist_stress)[source]¶
Bases:
objectHolds the results of the find_minimum_force evaluation.
Attributes:¶
- successbool
Whether the algorithm converged.
- critical_skier_weightfloat
The critical skier weight.
- new_segmentslist[Segment]
The new segments.
- old_segmentslist[Segment]
The old segments.
- iterationsint
The number of iterations.
- max_dist_stressfloat
The maximum distance to failure.
- min_dist_stressfloat
The minimum distance to failure.
- success: bool¶
- critical_skier_weight: float¶
- iterations: int | None¶
- max_dist_stress: float¶
- min_dist_stress: float¶
- __init__(success, critical_skier_weight, new_segments, old_segments, iterations, max_dist_stress, min_dist_stress)¶
- class weac.analysis.MaximalStressResult(principal_stress_kPa, Sxx_kPa, principal_stress_norm, Sxx_norm, max_principal_stress_norm, max_Sxx_norm, slab_tensile_criterion)[source]¶
Bases:
objectHolds the results of the maximal stress evaluation.
Attributes:¶
- principal_stress_kPa: np.ndarray
The principal stress in kPa.
- Sxx_kPa: np.ndarray
The axial normal stress in kPa.
- principal_stress_norm: np.ndarray
The normalized principal stress to the tensile strength of the layers.
- Sxx_norm: np.ndarray
The normalized axial normal stress to the tensile strength of the layers.
- max_principal_stress_norm: float
The normalized maximum principal stress to the tensile strength of the layers.
- max_Sxx_norm: float
The normalized maximum axial normal stress to the tensile strength of the layers.
- slab_tensile_criterion: float
The slab tensile criterion, i.e. the portion of the slab thickness that is prone to fail under tensile stresses in the steady state (between 0 and 1).
- principal_stress_kPa: ndarray¶
- Sxx_kPa: ndarray¶
- principal_stress_norm: ndarray¶
- Sxx_norm: ndarray¶
- max_principal_stress_norm: float¶
- max_Sxx_norm: float¶
- slab_tensile_criterion: float¶
- __init__(principal_stress_kPa, Sxx_kPa, principal_stress_norm, Sxx_norm, max_principal_stress_norm, max_Sxx_norm, slab_tensile_criterion)¶
- Parameters:
principal_stress_kPa (ndarray)
Sxx_kPa (ndarray)
principal_stress_norm (ndarray)
Sxx_norm (ndarray)
max_principal_stress_norm (float)
max_Sxx_norm (float)
slab_tensile_criterion (float)
- Return type:
None
- Parameters:
principal_stress_kPa (ndarray)
Sxx_kPa (ndarray)
principal_stress_norm (ndarray)
Sxx_norm (ndarray)
max_principal_stress_norm (float)
max_Sxx_norm (float)
slab_tensile_criterion (float)
- class weac.analysis.SteadyStateErrBlock(energy_release_rate, cut_length, cut_direction_winner, converged, message, diagnostics=<factory>, maximal_stress_result=None, system=None)[source]¶
Bases:
objectERR block from the tip-contact (touchdown-cut) search.
- Parameters:
energy_release_rate (float)
cut_length (float)
cut_direction_winner (Literal['upslope', 'downslope'])
converged (bool)
message (str)
diagnostics (dict[str, Any])
maximal_stress_result (MaximalStressResult | None)
system (SystemModel | None)
- energy_release_rate: float¶
- cut_length: float¶
- cut_direction_winner: Literal['upslope', 'downslope']¶
- converged: bool¶
- message: str¶
- diagnostics: dict[str, Any]¶
- maximal_stress_result: MaximalStressResult | None = None¶
- system: SystemModel | None = None¶
- __init__(energy_release_rate, cut_length, cut_direction_winner, converged, message, diagnostics=<factory>, maximal_stress_result=None, system=None)¶
- Parameters:
energy_release_rate (float)
cut_length (float)
cut_direction_winner (Literal['upslope', 'downslope'])
converged (bool)
message (str)
diagnostics (dict[str, Any])
maximal_stress_result (MaximalStressResult | None)
system (SystemModel | None)
- Return type:
None
- class weac.analysis.SteadyStateResult(tensile, err, phi)[source]¶
Bases:
objectStructured hybrid steady-state result with independent tensile / ERR legs.
Exposes
core_scalars()/diagnosticsfor comparison harnesses (characteristic_length= tensileL_crit,energy_release_rate= ERR-leg winner).- Parameters:
tensile (SteadyStateTensileBlock)
err (SteadyStateErrBlock)
phi (float)
- tensile: SteadyStateTensileBlock¶
- err: SteadyStateErrBlock¶
- phi: float¶
- property converged: bool¶
- property message: str¶
- property diagnostics: dict[str, Any]¶
- core_scalars()[source]¶
JSON-friendly top-level scalars for comparison runners.
- Return type:
dict[str, float | bool | str]
- __init__(tensile, err, phi)¶
- Parameters:
tensile (SteadyStateTensileBlock)
err (SteadyStateErrBlock)
phi (float)
- Return type:
None
- class weac.analysis.SteadyStateTensileBlock(critical_cut_length, cut_direction_winner, converged, message, diagnostics=<factory>, maximal_stress_result=None, system=None)[source]¶
Bases:
objectTensile-ease block from the critical-cut search.
- Parameters:
critical_cut_length (float)
cut_direction_winner (Literal['upslope', 'downslope'])
converged (bool)
message (str)
diagnostics (dict[str, Any])
maximal_stress_result (MaximalStressResult | None)
system (SystemModel | None)
- critical_cut_length: float¶
- cut_direction_winner: Literal['upslope', 'downslope']¶
- converged: bool¶
- message: str¶
- diagnostics: dict[str, Any]¶
- maximal_stress_result: MaximalStressResult | None = None¶
- system: SystemModel | None = None¶
- __init__(critical_cut_length, cut_direction_winner, converged, message, diagnostics=<factory>, maximal_stress_result=None, system=None)¶
- Parameters:
critical_cut_length (float)
cut_direction_winner (Literal['upslope', 'downslope'])
converged (bool)
message (str)
diagnostics (dict[str, Any])
maximal_stress_result (MaximalStressResult | None)
system (SystemModel | None)
- Return type:
None
- class weac.analysis.Plotter(plot_dir='plots')[source]¶
Bases:
objectModern plotting class for WEAC simulations with support for multiple system comparisons.
This class provides comprehensive visualization capabilities for weak layer anticrack nucleation simulations, including single system analysis and multi-system comparisons.
Features: - Single and multi-system plotting - System override functionality for selective plotting - Comprehensive dashboard creation - Modern matplotlib styling - Jupyter notebook integration - Automatic plot directory management
- Parameters:
plot_dir (str)
- __init__(plot_dir='plots')[source]¶
Initialize the plotter.
- Parameters:
system (SystemModel, optional) – Single system model for analysis
systems (List[SystemModel], optional) – List of system models for comparison
labels (List[str], optional) – Labels for each system in plots
colors (List[str], optional) – Colors for each system in plots
plot_dir (str, default "plots") – Directory to save plots
- plot_slab_profile(weak_layers, slabs, filename='slab_profile', labels=None, colors=None)[source]¶
Plot slab layer profiles for comparison.
- Parameters:
- Returns:
The generated plot figure.
- Return type:
matplotlib.figure.Figure
- plot_rotated_slab_profile(weak_layer, slab, angle=0, weight=0, slab_width=200, filename='rotated_slab_profile', title='Rotated Slab Profile')[source]¶
Plot a rectangular slab profile with layers stacked vertically, colored by density, and rotated by the specified angle.
- Parameters:
weak_layer (WeakLayer) – The weak layer to plot at the bottom.
slab (Slab) – The slab with layers to plot.
angle (float, optional) – Rotation angle in degrees. Default is 0.
slab_width (float, optional) – Width of the slab rectangle in mm. Default is 200.
filename (str, optional) – Filename for saving plot. Default is “rotated_slab_profile”.
title (str, optional) – Plot title. Default is “Rotated Slab Profile”.
weight (float)
- Returns:
The generated plot figure.
- Return type:
matplotlib.figure.Figure
- plot_section_forces(system_model=None, system_models=None, filename='section_forces', labels=None, colors=None)[source]¶
Plot section forces (N, M, V) for comparison.
- Parameters:
system_model (SystemModel, optional) – Single system to plot (overrides default)
system_models (list[SystemModel], optional) – Multiple systems to plot (overrides default)
filename (str, optional) – Filename for saving plot
labels (list of str, optional) – Labels for each system.
colors (list of str, optional) – Colors for each system.
- plot_energy_release_rates(system_model=None, system_models=None, filename='ERR', labels=None, colors=None)[source]¶
Plot energy release rates (G_I, G_II) for comparison.
- Parameters:
system_model (SystemModel, optional) – Single system to plot (overrides default)
system_models (list[SystemModel], optional) – Multiple systems to plot (overrides default)
filename (str, optional) – Filename for saving plot
labels (list of str, optional) – Labels for each system.
colors (list of str, optional) – Colors for each system.
- plot_deformed(xsl, xwl, z, analyzer, dz=2, scale=100, window=np.inf, pad=2, levels=300, aspect=2, field='w', normalize=True, filename='deformed_slab')[source]¶
Plot deformed slab with field contours.
- Parameters:
xsl (np.ndarray) – Slab x-coordinates.
xwl (np.ndarray) – Weak layer x-coordinates.
z (np.ndarray) – Solution vector.
analyzer (Analyzer) – Analyzer instance.
dz (int, optional) – Element size along z-axis (mm). Default is 2 mm.
scale (int, optional) – Deformation scale factor. Default is 100.
window (float, optional) – Plot window width. Default is inf.
pad (int, optional) – Padding around plot. Default is 2.
levels (int, optional) – Number of contour levels. Default is 300.
aspect (int, optional) – Aspect ratio. Default is 2.
field (str, optional) – Field to plot (‘w’, ‘u’, ‘principal’, ‘Sxx’, ‘Txz’, ‘Szz’). Default is ‘w’.
normalize (bool, optional) – Toggle normalization. Default is True.
filename (str, optional) – Filename for saving plot. Default is “deformed_slab”.
- Returns:
The generated plot figure.
- Return type:
matplotlib.figure.Figure
- plot_visualize_deformation(xsl, xwl, z, analyzer, window=None, weaklayer_proportion=None, dz=2, levels=300, field='w', normalize=True, filename='visualize_deformation')[source]¶
Plot visualize deformation of the slab and weak layer.
- Parameters:
xsl (np.ndarray) – Slab x-coordinates.
xwl (np.ndarray) – Weak layer x-coordinates.
z (np.ndarray) – Solution vector.
analyzer (Analyzer) – Analyzer instance.
window (float | None, optional) – Window size for the plot. Shows the right edge of the slab, where the slab is deformed. Default is None.
weaklayer_proportion (float | None, optional) – Proportion of the plot to allocate to the weak layer. Default is None.
dz (int, optional) – Element size along z-axis (mm). Default is 2 mm.
levels (int, optional) – Number of levels for the colormap. Default is 300.
field (str, optional) – Field to plot (‘w’, ‘u’, ‘principal’, ‘Sxx’, ‘Txz’, ‘Szz’). Default is ‘w’.
normalize (bool, optional) – Toggle normalization. Default is True.
filename (str, optional) – Filename for saving plot. Default is “visualize_deformation”.
- Returns:
The generated plot figure.
- Return type:
matplotlib.figure.Figure
- plot_stress_envelope(system_model, criteria_evaluator, all_envelopes=False, filename=None)[source]¶
Plot stress envelope in τ-σ space.
- Parameters:
system_model (SystemModel) – System to plot
criteria_evaluator (CriteriaEvaluator) – Criteria evaluator to use for the stress envelope
all_envelopes (bool, optional) – Whether to plot all four quadrants of the envelope
filename (str, optional) – Filename for saving plot
- plot_err_envelope(system_model, criteria_evaluator, filename='err_envelope')[source]¶
Plot the ERR envelope.
- Parameters:
system_model (SystemModel)
criteria_evaluator (CriteriaEvaluator)
filename (str)
- Return type:
Figure
- plot_analysis(system, criteria_evaluator, min_force_result, min_crack_length, coupled_criterion_result, dz=2, deformation_scale=100.0, window=np.inf, levels=300, filename='analysis')[source]¶
Plot deformed slab with field contours.
- Parameters:
field (str, default 'w') – Field to plot (‘w’, ‘u’, ‘principal’, ‘sigma’, ‘tau’)
system_model (SystemModel, optional) – System to plot (uses first system if not specified)
filename (str, optional) – Filename for saving plot
system (SystemModel)
criteria_evaluator (CriteriaEvaluator)
min_force_result (FindMinimumForceResult)
min_crack_length (float)
coupled_criterion_result (CoupledCriterionResult)
dz (int)
deformation_scale (float)
window (int)
levels (int)
- Return type:
Figure
- plot_displacements(analyzer, x, z, filename='displacements')[source]¶
Wrap for displacements plot.
- Parameters:
analyzer (Analyzer)
x (ndarray)
z (ndarray)
filename (str)
- Return type:
Figure
- plot_stresses(analyzer, x, z, filename='stresses')[source]¶
Wrap stress plot.
- Parameters:
analyzer (Analyzer)
x (ndarray)
z (ndarray)
filename (str)
- Return type:
Figure
- plot_stress_criteria(analyzer, x, stress)[source]¶
Wrap plot of stress and energy criteria.
- Parameters:
analyzer (Analyzer)
x (ndarray)
stress (ndarray)
- Return type:
Figure
- plot_ERR_comp(analyzer, da, Gdif, Ginc, mode=0)[source]¶
Wrap energy release rate plot.
- Parameters:
analyzer (Analyzer)
da (ndarray)
Gdif (ndarray)
Ginc (ndarray)
mode (int)
- Return type:
Figure
- plot_ERR_modes(analyzer, da, G, kind='inc')[source]¶
Wrap energy release rate plot.
- Parameters:
analyzer (Analyzer)
da (ndarray)
G (ndarray)
kind (str)
- Return type:
Figure