weac 3.1.2__py3-none-any.whl → 3.1.3__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 +1 -1
- weac/analysis/criteria_evaluator.py +4 -1
- weac/components/__init__.py +2 -1
- weac/components/config.py +10 -0
- weac/components/scenario_config.py +2 -0
- weac/core/slab_touchdown.py +29 -12
- weac/core/system_model.py +24 -1
- {weac-3.1.2.dist-info → weac-3.1.3.dist-info}/METADATA +1 -1
- {weac-3.1.2.dist-info → weac-3.1.3.dist-info}/RECORD +12 -12
- {weac-3.1.2.dist-info → weac-3.1.3.dist-info}/WHEEL +0 -0
- {weac-3.1.2.dist-info → weac-3.1.3.dist-info}/licenses/LICENSE +0 -0
- {weac-3.1.2.dist-info → weac-3.1.3.dist-info}/top_level.txt +0 -0
weac/__init__.py
CHANGED
|
@@ -24,7 +24,7 @@ from weac.components import (
|
|
|
24
24
|
WeakLayer,
|
|
25
25
|
)
|
|
26
26
|
from weac.constants import RHO_ICE
|
|
27
|
-
from weac.
|
|
27
|
+
from weac.components.scenario_config import TouchdownMode
|
|
28
28
|
from weac.core.system_model import SystemModel
|
|
29
29
|
|
|
30
30
|
logger = logging.getLogger(__name__)
|
|
@@ -741,6 +741,9 @@ class CriteriaEvaluator:
|
|
|
741
741
|
cut_length=cut_distance,
|
|
742
742
|
)
|
|
743
743
|
system_copy.update_scenario(segments=segments, scenario_config=scenario_config)
|
|
744
|
+
# Force the requested mode to avoid floating-point precision issues
|
|
745
|
+
# when l_AB/l_BC are recalculated with different scenario parameters
|
|
746
|
+
system_copy.set_forced_touchdown_mode(mode)
|
|
744
747
|
touchdown_distance = system_copy.slab_touchdown.touchdown_distance
|
|
745
748
|
analyzer = Analyzer(system_copy, printing_enabled=print_call_stats)
|
|
746
749
|
energy_release_rate, _, _ = analyzer.differential_ERR(unit="J/m^2")
|
weac/components/__init__.py
CHANGED
|
@@ -7,7 +7,7 @@ from .criteria_config import CriteriaConfig
|
|
|
7
7
|
from .layer import Layer, WeakLayer
|
|
8
8
|
from .model_input import ModelInput
|
|
9
9
|
from .segment import Segment
|
|
10
|
-
from .scenario_config import ScenarioConfig, SystemType
|
|
10
|
+
from .scenario_config import ScenarioConfig, SystemType, TouchdownMode
|
|
11
11
|
|
|
12
12
|
__all__ = [
|
|
13
13
|
"Config",
|
|
@@ -18,4 +18,5 @@ __all__ = [
|
|
|
18
18
|
"ScenarioConfig",
|
|
19
19
|
"ModelInput",
|
|
20
20
|
"SystemType",
|
|
21
|
+
"TouchdownMode",
|
|
21
22
|
]
|
weac/components/config.py
CHANGED
|
@@ -12,6 +12,8 @@ field_name: type = Field(..., gt=0, description="Description")
|
|
|
12
12
|
|
|
13
13
|
from pydantic import BaseModel, Field
|
|
14
14
|
|
|
15
|
+
from weac.components.scenario_config import TouchdownMode
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
class Config(BaseModel):
|
|
17
19
|
"""
|
|
@@ -21,11 +23,19 @@ class Config(BaseModel):
|
|
|
21
23
|
----------
|
|
22
24
|
touchdown : bool
|
|
23
25
|
Whether slab touchdown on the collapsed weak layer is considered.
|
|
26
|
+
forced_touchdown_mode : TouchdownMode | None
|
|
27
|
+
If set, forces the touchdown mode instead of calculating it from l_AB/l_BC.
|
|
28
|
+
This avoids floating-point precision issues when the mode boundary values
|
|
29
|
+
are recalculated with different scenario parameters.
|
|
24
30
|
"""
|
|
25
31
|
|
|
26
32
|
touchdown: bool = Field(
|
|
27
33
|
default=False, description="Whether to include slab touchdown in the analysis"
|
|
28
34
|
)
|
|
35
|
+
forced_touchdown_mode: TouchdownMode | None = Field(
|
|
36
|
+
default=None,
|
|
37
|
+
description="Force a specific touchdown mode instead of auto-calculating",
|
|
38
|
+
)
|
|
29
39
|
|
|
30
40
|
|
|
31
41
|
if __name__ == "__main__":
|
weac/core/slab_touchdown.py
CHANGED
|
@@ -9,7 +9,7 @@ from typing import Literal
|
|
|
9
9
|
from scipy.optimize import brentq
|
|
10
10
|
|
|
11
11
|
from weac.components.layer import WeakLayer
|
|
12
|
-
from weac.components.scenario_config import ScenarioConfig
|
|
12
|
+
from weac.components.scenario_config import ScenarioConfig, TouchdownMode
|
|
13
13
|
from weac.components.segment import Segment
|
|
14
14
|
from weac.constants import STIFFNESS_COLLAPSE_FACTOR
|
|
15
15
|
from weac.core.eigensystem import Eigensystem
|
|
@@ -20,9 +20,6 @@ from weac.core.unknown_constants_solver import UnknownConstantsSolver
|
|
|
20
20
|
logger = logging.getLogger(__name__)
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
TouchdownMode = Literal["A_free_hanging", "B_point_contact", "C_in_contact"]
|
|
24
|
-
|
|
25
|
-
|
|
26
23
|
class SlabTouchdown: # pylint: disable=too-many-instance-attributes,too-few-public-methods
|
|
27
24
|
"""
|
|
28
25
|
Handling the touchdown situation in a PST.
|
|
@@ -52,6 +49,9 @@ class SlabTouchdown: # pylint: disable=too-many-instance-attributes,too-few-pub
|
|
|
52
49
|
-----------
|
|
53
50
|
scenario: `Scenario`
|
|
54
51
|
eigensystem: `Eigensystem`
|
|
52
|
+
forced_mode: `TouchdownMode | None`
|
|
53
|
+
If provided, forces this touchdown mode instead of calculating from l_AB/l_BC.
|
|
54
|
+
This avoids floating-point precision issues when scenario parameters change.
|
|
55
55
|
|
|
56
56
|
Attributes:
|
|
57
57
|
-----------
|
|
@@ -81,9 +81,15 @@ class SlabTouchdown: # pylint: disable=too-many-instance-attributes,too-few-pub
|
|
|
81
81
|
touchdown_distance: float
|
|
82
82
|
collapsed_weak_layer_kR: float | None = None
|
|
83
83
|
|
|
84
|
-
def __init__(
|
|
84
|
+
def __init__(
|
|
85
|
+
self,
|
|
86
|
+
scenario: Scenario,
|
|
87
|
+
eigensystem: Eigensystem,
|
|
88
|
+
forced_mode: TouchdownMode | None = None,
|
|
89
|
+
):
|
|
85
90
|
self.scenario = scenario
|
|
86
91
|
self.eigensystem = eigensystem
|
|
92
|
+
self._forced_mode = forced_mode
|
|
87
93
|
|
|
88
94
|
# Create a new scenario config with phi=0 (flat slab) while preserving other settings
|
|
89
95
|
self.flat_config = ScenarioConfig(
|
|
@@ -114,14 +120,25 @@ class SlabTouchdown: # pylint: disable=too-many-instance-attributes,too-few-pub
|
|
|
114
120
|
self.l_BC = self._calc_l_BC()
|
|
115
121
|
except ValueError:
|
|
116
122
|
self.l_BC = self.scenario.L
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if self.
|
|
123
|
+
|
|
124
|
+
# Assign stage - use forced mode if provided, otherwise calculate from thresholds
|
|
125
|
+
if self._forced_mode is not None:
|
|
126
|
+
touchdown_mode = self._forced_mode
|
|
127
|
+
logger.debug(
|
|
128
|
+
"Using forced touchdown mode: %s (l_AB=%.2f, l_BC=%.2f, cut_length=%.2f)",
|
|
129
|
+
touchdown_mode,
|
|
130
|
+
self.l_AB,
|
|
131
|
+
self.l_BC,
|
|
132
|
+
self.scenario.cut_length,
|
|
133
|
+
)
|
|
134
|
+
else:
|
|
120
135
|
touchdown_mode = "A_free_hanging"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
if self.scenario.cut_length <= self.l_AB:
|
|
137
|
+
touchdown_mode = "A_free_hanging"
|
|
138
|
+
elif self.l_AB < self.scenario.cut_length <= self.l_BC:
|
|
139
|
+
touchdown_mode = "B_point_contact"
|
|
140
|
+
elif self.l_BC < self.scenario.cut_length:
|
|
141
|
+
touchdown_mode = "C_in_contact"
|
|
125
142
|
self.touchdown_mode = touchdown_mode
|
|
126
143
|
|
|
127
144
|
def _calc_touchdown_distance(self):
|
weac/core/system_model.py
CHANGED
|
@@ -28,6 +28,7 @@ from weac.core.eigensystem import Eigensystem
|
|
|
28
28
|
from weac.core.field_quantities import FieldQuantities
|
|
29
29
|
from weac.core.scenario import Scenario
|
|
30
30
|
from weac.core.slab import Slab
|
|
31
|
+
from weac.components.scenario_config import TouchdownMode
|
|
31
32
|
from weac.core.slab_touchdown import SlabTouchdown
|
|
32
33
|
from weac.core.unknown_constants_solver import UnknownConstantsSolver
|
|
33
34
|
|
|
@@ -164,7 +165,9 @@ class SystemModel:
|
|
|
164
165
|
if self.config.touchdown:
|
|
165
166
|
logger.info("Solving for Slab Touchdown")
|
|
166
167
|
slab_touchdown = SlabTouchdown(
|
|
167
|
-
scenario=self.scenario,
|
|
168
|
+
scenario=self.scenario,
|
|
169
|
+
eigensystem=self.eigensystem,
|
|
170
|
+
forced_mode=self.config.forced_touchdown_mode,
|
|
168
171
|
)
|
|
169
172
|
logger.info(
|
|
170
173
|
"Original cut_length: %s, touchdown_distance: %s",
|
|
@@ -345,6 +348,26 @@ class SystemModel:
|
|
|
345
348
|
self._invalidate_slab_touchdown()
|
|
346
349
|
self._invalidate_constants()
|
|
347
350
|
|
|
351
|
+
def set_forced_touchdown_mode(self, mode: TouchdownMode | None):
|
|
352
|
+
"""
|
|
353
|
+
Set the forced touchdown mode.
|
|
354
|
+
|
|
355
|
+
When set, the touchdown mode calculation will use this mode instead of
|
|
356
|
+
calculating it from l_AB/l_BC thresholds. This avoids floating-point
|
|
357
|
+
precision issues when the mode boundaries are recalculated with different
|
|
358
|
+
scenario parameters.
|
|
359
|
+
|
|
360
|
+
Parameters
|
|
361
|
+
----------
|
|
362
|
+
mode : TouchdownMode | None
|
|
363
|
+
The mode to force ("A_free_hanging", "B_point_contact", "C_in_contact"),
|
|
364
|
+
or None to use automatic calculation.
|
|
365
|
+
"""
|
|
366
|
+
if self.config.forced_touchdown_mode != mode:
|
|
367
|
+
self.config.forced_touchdown_mode = mode
|
|
368
|
+
self._invalidate_slab_touchdown()
|
|
369
|
+
self._invalidate_constants()
|
|
370
|
+
|
|
348
371
|
def _invalidate_eigensystem(self):
|
|
349
372
|
"""Invalidate the eigensystem."""
|
|
350
373
|
self.__dict__.pop("eigensystem", None)
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
weac/__init__.py,sha256=
|
|
1
|
+
weac/__init__.py,sha256=LEEvHYM1lupYQMMcn2dSLg39Hwlksbx2UAscsPiUt3M,76
|
|
2
2
|
weac/constants.py,sha256=BX8ifZhFciCuzzako1p-2Wh5CWWzR3cPdvyu501UtUs,1194
|
|
3
3
|
weac/logging_config.py,sha256=GJn4Fs80dDRpbPkSPByCmIOLkEI01dbeuMMSv_IDgoM,1103
|
|
4
4
|
weac/analysis/__init__.py,sha256=FDbmQLC5zmT8OJftqNYgihXc8WYB1b9FasFPGzkKVU8,498
|
|
5
5
|
weac/analysis/analyzer.py,sha256=-yoOqsdQvpNvBc-U2nqB4UEKHGTMBu23lVPJqKxUVcs,29095
|
|
6
|
-
weac/analysis/criteria_evaluator.py,sha256=
|
|
6
|
+
weac/analysis/criteria_evaluator.py,sha256=T4_BdWFHkw8ZpOOWdR0A4Y3GGSZHuMJdtX8bPC1mRdo,48498
|
|
7
7
|
weac/analysis/plotter.py,sha256=ibkH4rzQ2pqQVXPRfek722e8eU3vP63uysb-Q-EzfC0,80556
|
|
8
|
-
weac/components/__init__.py,sha256=
|
|
9
|
-
weac/components/config.py,sha256=
|
|
8
|
+
weac/components/__init__.py,sha256=zEQCrc9q-yd0B-n1-vLhpZLQD3ZPYhAyivHySnI1zhs,475
|
|
9
|
+
weac/components/config.py,sha256=PTzLLmtWqazcRvkxQt4mCV1gAGAng3oNuQpBbEYc22g,1372
|
|
10
10
|
weac/components/criteria_config.py,sha256=f2agU7nXWURFAw8_68igiSk5aICUxwaB9u3Qasit-Q0,2909
|
|
11
11
|
weac/components/layer.py,sha256=Ut0B9jKW4a6GVPxV43A4VCtAQJYk6ZA3MX8gt2aJBcQ,12491
|
|
12
12
|
weac/components/model_input.py,sha256=oyX4p7PgaAtUXXtpvV8XO_KxwOXtG1TB0x7rXxNfCFA,3330
|
|
13
|
-
weac/components/scenario_config.py,sha256=
|
|
13
|
+
weac/components/scenario_config.py,sha256=kR_YkI1fEKCs8VDQyvc118QCJnTsEFltYuDb-cpSJsc,2641
|
|
14
14
|
weac/components/segment.py,sha256=F279KcAAkRuJKWav_BZ4BanO96WZm4KXtKHinFZki7s,941
|
|
15
15
|
weac/core/__init__.py,sha256=pRyCKD8XD3qXVUWtFG7N3cS91P5x5d8Jpr1hMEgxQ2U,233
|
|
16
16
|
weac/core/eigensystem.py,sha256=b7KXi2weCY9IVlH_7lCTXzKSx_pLdWY-x8BPjHL5nKo,13736
|
|
17
17
|
weac/core/field_quantities.py,sha256=rr0KvM5Eu9AR43CQrrODJJkXkM2b2N3BWk2dE38f64c,9175
|
|
18
18
|
weac/core/scenario.py,sha256=vHHe-JDWc-8ECVfy6lFGVtJmIIKRc0J9iUEGR8zckdw,6050
|
|
19
19
|
weac/core/slab.py,sha256=YwbAf7ogYDn3p0nXfj3IjVqwA6ro3jBSg2wXb_io_gQ,5125
|
|
20
|
-
weac/core/slab_touchdown.py,sha256=
|
|
21
|
-
weac/core/system_model.py,sha256=
|
|
20
|
+
weac/core/slab_touchdown.py,sha256=gO-nB1RntBdDuxckqnTIoFKnATheX6JeTrzxjo-6wsc,14707
|
|
21
|
+
weac/core/system_model.py,sha256=U7iAcVRZrUbRR-vNhRU1lKWZQwtucMLdrY-K0ZcFcbo,16418
|
|
22
22
|
weac/core/unknown_constants_solver.py,sha256=kzB8351UC03rVcJWez0FAwdawI2tERbpcgqMRKgYbi8,17753
|
|
23
23
|
weac/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
weac/utils/geldsetzer.py,sha256=Rmn_PUyeomPLfxZlj9LDbdBBRDWovavrQenka318TIM,3681
|
|
25
25
|
weac/utils/misc.py,sha256=lGz0IDDJ_3nvYjSkivPJ5Xscl1D_AmvQLSjaL7SUbKs,3674
|
|
26
26
|
weac/utils/snow_types.py,sha256=OKSY8LzfKycSjg7uSUZkSXUzwhcw1D1fZs5S3hVQtUM,1573
|
|
27
27
|
weac/utils/snowpilot_parser.py,sha256=drOLnUg7uzMJMO9qU9x79xZkqQfFPCCQonVpU9S0x8U,13682
|
|
28
|
-
weac-3.1.
|
|
29
|
-
weac-3.1.
|
|
30
|
-
weac-3.1.
|
|
31
|
-
weac-3.1.
|
|
32
|
-
weac-3.1.
|
|
28
|
+
weac-3.1.3.dist-info/licenses/LICENSE,sha256=ojZPWKFHbFGDrlNOvuAKGH9WcKhpLHWZPcQ4SzhK91M,1082
|
|
29
|
+
weac-3.1.3.dist-info/METADATA,sha256=D1EzMmxGIS1qFrcq9QnI8P4vKy7Y77GAiTL_LenYvms,25593
|
|
30
|
+
weac-3.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
31
|
+
weac-3.1.3.dist-info/top_level.txt,sha256=8tyXUHPFU4Ba_5kPtpwvXo5l6GjJmOnODVBJFygpdeE,5
|
|
32
|
+
weac-3.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|