Document simulation protocol and generation evidence for v1.1.0
Browse filesAdds units, constrained-LHS definitions, impactor and boundary/contact settings, temporal sampling, discrete peak-time semantics, provenance updates, and anonymized generation evidence. Data archives and mesh bytes are unchanged.
- BUILD_AUDIT.json +2 -2
- CITATION.cff +3 -3
- DATASHEET.md +65 -11
- README.md +98 -6
- README_zh.md +52 -2
- THIRD_PARTY_NOTICES.md +10 -6
- VALIDATION_REPORT.json +4 -4
- checksums.sha256 +42 -13
- generation_evidence/README.md +32 -0
- generation_evidence/conversion/prepare_floorfrontR_compact_training_data.py +656 -0
- generation_evidence/conversion/prepare_floorfrontR_training_data.py +535 -0
- generation_evidence/conversion/prepare_floorfrontdriver_compact_training_data.py +13 -0
- generation_evidence/conversion/prepare_trunkfloor_compact_training_data.py +13 -0
- generation_evidence/export/compact_floorfrontR.cfile +23 -0
- generation_evidence/export/compact_floorfrontR_elements.cfile +12 -0
- generation_evidence/export/compact_floorfrontR_nodes.cfile +14 -0
- generation_evidence/export/compact_floorfrontdriver.cfile +23 -0
- generation_evidence/export/compact_trunkfloor.cfile +23 -0
- generation_evidence/impactor/add_impactor_to_floor_panels.py +530 -0
- generation_evidence/lhs/extend_floorfrontdriver_lhs_cases_to_500.py +129 -0
- generation_evidence/lhs/extend_floorfrontdriver_lhs_to_200.py +146 -0
- generation_evidence/lhs/floorfrontR/case_manifest.csv +0 -0
- generation_evidence/lhs/floorfrontR/lhs_design_summary.txt +13 -0
- generation_evidence/lhs/floorfrontdriver/case_manifest.csv +0 -0
- generation_evidence/lhs/floorfrontdriver/lhs_design_summary.txt +13 -0
- generation_evidence/lhs/floorfrontdriver/lhs_design_summary_200.txt +6 -0
- generation_evidence/lhs/floorfrontdriver/lhs_extension_201_500_summary.txt +11 -0
- generation_evidence/lhs/generate_floorfrontR_lhs_cases.py +19 -0
- generation_evidence/lhs/generate_floorfrontdriver_lhs_cases.py +300 -0
- generation_evidence/lhs/generate_floorfrontdriver_random_cases.py +424 -0
- generation_evidence/lhs/generate_trunkfloor_lhs_cases.py +19 -0
- generation_evidence/lhs/trunkfloor/case_manifest.csv +0 -0
- generation_evidence/lhs/trunkfloor/lhs_design_summary.txt +13 -0
- generation_evidence/stress/effective_stress_definition.txt +12 -0
- metadata/LHS_DESIGN.md +59 -0
- metadata/SIMULATION_PROTOCOL.md +92 -0
- metadata/TEMPORAL_SAMPLING.md +36 -0
- metadata/dataset.json +63 -10
- metadata/floorfrontR_geometry.json +8 -1
- metadata/floorfrontdriver_geometry.json +8 -1
- metadata/trunkfloor_geometry.json +8 -1
- release_inventory.json +1 -1
- schema.json +37 -24
- scripts/validate_dataset.py +3 -3
BUILD_AUDIT.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"dataset": "Automotive Impact Dataset",
|
| 3 |
-
"version": "1.
|
| 4 |
"audit_date": "2026-08-26",
|
| 5 |
"case_byte_preservation": {
|
| 6 |
"status": "passed",
|
|
@@ -24,5 +24,5 @@
|
|
| 24 |
"metadata/trunkfloor_peak_normalization.json"
|
| 25 |
]
|
| 26 |
},
|
| 27 |
-
"scope_note": "This is a technical build audit; provenance and
|
| 28 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"dataset": "Automotive Impact Dataset",
|
| 3 |
+
"version": "1.1.0",
|
| 4 |
"audit_date": "2026-08-26",
|
| 5 |
"case_byte_preservation": {
|
| 6 |
"status": "passed",
|
|
|
|
| 24 |
"metadata/trunkfloor_peak_normalization.json"
|
| 25 |
]
|
| 26 |
},
|
| 27 |
+
"scope_note": "This is a technical build audit; provenance, units, simulation settings, and remaining solver limitations are documented separately."
|
| 28 |
}
|
CITATION.cff
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
cff-version: 1.2.0
|
| 2 |
-
message: "If you use this dataset, please cite the versioned Hugging Face repository for release v1.
|
| 3 |
title: "Automotive Impact Dataset: Multi-Geometry Full-Field Transient Simulation Data"
|
| 4 |
type: dataset
|
| 5 |
-
version: 1.
|
| 6 |
-
date-released: 2026-09-
|
| 7 |
authors:
|
| 8 |
- family-names: "Authors"
|
| 9 |
given-names: "Anonymous"
|
|
|
|
| 1 |
cff-version: 1.2.0
|
| 2 |
+
message: "If you use this dataset, please cite the versioned Hugging Face repository for release v1.1.0."
|
| 3 |
title: "Automotive Impact Dataset: Multi-Geometry Full-Field Transient Simulation Data"
|
| 4 |
type: dataset
|
| 5 |
+
version: 1.1.0
|
| 6 |
+
date-released: 2026-09-10
|
| 7 |
authors:
|
| 8 |
- family-names: "Authors"
|
| 9 |
given-names: "Anonymous"
|
DATASHEET.md
CHANGED
|
@@ -31,16 +31,56 @@ state, it stores the maximum von Mises equivalent stress across all
|
|
| 31 |
through-thickness integration points. The integration-point index producing
|
| 32 |
the maximum is not retained. Values are reported in MPa.
|
| 33 |
|
| 34 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
|
| 42 |
-
The
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
## Preprocessing
|
| 46 |
|
|
@@ -50,6 +90,17 @@ preparation. They have not been reduced to a single peak state. The accompanying
|
|
| 50 |
the largest valid nodal displacement magnitude and using stress from the same
|
| 51 |
state.
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
Some source nodes may require filled values; each case retains
|
| 54 |
`raw_valid_node_mask`, `filled_node_mask`, `filled_node_count`, and
|
| 55 |
`valid_node_mask` to make that processing explicit.
|
|
@@ -91,7 +142,7 @@ audit described in `metadata/floorfrontR_DATA_NOTE.md`.
|
|
| 91 |
|
| 92 |
## Splits and benchmark integrity
|
| 93 |
|
| 94 |
-
The full v1.
|
| 95 |
Consequently, the test split reproduces the paper protocol but is not a hidden
|
| 96 |
benchmark after publication. New benchmark work should define a separate
|
| 97 |
private evaluation set or use an evaluation server.
|
|
@@ -110,5 +161,8 @@ without silently replacing data.
|
|
| 110 |
|
| 111 |
## Licensing
|
| 112 |
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
through-thickness integration points. The integration-point index producing
|
| 32 |
the maximum is not retained. Values are reported in MPa.
|
| 33 |
|
| 34 |
+
## Condition definitions and units
|
| 35 |
+
|
| 36 |
+
The simulations use a tonne--mm--s--N consistent unit system. Coordinates and
|
| 37 |
+
displacements are in mm, time is in s, velocity is in mm/s, mass is in tonne,
|
| 38 |
+
density is in tonne/mm^3, and stress and Young's modulus are in MPa.
|
| 39 |
+
|
| 40 |
+
The paper-level inputs map to released fields as follows:
|
| 41 |
|
| 42 |
+
- p is `impact_xyz`, the centroid of a selected eligible panel shell;
|
| 43 |
+
- v is `velocity_xyz`, the rigid impactor's initial translational velocity;
|
| 44 |
+
- mu is `mass_ratio`, a dimensionless scale factor in [0.75, 1.25];
|
| 45 |
+
- E is `material_young_mpa`, the rigid-impactor Young's modulus;
|
| 46 |
+
- nu is `material_poisson`, the rigid-impactor Poisson ratio.
|
| 47 |
|
| 48 |
+
The impact speed is sampled in [1732.05, 5196.15] mm/s. Theta is sampled in
|
| 49 |
+
[0, 15] degrees from global +Z, and phi is sampled in [0, 360] degrees in
|
| 50 |
+
global XY from +X toward +Y. Cartesian velocity is computed from speed and
|
| 51 |
+
these two angles. The three material categories are discrete rigid-impactor
|
| 52 |
+
E/nu pairs: (70000 MPa, 0.33), (110000 MPa, 0.34), and
|
| 53 |
+
(210000 MPa, 0.30).
|
| 54 |
+
|
| 55 |
+
Mass ratio scales the generator's reference impactor mass and density:
|
| 56 |
+
`impactor_mass = 0.01 tonne * mu` and
|
| 57 |
+
`impactor_density = 5.205e-5 tonne/mm^3 * mu`. The mass field is the nominal
|
| 58 |
+
mass recorded by the generator.
|
| 59 |
+
|
| 60 |
+
## Collection and simulation process
|
| 61 |
+
|
| 62 |
+
Conditions were generated with a seven-dimensional constrained Latin hypercube
|
| 63 |
+
over position X/Y, speed, mass ratio, theta, phi, and material class. Eligible
|
| 64 |
+
impact positions are panel-shell centroids at least 80 mm from the topological
|
| 65 |
+
outer boundary. Normalized LHS position coordinates are mapped to unused
|
| 66 |
+
eligible centroids, so Z is inherited from the selected shell and is not an
|
| 67 |
+
independent continuous coordinate. Among 128 trial designs, the normalized
|
| 68 |
+
maximin design is retained. `metadata/LHS_DESIGN.md` records the exact
|
| 69 |
+
geometry-specific batching and seeds.
|
| 70 |
+
|
| 71 |
+
The simulations were executed with LS-DYNA SMP single precision R12 through
|
| 72 |
+
ANSYS v221 `lsdyna_sp.exe`, using `ncpu=8` and `memory=400m`, on panel geometry
|
| 73 |
+
derived from the 2020 Nissan Rogue finite-element model Version 3. The rigid
|
| 74 |
+
spherical-shell impactor has radius 12.5 mm, thickness 0.1 mm, ELFORM 2,
|
| 75 |
+
SHRF 0.833333, NIP 3, and a 5.0-mm initial gap. Panel outer-boundary nodes are
|
| 76 |
+
fixed in all six degrees of freedom. Impactor--panel interaction uses automatic
|
| 77 |
+
surface-to-surface contact with static and dynamic friction coefficients of
|
| 78 |
+
0.15. A body acceleration of 9810 mm/s^2 acts in global +Z. Further details are
|
| 79 |
+
given in `metadata/SIMULATION_PROTOCOL.md`.
|
| 80 |
+
|
| 81 |
+
Raw solver databases and curve text are not included. Panel material and shell
|
| 82 |
+
definitions remain those of the upstream Version 3 model. The exact LS-DYNA
|
| 83 |
+
R12 sub-build is not retained for every released case.
|
| 84 |
|
| 85 |
## Preprocessing
|
| 86 |
|
|
|
|
| 90 |
the largest valid nodal displacement magnitude and using stress from the same
|
| 91 |
state.
|
| 92 |
|
| 93 |
+
The solver requests D3PLOT output every 0.0002 s through 0.03 s. Compact
|
| 94 |
+
conversion retains every tenth raw state and appends the final state. Both
|
| 95 |
+
nodal and element fields use indices `[0, 10, 20, ..., 150, 151]` in every
|
| 96 |
+
released case. The first 16 retained states have a nominal 0.002-s spacing;
|
| 97 |
+
the appended terminal state can be much closer to index 150. Exact times are
|
| 98 |
+
stored per case.
|
| 99 |
+
|
| 100 |
+
Peak time `t*` is an argmax over valid nodes and these 17 retained states only.
|
| 101 |
+
It is therefore a discrete, temporally quantized label rather than a
|
| 102 |
+
continuous-time solver maximum. See `metadata/TEMPORAL_SAMPLING.md`.
|
| 103 |
+
|
| 104 |
Some source nodes may require filled values; each case retains
|
| 105 |
`raw_valid_node_mask`, `filled_node_mask`, `filled_node_count`, and
|
| 106 |
`valid_node_mask` to make that processing explicit.
|
|
|
|
| 142 |
|
| 143 |
## Splits and benchmark integrity
|
| 144 |
|
| 145 |
+
The full v1.1 release includes labels for train, validation, and test cases.
|
| 146 |
Consequently, the test split reproduces the paper protocol but is not a hidden
|
| 147 |
benchmark after publication. New benchmark work should define a separate
|
| 148 |
private evaluation set or use an evaluation server.
|
|
|
|
| 161 |
|
| 162 |
## Licensing
|
| 163 |
|
| 164 |
+
Project-authored code, documentation, metadata, and derived numerical results
|
| 165 |
+
are released under the MIT License. The panel meshes are derived from the cited
|
| 166 |
+
CCSA/NHTSA vehicle model; upstream attribution is preserved and the upstream
|
| 167 |
+
model is not represented as MIT-licensed project-authored content. Provenance
|
| 168 |
+
and attribution are documented in `THIRD_PARTY_NOTICES.md`.
|
README.md
CHANGED
|
@@ -12,7 +12,7 @@ viewer: false
|
|
| 12 |
|
| 13 |
# Automotive Impact Dataset
|
| 14 |
|
| 15 |
-
**Version:** 1.
|
| 16 |
**Data type:** finite-element simulation trajectories
|
| 17 |
**Task:** impact-conditioned displacement and shell von Mises effective-stress field prediction
|
| 18 |
|
|
@@ -26,6 +26,15 @@ The dataset supports research on graph neural operators, mesh-based surrogate
|
|
| 26 |
models, spatiotemporal field prediction, peak-event prediction, and
|
| 27 |
simulation-based design screening.
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
## Dataset summary
|
| 30 |
|
| 31 |
| Geometry | Cases | Nodes | Directed graph edges | Shell elements | Displacement | von Mises effective stress |
|
|
@@ -37,6 +46,70 @@ simulation-based design screening.
|
|
| 37 |
The three geometries are independent datasets. Equal case identifiers across
|
| 38 |
geometries do **not** denote paired physical simulations.
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
## Stress definition
|
| 41 |
|
| 42 |
The `effective_stress` field is the shell-element von Mises equivalent stress
|
|
@@ -56,6 +129,7 @@ automotive-impact-data/
|
|
| 56 |
│ └── trunkfloor/cases_001_100.zip ... cases_401_500.zip
|
| 57 |
├── meshes/
|
| 58 |
├── metadata/
|
|
|
|
| 59 |
├── scripts/
|
| 60 |
├── manifest.csv
|
| 61 |
├── checksums.sha256
|
|
@@ -75,7 +149,7 @@ from huggingface_hub import snapshot_download
|
|
| 75 |
dataset_root = snapshot_download(
|
| 76 |
repo_id="structmeshdata/automotive-impact-data",
|
| 77 |
repo_type="dataset",
|
| 78 |
-
revision="v1.
|
| 79 |
)
|
| 80 |
```
|
| 81 |
|
|
@@ -124,6 +198,21 @@ For peak-event prediction, the supplied script selects the state containing the
|
|
| 124 |
global maximum valid nodal displacement magnitude and uses the von Mises
|
| 125 |
effective-stress field from that same state.
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
## Data-version note
|
| 128 |
|
| 129 |
The included `floorfrontR` data passed the release quality audit. Files from
|
|
@@ -136,8 +225,11 @@ earlier internal builds must not be mixed with this release; see
|
|
| 136 |
- The dataset covers three fixed meshes and their documented sampled conditions.
|
| 137 |
- It does not establish generalization to arbitrary vehicle geometries or real tests.
|
| 138 |
- Public test labels reproduce the fixed paper protocol but are not a hidden benchmark.
|
| 139 |
-
- The
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
## License
|
| 143 |
|
|
@@ -146,6 +238,6 @@ model provenance are documented in `THIRD_PARTY_NOTICES.md`.
|
|
| 146 |
|
| 147 |
## Citation
|
| 148 |
|
| 149 |
-
Please cite the versioned Hugging Face repository for release `v1.
|
| 150 |
-
https://huggingface.co/datasets/structmeshdata/automotive-impact-data/tree/v1.
|
| 151 |
Citation metadata is also provided in `CITATION.cff`.
|
|
|
|
| 12 |
|
| 13 |
# Automotive Impact Dataset
|
| 14 |
|
| 15 |
+
**Version:** 1.1.0
|
| 16 |
**Data type:** finite-element simulation trajectories
|
| 17 |
**Task:** impact-conditioned displacement and shell von Mises effective-stress field prediction
|
| 18 |
|
|
|
|
| 26 |
models, spatiotemporal field prediction, peak-event prediction, and
|
| 27 |
simulation-based design screening.
|
| 28 |
|
| 29 |
+
Detailed generation documentation is provided in:
|
| 30 |
+
|
| 31 |
+
- `metadata/SIMULATION_PROTOCOL.md` for units, the impactor, boundary/contact
|
| 32 |
+
conditions, and solver/output settings;
|
| 33 |
+
- `metadata/LHS_DESIGN.md` for parameter definitions, design bounds, and the
|
| 34 |
+
geometry-specific constrained-LHS construction;
|
| 35 |
+
- `metadata/TEMPORAL_SAMPLING.md` for the 17-state reduction and the discrete
|
| 36 |
+
peak-time definition.
|
| 37 |
+
|
| 38 |
## Dataset summary
|
| 39 |
|
| 40 |
| Geometry | Cases | Nodes | Directed graph edges | Shell elements | Displacement | von Mises effective stress |
|
|
|
|
| 46 |
The three geometries are independent datasets. Equal case identifiers across
|
| 47 |
geometries do **not** denote paired physical simulations.
|
| 48 |
|
| 49 |
+
## Conditions and units
|
| 50 |
+
|
| 51 |
+
The simulations use the tonne--mm--s--N consistent unit system. Coordinates
|
| 52 |
+
and displacements are in mm, time is in s, velocity is in mm/s, mass is in
|
| 53 |
+
tonne, density is in tonne/mm^3, and stress and Young's modulus are in MPa.
|
| 54 |
+
|
| 55 |
+
| Symbol | Released field | Definition | Design domain | Unit |
|
| 56 |
+
|---|---|---|---|---|
|
| 57 |
+
| p | `impact_xyz` | centroid of the selected eligible panel shell | geometry-dependent discrete candidate set | mm |
|
| 58 |
+
| v | `velocity_xyz` | initial rigid-impactor translational velocity | derived from speed and angles | mm/s |
|
| 59 |
+
| s | `impact_speed` | velocity magnitude | [1732.05, 5196.15] | mm/s |
|
| 60 |
+
| mu | `mass_ratio` | common scale factor for reference impactor mass and density | [0.75, 1.25] | dimensionless |
|
| 61 |
+
| theta | `theta_deg` | polar angle measured from global +Z | [0, 15] | degree |
|
| 62 |
+
| phi | `phi_deg` | azimuth in global XY, from +X toward +Y | [0, 360] | degree |
|
| 63 |
+
| E | `material_young_mpa` | rigid-impactor Young's modulus | {70000, 110000, 210000} | MPa |
|
| 64 |
+
| nu | `material_poisson` | rigid-impactor Poisson ratio | {0.33, 0.34, 0.30} | dimensionless |
|
| 65 |
+
|
| 66 |
+
The velocity is constructed as
|
| 67 |
+
`v = s [sin(theta) cos(phi), sin(theta) sin(phi), cos(theta)]`.
|
| 68 |
+
The mass-ratio convention is
|
| 69 |
+
`impactor_mass = 0.01 tonne * mu` and
|
| 70 |
+
`impactor_density = 5.205e-5 tonne/mm^3 * mu`.
|
| 71 |
+
|
| 72 |
+
Impact positions are not sampled as three independent continuous coordinates.
|
| 73 |
+
Eligible positions are shell-element centroids at least 80 mm from the
|
| 74 |
+
topological outer boundary. Two LHS coordinates are mapped in normalized XY to
|
| 75 |
+
the nearest unused eligible centroid; the released Z coordinate is the actual
|
| 76 |
+
centroid height.
|
| 77 |
+
|
| 78 |
+
## Constrained-LHS design
|
| 79 |
+
|
| 80 |
+
Each design uses seven normalized coordinates: position X, position Y, speed,
|
| 81 |
+
mass ratio, theta, phi, and material class. Candidate designs are generated by
|
| 82 |
+
Latin hypercube sampling, and the design with the largest normalized minimum
|
| 83 |
+
pairwise distance among 128 trials is retained. Material is a balanced
|
| 84 |
+
three-level categorical coordinate.
|
| 85 |
+
|
| 86 |
+
`floorfrontR` and `trunkfloor` use independent single-batch designs with seeds
|
| 87 |
+
20260728 and 20260723, respectively. `floorfrontdriver` is a staged design:
|
| 88 |
+
cases 001--100 use seed 20260721, cases 101--200 are a complementary nested
|
| 89 |
+
extension using seed 20260722, and cases 201--500 form an independent
|
| 90 |
+
augmentation using seed 20260722. The geometries share parameter bounds and
|
| 91 |
+
simulation rules but do not share paired physical conditions.
|
| 92 |
+
|
| 93 |
+
## Impactor and simulation setup
|
| 94 |
+
|
| 95 |
+
The impactor is a rigid spherical shell with radius 12.5 mm and an initial
|
| 96 |
+
5.0-mm gap from the target centroid along the direction opposite to travel. It
|
| 97 |
+
uses shell ELFORM 2, shear factor 0.833333, three through-thickness integration
|
| 98 |
+
points, thickness 0.1 mm, and `*MAT_RIGID`. The material class changes only the
|
| 99 |
+
rigid impactor's E and nu; mass ratio changes only its density and nominal
|
| 100 |
+
mass.
|
| 101 |
+
|
| 102 |
+
All nodes on the panel's topological outer boundary are constrained in all six
|
| 103 |
+
degrees of freedom. Impactor--panel interaction uses
|
| 104 |
+
`*CONTACT_AUTOMATIC_SURFACE_TO_SURFACE_ID` with static and dynamic friction
|
| 105 |
+
coefficients of 0.15. A body acceleration of 9810 mm/s^2 is applied in global
|
| 106 |
+
+Z. Simulations end at 0.03 s. They were run with LS-DYNA SMP single precision
|
| 107 |
+
R12 through ANSYS v221 `lsdyna_sp.exe` using `ncpu=8` and `memory=400m`.
|
| 108 |
+
|
| 109 |
+
The panel material definitions and shell sections remain those of the cited
|
| 110 |
+
upstream Version 3 model; their full keyword cards are not redistributed in
|
| 111 |
+
this compact release.
|
| 112 |
+
|
| 113 |
## Stress definition
|
| 114 |
|
| 115 |
The `effective_stress` field is the shell-element von Mises equivalent stress
|
|
|
|
| 129 |
│ └── trunkfloor/cases_001_100.zip ... cases_401_500.zip
|
| 130 |
├── meshes/
|
| 131 |
├── metadata/
|
| 132 |
+
├── generation_evidence/
|
| 133 |
├── scripts/
|
| 134 |
├── manifest.csv
|
| 135 |
├── checksums.sha256
|
|
|
|
| 149 |
dataset_root = snapshot_download(
|
| 150 |
repo_id="structmeshdata/automotive-impact-data",
|
| 151 |
repo_type="dataset",
|
| 152 |
+
revision="v1.1.0",
|
| 153 |
)
|
| 154 |
```
|
| 155 |
|
|
|
|
| 198 |
global maximum valid nodal displacement magnitude and uses the von Mises
|
| 199 |
effective-stress field from that same state.
|
| 200 |
|
| 201 |
+
## Temporal sampling
|
| 202 |
+
|
| 203 |
+
The solver writes D3PLOT output at a nominal interval of 0.0002 s. Compact
|
| 204 |
+
conversion retains every tenth raw state and appends the final state. Every
|
| 205 |
+
released case therefore uses indices `[0, 10, 20, ..., 150, 151]`; the first
|
| 206 |
+
16 retained states have a nominal 0.002-s spacing, while the appended terminal
|
| 207 |
+
state can be very close to index 150. Exact floating-point times are stored in
|
| 208 |
+
each case and should be used instead of reconstructing them from the nominal
|
| 209 |
+
interval.
|
| 210 |
+
|
| 211 |
+
The peak time `t*` is discrete: it is the argmax of nodal displacement magnitude
|
| 212 |
+
over valid nodes and the 17 retained states only. It is not a continuous-time
|
| 213 |
+
solver maximum. Stress at the same selected retained state is used as the
|
| 214 |
+
paired peak-event stress target.
|
| 215 |
+
|
| 216 |
## Data-version note
|
| 217 |
|
| 218 |
The included `floorfrontR` data passed the release quality audit. Files from
|
|
|
|
| 225 |
- The dataset covers three fixed meshes and their documented sampled conditions.
|
| 226 |
- It does not establish generalization to arbitrary vehicle geometries or real tests.
|
| 227 |
- Public test labels reproduce the fixed paper protocol but are not a hidden benchmark.
|
| 228 |
+
- The exact LS-DYNA R12 sub-build is not retained for every case.
|
| 229 |
+
- The recorded `impactor_mass` is the generator-defined nominal mass; users
|
| 230 |
+
requiring an independently recomputed solver mass should inspect an original
|
| 231 |
+
solver `MATSUM` output.
|
| 232 |
+
- Peak-event time is quantized to the released 17-state temporal grid.
|
| 233 |
|
| 234 |
## License
|
| 235 |
|
|
|
|
| 238 |
|
| 239 |
## Citation
|
| 240 |
|
| 241 |
+
Please cite the versioned Hugging Face repository for release `v1.1.0`:
|
| 242 |
+
https://huggingface.co/datasets/structmeshdata/automotive-impact-data/tree/v1.1.0.
|
| 243 |
Citation metadata is also provided in `CITATION.cff`.
|
README_zh.md
CHANGED
|
@@ -1,10 +1,58 @@
|
|
| 1 |
# 汽车结构冲击数据集中文说明
|
| 2 |
|
| 3 |
本汽车结构冲击数据集包含三种汽车
|
| 4 |
-
结构几何上的独立冲击有限元仿真。每种几何包含 500 个 LHS 工况,
|
| 5 |
每个工况保存 17 个对齐时刻的完整节点三维位移场和壳单元
|
| 6 |
von Mises 等效应力场。
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
## 数据规模
|
| 9 |
|
| 10 |
| 几何 | case数 | 节点数 | 壳单元数 | 位移张量 | 应力张量 |
|
|
@@ -40,4 +88,6 @@ python scripts/validate_dataset.py --dataset-root . --verify-checksums
|
|
| 40 |
|
| 41 |
本发布包中的 `floorfrontR` 数据经过完整质量核查;不要与更早的内部构建
|
| 42 |
混用。本仓库采用 MIT License,详细来源、字段和局限请参阅英文
|
| 43 |
-
`README.md`、`DATASHEET.md`
|
|
|
|
|
|
|
|
|
| 1 |
# 汽车结构冲击数据集中文说明
|
| 2 |
|
| 3 |
本汽车结构冲击数据集包含三种汽车
|
| 4 |
+
结构几何上的独立冲击有限元仿真。每种几何包含 500 个约束 LHS 工况,
|
| 5 |
每个工况保存 17 个对齐时刻的完整节点三维位移场和壳单元
|
| 6 |
von Mises 等效应力场。
|
| 7 |
|
| 8 |
+
## 参数与单位
|
| 9 |
+
|
| 10 |
+
仿真采用 tonne--mm--s--N 一致单位制:坐标和位移为 mm,时间为 s,
|
| 11 |
+
速度为 mm/s,质量为 tonne,密度为 tonne/mm^3,应力和弹性模量为 MPa。
|
| 12 |
+
|
| 13 |
+
- 冲击速度范围为 1732.05--5196.15 mm/s。
|
| 14 |
+
- 质量比 `mu` 范围为 0.75--1.25,并满足
|
| 15 |
+
`impactor_mass = 0.01 tonne * mu`、
|
| 16 |
+
`impactor_density = 5.205e-5 tonne/mm^3 * mu`。
|
| 17 |
+
- `theta` 为相对全局 +Z 的极角,范围 0--15 度;`phi` 为全局 XY
|
| 18 |
+
平面内从 +X 指向 +Y 的方位角,范围 0--360 度。
|
| 19 |
+
- 速度向量为
|
| 20 |
+
`v = s [sin(theta) cos(phi), sin(theta) sin(phi), cos(theta)]`。
|
| 21 |
+
- E 和 nu 是刚性冲击球的材料参数,三个离散组合分别为
|
| 22 |
+
`(70000 MPa, 0.33)`、`(110000 MPa, 0.34)` 和
|
| 23 |
+
`(210000 MPa, 0.30)`。
|
| 24 |
+
|
| 25 |
+
冲击位置不是三个连续坐标的独立采样。候选位置是距离面板拓扑外边界
|
| 26 |
+
至少 80 mm 的壳单元质心;两个归一化 LHS 位置坐标映射到最近且未使用的
|
| 27 |
+
候选质心,Z 坐标取该质心的实际高度。
|
| 28 |
+
|
| 29 |
+
## 仿真设置
|
| 30 |
+
|
| 31 |
+
冲击体是半径 12.5 mm 的刚性球壳,初始间隙 5.0 mm,采用 ELFORM=2、
|
| 32 |
+
SHRF=0.833333、NIP=3、厚度 0.1 mm 和 `*MAT_RIGID`。面板拓扑外边界
|
| 33 |
+
节点的六个自由度全部固定。冲击接触采用
|
| 34 |
+
`*CONTACT_AUTOMATIC_SURFACE_TO_SURFACE_ID`,静、动摩擦系数均为 0.15;
|
| 35 |
+
全局 +Z 方向施加 9810 mm/s^2 的体加速度。仿真终止时间为 0.03 s。
|
| 36 |
+
|
| 37 |
+
求解使用 ANSYS v221 中的 `lsdyna_sp.exe`,对应 LS-DYNA SMP single
|
| 38 |
+
precision R12,运行参数为 `ncpu=8`、`memory=400m`。面板材料和壳截面
|
| 39 |
+
沿用上游 Version 3 模型;完整 keyword 卡不包含在本紧凑数据发布中。
|
| 40 |
+
|
| 41 |
+
## LHS 与时间采样
|
| 42 |
+
|
| 43 |
+
LHS 包含位置 X/Y、速度大小、质量比、theta、phi 和材料类别七个维度,
|
| 44 |
+
并从 128 个候选设计中选择归一化最小样本间距最大的设计。三种几何共享
|
| 45 |
+
参数范围和仿真规则,但使用不同的候选网格位置和随机种子;其中
|
| 46 |
+
`floorfrontdriver` 是分阶段构建的设计,而不是一次生成的单批设计。
|
| 47 |
+
|
| 48 |
+
D3PLOT 名义输出间隔为 0.0002 s。紧凑转换每十个原始状态保留一帧,
|
| 49 |
+
并额外加入最终状态;全部公开工况的索引均为
|
| 50 |
+
`[0,10,20,...,150,151]`。前 16 帧名义间隔为 0.002 s,最后一帧可能与
|
| 51 |
+
前一帧非常接近,实际计算应使用每个样本保存的 `time`。
|
| 52 |
+
|
| 53 |
+
峰值时间 `t*` 只在 17 个保留状态中对有效节点的位移模长取最大值,
|
| 54 |
+
因此是离散时间,不是连续求解轨迹的精确峰值;应力标签取相同状态。
|
| 55 |
+
|
| 56 |
## 数据规模
|
| 57 |
|
| 58 |
| 几何 | case数 | 节点数 | 壳单元数 | 位移张量 | 应力张量 |
|
|
|
|
| 88 |
|
| 89 |
本发布包中的 `floorfrontR` 数据经过完整质量核查;不要与更早的内部构建
|
| 90 |
混用。本仓库采用 MIT License,详细来源、字段和局限请参阅英文
|
| 91 |
+
`README.md`、`DATASHEET.md`、`metadata/SIMULATION_PROTOCOL.md`、
|
| 92 |
+
`metadata/LHS_DESIGN.md`、`metadata/TEMPORAL_SAMPLING.md` 和
|
| 93 |
+
`THIRD_PARTY_NOTICES.md`。
|
THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -11,12 +11,16 @@ Official model page:
|
|
| 11 |
|
| 12 |
https://www.ccsa.gmu.edu/models/2020-nissan-rogue/
|
| 13 |
|
| 14 |
-
The
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
## LS-DYNA
|
| 22 |
|
|
|
|
| 11 |
|
| 12 |
https://www.ccsa.gmu.edu/models/2020-nissan-rogue/
|
| 13 |
|
| 14 |
+
The released panel geometries were derived from Version 3, released August
|
| 15 |
+
2024. The official technical presentation is identified by DOI
|
| 16 |
+
`10.13021/xb7g-8z06`.
|
| 17 |
+
|
| 18 |
+
This repository includes three extracted panel meshes needed to interpret the
|
| 19 |
+
released fields. Project-authored code, metadata, documentation, and derived
|
| 20 |
+
numerical results are distributed under this repository's licenses. Reference
|
| 21 |
+
to those licenses does not represent the upstream vehicle model as
|
| 22 |
+
project-authored or relicense it. Publications using these assets should retain
|
| 23 |
+
the CCSA and NHTSA acknowledgement and applicable disclaimer.
|
| 24 |
|
| 25 |
## LS-DYNA
|
| 26 |
|
VALIDATION_REPORT.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"dataset": "Automotive Impact Dataset",
|
| 3 |
-
"version": "1.
|
| 4 |
"status": "passed",
|
| 5 |
"cases_validated": 1500,
|
| 6 |
"split_sizes": {
|
|
@@ -51,9 +51,9 @@
|
|
| 51 |
}
|
| 52 |
},
|
| 53 |
"checksums": {
|
| 54 |
-
"checked_files":
|
| 55 |
},
|
| 56 |
-
"elapsed_seconds":
|
| 57 |
"errors": [],
|
| 58 |
-
"scope_note": "Technical package validation only; provenance and
|
| 59 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"dataset": "Automotive Impact Dataset",
|
| 3 |
+
"version": "1.1.0",
|
| 4 |
"status": "passed",
|
| 5 |
"cases_validated": 1500,
|
| 6 |
"split_sizes": {
|
|
|
|
| 51 |
}
|
| 52 |
},
|
| 53 |
"checksums": {
|
| 54 |
+
"checked_files": 77
|
| 55 |
},
|
| 56 |
+
"elapsed_seconds": 32.78638792037964,
|
| 57 |
"errors": [],
|
| 58 |
+
"scope_note": "Technical package validation only; provenance and remaining configuration limitations are documented in the release metadata."
|
| 59 |
}
|
checksums.sha256
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
1390fe35fb4bf7ae3b664798735e5e6e90421a14ee41717029b704d8189571e4 .gitignore
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
0566a01e7392327b540b35810be439b9f5f1e0ff330c2d2c9e5cc72ccc319363 LICENSE
|
| 6 |
0566a01e7392327b540b35810be439b9f5f1e0ff330c2d2c9e5cc72ccc319363 LICENSE-CODE
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
b86c173e169a1f0fd8c298b86f155d4c2e4d909e225c467600558c3b01d41ec5 data/floorfrontR/cases_001_100.zip
|
| 11 |
b06750609d7da3579f4e83a973255be17288ff75643add7a85a7764a5e93dcd7 data/floorfrontR/cases_101_200.zip
|
| 12 |
2ebee491189083a7f33aeb11999cfc04ce77fd4bed57745f9b5202d1951a6a58 data/floorfrontR/cases_201_300.zip
|
|
@@ -22,27 +22,56 @@ c5a938dea14657df147648795247a415d8ec31a3ca68c989a69ed62e154e5749 data/trunkfloo
|
|
| 22 |
745ab8ad15ed3a40466f4b1c2e539cac3981cf3442da5d267150356e6c923f8b data/trunkfloor/cases_201_300.zip
|
| 23 |
f7c0ebbd8bf53079bb7fbf856286c8df2a5652184ecf3884398c190530019dd7 data/trunkfloor/cases_301_400.zip
|
| 24 |
98487b9085eb8d715ae81d3466befec53fb8468ff1286a357c5380f91de02dfd data/trunkfloor/cases_401_500.zip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
02f7ac3d93d902eab35e4235d94ee70a7b3a3b75387053a3351c6a5bb977d503 manifest.csv
|
| 26 |
7c63c99afe297f995c18a801159573f4b5a86bc25031743fd5168da77a47385d meshes/floorfrontR_mesh.npz
|
| 27 |
f3493dbed1517d74b34cc6a801238735e3c570f63234566d6f4f8dede51788ba meshes/floorfrontdriver_mesh.npz
|
| 28 |
9cbb3476bed490746ef6e01f0049ec1573746a2c68ca5537364e66311a29ce9b meshes/trunkfloor_mesh.npz
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
5827784a6b36fb7df800dcad4c2e2cb1ef69b69770ed16a74fd273bb660d6817 metadata/floorfrontR_DATA_NOTE.md
|
| 31 |
decbe458d0572178fa502b35329460bd758884f06fc72f2e095a8e99185b0080 metadata/floorfrontR_conditions.csv
|
| 32 |
-
|
| 33 |
4f4c3db379540ac3aa5d27ca4ed96095324d43a47b93ecbd1c321d54700cf8ef metadata/floorfrontR_peak_normalization.json
|
| 34 |
5576a6401c58a83c856b5b5d350f04fe7d4f98417db2d34848ffd8f91290157d metadata/floorfrontdriver_conditions.csv
|
| 35 |
-
|
| 36 |
0ad2af354f04891d1768c3d6bb6d7a9eb925935ea411f163107bd9bf2d747780 metadata/floorfrontdriver_peak_normalization.json
|
| 37 |
cd89eadfc5b9c1b69832a24d0c00617d2fdf2e983fe3bfd1d3a8ac15166c9ab9 metadata/split_400_50_50_seed12345.json
|
| 38 |
f64c3d94411da71e7ef5ec1bac9ce5d6c2305189bd6469a3c34c75a0b42d8bd8 metadata/trunkfloor_conditions.csv
|
| 39 |
-
|
| 40 |
37e1726395b3960f1d549f360c6428c47cda21bf4fc4a92783de2b163b7f3fb1 metadata/trunkfloor_peak_normalization.json
|
| 41 |
-
|
| 42 |
c0801d2e3f5249c34a251979aecaa32b046deabb5cb627f0592866e4dee5f376 requirements.txt
|
| 43 |
-
|
| 44 |
3008c2139a8d7ee556222e964c5e5e638828683e4bd38003098cdd2df0b413d0 scripts/build_peak_targets.py
|
| 45 |
683dc2d9c9bf93d47e5edf253045e8a19e0bf1dccdd5784c52570b72c3c840dc scripts/compute_train_normalization.py
|
| 46 |
6781f7623d8c7f9bca4798f94bf0cd4bd272cd4ef29c7bdeda1a287c0aa14ec1 scripts/load_case.py
|
| 47 |
-
|
| 48 |
7afa09ebeda88f8afed693540899f1d3a1ded9ab0bb2c6d67bab1b6ba99d55f0 scripts/visualize_trajectory.py
|
|
|
|
| 1 |
1390fe35fb4bf7ae3b664798735e5e6e90421a14ee41717029b704d8189571e4 .gitignore
|
| 2 |
+
1017ba775c18b5a9608826f5adcf13637453918bd93fd65b96cac3a2b1d1de25 BUILD_AUDIT.json
|
| 3 |
+
9768a8cd9bca1793bb9898ccdf3beeead683a438d9bd6bd89c01856d3ac2cd6e CITATION.cff
|
| 4 |
+
0814fcd0e23c4c16c6cbb57ab7b119805553051cbd9d52916ada2940db3bbe78 DATASHEET.md
|
| 5 |
0566a01e7392327b540b35810be439b9f5f1e0ff330c2d2c9e5cc72ccc319363 LICENSE
|
| 6 |
0566a01e7392327b540b35810be439b9f5f1e0ff330c2d2c9e5cc72ccc319363 LICENSE-CODE
|
| 7 |
+
daec69f01d9b4ebd2854ea09c84a9013d91a5f9f1a9ecbe1e0d7ad895ddf9287 README.md
|
| 8 |
+
5585747191fddc2b9ca23d09c7937039c040e130158c935c5143e5eb9ec1af03 README_zh.md
|
| 9 |
+
8ac9c65332853b19a994459ee308fb6e06eeeb768b5768f38dda3ae55a377217 THIRD_PARTY_NOTICES.md
|
| 10 |
b86c173e169a1f0fd8c298b86f155d4c2e4d909e225c467600558c3b01d41ec5 data/floorfrontR/cases_001_100.zip
|
| 11 |
b06750609d7da3579f4e83a973255be17288ff75643add7a85a7764a5e93dcd7 data/floorfrontR/cases_101_200.zip
|
| 12 |
2ebee491189083a7f33aeb11999cfc04ce77fd4bed57745f9b5202d1951a6a58 data/floorfrontR/cases_201_300.zip
|
|
|
|
| 22 |
745ab8ad15ed3a40466f4b1c2e539cac3981cf3442da5d267150356e6c923f8b data/trunkfloor/cases_201_300.zip
|
| 23 |
f7c0ebbd8bf53079bb7fbf856286c8df2a5652184ecf3884398c190530019dd7 data/trunkfloor/cases_301_400.zip
|
| 24 |
98487b9085eb8d715ae81d3466befec53fb8468ff1286a357c5380f91de02dfd data/trunkfloor/cases_401_500.zip
|
| 25 |
+
e58bd0c738111c43dd047fb39a98101ccdbb73325a4c10a664f77df35d7c0246 generation_evidence/README.md
|
| 26 |
+
b3f9edbb791059879683a63184a7bc80fceaa41e3f5ab82e74113e96f07b2a31 generation_evidence/conversion/prepare_floorfrontR_compact_training_data.py
|
| 27 |
+
22f8012bc90b34df68ca98c2eb0e99a3e6cc99a13dca88164763299820b16b69 generation_evidence/conversion/prepare_floorfrontR_training_data.py
|
| 28 |
+
1b8ec53015b7e4e247e26c6960feabea243aee8313e2b3fada004f01f93b54c4 generation_evidence/conversion/prepare_floorfrontdriver_compact_training_data.py
|
| 29 |
+
043ea47d7105de49229e418d2efefc876bbb8794871b4bcab0003fe4d42e6188 generation_evidence/conversion/prepare_trunkfloor_compact_training_data.py
|
| 30 |
+
9d7a99e335ddfbe6a1247da5d41a752304ec92093baab601a030ac06806bea0e generation_evidence/export/compact_floorfrontR.cfile
|
| 31 |
+
827f5bc3c72d1fe041301068fb0ccd2823e1bbba85b50e34830e9013d94e53cf generation_evidence/export/compact_floorfrontR_elements.cfile
|
| 32 |
+
88fdef945708145979aba323ba3b06ce8e0024ab3c987125a0b047d13ce78222 generation_evidence/export/compact_floorfrontR_nodes.cfile
|
| 33 |
+
5c754d447c73ab89532c633575bb4e2f7d6ce8907043c06e112adaba40b5b7ee generation_evidence/export/compact_floorfrontdriver.cfile
|
| 34 |
+
7f3fcf60de096e8bf47d95af680aba6902244c59f0373bba7d12faae9faa8ef7 generation_evidence/export/compact_trunkfloor.cfile
|
| 35 |
+
cceb5c2e64710f0f65c6859c94fdd335de3fe80a8f963da0f92de0c539b74dc1 generation_evidence/impactor/add_impactor_to_floor_panels.py
|
| 36 |
+
444f0a594e605de730b40220fc2f0fedfb92804bfd1c6ab19bbce39fbb4b9063 generation_evidence/lhs/extend_floorfrontdriver_lhs_cases_to_500.py
|
| 37 |
+
c9ac4801795e71dc92ec3b3c26648b568f9b91972353727f8b35a354ab0a454a generation_evidence/lhs/extend_floorfrontdriver_lhs_to_200.py
|
| 38 |
+
ec54243c1fefb5e15ae002e21a516a29dd40d500bd7f0c09f5f345891bdadb8c generation_evidence/lhs/floorfrontR/case_manifest.csv
|
| 39 |
+
6e61656e954d248c69fa28acccb394b10fa169988ee6fd292a52c996f35ec9fa generation_evidence/lhs/floorfrontR/lhs_design_summary.txt
|
| 40 |
+
37b93f008da5de0b28d8ff3460593cfbf1f8a7bb3653eaaf174c5d63682f4774 generation_evidence/lhs/floorfrontdriver/case_manifest.csv
|
| 41 |
+
51b893c674f320e29211ebc60ce2231fec5e301aec1f885c7bef316bd35de204 generation_evidence/lhs/floorfrontdriver/lhs_design_summary.txt
|
| 42 |
+
8350dcccf37850573ff8ee1256c18f592f0785cd8aeb9b1f8e423ed03970cffd generation_evidence/lhs/floorfrontdriver/lhs_design_summary_200.txt
|
| 43 |
+
61043910819171bbbefe986ccc9b58c6b6c0950fbbe6760b3477b06366bbd3e7 generation_evidence/lhs/floorfrontdriver/lhs_extension_201_500_summary.txt
|
| 44 |
+
2718e7e29da191ac44861c4e7abce0bcb8a0317fd8cf0bbe067d5c03ea8febf3 generation_evidence/lhs/generate_floorfrontR_lhs_cases.py
|
| 45 |
+
ccf2b71c67f3a8237d5ed03e032274a6a86ac1ab339e2bc561d1e490152d1628 generation_evidence/lhs/generate_floorfrontdriver_lhs_cases.py
|
| 46 |
+
cbc6e087de631ce33e23275b2530097a44a102fcf8909b6802f2014ae7d2e808 generation_evidence/lhs/generate_floorfrontdriver_random_cases.py
|
| 47 |
+
a5782cc91c53f0118e0d0a9af400469bea1e003ebc200b2026176679bc4ca8f2 generation_evidence/lhs/generate_trunkfloor_lhs_cases.py
|
| 48 |
+
b448fa87b80bdfc77cf6e563b84d9d03043f9199f48c3a5c905ce72d0c6cd2d9 generation_evidence/lhs/trunkfloor/case_manifest.csv
|
| 49 |
+
4465bcaba14ebe817a15dcf76c49d7b18fd7a629c96549af9a10dfd8f090f5dc generation_evidence/lhs/trunkfloor/lhs_design_summary.txt
|
| 50 |
+
56b153459a23cbcc42ca0ea0a08d925112a74b47de4bf12a19d9fd90cc524ed3 generation_evidence/stress/effective_stress_definition.txt
|
| 51 |
02f7ac3d93d902eab35e4235d94ee70a7b3a3b75387053a3351c6a5bb977d503 manifest.csv
|
| 52 |
7c63c99afe297f995c18a801159573f4b5a86bc25031743fd5168da77a47385d meshes/floorfrontR_mesh.npz
|
| 53 |
f3493dbed1517d74b34cc6a801238735e3c570f63234566d6f4f8dede51788ba meshes/floorfrontdriver_mesh.npz
|
| 54 |
9cbb3476bed490746ef6e01f0049ec1573746a2c68ca5537364e66311a29ce9b meshes/trunkfloor_mesh.npz
|
| 55 |
+
2dd66d5fb7b7aa68c72dde949bee1f06043922586d76e8aef7f5243eb2908f4f metadata/LHS_DESIGN.md
|
| 56 |
+
a17bfda7f8f4f5735f396fa732c1a78b9426710c4a803d242045978b7871f3a6 metadata/SIMULATION_PROTOCOL.md
|
| 57 |
+
c55a3ffa95e7820251a7b89d2bda561c7aac323e14bb1c31a15c88e25d72de99 metadata/TEMPORAL_SAMPLING.md
|
| 58 |
+
eb438607874f4165a63790ea0b247b0fa8308e9592eb4a2bd185c3347169543b metadata/dataset.json
|
| 59 |
5827784a6b36fb7df800dcad4c2e2cb1ef69b69770ed16a74fd273bb660d6817 metadata/floorfrontR_DATA_NOTE.md
|
| 60 |
decbe458d0572178fa502b35329460bd758884f06fc72f2e095a8e99185b0080 metadata/floorfrontR_conditions.csv
|
| 61 |
+
dab8c2346a8041c747e95375f09950453b30fd27623f9c8c935e2ebe3d70ae99 metadata/floorfrontR_geometry.json
|
| 62 |
4f4c3db379540ac3aa5d27ca4ed96095324d43a47b93ecbd1c321d54700cf8ef metadata/floorfrontR_peak_normalization.json
|
| 63 |
5576a6401c58a83c856b5b5d350f04fe7d4f98417db2d34848ffd8f91290157d metadata/floorfrontdriver_conditions.csv
|
| 64 |
+
dc91d6e95f5dd55319c7d68bb0ec5720d25f7bc22418e2afb904017523761188 metadata/floorfrontdriver_geometry.json
|
| 65 |
0ad2af354f04891d1768c3d6bb6d7a9eb925935ea411f163107bd9bf2d747780 metadata/floorfrontdriver_peak_normalization.json
|
| 66 |
cd89eadfc5b9c1b69832a24d0c00617d2fdf2e983fe3bfd1d3a8ac15166c9ab9 metadata/split_400_50_50_seed12345.json
|
| 67 |
f64c3d94411da71e7ef5ec1bac9ce5d6c2305189bd6469a3c34c75a0b42d8bd8 metadata/trunkfloor_conditions.csv
|
| 68 |
+
b61c9645cb1a3396b3b19b4a65b5e97e7a0b6369a9cdd67b18627f0cbbef19f9 metadata/trunkfloor_geometry.json
|
| 69 |
37e1726395b3960f1d549f360c6428c47cda21bf4fc4a92783de2b163b7f3fb1 metadata/trunkfloor_peak_normalization.json
|
| 70 |
+
c572e08b8eb73b546c57e7caa0ebee9cea34cfedd784ace455e06f4c6beae4b4 release_inventory.json
|
| 71 |
c0801d2e3f5249c34a251979aecaa32b046deabb5cb627f0592866e4dee5f376 requirements.txt
|
| 72 |
+
854d76a81793f05abe7127bfb5823d7fa25d115f150161eba13f70aa5c078d6c schema.json
|
| 73 |
3008c2139a8d7ee556222e964c5e5e638828683e4bd38003098cdd2df0b413d0 scripts/build_peak_targets.py
|
| 74 |
683dc2d9c9bf93d47e5edf253045e8a19e0bf1dccdd5784c52570b72c3c840dc scripts/compute_train_normalization.py
|
| 75 |
6781f7623d8c7f9bca4798f94bf0cd4bd272cd4ef29c7bdeda1a287c0aa14ec1 scripts/load_case.py
|
| 76 |
+
e7022182a385c9c77bd4a46be9e9720416f3e299914a9c4c22937094a94d48d5 scripts/validate_dataset.py
|
| 77 |
7afa09ebeda88f8afed693540899f1d3a1ded9ab0bb2c6d67bab1b6ba99d55f0 scripts/visualize_trajectory.py
|
generation_evidence/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generation evidence
|
| 2 |
+
|
| 3 |
+
This directory contains project-authored scripts and design records supporting
|
| 4 |
+
the simulation and preprocessing descriptions in the dataset Datasheet.
|
| 5 |
+
|
| 6 |
+
## Included
|
| 7 |
+
|
| 8 |
+
- `lhs/`: constrained-LHS generation and staged-extension implementations,
|
| 9 |
+
geometry-specific design summaries, and exact case manifests;
|
| 10 |
+
- `impactor/`: construction of the rigid spherical impactor, panel-boundary
|
| 11 |
+
constraints, contact, gravity, termination, and D3PLOT controls;
|
| 12 |
+
- `export/`: LS-PrePost command files for nodal displacement and shell effective
|
| 13 |
+
stress export;
|
| 14 |
+
- `conversion/`: compact temporal reduction and PyTorch serialization;
|
| 15 |
+
- `stress/`: retained LS-PrePost header evidence for the effective-stress
|
| 16 |
+
definition.
|
| 17 |
+
|
| 18 |
+
## Reproducibility boundary
|
| 19 |
+
|
| 20 |
+
These files document the algorithms used for the released data. Some generation
|
| 21 |
+
scripts require third-party LS-DYNA keyword templates obtained from the cited
|
| 22 |
+
upstream model. Those keyword files, LS-DYNA executables, raw D3PLOT databases,
|
| 23 |
+
and representative solver logs are not included here. Consequently this
|
| 24 |
+
directory is an auditable generation record, not a standalone redistribution
|
| 25 |
+
of the upstream finite-element model.
|
| 26 |
+
|
| 27 |
+
Historical local paths and machine-specific wrapper scripts are intentionally
|
| 28 |
+
excluded. Paths appearing in case manifests are relative historical case paths
|
| 29 |
+
and contain no user or machine identity.
|
| 30 |
+
|
| 31 |
+
The repository's code license applies to the project-authored scripts in this
|
| 32 |
+
directory. See `../THIRD_PARTY_NOTICES.md` for upstream attribution.
|
generation_evidence/conversion/prepare_floorfrontR_compact_training_data.py
ADDED
|
@@ -0,0 +1,656 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import csv
|
| 5 |
+
import os
|
| 6 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
from typing import Dict, List, Optional, Tuple
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
import torch
|
| 12 |
+
|
| 13 |
+
from prepare_floorfrontR_training_data import (
|
| 14 |
+
DEFAULT_PANEL_KEY,
|
| 15 |
+
PANEL_PID,
|
| 16 |
+
build_graph,
|
| 17 |
+
parse_key_mesh,
|
| 18 |
+
read_curveplot_txt,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
DEFAULT_CASE_ROOT = Path("cases_floorfrontR_random_50")
|
| 23 |
+
DEFAULT_OUT_ROOT = Path("training_data_floorfrontR_compact")
|
| 24 |
+
RESULTS_DIR = "results_compact"
|
| 25 |
+
NODE_RESULT_NAMES = ("x_displacement", "y_displacement", "z_displacement")
|
| 26 |
+
ELEMENT_RESULT_NAMES = ("effective_stress", "effective_plastic_strain")
|
| 27 |
+
MIN_UNIQUE_ELEMENT_ID_FRACTION = 0.99
|
| 28 |
+
MAX_DOMINANT_STRESS_CURVE_FRACTION = 0.95
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def parse_args() -> argparse.Namespace:
|
| 32 |
+
ap = argparse.ArgumentParser(
|
| 33 |
+
description="Convert compact floorfrontR LS-PrePost curve outputs to lightweight .pt training data."
|
| 34 |
+
)
|
| 35 |
+
ap.add_argument("--case-root", type=Path, default=DEFAULT_CASE_ROOT)
|
| 36 |
+
ap.add_argument("--sweep-root", type=Path, default=None, help="Process every velocity folder under this root.")
|
| 37 |
+
ap.add_argument("--out-root", type=Path, default=DEFAULT_OUT_ROOT)
|
| 38 |
+
ap.add_argument("--panel-key", type=Path, default=DEFAULT_PANEL_KEY)
|
| 39 |
+
ap.add_argument("--panel-pid", type=int, default=PANEL_PID)
|
| 40 |
+
ap.add_argument("--start", type=int, default=1, help="First case number to convert.")
|
| 41 |
+
ap.add_argument("--end", type=int, default=0, help="Last case number to convert. Use 0 for all cases.")
|
| 42 |
+
ap.add_argument("--stride", type=int, default=10, help="Save one state every N time steps.")
|
| 43 |
+
ap.add_argument("--no-include-last", action="store_true", help="Do not append the final time state.")
|
| 44 |
+
ap.add_argument("--workers", type=int, default=1)
|
| 45 |
+
ap.add_argument("--overwrite", action="store_true")
|
| 46 |
+
ap.add_argument(
|
| 47 |
+
"--expected-cases",
|
| 48 |
+
type=int,
|
| 49 |
+
default=0,
|
| 50 |
+
help="Expected number of manifest/case entries. Use 0 to disable this check.",
|
| 51 |
+
)
|
| 52 |
+
ap.add_argument(
|
| 53 |
+
"--require-all",
|
| 54 |
+
action="store_true",
|
| 55 |
+
help="Fail if any selected case is missing required results_compact files.",
|
| 56 |
+
)
|
| 57 |
+
ap.add_argument(
|
| 58 |
+
"--delete-raw",
|
| 59 |
+
action="store_true",
|
| 60 |
+
help="Delete results_compact text files after a case .pt is successfully written.",
|
| 61 |
+
)
|
| 62 |
+
return ap.parse_args()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def save_npz_from_graph(graph: Dict[str, torch.Tensor], out_path: Path) -> None:
|
| 66 |
+
arrays = {
|
| 67 |
+
"nid": graph["nid"].numpy(),
|
| 68 |
+
"pos": graph["pos"].numpy(),
|
| 69 |
+
"edge_index": graph["edge_index"].numpy(),
|
| 70 |
+
"boundary_mask": graph["boundary_mask"].numpy(),
|
| 71 |
+
}
|
| 72 |
+
if "element_id" in graph:
|
| 73 |
+
arrays["element_id"] = graph["element_id"].numpy()
|
| 74 |
+
np.savez_compressed(out_path, **arrays)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def make_stride_indices(n_steps: int, stride: int, include_last: bool) -> torch.Tensor:
|
| 78 |
+
if stride < 1:
|
| 79 |
+
raise ValueError("--stride must be >= 1")
|
| 80 |
+
idx = list(range(0, n_steps, stride))
|
| 81 |
+
if include_last and idx[-1] != n_steps - 1:
|
| 82 |
+
idx.append(n_steps - 1)
|
| 83 |
+
return torch.tensor(idx, dtype=torch.long)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def read_manifest_rows(case_root: Path) -> List[dict]:
|
| 87 |
+
case_manifest = case_root / "case_manifest.csv"
|
| 88 |
+
if case_manifest.exists():
|
| 89 |
+
with case_manifest.open("r", newline="") as f:
|
| 90 |
+
return list(csv.DictReader(f))
|
| 91 |
+
|
| 92 |
+
velocity_manifest = case_root.parent / "velocity_manifest.csv"
|
| 93 |
+
if velocity_manifest.exists():
|
| 94 |
+
with velocity_manifest.open("r", newline="") as f:
|
| 95 |
+
rows = list(csv.DictReader(f))
|
| 96 |
+
return [r for r in rows if r.get("velocity_set") == case_root.name]
|
| 97 |
+
|
| 98 |
+
rows = []
|
| 99 |
+
for case_dir in sorted(case_root.glob("case*")):
|
| 100 |
+
if not case_dir.is_dir():
|
| 101 |
+
continue
|
| 102 |
+
case_name = case_dir.name
|
| 103 |
+
rows.append(
|
| 104 |
+
{
|
| 105 |
+
"case": case_name,
|
| 106 |
+
"key_file": str(case_dir / f"{case_name}.key"),
|
| 107 |
+
"panel_pid": str(PANEL_PID),
|
| 108 |
+
}
|
| 109 |
+
)
|
| 110 |
+
return rows
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def filter_case_rows(rows: List[dict], start: int, end: int) -> List[dict]:
|
| 114 |
+
if start <= 1 and end <= 0:
|
| 115 |
+
return rows
|
| 116 |
+
|
| 117 |
+
selected = []
|
| 118 |
+
for row in rows:
|
| 119 |
+
case_name = row.get("case", "")
|
| 120 |
+
if not case_name.startswith("case"):
|
| 121 |
+
selected.append(row)
|
| 122 |
+
continue
|
| 123 |
+
try:
|
| 124 |
+
case_num = int(case_name[4:])
|
| 125 |
+
except ValueError:
|
| 126 |
+
selected.append(row)
|
| 127 |
+
continue
|
| 128 |
+
if case_num < start:
|
| 129 |
+
continue
|
| 130 |
+
if end > 0 and case_num > end:
|
| 131 |
+
continue
|
| 132 |
+
selected.append(row)
|
| 133 |
+
return selected
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def format_case_preview(cases: List[str], limit: int = 20) -> str:
|
| 137 |
+
preview = ", ".join(sorted(cases)[:limit])
|
| 138 |
+
if len(cases) > limit:
|
| 139 |
+
preview += f", ... (+{len(cases) - limit} more)"
|
| 140 |
+
return preview
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def find_missing_compact_results(rows: List[dict]) -> List[str]:
|
| 144 |
+
missing = []
|
| 145 |
+
required_names = NODE_RESULT_NAMES + ELEMENT_RESULT_NAMES
|
| 146 |
+
for row in rows:
|
| 147 |
+
key_file = Path(row.get("key_file", ""))
|
| 148 |
+
results_dir = key_file.parent / RESULTS_DIR
|
| 149 |
+
if not results_dir.exists():
|
| 150 |
+
missing.append(row["case"])
|
| 151 |
+
continue
|
| 152 |
+
if any(not (results_dir / name).exists() or (results_dir / name).stat().st_size <= 0 for name in required_names):
|
| 153 |
+
missing.append(row["case"])
|
| 154 |
+
return missing
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
def tensor3(values: List[Optional[str]]) -> Optional[torch.Tensor]:
|
| 158 |
+
if any(v in (None, "") for v in values):
|
| 159 |
+
return None
|
| 160 |
+
return torch.tensor([float(v) for v in values], dtype=torch.float32)
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
def map_nodal_curves(
|
| 164 |
+
graph_nid: torch.Tensor,
|
| 165 |
+
curve_nid: torch.Tensor,
|
| 166 |
+
curves: Dict[str, torch.Tensor],
|
| 167 |
+
step_idx: torch.Tensor,
|
| 168 |
+
) -> Tuple[torch.Tensor, torch.Tensor]:
|
| 169 |
+
nid_to_row = {int(n): i for i, n in enumerate(curve_nid.tolist())}
|
| 170 |
+
order = []
|
| 171 |
+
valid = []
|
| 172 |
+
for n in graph_nid.tolist():
|
| 173 |
+
idx = nid_to_row.get(int(n))
|
| 174 |
+
if idx is None:
|
| 175 |
+
order.append(-1)
|
| 176 |
+
valid.append(False)
|
| 177 |
+
else:
|
| 178 |
+
order.append(idx)
|
| 179 |
+
valid.append(True)
|
| 180 |
+
|
| 181 |
+
valid_mask = torch.tensor(valid, dtype=torch.bool)
|
| 182 |
+
valid_order = [idx for idx in order if idx >= 0]
|
| 183 |
+
disp = torch.full((graph_nid.numel(), step_idx.numel(), 3), float("nan"), dtype=torch.float32)
|
| 184 |
+
disp[valid_mask] = torch.stack(
|
| 185 |
+
[
|
| 186 |
+
curves["x_displacement"][valid_order][:, step_idx],
|
| 187 |
+
curves["y_displacement"][valid_order][:, step_idx],
|
| 188 |
+
curves["z_displacement"][valid_order][:, step_idx],
|
| 189 |
+
],
|
| 190 |
+
dim=-1,
|
| 191 |
+
)
|
| 192 |
+
return disp, valid_mask
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
def fill_missing_nodal_disp(
|
| 196 |
+
disp: torch.Tensor,
|
| 197 |
+
valid_mask: torch.Tensor,
|
| 198 |
+
edge_index: torch.Tensor,
|
| 199 |
+
) -> Tuple[torch.Tensor, torch.Tensor]:
|
| 200 |
+
filled_mask = ~valid_mask
|
| 201 |
+
if not bool(filled_mask.any()):
|
| 202 |
+
return disp, filled_mask
|
| 203 |
+
|
| 204 |
+
adjacency: Dict[int, List[int]] = {}
|
| 205 |
+
for src, dst in edge_index.t().tolist():
|
| 206 |
+
adjacency.setdefault(int(src), []).append(int(dst))
|
| 207 |
+
|
| 208 |
+
for node_idx in torch.nonzero(filled_mask, as_tuple=False).flatten().tolist():
|
| 209 |
+
neighbors = [idx for idx in adjacency.get(int(node_idx), []) if bool(valid_mask[idx])]
|
| 210 |
+
if not neighbors:
|
| 211 |
+
continue
|
| 212 |
+
disp[node_idx] = disp[neighbors].mean(dim=0)
|
| 213 |
+
valid_mask[node_idx] = True
|
| 214 |
+
|
| 215 |
+
return disp, filled_mask
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
def repair_ids_by_order(reference_ids: torch.Tensor, curve_ids: torch.Tensor) -> Tuple[torch.Tensor, int]:
|
| 219 |
+
"""Repair LS-PrePost curve-header duplicates when row order is anchored."""
|
| 220 |
+
if reference_ids.numel() != curve_ids.numel():
|
| 221 |
+
return curve_ids, 0
|
| 222 |
+
if torch.equal(reference_ids, curve_ids):
|
| 223 |
+
return curve_ids, 0
|
| 224 |
+
|
| 225 |
+
mismatched = reference_ids != curve_ids
|
| 226 |
+
mismatch_count = int(mismatched.sum())
|
| 227 |
+
if mismatch_count == 0:
|
| 228 |
+
return curve_ids, 0
|
| 229 |
+
|
| 230 |
+
match_ratio = 1.0 - mismatch_count / max(1, reference_ids.numel())
|
| 231 |
+
if match_ratio >= 0.99:
|
| 232 |
+
return reference_ids.clone(), mismatch_count
|
| 233 |
+
|
| 234 |
+
# LS-PrePost can label a long contiguous block of otherwise correctly
|
| 235 |
+
# ordered curves with one repeated element ID. Accept that pattern only
|
| 236 |
+
# when every singleton label agrees with the reference at its position
|
| 237 |
+
# and singleton anchors exist on both sides of the mismatched block.
|
| 238 |
+
unique_ids, inverse, counts = torch.unique(
|
| 239 |
+
curve_ids, sorted=False, return_inverse=True, return_counts=True
|
| 240 |
+
)
|
| 241 |
+
singleton = counts[inverse] == 1
|
| 242 |
+
reference_set = set(reference_ids.tolist())
|
| 243 |
+
observed_set = set(unique_ids.tolist())
|
| 244 |
+
mismatch_indices = torch.nonzero(mismatched, as_tuple=False).flatten()
|
| 245 |
+
trusted_singleton = singleton & (curve_ids == reference_ids)
|
| 246 |
+
singleton_count = int(singleton.sum())
|
| 247 |
+
singleton_mismatch_count = int((singleton & mismatched).sum())
|
| 248 |
+
allowed_singleton_mismatches = max(1, int(0.01 * singleton_count))
|
| 249 |
+
trusted_singleton_indices = torch.nonzero(
|
| 250 |
+
trusted_singleton, as_tuple=False
|
| 251 |
+
).flatten()
|
| 252 |
+
anchored_before = bool(
|
| 253 |
+
trusted_singleton_indices.numel()
|
| 254 |
+
and (trusted_singleton_indices < mismatch_indices.min()).any()
|
| 255 |
+
)
|
| 256 |
+
anchored_after = bool(
|
| 257 |
+
trusted_singleton_indices.numel()
|
| 258 |
+
and (trusted_singleton_indices > mismatch_indices.max()).any()
|
| 259 |
+
)
|
| 260 |
+
if (
|
| 261 |
+
observed_set.issubset(reference_set)
|
| 262 |
+
and singleton_mismatch_count <= allowed_singleton_mismatches
|
| 263 |
+
and anchored_before
|
| 264 |
+
and anchored_after
|
| 265 |
+
):
|
| 266 |
+
return reference_ids.clone(), mismatch_count
|
| 267 |
+
|
| 268 |
+
return curve_ids, 0
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
def make_sample(
|
| 272 |
+
row: dict,
|
| 273 |
+
graph: Dict[str, torch.Tensor],
|
| 274 |
+
fixed_mask: torch.Tensor,
|
| 275 |
+
stride: int,
|
| 276 |
+
include_last: bool,
|
| 277 |
+
) -> Optional[dict]:
|
| 278 |
+
case_name = row["case"]
|
| 279 |
+
key_file = Path(row.get("key_file", ""))
|
| 280 |
+
if not key_file.is_absolute():
|
| 281 |
+
case_dir = key_file.parent
|
| 282 |
+
else:
|
| 283 |
+
case_dir = key_file.parent
|
| 284 |
+
if not case_dir.exists():
|
| 285 |
+
return None
|
| 286 |
+
|
| 287 |
+
results_dir = case_dir / RESULTS_DIR
|
| 288 |
+
if not results_dir.exists():
|
| 289 |
+
return None
|
| 290 |
+
|
| 291 |
+
required = [results_dir / name for name in NODE_RESULT_NAMES + ELEMENT_RESULT_NAMES]
|
| 292 |
+
if not all(path.exists() for path in required):
|
| 293 |
+
return None
|
| 294 |
+
|
| 295 |
+
node_curves = {}
|
| 296 |
+
node_time = None
|
| 297 |
+
node_nid = None
|
| 298 |
+
for name in NODE_RESULT_NAMES:
|
| 299 |
+
time, nid, values = read_curveplot_txt(results_dir / name)
|
| 300 |
+
if node_time is None:
|
| 301 |
+
node_time = time
|
| 302 |
+
node_nid = nid
|
| 303 |
+
elif not torch.allclose(node_time, time):
|
| 304 |
+
raise RuntimeError(f"Node time grid mismatch in {case_dir}")
|
| 305 |
+
if not torch.equal(node_nid, nid):
|
| 306 |
+
raise RuntimeError(f"Node ID order mismatch in {case_dir}")
|
| 307 |
+
node_curves[name] = values
|
| 308 |
+
|
| 309 |
+
node_step_idx = make_stride_indices(node_time.numel(), stride, include_last)
|
| 310 |
+
disp, valid_node_mask = map_nodal_curves(graph["nid"], node_nid, node_curves, node_step_idx)
|
| 311 |
+
raw_valid_node_mask = valid_node_mask.clone()
|
| 312 |
+
disp, _ = fill_missing_nodal_disp(disp, valid_node_mask.clone(), graph["edge_index"])
|
| 313 |
+
valid_node_mask = torch.isfinite(disp).flatten(start_dim=1).all(dim=1)
|
| 314 |
+
filled_node_mask = valid_node_mask & ~raw_valid_node_mask
|
| 315 |
+
|
| 316 |
+
element_curves = {}
|
| 317 |
+
element_time = None
|
| 318 |
+
element_id = None
|
| 319 |
+
for name in ELEMENT_RESULT_NAMES:
|
| 320 |
+
time, ids, values = read_curveplot_txt(results_dir / name)
|
| 321 |
+
if element_time is None:
|
| 322 |
+
element_time = time
|
| 323 |
+
element_id = ids
|
| 324 |
+
elif not torch.allclose(element_time, time):
|
| 325 |
+
raise RuntimeError(f"Element time grid mismatch in {case_dir}")
|
| 326 |
+
if not torch.equal(element_id, ids):
|
| 327 |
+
raise RuntimeError(f"Element ID order mismatch in {case_dir}")
|
| 328 |
+
element_curves[name] = values
|
| 329 |
+
|
| 330 |
+
stress_curves = element_curves["effective_stress"]
|
| 331 |
+
unique_id_fraction = float(element_id.unique().numel()) / max(1, element_id.numel())
|
| 332 |
+
_, stress_curve_counts = torch.unique(stress_curves, dim=0, return_counts=True)
|
| 333 |
+
dominant_stress_fraction = float(stress_curve_counts.max()) / max(
|
| 334 |
+
1, stress_curves.shape[0]
|
| 335 |
+
)
|
| 336 |
+
if unique_id_fraction < MIN_UNIQUE_ELEMENT_ID_FRACTION:
|
| 337 |
+
raise RuntimeError(
|
| 338 |
+
f"Degenerate compact stress element IDs in {case_dir}: "
|
| 339 |
+
f"unique_fraction={unique_id_fraction:.6f}"
|
| 340 |
+
)
|
| 341 |
+
if dominant_stress_fraction > MAX_DOMINANT_STRESS_CURVE_FRACTION:
|
| 342 |
+
raise RuntimeError(
|
| 343 |
+
f"Degenerate compact stress curves in {case_dir}: "
|
| 344 |
+
f"dominant_fraction={dominant_stress_fraction:.6f}"
|
| 345 |
+
)
|
| 346 |
+
|
| 347 |
+
element_id, repaired_element_ids = repair_ids_by_order(graph["element_id"], element_id)
|
| 348 |
+
elem_step_idx = make_stride_indices(element_time.numel(), stride, include_last)
|
| 349 |
+
effective_stress = element_curves["effective_stress"][:, elem_step_idx]
|
| 350 |
+
effective_plastic_strain = element_curves["effective_plastic_strain"][:, elem_step_idx]
|
| 351 |
+
|
| 352 |
+
impact_xyz = tensor3([row.get("impact_x"), row.get("impact_y"), row.get("impact_z")])
|
| 353 |
+
ball_center_xyz = tensor3([row.get("ball_center_x"), row.get("ball_center_y"), row.get("ball_center_z")])
|
| 354 |
+
velocity_vz = row.get("velocity_vz", "")
|
| 355 |
+
if velocity_vz in ("", None):
|
| 356 |
+
velocity_vz = "3464.1"
|
| 357 |
+
velocity_vx = float(row.get("velocity_vx") or 0.0)
|
| 358 |
+
velocity_vy = float(row.get("velocity_vy") or 0.0)
|
| 359 |
+
velocity_vz_value = float(velocity_vz)
|
| 360 |
+
impact_speed = float(
|
| 361 |
+
row.get("impact_speed")
|
| 362 |
+
or (velocity_vx**2 + velocity_vy**2 + velocity_vz_value**2) ** 0.5
|
| 363 |
+
)
|
| 364 |
+
|
| 365 |
+
sample = {
|
| 366 |
+
"case": case_name,
|
| 367 |
+
"panel_pid": torch.tensor(int(row.get("panel_pid") or PANEL_PID), dtype=torch.long),
|
| 368 |
+
"nid": graph["nid"],
|
| 369 |
+
"boundary_mask": fixed_mask,
|
| 370 |
+
"valid_node_mask": valid_node_mask,
|
| 371 |
+
"raw_valid_node_mask": raw_valid_node_mask,
|
| 372 |
+
"filled_node_mask": filled_node_mask,
|
| 373 |
+
"filled_node_count": torch.tensor(int(filled_node_mask.sum()), dtype=torch.long),
|
| 374 |
+
"time": node_time[node_step_idx],
|
| 375 |
+
"time_indices": node_step_idx,
|
| 376 |
+
"disp": disp,
|
| 377 |
+
"disp_z": disp[..., 2],
|
| 378 |
+
"element_time": element_time[elem_step_idx],
|
| 379 |
+
"element_time_indices": elem_step_idx,
|
| 380 |
+
"element_id": element_id,
|
| 381 |
+
"repaired_element_ids": torch.tensor(repaired_element_ids, dtype=torch.long),
|
| 382 |
+
"effective_stress": effective_stress,
|
| 383 |
+
"effective_plastic_strain": effective_plastic_strain,
|
| 384 |
+
"effective_strain": effective_plastic_strain,
|
| 385 |
+
"velocity_vz": torch.tensor(velocity_vz_value, dtype=torch.float32),
|
| 386 |
+
"velocity_xyz": torch.tensor(
|
| 387 |
+
[velocity_vx, velocity_vy, velocity_vz_value], dtype=torch.float32
|
| 388 |
+
),
|
| 389 |
+
"impact_speed": torch.tensor(impact_speed, dtype=torch.float32),
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
if impact_xyz is not None:
|
| 393 |
+
sample["impact_xyz"] = impact_xyz
|
| 394 |
+
sample["impact_node_distance"] = torch.linalg.norm(graph["pos"] - impact_xyz[None, :], dim=1)
|
| 395 |
+
if ball_center_xyz is not None:
|
| 396 |
+
sample["ball_center_xyz"] = ball_center_xyz
|
| 397 |
+
if row.get("impact_element_id"):
|
| 398 |
+
sample["impact_element_id"] = torch.tensor(int(row["impact_element_id"]), dtype=torch.long)
|
| 399 |
+
if row.get("velocity_set"):
|
| 400 |
+
sample["velocity_set"] = row["velocity_set"]
|
| 401 |
+
|
| 402 |
+
lhs_fields = (
|
| 403 |
+
"mass_ratio",
|
| 404 |
+
"impactor_mass",
|
| 405 |
+
"impactor_density",
|
| 406 |
+
"theta_deg",
|
| 407 |
+
"phi_deg",
|
| 408 |
+
"material_young_mpa",
|
| 409 |
+
"material_poisson",
|
| 410 |
+
)
|
| 411 |
+
for field in lhs_fields:
|
| 412 |
+
if row.get(field) not in ("", None):
|
| 413 |
+
sample[field] = torch.tensor(float(row[field]), dtype=torch.float32)
|
| 414 |
+
if row.get("material_index") not in ("", None):
|
| 415 |
+
material_index = int(row["material_index"])
|
| 416 |
+
sample["material_index"] = torch.tensor(material_index, dtype=torch.long)
|
| 417 |
+
sample["material_one_hot"] = torch.nn.functional.one_hot(
|
| 418 |
+
torch.tensor(material_index), num_classes=3
|
| 419 |
+
).to(torch.float32)
|
| 420 |
+
if row.get("material_name"):
|
| 421 |
+
sample["material_name"] = row["material_name"]
|
| 422 |
+
|
| 423 |
+
condition_names = (
|
| 424 |
+
"impact_x",
|
| 425 |
+
"impact_y",
|
| 426 |
+
"impact_speed",
|
| 427 |
+
"mass_ratio",
|
| 428 |
+
"theta_deg",
|
| 429 |
+
"phi_deg",
|
| 430 |
+
"material_index",
|
| 431 |
+
)
|
| 432 |
+
if all(row.get(name) not in ("", None) for name in condition_names):
|
| 433 |
+
sample["condition_names"] = list(condition_names)
|
| 434 |
+
sample["condition_vector"] = torch.tensor(
|
| 435 |
+
[float(row[name]) for name in condition_names], dtype=torch.float32
|
| 436 |
+
)
|
| 437 |
+
|
| 438 |
+
return sample
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
def convert_case(
|
| 442 |
+
row: dict,
|
| 443 |
+
graph: Dict[str, torch.Tensor],
|
| 444 |
+
fixed_mask: torch.Tensor,
|
| 445 |
+
out_cases_dir: Path,
|
| 446 |
+
stride: int,
|
| 447 |
+
include_last: bool,
|
| 448 |
+
overwrite: bool,
|
| 449 |
+
delete_raw: bool,
|
| 450 |
+
) -> Tuple[str, str, str]:
|
| 451 |
+
case_name = row["case"]
|
| 452 |
+
out_path = out_cases_dir / f"{case_name}.pt"
|
| 453 |
+
if out_path.exists() and not overwrite:
|
| 454 |
+
return "skipped_existing", case_name, str(out_path)
|
| 455 |
+
|
| 456 |
+
try:
|
| 457 |
+
sample = make_sample(row, graph, fixed_mask, stride, include_last)
|
| 458 |
+
if sample is None:
|
| 459 |
+
return "skipped_missing", case_name, ""
|
| 460 |
+
|
| 461 |
+
tmp_path = out_path.with_name(f"{out_path.name}.tmp.{os.getpid()}")
|
| 462 |
+
torch.save(sample, tmp_path)
|
| 463 |
+
tmp_path.replace(out_path)
|
| 464 |
+
|
| 465 |
+
if delete_raw:
|
| 466 |
+
key_file = Path(row.get("key_file", ""))
|
| 467 |
+
results_dir = key_file.parent / RESULTS_DIR
|
| 468 |
+
for name in NODE_RESULT_NAMES + ELEMENT_RESULT_NAMES:
|
| 469 |
+
path = results_dir / name
|
| 470 |
+
if path.exists():
|
| 471 |
+
path.unlink()
|
| 472 |
+
|
| 473 |
+
return "converted", case_name, str(out_path)
|
| 474 |
+
except Exception as exc:
|
| 475 |
+
return "error", case_name, str(exc)
|
| 476 |
+
|
| 477 |
+
|
| 478 |
+
def write_readme(out_root: Path, case_root: Path, stride: int, include_last: bool) -> None:
|
| 479 |
+
text = f"""# compact floorfrontR training data
|
| 480 |
+
|
| 481 |
+
Source case root: `{case_root}`
|
| 482 |
+
|
| 483 |
+
This dataset stores only the reduced training targets:
|
| 484 |
+
|
| 485 |
+
- nodal displacement: `disp`, shape `(N, T_reduced, 3)`
|
| 486 |
+
- shell effective stress: `effective_stress`, shape `(Ne, T_reduced)`
|
| 487 |
+
- shell effective strain alias: `effective_strain`, shape `(Ne, T_reduced)`
|
| 488 |
+
- original LS-PrePost variable: `effective_plastic_strain`, shape `(Ne, T_reduced)`
|
| 489 |
+
|
| 490 |
+
Time downsampling:
|
| 491 |
+
|
| 492 |
+
- stride: `{stride}`
|
| 493 |
+
- include final state: `{include_last}`
|
| 494 |
+
|
| 495 |
+
The full LS-PrePost text curves are read from each case `results_compact/` folder.
|
| 496 |
+
The saved `.pt` files keep only the downsampled time states.
|
| 497 |
+
"""
|
| 498 |
+
(out_root / "README.md").write_text(text, newline="")
|
| 499 |
+
|
| 500 |
+
|
| 501 |
+
def convert_case_root(
|
| 502 |
+
case_root: Path,
|
| 503 |
+
base_out_root: Path,
|
| 504 |
+
graph: Dict[str, torch.Tensor],
|
| 505 |
+
fixed_mask: torch.Tensor,
|
| 506 |
+
args: argparse.Namespace,
|
| 507 |
+
) -> Tuple[Path, int, int, int, int]:
|
| 508 |
+
out_root = base_out_root / case_root.name
|
| 509 |
+
out_cases = out_root / "cases"
|
| 510 |
+
out_cases.mkdir(parents=True, exist_ok=True)
|
| 511 |
+
|
| 512 |
+
mesh_graph_pt = out_root / "mesh_graph.pt"
|
| 513 |
+
if args.overwrite or not mesh_graph_pt.exists():
|
| 514 |
+
torch.save(graph, mesh_graph_pt)
|
| 515 |
+
save_npz_from_graph(graph, out_root / "mesh_graph.npz")
|
| 516 |
+
|
| 517 |
+
all_rows = read_manifest_rows(case_root)
|
| 518 |
+
if args.expected_cases > 0 and len(all_rows) != args.expected_cases:
|
| 519 |
+
raise RuntimeError(f"Expected {args.expected_cases} cases from {case_root}, found {len(all_rows)}.")
|
| 520 |
+
rows = filter_case_rows(all_rows, args.start, args.end)
|
| 521 |
+
missing_before = find_missing_compact_results(rows)
|
| 522 |
+
if missing_before and args.require_all:
|
| 523 |
+
raise RuntimeError(
|
| 524 |
+
f"Missing compact export for {len(missing_before)} case(s): "
|
| 525 |
+
f"{format_case_preview(missing_before)}"
|
| 526 |
+
)
|
| 527 |
+
|
| 528 |
+
conditions = {
|
| 529 |
+
"case": [r["case"] for r in all_rows],
|
| 530 |
+
"velocity_vz": torch.tensor(
|
| 531 |
+
[float(r.get("velocity_vz") or 3464.1) for r in all_rows],
|
| 532 |
+
dtype=torch.float32,
|
| 533 |
+
),
|
| 534 |
+
}
|
| 535 |
+
optional_float_fields = (
|
| 536 |
+
"impact_x",
|
| 537 |
+
"impact_y",
|
| 538 |
+
"impact_z",
|
| 539 |
+
"velocity_vx",
|
| 540 |
+
"velocity_vy",
|
| 541 |
+
"impact_speed",
|
| 542 |
+
"mass_ratio",
|
| 543 |
+
"impactor_mass",
|
| 544 |
+
"impactor_density",
|
| 545 |
+
"theta_deg",
|
| 546 |
+
"phi_deg",
|
| 547 |
+
"material_young_mpa",
|
| 548 |
+
"material_poisson",
|
| 549 |
+
)
|
| 550 |
+
for field in optional_float_fields:
|
| 551 |
+
if all(row.get(field) not in ("", None) for row in all_rows):
|
| 552 |
+
conditions[field] = torch.tensor(
|
| 553 |
+
[float(row[field]) for row in all_rows], dtype=torch.float32
|
| 554 |
+
)
|
| 555 |
+
if all(row.get("material_index") not in ("", None) for row in all_rows):
|
| 556 |
+
conditions["material_index"] = torch.tensor(
|
| 557 |
+
[int(row["material_index"]) for row in all_rows], dtype=torch.long
|
| 558 |
+
)
|
| 559 |
+
if all(row.get("material_name") for row in all_rows):
|
| 560 |
+
conditions["material_name"] = [row["material_name"] for row in all_rows]
|
| 561 |
+
torch.save(conditions, out_root / "case_conditions.pt")
|
| 562 |
+
write_readme(out_root, case_root, args.stride, not args.no_include_last)
|
| 563 |
+
|
| 564 |
+
converted = 0
|
| 565 |
+
skipped_missing = 0
|
| 566 |
+
missing_cases = []
|
| 567 |
+
skipped_existing = 0
|
| 568 |
+
errors = []
|
| 569 |
+
workers = max(1, int(args.workers))
|
| 570 |
+
|
| 571 |
+
if workers == 1:
|
| 572 |
+
iterator = [
|
| 573 |
+
convert_case(
|
| 574 |
+
row,
|
| 575 |
+
graph,
|
| 576 |
+
fixed_mask,
|
| 577 |
+
out_cases,
|
| 578 |
+
args.stride,
|
| 579 |
+
not args.no_include_last,
|
| 580 |
+
args.overwrite,
|
| 581 |
+
args.delete_raw,
|
| 582 |
+
)
|
| 583 |
+
for row in rows
|
| 584 |
+
]
|
| 585 |
+
else:
|
| 586 |
+
with ThreadPoolExecutor(max_workers=workers) as executor:
|
| 587 |
+
futures = [
|
| 588 |
+
executor.submit(
|
| 589 |
+
convert_case,
|
| 590 |
+
row,
|
| 591 |
+
graph,
|
| 592 |
+
fixed_mask,
|
| 593 |
+
out_cases,
|
| 594 |
+
args.stride,
|
| 595 |
+
not args.no_include_last,
|
| 596 |
+
args.overwrite,
|
| 597 |
+
args.delete_raw,
|
| 598 |
+
)
|
| 599 |
+
for row in rows
|
| 600 |
+
]
|
| 601 |
+
iterator = [future.result() for future in as_completed(futures)]
|
| 602 |
+
|
| 603 |
+
for status, case_name, message in iterator:
|
| 604 |
+
if status == "converted":
|
| 605 |
+
converted += 1
|
| 606 |
+
elif status == "skipped_missing":
|
| 607 |
+
skipped_missing += 1
|
| 608 |
+
missing_cases.append(case_name)
|
| 609 |
+
elif status == "skipped_existing":
|
| 610 |
+
skipped_existing += 1
|
| 611 |
+
else:
|
| 612 |
+
errors.append((case_name, message))
|
| 613 |
+
|
| 614 |
+
if errors:
|
| 615 |
+
detail = "\n".join(f" {case}: {msg}" for case, msg in errors[:10])
|
| 616 |
+
raise RuntimeError(f"Failed converting {len(errors)} cases under {case_root}:\n{detail}")
|
| 617 |
+
if missing_cases:
|
| 618 |
+
print(f"[INFO] missing compact result cases: {format_case_preview(missing_cases)}")
|
| 619 |
+
|
| 620 |
+
return out_root, converted, skipped_existing, skipped_missing, len(rows)
|
| 621 |
+
|
| 622 |
+
|
| 623 |
+
def main() -> None:
|
| 624 |
+
args = parse_args()
|
| 625 |
+
|
| 626 |
+
nodes, elements, fixed_nodes = parse_key_mesh(args.panel_key, args.panel_pid)
|
| 627 |
+
graph = build_graph(nodes, elements)
|
| 628 |
+
fixed_set = set(fixed_nodes)
|
| 629 |
+
fixed_mask = torch.tensor([int(n) in fixed_set for n in graph["nid"].tolist()], dtype=torch.bool)
|
| 630 |
+
graph["boundary_mask"] = fixed_mask
|
| 631 |
+
|
| 632 |
+
if args.sweep_root is not None:
|
| 633 |
+
roots = sorted([p for p in args.sweep_root.iterdir() if p.is_dir() and p.name.startswith("v")])
|
| 634 |
+
else:
|
| 635 |
+
roots = [args.case_root]
|
| 636 |
+
|
| 637 |
+
print(f"[OK] graph nodes: {graph['nid'].numel()}")
|
| 638 |
+
print(f"[OK] graph directed edges: {graph['edge_index'].shape[1]}")
|
| 639 |
+
print(f"[OK] fixed boundary nodes: {int(fixed_mask.sum())}")
|
| 640 |
+
print(f"[OK] time stride: {args.stride}")
|
| 641 |
+
|
| 642 |
+
for root in roots:
|
| 643 |
+
out_root, converted, skipped_existing, skipped_missing, total = convert_case_root(
|
| 644 |
+
root, args.out_root, graph, fixed_mask, args
|
| 645 |
+
)
|
| 646 |
+
print("=========================================")
|
| 647 |
+
print(f"[OK] source: {root}")
|
| 648 |
+
print(f"[OK] output: {out_root}")
|
| 649 |
+
print(f"[OK] manifest cases: {total}")
|
| 650 |
+
print(f"[OK] converted: {converted}")
|
| 651 |
+
print(f"[OK] skipped existing: {skipped_existing}")
|
| 652 |
+
print(f"[OK] skipped missing compact results: {skipped_missing}")
|
| 653 |
+
|
| 654 |
+
|
| 655 |
+
if __name__ == "__main__":
|
| 656 |
+
main()
|
generation_evidence/conversion/prepare_floorfrontR_training_data.py
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import csv
|
| 5 |
+
import os
|
| 6 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 7 |
+
from dataclasses import dataclass
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
from typing import Dict, Iterable, List, Optional, Tuple
|
| 10 |
+
|
| 11 |
+
import numpy as np
|
| 12 |
+
import torch
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
PANEL_PID = 2000395
|
| 16 |
+
DEFAULT_PANEL_KEY = Path("floor_panel_largest_2_pid_2000395_133_floorfrontR.key")
|
| 17 |
+
DEFAULT_CASE_ROOT = Path("cases_floorfrontR_random_50")
|
| 18 |
+
DEFAULT_OUT_ROOT = Path("training_data_floorfrontR_random_50")
|
| 19 |
+
NODE_COORD_NAMES = ("x_coordinate", "y_coordinate", "z_coordinate")
|
| 20 |
+
NODE_RESULT_NAMES = ("x_displacement", "y_displacement", "z_displacement")
|
| 21 |
+
ELEMENT_RESULT_NAMES = (
|
| 22 |
+
"x_stress",
|
| 23 |
+
"y_stress",
|
| 24 |
+
"z_stress",
|
| 25 |
+
"xy_stress",
|
| 26 |
+
"yz_stress",
|
| 27 |
+
"zx_stress",
|
| 28 |
+
"effective_plastic_strain",
|
| 29 |
+
"pressure",
|
| 30 |
+
"effective_stress",
|
| 31 |
+
"lower_Ipt_x_strain",
|
| 32 |
+
"lower_Ipt_y_strain",
|
| 33 |
+
"lower_Ipt_z_strain",
|
| 34 |
+
"lower_Ipt_xy_strain",
|
| 35 |
+
"lower_Ipt_yz_strain",
|
| 36 |
+
"lower_Ipt_zx_strain",
|
| 37 |
+
"upper_Ipt_x_strain",
|
| 38 |
+
"upper_Ipt_y_strain",
|
| 39 |
+
"upper_Ipt_z_strain",
|
| 40 |
+
"upper_Ipt_xy_strain",
|
| 41 |
+
"upper_Ipt_yz_strain",
|
| 42 |
+
"upper_Ipt_zx_strain",
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
@dataclass
|
| 47 |
+
class ShellElement:
|
| 48 |
+
eid: int
|
| 49 |
+
pid: int
|
| 50 |
+
nodes: Tuple[int, ...]
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def is_keyword(line: str) -> bool:
|
| 54 |
+
return line.lstrip().startswith("*")
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def split_fields(line: str) -> List[str]:
|
| 58 |
+
return line.replace(",", " ").split()
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def parse_key_mesh(path: Path, panel_pid: int) -> Tuple[Dict[int, Tuple[float, float, float]], List[ShellElement], List[int]]:
|
| 62 |
+
nodes: Dict[int, Tuple[float, float, float]] = {}
|
| 63 |
+
elements: List[ShellElement] = []
|
| 64 |
+
fixed_nodes: List[int] = []
|
| 65 |
+
|
| 66 |
+
mode: Optional[str] = None
|
| 67 |
+
pending_spc_set = False
|
| 68 |
+
|
| 69 |
+
with path.open("r", errors="ignore") as f:
|
| 70 |
+
for raw in f:
|
| 71 |
+
line = raw.strip()
|
| 72 |
+
if not line or line.startswith("$"):
|
| 73 |
+
continue
|
| 74 |
+
|
| 75 |
+
upper = line.upper()
|
| 76 |
+
if is_keyword(line):
|
| 77 |
+
if upper.startswith("*NODE"):
|
| 78 |
+
mode = "node"
|
| 79 |
+
elif upper.startswith("*ELEMENT_SHELL"):
|
| 80 |
+
mode = "shell"
|
| 81 |
+
elif upper.startswith("*SET_NODE_LIST"):
|
| 82 |
+
mode = "node_set"
|
| 83 |
+
pending_spc_set = False
|
| 84 |
+
elif upper.startswith("*BOUNDARY_SPC_SET"):
|
| 85 |
+
mode = "spc"
|
| 86 |
+
pending_spc_set = True
|
| 87 |
+
else:
|
| 88 |
+
mode = None
|
| 89 |
+
continue
|
| 90 |
+
|
| 91 |
+
if mode == "node":
|
| 92 |
+
parts = split_fields(line)
|
| 93 |
+
if len(parts) >= 4:
|
| 94 |
+
try:
|
| 95 |
+
nid = int(parts[0])
|
| 96 |
+
nodes[nid] = (float(parts[1]), float(parts[2]), float(parts[3]))
|
| 97 |
+
except ValueError:
|
| 98 |
+
pass
|
| 99 |
+
|
| 100 |
+
elif mode == "shell":
|
| 101 |
+
parts = split_fields(line)
|
| 102 |
+
if len(parts) >= 6:
|
| 103 |
+
try:
|
| 104 |
+
eid = int(parts[0])
|
| 105 |
+
pid = int(parts[1])
|
| 106 |
+
elem_nodes = [int(x) for x in parts[2:6]]
|
| 107 |
+
except ValueError:
|
| 108 |
+
continue
|
| 109 |
+
if pid != panel_pid:
|
| 110 |
+
continue
|
| 111 |
+
if elem_nodes[3] == 0 or elem_nodes[3] == elem_nodes[2]:
|
| 112 |
+
elem_nodes = elem_nodes[:3]
|
| 113 |
+
elements.append(ShellElement(eid=eid, pid=pid, nodes=tuple(elem_nodes)))
|
| 114 |
+
|
| 115 |
+
elif mode == "spc" and pending_spc_set:
|
| 116 |
+
# The first non-comment data line of *BOUNDARY_SPC_SET gives the fixed node set ID.
|
| 117 |
+
# The actual nodes are read from the following *SET_NODE_LIST block in this deck.
|
| 118 |
+
pending_spc_set = False
|
| 119 |
+
|
| 120 |
+
elif mode == "node_set":
|
| 121 |
+
parts = split_fields(line)
|
| 122 |
+
if len(parts) == 1:
|
| 123 |
+
# set ID line
|
| 124 |
+
continue
|
| 125 |
+
for token in parts:
|
| 126 |
+
try:
|
| 127 |
+
nid = int(token)
|
| 128 |
+
except ValueError:
|
| 129 |
+
continue
|
| 130 |
+
if nid > 0:
|
| 131 |
+
fixed_nodes.append(nid)
|
| 132 |
+
|
| 133 |
+
if not nodes:
|
| 134 |
+
raise RuntimeError(f"No *NODE data found in {path}")
|
| 135 |
+
if not elements:
|
| 136 |
+
raise RuntimeError(f"No shell elements with PID={panel_pid} found in {path}")
|
| 137 |
+
|
| 138 |
+
return nodes, elements, sorted(set(fixed_nodes))
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def build_graph(
|
| 142 |
+
nodes: Dict[int, Tuple[float, float, float]],
|
| 143 |
+
elements: Iterable[ShellElement],
|
| 144 |
+
) -> Dict[str, torch.Tensor]:
|
| 145 |
+
elements = list(elements)
|
| 146 |
+
used_nids = sorted({nid for e in elements for nid in e.nodes})
|
| 147 |
+
nid_to_idx = {nid: i for i, nid in enumerate(used_nids)}
|
| 148 |
+
|
| 149 |
+
pos = torch.tensor([nodes[nid] for nid in used_nids], dtype=torch.float32)
|
| 150 |
+
nid = torch.tensor(used_nids, dtype=torch.long)
|
| 151 |
+
element_id = torch.tensor([e.eid for e in elements], dtype=torch.long)
|
| 152 |
+
|
| 153 |
+
undirected_edges = set()
|
| 154 |
+
for e in elements:
|
| 155 |
+
ns = e.nodes
|
| 156 |
+
for i, a in enumerate(ns):
|
| 157 |
+
b = ns[(i + 1) % len(ns)]
|
| 158 |
+
if a in nid_to_idx and b in nid_to_idx:
|
| 159 |
+
ia, ib = nid_to_idx[a], nid_to_idx[b]
|
| 160 |
+
undirected_edges.add((min(ia, ib), max(ia, ib)))
|
| 161 |
+
|
| 162 |
+
directed = []
|
| 163 |
+
for ia, ib in sorted(undirected_edges):
|
| 164 |
+
directed.append((ia, ib))
|
| 165 |
+
directed.append((ib, ia))
|
| 166 |
+
|
| 167 |
+
edge_index = torch.tensor(directed, dtype=torch.long).t().contiguous()
|
| 168 |
+
return {"nid": nid, "pos": pos, "edge_index": edge_index, "element_id": element_id}
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def read_manifest(path: Path) -> List[dict]:
|
| 172 |
+
with path.open("r", newline="") as f:
|
| 173 |
+
return list(csv.DictReader(f))
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
def read_curveplot_txt(path: Path) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
| 177 |
+
nids = []
|
| 178 |
+
curves = []
|
| 179 |
+
time_ref = None
|
| 180 |
+
|
| 181 |
+
lines = path.read_text(errors="ignore").splitlines()
|
| 182 |
+
i = 0
|
| 183 |
+
while i < len(lines):
|
| 184 |
+
line = lines[i].strip()
|
| 185 |
+
if line and line[0].isdigit() and "#pts=" in line:
|
| 186 |
+
nid = int(line.split()[0])
|
| 187 |
+
nids.append(nid)
|
| 188 |
+
i += 3
|
| 189 |
+
ts, vs = [], []
|
| 190 |
+
while i < len(lines):
|
| 191 |
+
row = lines[i].strip()
|
| 192 |
+
if row.lower().startswith("endcurve"):
|
| 193 |
+
break
|
| 194 |
+
parts = row.split()
|
| 195 |
+
if len(parts) == 2:
|
| 196 |
+
ts.append(float(parts[0]))
|
| 197 |
+
vs.append(float(parts[1]))
|
| 198 |
+
i += 1
|
| 199 |
+
t = np.asarray(ts, dtype=np.float32)
|
| 200 |
+
v = np.asarray(vs, dtype=np.float32)
|
| 201 |
+
if time_ref is None:
|
| 202 |
+
time_ref = t
|
| 203 |
+
elif not np.allclose(time_ref, t):
|
| 204 |
+
raise ValueError(f"Time grid mismatch in {path}")
|
| 205 |
+
curves.append(v)
|
| 206 |
+
i += 1
|
| 207 |
+
|
| 208 |
+
if time_ref is None:
|
| 209 |
+
raise RuntimeError(f"No node curves found in {path}")
|
| 210 |
+
return (
|
| 211 |
+
torch.tensor(time_ref, dtype=torch.float32),
|
| 212 |
+
torch.tensor(nids, dtype=torch.long),
|
| 213 |
+
torch.tensor(np.stack(curves, axis=0), dtype=torch.float32),
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
def save_npz_from_graph(graph: Dict[str, torch.Tensor], out_path: Path) -> None:
|
| 218 |
+
arrays = {
|
| 219 |
+
"nid": graph["nid"].numpy(),
|
| 220 |
+
"pos": graph["pos"].numpy(),
|
| 221 |
+
"edge_index": graph["edge_index"].numpy(),
|
| 222 |
+
"boundary_mask": graph["boundary_mask"].numpy(),
|
| 223 |
+
}
|
| 224 |
+
if "element_id" in graph:
|
| 225 |
+
arrays["element_id"] = graph["element_id"].numpy()
|
| 226 |
+
np.savez_compressed(out_path, **arrays)
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
def make_case_sample(
|
| 230 |
+
row: dict,
|
| 231 |
+
graph: Dict[str, torch.Tensor],
|
| 232 |
+
fixed_mask: torch.Tensor,
|
| 233 |
+
) -> Optional[Dict[str, torch.Tensor]]:
|
| 234 |
+
key_path = Path(row["key_file"])
|
| 235 |
+
case_dir = key_path.parent
|
| 236 |
+
results_dir = case_dir / "results"
|
| 237 |
+
if not results_dir.exists():
|
| 238 |
+
return None
|
| 239 |
+
|
| 240 |
+
node_paths = [results_dir / name for name in NODE_RESULT_NAMES]
|
| 241 |
+
if not all(path.exists() for path in node_paths):
|
| 242 |
+
return None
|
| 243 |
+
|
| 244 |
+
node_curves = {}
|
| 245 |
+
node_time = None
|
| 246 |
+
label_nid = None
|
| 247 |
+
for name, path in zip(NODE_RESULT_NAMES, node_paths):
|
| 248 |
+
time, curve_nid, values = read_curveplot_txt(path)
|
| 249 |
+
if node_time is None:
|
| 250 |
+
node_time = time
|
| 251 |
+
label_nid = curve_nid
|
| 252 |
+
elif not torch.allclose(node_time, time):
|
| 253 |
+
raise RuntimeError(f"Node time grid mismatch in {case_dir}")
|
| 254 |
+
if not torch.equal(label_nid, curve_nid):
|
| 255 |
+
raise RuntimeError(f"Node ID order mismatch in {case_dir}")
|
| 256 |
+
node_curves[name] = values
|
| 257 |
+
|
| 258 |
+
nid_to_row = {int(n): i for i, n in enumerate(label_nid.tolist())}
|
| 259 |
+
order = []
|
| 260 |
+
valid_node_mask = []
|
| 261 |
+
for n in graph["nid"].tolist():
|
| 262 |
+
idx = nid_to_row.get(int(n))
|
| 263 |
+
if idx is None:
|
| 264 |
+
order.append(-1)
|
| 265 |
+
valid_node_mask.append(False)
|
| 266 |
+
else:
|
| 267 |
+
order.append(idx)
|
| 268 |
+
valid_node_mask.append(True)
|
| 269 |
+
|
| 270 |
+
impact_xyz = torch.tensor(
|
| 271 |
+
[float(row["impact_x"]), float(row["impact_y"]), float(row["impact_z"])],
|
| 272 |
+
dtype=torch.float32,
|
| 273 |
+
)
|
| 274 |
+
ball_center = torch.tensor(
|
| 275 |
+
[float(row["ball_center_x"]), float(row["ball_center_y"]), float(row["ball_center_z"])],
|
| 276 |
+
dtype=torch.float32,
|
| 277 |
+
)
|
| 278 |
+
impact_features = torch.tensor(
|
| 279 |
+
[
|
| 280 |
+
float(row["impact_x"]),
|
| 281 |
+
float(row["impact_y"]),
|
| 282 |
+
float(row["impact_z"]),
|
| 283 |
+
float(row["ball_center_x"]),
|
| 284 |
+
float(row["ball_center_y"]),
|
| 285 |
+
float(row["ball_center_z"]),
|
| 286 |
+
3464.1,
|
| 287 |
+
float(row["min_boundary_distance_mm"]),
|
| 288 |
+
],
|
| 289 |
+
dtype=torch.float32,
|
| 290 |
+
)
|
| 291 |
+
distance = torch.linalg.norm(graph["pos"] - impact_xyz[None, :], dim=1)
|
| 292 |
+
|
| 293 |
+
valid_node_mask = torch.tensor(valid_node_mask, dtype=torch.bool)
|
| 294 |
+
valid_order = [idx for idx in order if idx >= 0]
|
| 295 |
+
disp = torch.full((graph["nid"].numel(), node_time.numel(), 3), float("nan"), dtype=torch.float32)
|
| 296 |
+
disp[valid_node_mask] = torch.stack(
|
| 297 |
+
[
|
| 298 |
+
node_curves["x_displacement"][valid_order],
|
| 299 |
+
node_curves["y_displacement"][valid_order],
|
| 300 |
+
node_curves["z_displacement"][valid_order],
|
| 301 |
+
],
|
| 302 |
+
dim=-1,
|
| 303 |
+
)
|
| 304 |
+
|
| 305 |
+
sample = {
|
| 306 |
+
"case": row["case"],
|
| 307 |
+
"panel_pid": torch.tensor(int(row["panel_pid"]), dtype=torch.long),
|
| 308 |
+
"impact_element_id": torch.tensor(int(row["impact_element_id"]), dtype=torch.long),
|
| 309 |
+
"impact_xyz": impact_xyz,
|
| 310 |
+
"ball_center_xyz": ball_center,
|
| 311 |
+
"impact_features": impact_features,
|
| 312 |
+
"impact_node_distance": distance,
|
| 313 |
+
"boundary_mask": fixed_mask,
|
| 314 |
+
"valid_node_mask": valid_node_mask,
|
| 315 |
+
"time": node_time,
|
| 316 |
+
"nid": graph["nid"],
|
| 317 |
+
"disp": disp,
|
| 318 |
+
"disp_z": disp[..., 2],
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
coord_paths = [results_dir / name for name in NODE_COORD_NAMES]
|
| 322 |
+
if all(path.exists() for path in coord_paths):
|
| 323 |
+
coord_curves = {}
|
| 324 |
+
coord_time = None
|
| 325 |
+
coord_nid = None
|
| 326 |
+
for name, path in zip(NODE_COORD_NAMES, coord_paths):
|
| 327 |
+
time, curve_nid, values = read_curveplot_txt(path)
|
| 328 |
+
if coord_time is None:
|
| 329 |
+
coord_time = time
|
| 330 |
+
coord_nid = curve_nid
|
| 331 |
+
elif not torch.allclose(coord_time, time):
|
| 332 |
+
raise RuntimeError(f"Coordinate time grid mismatch in {case_dir}")
|
| 333 |
+
if not torch.equal(coord_nid, curve_nid):
|
| 334 |
+
raise RuntimeError(f"Coordinate node ID order mismatch in {case_dir}")
|
| 335 |
+
|
| 336 |
+
coord_curves[name] = values
|
| 337 |
+
|
| 338 |
+
coord_nid_to_row = {int(n): i for i, n in enumerate(coord_nid.tolist())}
|
| 339 |
+
coord_order = []
|
| 340 |
+
coord_valid_mask = []
|
| 341 |
+
for n in graph["nid"].tolist():
|
| 342 |
+
idx = coord_nid_to_row.get(int(n))
|
| 343 |
+
if idx is None:
|
| 344 |
+
coord_order.append(-1)
|
| 345 |
+
coord_valid_mask.append(False)
|
| 346 |
+
else:
|
| 347 |
+
coord_order.append(idx)
|
| 348 |
+
coord_valid_mask.append(True)
|
| 349 |
+
coord_valid_mask = torch.tensor(coord_valid_mask, dtype=torch.bool)
|
| 350 |
+
coord_valid_order = [idx for idx in coord_order if idx >= 0]
|
| 351 |
+
coord = torch.full((graph["nid"].numel(), coord_time.numel(), 3), float("nan"), dtype=torch.float32)
|
| 352 |
+
coord[coord_valid_mask] = torch.stack(
|
| 353 |
+
[
|
| 354 |
+
coord_curves["x_coordinate"][coord_valid_order],
|
| 355 |
+
coord_curves["y_coordinate"][coord_valid_order],
|
| 356 |
+
coord_curves["z_coordinate"][coord_valid_order],
|
| 357 |
+
],
|
| 358 |
+
dim=-1,
|
| 359 |
+
)
|
| 360 |
+
sample["coord_time"] = coord_time
|
| 361 |
+
sample["coord"] = coord
|
| 362 |
+
sample["valid_coord_mask"] = coord_valid_mask
|
| 363 |
+
|
| 364 |
+
element_results = {}
|
| 365 |
+
element_ids = None
|
| 366 |
+
element_time = None
|
| 367 |
+
for name in ELEMENT_RESULT_NAMES:
|
| 368 |
+
path = results_dir / name
|
| 369 |
+
if not path.exists():
|
| 370 |
+
continue
|
| 371 |
+
time, ids, values = read_curveplot_txt(path)
|
| 372 |
+
if element_time is None:
|
| 373 |
+
element_time = time
|
| 374 |
+
element_ids = ids
|
| 375 |
+
elif not torch.allclose(element_time, time):
|
| 376 |
+
raise RuntimeError(f"Element time grid mismatch in {case_dir}")
|
| 377 |
+
if not torch.equal(element_ids, ids):
|
| 378 |
+
raise RuntimeError(f"Element ID order mismatch in {case_dir}")
|
| 379 |
+
element_results[name] = values
|
| 380 |
+
|
| 381 |
+
if element_results:
|
| 382 |
+
sample["element_time"] = element_time
|
| 383 |
+
sample["element_id"] = element_ids
|
| 384 |
+
sample["element_results"] = element_results
|
| 385 |
+
|
| 386 |
+
return sample
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def convert_case_to_pt(
|
| 390 |
+
row: dict,
|
| 391 |
+
graph: Dict[str, torch.Tensor],
|
| 392 |
+
fixed_mask: torch.Tensor,
|
| 393 |
+
out_cases_dir: Path,
|
| 394 |
+
overwrite: bool,
|
| 395 |
+
) -> Tuple[str, str, str]:
|
| 396 |
+
case_name = row["case"]
|
| 397 |
+
out_path = out_cases_dir / f"{case_name}.pt"
|
| 398 |
+
|
| 399 |
+
if out_path.exists() and not overwrite:
|
| 400 |
+
return "skipped_existing", case_name, str(out_path)
|
| 401 |
+
|
| 402 |
+
try:
|
| 403 |
+
sample = make_case_sample(row, graph, fixed_mask)
|
| 404 |
+
if sample is None:
|
| 405 |
+
return "skipped_missing", case_name, ""
|
| 406 |
+
tmp_path = out_path.with_name(f"{out_path.name}.tmp.{os.getpid()}")
|
| 407 |
+
torch.save(sample, tmp_path)
|
| 408 |
+
tmp_path.replace(out_path)
|
| 409 |
+
return "converted", case_name, str(out_path)
|
| 410 |
+
except Exception as exc:
|
| 411 |
+
return "error", case_name, str(exc)
|
| 412 |
+
|
| 413 |
+
|
| 414 |
+
def main() -> None:
|
| 415 |
+
ap = argparse.ArgumentParser()
|
| 416 |
+
ap.add_argument("--panel-key", type=Path, default=DEFAULT_PANEL_KEY)
|
| 417 |
+
ap.add_argument("--case-root", type=Path, default=DEFAULT_CASE_ROOT)
|
| 418 |
+
ap.add_argument("--out-root", type=Path, default=DEFAULT_OUT_ROOT)
|
| 419 |
+
ap.add_argument("--panel-pid", type=int, default=PANEL_PID)
|
| 420 |
+
ap.add_argument("--workers", type=int, default=1, help="Number of cases to convert in parallel")
|
| 421 |
+
ap.add_argument("--overwrite", action="store_true", help="Regenerate existing .pt files")
|
| 422 |
+
ap.add_argument("--skip-existing", action="store_true", help=argparse.SUPPRESS)
|
| 423 |
+
args = ap.parse_args()
|
| 424 |
+
|
| 425 |
+
manifest = args.case_root / "case_manifest.csv"
|
| 426 |
+
args.out_root.mkdir(parents=True, exist_ok=True)
|
| 427 |
+
(args.out_root / "cases").mkdir(exist_ok=True)
|
| 428 |
+
|
| 429 |
+
nodes, elements, fixed_nodes = parse_key_mesh(args.panel_key, args.panel_pid)
|
| 430 |
+
graph = build_graph(nodes, elements)
|
| 431 |
+
fixed_set = set(fixed_nodes)
|
| 432 |
+
fixed_mask = torch.tensor([int(n) in fixed_set for n in graph["nid"].tolist()], dtype=torch.bool)
|
| 433 |
+
graph["boundary_mask"] = fixed_mask
|
| 434 |
+
|
| 435 |
+
mesh_graph_pt = args.out_root / "mesh_graph.pt"
|
| 436 |
+
mesh_graph_npz = args.out_root / "mesh_graph.npz"
|
| 437 |
+
if args.overwrite or not mesh_graph_pt.exists():
|
| 438 |
+
torch.save(graph, mesh_graph_pt)
|
| 439 |
+
if args.overwrite or not mesh_graph_npz.exists():
|
| 440 |
+
save_npz_from_graph(graph, mesh_graph_npz)
|
| 441 |
+
|
| 442 |
+
rows = read_manifest(manifest)
|
| 443 |
+
case_conditions_pt = args.out_root / "case_conditions.pt"
|
| 444 |
+
refresh_case_conditions = args.overwrite or not case_conditions_pt.exists()
|
| 445 |
+
if not refresh_case_conditions:
|
| 446 |
+
try:
|
| 447 |
+
existing_conditions = torch.load(case_conditions_pt, map_location="cpu", weights_only=False)
|
| 448 |
+
refresh_case_conditions = existing_conditions.get("case") != [r["case"] for r in rows]
|
| 449 |
+
except Exception:
|
| 450 |
+
refresh_case_conditions = True
|
| 451 |
+
if refresh_case_conditions:
|
| 452 |
+
torch.save(
|
| 453 |
+
{
|
| 454 |
+
"case": [r["case"] for r in rows],
|
| 455 |
+
"impact_features": torch.tensor(
|
| 456 |
+
[
|
| 457 |
+
[
|
| 458 |
+
float(r["impact_x"]),
|
| 459 |
+
float(r["impact_y"]),
|
| 460 |
+
float(r["impact_z"]),
|
| 461 |
+
float(r["ball_center_x"]),
|
| 462 |
+
float(r["ball_center_y"]),
|
| 463 |
+
float(r["ball_center_z"]),
|
| 464 |
+
3464.1,
|
| 465 |
+
float(r["min_boundary_distance_mm"]),
|
| 466 |
+
]
|
| 467 |
+
for r in rows
|
| 468 |
+
],
|
| 469 |
+
dtype=torch.float32,
|
| 470 |
+
),
|
| 471 |
+
},
|
| 472 |
+
case_conditions_pt,
|
| 473 |
+
)
|
| 474 |
+
|
| 475 |
+
converted = 0
|
| 476 |
+
skipped_missing = 0
|
| 477 |
+
skipped_existing = 0
|
| 478 |
+
errors = []
|
| 479 |
+
out_cases_dir = args.out_root / "cases"
|
| 480 |
+
workers = max(1, int(args.workers))
|
| 481 |
+
|
| 482 |
+
if workers == 1:
|
| 483 |
+
for row in rows:
|
| 484 |
+
status, case_name, message = convert_case_to_pt(
|
| 485 |
+
row, graph, fixed_mask, out_cases_dir, args.overwrite
|
| 486 |
+
)
|
| 487 |
+
if status == "converted":
|
| 488 |
+
converted += 1
|
| 489 |
+
elif status == "skipped_missing":
|
| 490 |
+
skipped_missing += 1
|
| 491 |
+
elif status == "skipped_existing":
|
| 492 |
+
skipped_existing += 1
|
| 493 |
+
else:
|
| 494 |
+
errors.append((case_name, message))
|
| 495 |
+
else:
|
| 496 |
+
print(f"[INFO] parallel case conversion workers: {workers}")
|
| 497 |
+
with ThreadPoolExecutor(max_workers=workers) as executor:
|
| 498 |
+
futures = [
|
| 499 |
+
executor.submit(
|
| 500 |
+
convert_case_to_pt,
|
| 501 |
+
row,
|
| 502 |
+
graph,
|
| 503 |
+
fixed_mask,
|
| 504 |
+
out_cases_dir,
|
| 505 |
+
args.overwrite,
|
| 506 |
+
)
|
| 507 |
+
for row in rows
|
| 508 |
+
]
|
| 509 |
+
for future in as_completed(futures):
|
| 510 |
+
status, case_name, message = future.result()
|
| 511 |
+
if status == "converted":
|
| 512 |
+
converted += 1
|
| 513 |
+
print(f"[OK] converted {case_name}")
|
| 514 |
+
elif status == "skipped_missing":
|
| 515 |
+
skipped_missing += 1
|
| 516 |
+
elif status == "skipped_existing":
|
| 517 |
+
skipped_existing += 1
|
| 518 |
+
else:
|
| 519 |
+
errors.append((case_name, message))
|
| 520 |
+
|
| 521 |
+
print(f"[OK] graph nodes: {graph['nid'].numel()}")
|
| 522 |
+
print(f"[OK] graph directed edges: {graph['edge_index'].shape[1]}")
|
| 523 |
+
print(f"[OK] fixed boundary nodes: {int(fixed_mask.sum())}")
|
| 524 |
+
print(f"[OK] saved: {args.out_root / 'mesh_graph.pt'}")
|
| 525 |
+
print(f"[OK] saved: {args.out_root / 'case_conditions.pt'}")
|
| 526 |
+
print(f"[OK] converted case result files: {converted}")
|
| 527 |
+
print(f"[OK] skipped existing case files: {skipped_existing}")
|
| 528 |
+
print(f"[OK] skipped cases without displacement results: {skipped_missing}")
|
| 529 |
+
if errors:
|
| 530 |
+
details = "\n".join(f" {case}: {message}" for case, message in errors[:10])
|
| 531 |
+
raise RuntimeError(f"Case conversion failed for {len(errors)} case(s):\n{details}")
|
| 532 |
+
|
| 533 |
+
|
| 534 |
+
if __name__ == "__main__":
|
| 535 |
+
main()
|
generation_evidence/conversion/prepare_floorfrontdriver_compact_training_data.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
import prepare_floorfrontR_compact_training_data as compact
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
compact.DEFAULT_CASE_ROOT = Path("cases_floorfrontdriver_random_50")
|
| 7 |
+
compact.DEFAULT_OUT_ROOT = Path("training_data_floorfrontdriver_compact")
|
| 8 |
+
compact.DEFAULT_PANEL_KEY = Path("floor_panel_largest_3_pid_2000394_373_floorfrontdriver.key")
|
| 9 |
+
compact.PANEL_PID = 2000394
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
if __name__ == "__main__":
|
| 13 |
+
compact.main()
|
generation_evidence/conversion/prepare_trunkfloor_compact_training_data.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
import prepare_floorfrontR_compact_training_data as compact
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
compact.DEFAULT_CASE_ROOT = Path("cases_trunkfloor_random_50")
|
| 7 |
+
compact.DEFAULT_OUT_ROOT = Path("training_data_trunkfloor_compact")
|
| 8 |
+
compact.DEFAULT_PANEL_KEY = Path("floor_panel_largest_1_pid_2000447_153_trunkfloor.key")
|
| 9 |
+
compact.PANEL_PID = 2000447
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
if __name__ == "__main__":
|
| 13 |
+
compact.main()
|
generation_evidence/export/compact_floorfrontR.cfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
open d3plot "d3plot"
|
| 2 |
+
|
| 3 |
+
genselect target part
|
| 4 |
+
genselect target node
|
| 5 |
+
genselect node add part 2000395/0
|
| 6 |
+
|
| 7 |
+
ntime 5
|
| 8 |
+
xyplot 1 savefile curve_file "results_compact\x_displacement" 1 all
|
| 9 |
+
ntime 6
|
| 10 |
+
xyplot 1 savefile curve_file "results_compact\y_displacement" 1 all
|
| 11 |
+
ntime 7
|
| 12 |
+
xyplot 1 savefile curve_file "results_compact\z_displacement" 1 all
|
| 13 |
+
|
| 14 |
+
genselect target part
|
| 15 |
+
genselect target element
|
| 16 |
+
genselect element add part 2000395/0
|
| 17 |
+
|
| 18 |
+
etime 9
|
| 19 |
+
xyplot 1 savefile curve_file "results_compact\effective_stress" 1 all
|
| 20 |
+
etime 7
|
| 21 |
+
xyplot 1 savefile curve_file "results_compact\effective_plastic_strain" 1 all
|
| 22 |
+
|
| 23 |
+
exit
|
generation_evidence/export/compact_floorfrontR_elements.cfile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
open d3plot "d3plot"
|
| 2 |
+
|
| 3 |
+
genselect target part
|
| 4 |
+
genselect target element
|
| 5 |
+
genselect element add part 2000395/0
|
| 6 |
+
|
| 7 |
+
etime 9
|
| 8 |
+
xyplot 1 savefile curve_file "results_compact\effective_stress" 1 all
|
| 9 |
+
etime 7
|
| 10 |
+
xyplot 1 savefile curve_file "results_compact\effective_plastic_strain" 1 all
|
| 11 |
+
|
| 12 |
+
exit
|
generation_evidence/export/compact_floorfrontR_nodes.cfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
open d3plot "d3plot"
|
| 2 |
+
|
| 3 |
+
genselect target part
|
| 4 |
+
genselect target node
|
| 5 |
+
genselect node add part 2000395/0
|
| 6 |
+
|
| 7 |
+
ntime 5
|
| 8 |
+
xyplot 1 savefile curve_file "results_compact\x_displacement" 1 all
|
| 9 |
+
ntime 6
|
| 10 |
+
xyplot 1 savefile curve_file "results_compact\y_displacement" 1 all
|
| 11 |
+
ntime 7
|
| 12 |
+
xyplot 1 savefile curve_file "results_compact\z_displacement" 1 all
|
| 13 |
+
|
| 14 |
+
exit
|
generation_evidence/export/compact_floorfrontdriver.cfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
open d3plot "d3plot"
|
| 2 |
+
|
| 3 |
+
genselect target part
|
| 4 |
+
genselect target node
|
| 5 |
+
genselect node add part 2000394/0
|
| 6 |
+
|
| 7 |
+
ntime 5
|
| 8 |
+
xyplot 1 savefile curve_file "results_compact\x_displacement" 1 all
|
| 9 |
+
ntime 6
|
| 10 |
+
xyplot 1 savefile curve_file "results_compact\y_displacement" 1 all
|
| 11 |
+
ntime 7
|
| 12 |
+
xyplot 1 savefile curve_file "results_compact\z_displacement" 1 all
|
| 13 |
+
|
| 14 |
+
genselect target part
|
| 15 |
+
genselect target element
|
| 16 |
+
genselect element add part 2000394/0
|
| 17 |
+
|
| 18 |
+
etime 9
|
| 19 |
+
xyplot 1 savefile curve_file "results_compact\effective_stress" 1 all
|
| 20 |
+
etime 7
|
| 21 |
+
xyplot 1 savefile curve_file "results_compact\effective_plastic_strain" 1 all
|
| 22 |
+
|
| 23 |
+
exit
|
generation_evidence/export/compact_trunkfloor.cfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
open d3plot "d3plot"
|
| 2 |
+
|
| 3 |
+
genselect target part
|
| 4 |
+
genselect target node
|
| 5 |
+
genselect node add part 2000447/0
|
| 6 |
+
|
| 7 |
+
ntime 5
|
| 8 |
+
xyplot 1 savefile curve_file "results_compact\x_displacement" 1 all
|
| 9 |
+
ntime 6
|
| 10 |
+
xyplot 1 savefile curve_file "results_compact\y_displacement" 1 all
|
| 11 |
+
ntime 7
|
| 12 |
+
xyplot 1 savefile curve_file "results_compact\z_displacement" 1 all
|
| 13 |
+
|
| 14 |
+
genselect target part
|
| 15 |
+
genselect target element
|
| 16 |
+
genselect element add part 2000447/0
|
| 17 |
+
|
| 18 |
+
etime 9
|
| 19 |
+
xyplot 1 savefile curve_file "results_compact\effective_stress" 1 all
|
| 20 |
+
etime 7
|
| 21 |
+
xyplot 1 savefile curve_file "results_compact\effective_plastic_strain" 1 all
|
| 22 |
+
|
| 23 |
+
exit
|
generation_evidence/impactor/add_impactor_to_floor_panels.py
ADDED
|
@@ -0,0 +1,530 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import math
|
| 2 |
+
import re
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
REFERENCE = Path("bottomimpact_60JP1.key")
|
| 7 |
+
PANEL_GLOB = "floor_panel_largest_*.key"
|
| 8 |
+
|
| 9 |
+
BALL_SOURCE_PID = 9636
|
| 10 |
+
BALL_PID = 9636
|
| 11 |
+
BALL_SECID = 9636
|
| 12 |
+
BALL_MID = 174
|
| 13 |
+
BALL_VZ = 3464.1
|
| 14 |
+
TERMINATION_TIME = 0.03
|
| 15 |
+
|
| 16 |
+
ADAPT_FREQ = 0.0002
|
| 17 |
+
ADAPT_TOL = 5.0
|
| 18 |
+
ADAPT_OPT = 2
|
| 19 |
+
ADAPT_MAX_LEVEL = 2
|
| 20 |
+
|
| 21 |
+
CONTACT_ID = 57
|
| 22 |
+
GRAVITY_CURVE_ID = 251
|
| 23 |
+
GRAVITY_Z = 9810.0
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def is_keyword(line):
|
| 27 |
+
return line.startswith("*")
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def first_int(line):
|
| 31 |
+
fixed = line[:10].strip()
|
| 32 |
+
if fixed:
|
| 33 |
+
try:
|
| 34 |
+
return int(float(fixed))
|
| 35 |
+
except ValueError:
|
| 36 |
+
pass
|
| 37 |
+
fields = line.strip().split()
|
| 38 |
+
if not fields:
|
| 39 |
+
return None
|
| 40 |
+
try:
|
| 41 |
+
return int(float(fields[0]))
|
| 42 |
+
except ValueError:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def parse_int_fields(line):
|
| 47 |
+
values = []
|
| 48 |
+
for field in line.strip().split():
|
| 49 |
+
try:
|
| 50 |
+
values.append(int(float(field)))
|
| 51 |
+
except ValueError:
|
| 52 |
+
pass
|
| 53 |
+
return values
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def parse_fixed_ints(line, width=8, count=6):
|
| 57 |
+
values = []
|
| 58 |
+
for i in range(count):
|
| 59 |
+
chunk = line[i * width : (i + 1) * width].strip()
|
| 60 |
+
if not chunk:
|
| 61 |
+
values.append(0)
|
| 62 |
+
continue
|
| 63 |
+
try:
|
| 64 |
+
values.append(int(chunk))
|
| 65 |
+
except ValueError:
|
| 66 |
+
return None
|
| 67 |
+
return values
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def read_blocks(path):
|
| 71 |
+
block = []
|
| 72 |
+
with path.open("r", encoding="utf-8", errors="ignore") as f:
|
| 73 |
+
for line in f:
|
| 74 |
+
if is_keyword(line) and block:
|
| 75 |
+
yield block
|
| 76 |
+
block = [line]
|
| 77 |
+
else:
|
| 78 |
+
block.append(line)
|
| 79 |
+
if block:
|
| 80 |
+
yield block
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def data_lines(block):
|
| 84 |
+
for line in block[1:]:
|
| 85 |
+
stripped = line.strip()
|
| 86 |
+
if stripped and not stripped.startswith("$"):
|
| 87 |
+
yield line
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def block_id(block):
|
| 91 |
+
for line in data_lines(block):
|
| 92 |
+
value = first_int(line)
|
| 93 |
+
if value is not None:
|
| 94 |
+
return value
|
| 95 |
+
return None
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def parse_part_pid(block):
|
| 99 |
+
for line in data_lines(block):
|
| 100 |
+
fields = parse_int_fields(line)
|
| 101 |
+
if len(fields) >= 3:
|
| 102 |
+
return fields[0]
|
| 103 |
+
return None
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def parse_nodes_from_block(block):
|
| 107 |
+
nodes = {}
|
| 108 |
+
for line in block[1:]:
|
| 109 |
+
stripped = line.strip()
|
| 110 |
+
if not stripped or stripped.startswith("$"):
|
| 111 |
+
continue
|
| 112 |
+
fields = stripped.split()
|
| 113 |
+
try:
|
| 114 |
+
nid = int(float(fields[0]))
|
| 115 |
+
nodes[nid] = (float(fields[1]), float(fields[2]), float(fields[3]))
|
| 116 |
+
except (IndexError, ValueError):
|
| 117 |
+
continue
|
| 118 |
+
return nodes
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
def parse_shell_line(line):
|
| 122 |
+
fields = parse_int_fields(line)
|
| 123 |
+
if len(fields) >= 6:
|
| 124 |
+
return fields[:6]
|
| 125 |
+
fixed = parse_fixed_ints(line, width=8, count=6)
|
| 126 |
+
if fixed and fixed[0] and fixed[1]:
|
| 127 |
+
return fixed
|
| 128 |
+
return None
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def shell_edges(nids):
|
| 132 |
+
clean = []
|
| 133 |
+
for nid in nids:
|
| 134 |
+
if nid > 0 and nid not in clean:
|
| 135 |
+
clean.append(nid)
|
| 136 |
+
if len(clean) < 3:
|
| 137 |
+
return []
|
| 138 |
+
return [
|
| 139 |
+
tuple(sorted((clean[i], clean[(i + 1) % len(clean)])))
|
| 140 |
+
for i in range(len(clean))
|
| 141 |
+
]
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def bbox(points):
|
| 145 |
+
xs = [p[0] for p in points]
|
| 146 |
+
ys = [p[1] for p in points]
|
| 147 |
+
zs = [p[2] for p in points]
|
| 148 |
+
return (min(xs), max(xs), min(ys), max(ys), min(zs), max(zs))
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def center_of_bbox(points):
|
| 152 |
+
xmin, xmax, ymin, ymax, zmin, zmax = bbox(points)
|
| 153 |
+
return ((xmin + xmax) / 2.0, (ymin + ymax) / 2.0, (zmin + zmax) / 2.0)
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def extract_reference_ball():
|
| 157 |
+
nodes = {}
|
| 158 |
+
all_shell_elements = []
|
| 159 |
+
ball_part = None
|
| 160 |
+
ball_section = None
|
| 161 |
+
ball_material = None
|
| 162 |
+
control_blocks = []
|
| 163 |
+
|
| 164 |
+
for block in read_blocks(REFERENCE):
|
| 165 |
+
key = block[0].strip().upper()
|
| 166 |
+
if key.startswith("*CONTROL_"):
|
| 167 |
+
control_blocks.append(block)
|
| 168 |
+
elif key == "*NODE":
|
| 169 |
+
nodes.update(parse_nodes_from_block(block))
|
| 170 |
+
elif key == "*ELEMENT_SHELL":
|
| 171 |
+
for line in block[1:]:
|
| 172 |
+
stripped = line.strip()
|
| 173 |
+
if not stripped or stripped.startswith("$"):
|
| 174 |
+
continue
|
| 175 |
+
parsed = parse_shell_line(line)
|
| 176 |
+
if parsed:
|
| 177 |
+
all_shell_elements.append(parsed)
|
| 178 |
+
elif key == "*PART" and parse_part_pid(block) == BALL_SOURCE_PID:
|
| 179 |
+
ball_part = block
|
| 180 |
+
elif key.startswith("*SECTION_SHELL") and block_id(block) == BALL_SECID:
|
| 181 |
+
ball_section = block
|
| 182 |
+
elif key.startswith("*MAT_RIGID") and block_id(block) == BALL_MID:
|
| 183 |
+
ball_material = block
|
| 184 |
+
|
| 185 |
+
ball_elements = [elem for elem in all_shell_elements if elem[1] == BALL_SOURCE_PID]
|
| 186 |
+
ball_node_ids = sorted({nid for elem in ball_elements for nid in elem[2:6] if nid > 0})
|
| 187 |
+
ball_nodes = {nid: nodes[nid] for nid in ball_node_ids}
|
| 188 |
+
|
| 189 |
+
if not ball_elements or not ball_nodes:
|
| 190 |
+
raise SystemExit("Failed to extract reference ball mesh")
|
| 191 |
+
if not (ball_part and ball_section and ball_material):
|
| 192 |
+
raise SystemExit("Failed to extract reference ball part/section/material")
|
| 193 |
+
|
| 194 |
+
points = list(ball_nodes.values())
|
| 195 |
+
xmin, xmax, ymin, ymax, zmin, zmax = bbox(points)
|
| 196 |
+
center = center_of_bbox(points)
|
| 197 |
+
radius = max(xmax - xmin, ymax - ymin, zmax - zmin) / 2.0
|
| 198 |
+
return {
|
| 199 |
+
"part": ball_part,
|
| 200 |
+
"section": ball_section,
|
| 201 |
+
"material": ball_material,
|
| 202 |
+
"elements": ball_elements,
|
| 203 |
+
"nodes": ball_nodes,
|
| 204 |
+
"center": center,
|
| 205 |
+
"radius": radius,
|
| 206 |
+
"controls": control_blocks,
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def parse_panel(path):
|
| 211 |
+
blocks = list(read_blocks(path))
|
| 212 |
+
nodes = {}
|
| 213 |
+
shell_elements = []
|
| 214 |
+
part_ids = []
|
| 215 |
+
boundary_node_sets = {}
|
| 216 |
+
keywords = []
|
| 217 |
+
|
| 218 |
+
mode = None
|
| 219 |
+
for block in blocks:
|
| 220 |
+
key = block[0].strip().upper()
|
| 221 |
+
keywords.append(key)
|
| 222 |
+
if key == "*NODE":
|
| 223 |
+
nodes.update(parse_nodes_from_block(block))
|
| 224 |
+
elif key == "*ELEMENT_SHELL":
|
| 225 |
+
for line in block[1:]:
|
| 226 |
+
stripped = line.strip()
|
| 227 |
+
if not stripped or stripped.startswith("$"):
|
| 228 |
+
continue
|
| 229 |
+
parsed = parse_shell_line(line)
|
| 230 |
+
if parsed:
|
| 231 |
+
shell_elements.append(parsed)
|
| 232 |
+
elif key == "*PART":
|
| 233 |
+
pid = parse_part_pid(block)
|
| 234 |
+
if pid is not None:
|
| 235 |
+
part_ids.append(pid)
|
| 236 |
+
|
| 237 |
+
if len(part_ids) != 1:
|
| 238 |
+
raise SystemExit(f"{path} must contain exactly one panel part, found {part_ids}")
|
| 239 |
+
panel_pid = part_ids[0]
|
| 240 |
+
panel_node_ids = sorted({nid for elem in shell_elements if elem[1] == panel_pid for nid in elem[2:6] if nid > 0})
|
| 241 |
+
panel_points = [nodes[nid] for nid in panel_node_ids]
|
| 242 |
+
xmin, xmax, ymin, ymax, zmin, zmax = bbox(panel_points)
|
| 243 |
+
|
| 244 |
+
edge_counts = {}
|
| 245 |
+
for elem in shell_elements:
|
| 246 |
+
if elem[1] != panel_pid:
|
| 247 |
+
continue
|
| 248 |
+
for edge in shell_edges(elem[2:6]):
|
| 249 |
+
edge_counts[edge] = edge_counts.get(edge, 0) + 1
|
| 250 |
+
boundary_nodes = set()
|
| 251 |
+
for edge, count in edge_counts.items():
|
| 252 |
+
if count == 1:
|
| 253 |
+
boundary_nodes.update(edge)
|
| 254 |
+
|
| 255 |
+
return {
|
| 256 |
+
"blocks": blocks,
|
| 257 |
+
"panel_pid": panel_pid,
|
| 258 |
+
"nodes": nodes,
|
| 259 |
+
"shell_elements": shell_elements,
|
| 260 |
+
"bbox": (xmin, xmax, ymin, ymax, zmin, zmax),
|
| 261 |
+
"boundary_nodes": boundary_nodes,
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
def next_ids(panel):
|
| 266 |
+
used_nodes = set(panel["nodes"])
|
| 267 |
+
used_elems = {elem[0] for elem in panel["shell_elements"]}
|
| 268 |
+
node_base = max(max(used_nodes) + 1, 9000000)
|
| 269 |
+
elem_base = max(max(used_elems) + 1, 9000000)
|
| 270 |
+
return node_base, elem_base
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
def translated_ball(ball, panel):
|
| 274 |
+
xmin, xmax, ymin, ymax, zmin, zmax = panel["bbox"]
|
| 275 |
+
target_center = (
|
| 276 |
+
(xmin + xmax) / 2.0,
|
| 277 |
+
(ymin + ymax) / 2.0,
|
| 278 |
+
zmin - ball["radius"] - 5.0,
|
| 279 |
+
)
|
| 280 |
+
sx, sy, sz = ball["center"]
|
| 281 |
+
tx, ty, tz = target_center
|
| 282 |
+
return (tx - sx, ty - sy, tz - sz), target_center
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
def update_part_id_block(block, pid, secid, mid):
|
| 286 |
+
out = []
|
| 287 |
+
replaced = False
|
| 288 |
+
for line in block:
|
| 289 |
+
if not replaced and not line.strip().startswith("$") and not line.startswith("*") and len(parse_int_fields(line)) >= 3:
|
| 290 |
+
out.append(f"{pid:10d}{secid:10d}{mid:10d} 0 0 0 0 0\n")
|
| 291 |
+
replaced = True
|
| 292 |
+
else:
|
| 293 |
+
out.append(line)
|
| 294 |
+
return out
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
def update_section_id_block(block, secid):
|
| 298 |
+
out = []
|
| 299 |
+
replaced = False
|
| 300 |
+
for line in block:
|
| 301 |
+
if not replaced and not line.strip().startswith("$") and not line.startswith("*") and first_int(line) is not None:
|
| 302 |
+
rest = line[10:] if len(line) > 10 else "\n"
|
| 303 |
+
out.append(f"{secid:10d}{rest}")
|
| 304 |
+
replaced = True
|
| 305 |
+
else:
|
| 306 |
+
out.append(line)
|
| 307 |
+
return out
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
def update_material_id_block(block, mid):
|
| 311 |
+
out = []
|
| 312 |
+
replaced = False
|
| 313 |
+
for line in block:
|
| 314 |
+
if not replaced and not line.strip().startswith("$") and not line.startswith("*") and first_int(line) is not None:
|
| 315 |
+
rest = line[10:] if len(line) > 10 else "\n"
|
| 316 |
+
out.append(f"{mid:10d}{rest}")
|
| 317 |
+
replaced = True
|
| 318 |
+
else:
|
| 319 |
+
out.append(line)
|
| 320 |
+
return out
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
def update_control_termination_block(block):
|
| 324 |
+
out = []
|
| 325 |
+
replaced = False
|
| 326 |
+
for line in block:
|
| 327 |
+
if not replaced and not line.strip().startswith("$") and not line.startswith("*"):
|
| 328 |
+
out.append(f"{TERMINATION_TIME:10.4f} 0 0. 0. 0. 0\n")
|
| 329 |
+
replaced = True
|
| 330 |
+
else:
|
| 331 |
+
out.append(line)
|
| 332 |
+
return out
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
def update_part_adpopt_block(block, adpopt):
|
| 336 |
+
out = []
|
| 337 |
+
replaced = False
|
| 338 |
+
for line in block:
|
| 339 |
+
if not replaced and not line.strip().startswith("$") and not line.startswith("*"):
|
| 340 |
+
fields = parse_int_fields(line)
|
| 341 |
+
if len(fields) >= 3:
|
| 342 |
+
while len(fields) < 8:
|
| 343 |
+
fields.append(0)
|
| 344 |
+
fields[6] = adpopt
|
| 345 |
+
out.append("".join(f"{item:10d}" for item in fields[:8]) + "\n")
|
| 346 |
+
replaced = True
|
| 347 |
+
continue
|
| 348 |
+
out.append(line)
|
| 349 |
+
return out
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
def write_control_adaptive(out):
|
| 353 |
+
out.write("*CONTROL_ADAPTIVE\n")
|
| 354 |
+
out.write("$# adpfreq adptol adpopt maxlvl tbirth tdeath lcadp ioflag\n")
|
| 355 |
+
out.write(
|
| 356 |
+
f"{ADAPT_FREQ:10.6f}{ADAPT_TOL:10.1f}{ADAPT_OPT:10d}{ADAPT_MAX_LEVEL:10d}"
|
| 357 |
+
f"{0.0:10.1f}{TERMINATION_TIME:10.4f}{0:10d}{0:10d}\n"
|
| 358 |
+
)
|
| 359 |
+
|
| 360 |
+
|
| 361 |
+
def write_node_set(out, sid, title, node_ids):
|
| 362 |
+
out.write("*SET_NODE_LIST_TITLE\n")
|
| 363 |
+
out.write(f"{title}\n")
|
| 364 |
+
out.write("$# sid da1 da2 da3 da4 solver\n")
|
| 365 |
+
out.write(f"{sid:10d} 0.0 0.0 0.0 0.0MECH\n")
|
| 366 |
+
out.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n")
|
| 367 |
+
row = []
|
| 368 |
+
for nid in sorted(node_ids):
|
| 369 |
+
row.append(nid)
|
| 370 |
+
if len(row) == 8:
|
| 371 |
+
out.write("".join(f"{item:10d}" for item in row) + "\n")
|
| 372 |
+
row = []
|
| 373 |
+
if row:
|
| 374 |
+
out.write("".join(f"{item:10d}" for item in row) + "\n")
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
def format_node(nid, xyz):
|
| 378 |
+
x, y, z = xyz
|
| 379 |
+
return f"{nid:8d}{x:16.8f}{y:16.8f}{z:16.8f} 0 0\n"
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
def format_shell(eid, pid, nids):
|
| 383 |
+
padded = list(nids[:4])
|
| 384 |
+
while len(padded) < 4:
|
| 385 |
+
padded.append(padded[-1])
|
| 386 |
+
return f"{eid:8d}{pid:8d}{padded[0]:8d}{padded[1]:8d}{padded[2]:8d}{padded[3]:8d}\n"
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def strip_end(blocks):
|
| 390 |
+
return [block for block in blocks if block[0].strip().upper() != "*END"]
|
| 391 |
+
|
| 392 |
+
|
| 393 |
+
def output_path(path):
|
| 394 |
+
return path.with_name(path.stem + "_with_ball.key")
|
| 395 |
+
|
| 396 |
+
|
| 397 |
+
def add_ball_to_panel(path, ball):
|
| 398 |
+
panel = parse_panel(path)
|
| 399 |
+
node_base, elem_base = next_ids(panel)
|
| 400 |
+
translation, target_center = translated_ball(ball, panel)
|
| 401 |
+
dx, dy, dz = translation
|
| 402 |
+
|
| 403 |
+
node_map = {}
|
| 404 |
+
moved_nodes = {}
|
| 405 |
+
for index, (old_nid, xyz) in enumerate(sorted(ball["nodes"].items())):
|
| 406 |
+
new_nid = node_base + index
|
| 407 |
+
node_map[old_nid] = new_nid
|
| 408 |
+
moved_nodes[new_nid] = (xyz[0] + dx, xyz[1] + dy, xyz[2] + dz)
|
| 409 |
+
|
| 410 |
+
moved_elements = []
|
| 411 |
+
for index, elem in enumerate(ball["elements"]):
|
| 412 |
+
new_eid = elem_base + index
|
| 413 |
+
new_nids = [node_map[nid] for nid in elem[2:6] if nid > 0]
|
| 414 |
+
moved_elements.append((new_eid, BALL_PID, new_nids))
|
| 415 |
+
|
| 416 |
+
out_path = output_path(path)
|
| 417 |
+
panel_pid = panel["panel_pid"]
|
| 418 |
+
boundary_set_id = 9100000 + (panel_pid % 10000)
|
| 419 |
+
|
| 420 |
+
with out_path.open("w", encoding="utf-8", newline="\n") as out:
|
| 421 |
+
out.write("*KEYWORD\n")
|
| 422 |
+
out.write("$ Control cards copied from bottomimpact_60JP1.key\n")
|
| 423 |
+
for block in ball["controls"]:
|
| 424 |
+
if block[0].strip().upper() == "*CONTROL_TERMINATION":
|
| 425 |
+
out.writelines(update_control_termination_block(block))
|
| 426 |
+
else:
|
| 427 |
+
out.writelines(block)
|
| 428 |
+
if not block[-1].endswith("\n"):
|
| 429 |
+
out.write("\n")
|
| 430 |
+
write_control_adaptive(out)
|
| 431 |
+
out.write("$-------------------------------------------------------------------------------\n")
|
| 432 |
+
|
| 433 |
+
for block in strip_end(panel["blocks"]):
|
| 434 |
+
key = block[0].strip().upper()
|
| 435 |
+
if key == "*KEYWORD":
|
| 436 |
+
continue
|
| 437 |
+
if key == "*PART" and parse_part_pid(block) == panel_pid:
|
| 438 |
+
out.writelines(update_part_adpopt_block(block, 1))
|
| 439 |
+
continue
|
| 440 |
+
if key == "*NODE":
|
| 441 |
+
out.writelines(block)
|
| 442 |
+
for nid in sorted(moved_nodes):
|
| 443 |
+
out.write(format_node(nid, moved_nodes[nid]))
|
| 444 |
+
continue
|
| 445 |
+
if key == "*ELEMENT_SHELL":
|
| 446 |
+
out.writelines(block)
|
| 447 |
+
for eid, pid, nids in moved_elements:
|
| 448 |
+
out.write(format_shell(eid, pid, nids))
|
| 449 |
+
continue
|
| 450 |
+
if key.startswith("*SET_NODE_LIST"):
|
| 451 |
+
# Regenerate the fixed boundary set after adding the ball.
|
| 452 |
+
continue
|
| 453 |
+
if key.startswith("*BOUNDARY_SPC_SET"):
|
| 454 |
+
continue
|
| 455 |
+
out.writelines(block)
|
| 456 |
+
|
| 457 |
+
out.write("$-------------------------------------------------------------------------------\n")
|
| 458 |
+
out.writelines(update_part_id_block(ball["part"], BALL_PID, BALL_SECID, BALL_MID))
|
| 459 |
+
out.writelines(update_section_id_block(ball["section"], BALL_SECID))
|
| 460 |
+
out.writelines(update_material_id_block(ball["material"], BALL_MID))
|
| 461 |
+
|
| 462 |
+
out.write("$-------------------------------------------------------------------------------\n")
|
| 463 |
+
write_node_set(out, boundary_set_id, f"PID {panel_pid} outer boundary nodes - fixed", panel["boundary_nodes"])
|
| 464 |
+
out.write("*BOUNDARY_SPC_SET\n")
|
| 465 |
+
out.write("$# nsid cid dofx dofy dofz dofrx dofry dofrz\n")
|
| 466 |
+
out.write(f"{boundary_set_id:10d} 0 1 1 1 1 1 1\n")
|
| 467 |
+
|
| 468 |
+
out.write("*CONTACT_AUTOMATIC_SURFACE_TO_SURFACE_ID\n")
|
| 469 |
+
out.write(f"{CONTACT_ID:10d} ball\n")
|
| 470 |
+
out.write("$# ssid msid sstyp mstyp sboxid mboxid spr mpr\n")
|
| 471 |
+
out.write(f"{panel_pid:10d}{BALL_PID:10d} 3 3 0 0 0 0\n")
|
| 472 |
+
out.write("$# fs fd dc vc vdc penchk bt dt\n")
|
| 473 |
+
out.write(" 0.15 0.15 0.0 0.0 0.0 0 0.0 0.0\n")
|
| 474 |
+
out.write("$# sfs sfm sst mst sfst sfmt fsf vsf\n")
|
| 475 |
+
out.write(" 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0\n")
|
| 476 |
+
out.write("$# soft sofscl lcidab maxpar sbopt depth bsort frcfrq\n")
|
| 477 |
+
out.write(" 1 0.0 0 0.0 0.0 0 0 0\n")
|
| 478 |
+
out.write("$# penmax thkopt shlthk snlog isym i2d3d sldthk sldstf\n")
|
| 479 |
+
out.write(" 0.0 0 0 0 0 0 0.0 0.0\n")
|
| 480 |
+
|
| 481 |
+
out.write("*INITIAL_VELOCITY_RIGID_BODY\n")
|
| 482 |
+
out.write("$ PID| VX| VY| VZ| VXR| VYR| VZR| ICID|\n")
|
| 483 |
+
out.write(f"{BALL_PID:10d} 0. 0.{BALL_VZ:10.1f} 0. 0. 0. 0\n")
|
| 484 |
+
|
| 485 |
+
out.write("*LOAD_BODY_Z\n")
|
| 486 |
+
out.write(f"{GRAVITY_CURVE_ID:10d}{GRAVITY_Z:10.1f}\n")
|
| 487 |
+
out.write("*DEFINE_CURVE\n")
|
| 488 |
+
out.write("$# lcid sidr sfa sfo offa offo dattyp\n")
|
| 489 |
+
out.write(f"{GRAVITY_CURVE_ID:10d} 0 1.0 1.0 0.0 0.0 0\n")
|
| 490 |
+
out.write("$# a1 o1\n")
|
| 491 |
+
out.write(" 0.0 1.0\n")
|
| 492 |
+
out.write(" 1000.0 1.0\n")
|
| 493 |
+
|
| 494 |
+
out.write("*DATABASE_BINARY_D3PLOT\n")
|
| 495 |
+
out.write("$# dt lcdt beam npltc psetid\n")
|
| 496 |
+
out.write(" 0.000200 0 0 0 0\n")
|
| 497 |
+
out.write("*DATABASE_GLSTAT\n")
|
| 498 |
+
out.write(" 0.000100\n")
|
| 499 |
+
out.write("*DATABASE_MATSUM\n")
|
| 500 |
+
out.write(" 0.000100\n")
|
| 501 |
+
out.write("*DATABASE_RCFORC\n")
|
| 502 |
+
out.write(" 0.000100\n")
|
| 503 |
+
|
| 504 |
+
out.write("*END\n")
|
| 505 |
+
|
| 506 |
+
print(
|
| 507 |
+
f"{out_path.name}: panel_pid={panel_pid}, ball_nodes={len(moved_nodes)}, "
|
| 508 |
+
f"ball_elements={len(moved_elements)}, ball_center=({target_center[0]:.3f}, "
|
| 509 |
+
f"{target_center[1]:.3f}, {target_center[2]:.3f}), radius={ball['radius']:.3f}"
|
| 510 |
+
)
|
| 511 |
+
return out_path
|
| 512 |
+
|
| 513 |
+
|
| 514 |
+
def main():
|
| 515 |
+
ball = extract_reference_ball()
|
| 516 |
+
print(
|
| 517 |
+
f"Reference ball: nodes={len(ball['nodes'])}, elements={len(ball['elements'])}, "
|
| 518 |
+
f"center=({ball['center'][0]:.3f}, {ball['center'][1]:.3f}, {ball['center'][2]:.3f}), "
|
| 519 |
+
f"radius={ball['radius']:.3f}"
|
| 520 |
+
)
|
| 521 |
+
panel_paths = sorted(Path(".").glob(PANEL_GLOB))
|
| 522 |
+
panel_paths = [path for path in panel_paths if not path.stem.endswith("_with_ball")]
|
| 523 |
+
if len(panel_paths) < 3:
|
| 524 |
+
raise SystemExit(f"Expected at least 3 panel key files matching {PANEL_GLOB}")
|
| 525 |
+
for path in panel_paths[:3]:
|
| 526 |
+
add_ball_to_panel(path, ball)
|
| 527 |
+
|
| 528 |
+
|
| 529 |
+
if __name__ == "__main__":
|
| 530 |
+
main()
|
generation_evidence/lhs/extend_floorfrontdriver_lhs_cases_to_500.py
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import csv
|
| 4 |
+
from collections import Counter
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
import generate_floorfrontdriver_lhs_cases as lhs
|
| 10 |
+
import generate_floorfrontdriver_random_cases as base
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
CASE_ROOT = Path("cases_floorfrontdriver_lhs_100")
|
| 14 |
+
START_CASE = 201
|
| 15 |
+
END_CASE = 500
|
| 16 |
+
SEED = 20260722
|
| 17 |
+
TRIALS = 128
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def main() -> None:
|
| 21 |
+
manifest_path = CASE_ROOT / "case_manifest.csv"
|
| 22 |
+
if not manifest_path.exists():
|
| 23 |
+
raise FileNotFoundError(manifest_path)
|
| 24 |
+
with manifest_path.open(newline="", encoding="utf-8") as handle:
|
| 25 |
+
reader = csv.DictReader(handle)
|
| 26 |
+
fieldnames = list(reader.fieldnames or [])
|
| 27 |
+
existing = list(reader)
|
| 28 |
+
|
| 29 |
+
expected_existing = START_CASE - 1
|
| 30 |
+
expected_names = [f"case{number:03d}" for number in range(1, START_CASE)]
|
| 31 |
+
if len(existing) != expected_existing or [row["case"] for row in existing] != expected_names:
|
| 32 |
+
raise RuntimeError(
|
| 33 |
+
f"Expected an uninterrupted case001-case{expected_existing:03d} manifest; "
|
| 34 |
+
f"found {len(existing)} rows"
|
| 35 |
+
)
|
| 36 |
+
for number in range(START_CASE, END_CASE + 1):
|
| 37 |
+
case_dir = CASE_ROOT / f"case{number:03d}"
|
| 38 |
+
if case_dir.exists() and any(case_dir.iterdir()):
|
| 39 |
+
raise RuntimeError(f"Refusing to overwrite existing case directory: {case_dir}")
|
| 40 |
+
|
| 41 |
+
template = base.parse_template(lhs.TEMPLATE)
|
| 42 |
+
used_element_ids = {int(row["impact_element_id"]) for row in existing}
|
| 43 |
+
available = [item for item in template["candidates"] if int(item["eid"]) not in used_element_ids]
|
| 44 |
+
count = END_CASE - START_CASE + 1
|
| 45 |
+
design, impacts, score = lhs.make_design(count, available, SEED, TRIALS)
|
| 46 |
+
|
| 47 |
+
added: list[dict[str, object]] = []
|
| 48 |
+
for number, unit, impact in zip(range(START_CASE, END_CASE + 1), design, impacts):
|
| 49 |
+
speed = lhs.scale(float(unit[2]), lhs.SPEED_RANGE)
|
| 50 |
+
mass_ratio = lhs.scale(float(unit[3]), lhs.MASS_RATIO_RANGE)
|
| 51 |
+
theta_deg = lhs.scale(float(unit[4]), lhs.THETA_RANGE_DEG)
|
| 52 |
+
phi_deg = lhs.scale(float(unit[5]), lhs.PHI_RANGE_DEG)
|
| 53 |
+
material_index = min(int(unit[6] * len(lhs.MATERIALS)), len(lhs.MATERIALS) - 1)
|
| 54 |
+
material = lhs.MATERIALS[material_index]
|
| 55 |
+
velocity = speed * lhs.direction(theta_deg, phi_deg)
|
| 56 |
+
density = lhs.BASE_DENSITY * mass_ratio
|
| 57 |
+
mass = lhs.BASE_MASS * mass_ratio
|
| 58 |
+
|
| 59 |
+
case_name = f"case{number:03d}"
|
| 60 |
+
case_dir = CASE_ROOT / case_name
|
| 61 |
+
case_dir.mkdir(parents=True, exist_ok=True)
|
| 62 |
+
key_path = case_dir / f"{case_name}.key"
|
| 63 |
+
key_lines, ball_center = lhs.make_case_key(template, impact, velocity, density, material)
|
| 64 |
+
key_path.write_text("".join(key_lines), encoding="utf-8", newline="\n")
|
| 65 |
+
center = impact["center"]
|
| 66 |
+
row = {
|
| 67 |
+
"case": case_name,
|
| 68 |
+
"key_file": str(key_path),
|
| 69 |
+
"panel_pid": lhs.PANEL_PID,
|
| 70 |
+
"impact_element_id": impact["eid"],
|
| 71 |
+
"impact_x": f"{center[0]:.8f}",
|
| 72 |
+
"impact_y": f"{center[1]:.8f}",
|
| 73 |
+
"impact_z": f"{center[2]:.8f}",
|
| 74 |
+
"ball_center_x": f"{ball_center[0]:.8f}",
|
| 75 |
+
"ball_center_y": f"{ball_center[1]:.8f}",
|
| 76 |
+
"ball_center_z": f"{ball_center[2]:.8f}",
|
| 77 |
+
"velocity_vx": f"{velocity[0]:.8f}",
|
| 78 |
+
"velocity_vy": f"{velocity[1]:.8f}",
|
| 79 |
+
"velocity_vz": f"{velocity[2]:.8f}",
|
| 80 |
+
"impact_speed": f"{speed:.8f}",
|
| 81 |
+
"mass_ratio": f"{mass_ratio:.8f}",
|
| 82 |
+
"impactor_mass": f"{mass:.10f}",
|
| 83 |
+
"impactor_density": f"{density:.10E}",
|
| 84 |
+
"theta_deg": f"{theta_deg:.8f}",
|
| 85 |
+
"phi_deg": f"{phi_deg:.8f}",
|
| 86 |
+
"material_index": material_index,
|
| 87 |
+
"material_name": material["name"],
|
| 88 |
+
"material_young_mpa": f"{material['young_mpa']:.1f}",
|
| 89 |
+
"material_poisson": f"{material['poisson']:.4f}",
|
| 90 |
+
"min_boundary_distance_mm": f"{impact['min_boundary_distance']:.8f}",
|
| 91 |
+
**{
|
| 92 |
+
f"lhs_u_{name}": f"{unit[index]:.10f}"
|
| 93 |
+
for index, name in enumerate(("x", "y", "v", "m", "theta", "phi", "material"))
|
| 94 |
+
},
|
| 95 |
+
}
|
| 96 |
+
if set(row) != set(fieldnames):
|
| 97 |
+
raise RuntimeError("Existing manifest schema differs from the LHS generator schema")
|
| 98 |
+
added.append(row)
|
| 99 |
+
|
| 100 |
+
temporary = manifest_path.with_suffix(".csv.tmp")
|
| 101 |
+
with temporary.open("w", newline="", encoding="utf-8") as handle:
|
| 102 |
+
writer = csv.DictWriter(handle, fieldnames=fieldnames)
|
| 103 |
+
writer.writeheader()
|
| 104 |
+
writer.writerows(existing)
|
| 105 |
+
writer.writerows(added)
|
| 106 |
+
temporary.replace(manifest_path)
|
| 107 |
+
|
| 108 |
+
all_rows = existing + added
|
| 109 |
+
counts = Counter(row["material_name"] for row in all_rows)
|
| 110 |
+
summary = (
|
| 111 |
+
"floorfrontdriver sequential constrained LHS extension\n"
|
| 112 |
+
f"preserved_cases=1-{START_CASE - 1}\n"
|
| 113 |
+
f"added_cases={START_CASE}-{END_CASE}\n"
|
| 114 |
+
f"added_count={count}\ntotal_cases={len(all_rows)}\n"
|
| 115 |
+
f"extension_seed={SEED}\nextension_trials={TRIALS}\n"
|
| 116 |
+
f"extension_normalized_maximin_score={score:.8f}\n"
|
| 117 |
+
f"extension_minimum_xy_spacing_mm={lhs.min_impact_spacing(impacts):.8f}\n"
|
| 118 |
+
f"combined_material_counts={dict(counts)}\n"
|
| 119 |
+
"The added 300 cases form an independent constrained LHS batch.\n"
|
| 120 |
+
)
|
| 121 |
+
(CASE_ROOT / "lhs_extension_201_500_summary.txt").write_text(
|
| 122 |
+
summary, encoding="utf-8", newline="\n"
|
| 123 |
+
)
|
| 124 |
+
print(summary, end="")
|
| 125 |
+
print(f"manifest={manifest_path}")
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
if __name__ == "__main__":
|
| 129 |
+
main()
|
generation_evidence/lhs/extend_floorfrontdriver_lhs_to_200.py
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import csv
|
| 4 |
+
from collections import Counter
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
import generate_floorfrontdriver_lhs_cases as lhsgen
|
| 10 |
+
import generate_floorfrontdriver_random_cases as base
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
ROOT = Path("cases_floorfrontdriver_lhs_100")
|
| 14 |
+
TOTAL_CASES = 200
|
| 15 |
+
SEED = 20260722
|
| 16 |
+
TRIALS = 128
|
| 17 |
+
PARAMETER_NAMES = ("v", "m", "theta", "phi", "material")
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def complementary_values(rows: list[dict], name: str, rng: np.random.Generator) -> np.ndarray:
|
| 21 |
+
occupied = {int(np.floor(TOTAL_CASES * float(row[f"lhs_u_{name}"]))) for row in rows}
|
| 22 |
+
missing = np.asarray(sorted(set(range(TOTAL_CASES)) - occupied), dtype=np.int64)
|
| 23 |
+
if len(missing) != 100:
|
| 24 |
+
raise RuntimeError(f"{name}: expected 100 unoccupied nested-LHS bins, found {len(missing)}")
|
| 25 |
+
rng.shuffle(missing)
|
| 26 |
+
return (missing + rng.random(len(missing))) / TOTAL_CASES
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def select_design(template: dict, old_rows: list[dict]) -> tuple[np.ndarray, list[dict], float]:
|
| 30 |
+
old_eids = {int(row["impact_element_id"]) for row in old_rows}
|
| 31 |
+
candidates = [item for item in template["candidates"] if int(item["eid"]) not in old_eids]
|
| 32 |
+
old_design = np.asarray(
|
| 33 |
+
[
|
| 34 |
+
[float(row[f"lhs_u_{name}"]) for name in ("x", "y", *PARAMETER_NAMES)]
|
| 35 |
+
for row in old_rows
|
| 36 |
+
],
|
| 37 |
+
dtype=np.float64,
|
| 38 |
+
)
|
| 39 |
+
root_rng = np.random.default_rng(SEED)
|
| 40 |
+
best_design = None
|
| 41 |
+
best_impacts = None
|
| 42 |
+
best_score = -np.inf
|
| 43 |
+
|
| 44 |
+
for _ in range(TRIALS):
|
| 45 |
+
rng = np.random.default_rng(int(root_rng.integers(0, np.iinfo(np.int64).max)))
|
| 46 |
+
design = np.empty((100, 7), dtype=np.float64)
|
| 47 |
+
design[:, :2] = lhsgen.lhs(100, 2, rng)
|
| 48 |
+
for column, name in enumerate(PARAMETER_NAMES, start=2):
|
| 49 |
+
design[:, column] = complementary_values(old_rows, name, rng)
|
| 50 |
+
impacts, mapped = lhsgen.map_xy_to_panel(design, candidates, rng)
|
| 51 |
+
scored_new = mapped.copy()
|
| 52 |
+
scored_old = old_design.copy()
|
| 53 |
+
scored_new[:, 6] = (np.floor(scored_new[:, 6] * 3) + 0.5) / 3
|
| 54 |
+
scored_old[:, 6] = (np.floor(scored_old[:, 6] * 3) + 0.5) / 3
|
| 55 |
+
score = lhsgen.pairwise_min_distance(np.vstack((scored_old, scored_new)))
|
| 56 |
+
if score > best_score:
|
| 57 |
+
best_design, best_impacts, best_score = mapped, impacts, score
|
| 58 |
+
|
| 59 |
+
assert best_design is not None and best_impacts is not None
|
| 60 |
+
return best_design, best_impacts, best_score
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def main() -> None:
|
| 64 |
+
manifest = ROOT / "case_manifest.csv"
|
| 65 |
+
with manifest.open(newline="", encoding="utf-8") as handle:
|
| 66 |
+
old_rows = list(csv.DictReader(handle))
|
| 67 |
+
if len(old_rows) == TOTAL_CASES:
|
| 68 |
+
print("[OK] manifest already contains 200 cases; nothing to generate")
|
| 69 |
+
return
|
| 70 |
+
if len(old_rows) != 100:
|
| 71 |
+
raise RuntimeError(f"Expected existing 100-case manifest, found {len(old_rows)} rows")
|
| 72 |
+
|
| 73 |
+
template = base.parse_template(lhsgen.TEMPLATE)
|
| 74 |
+
design, impacts, score = select_design(template, old_rows)
|
| 75 |
+
new_rows: list[dict] = []
|
| 76 |
+
for case_number, (unit, impact) in enumerate(zip(design, impacts), start=101):
|
| 77 |
+
speed = lhsgen.scale(float(unit[2]), lhsgen.SPEED_RANGE)
|
| 78 |
+
mass_ratio = lhsgen.scale(float(unit[3]), lhsgen.MASS_RATIO_RANGE)
|
| 79 |
+
theta_deg = lhsgen.scale(float(unit[4]), lhsgen.THETA_RANGE_DEG)
|
| 80 |
+
phi_deg = lhsgen.scale(float(unit[5]), lhsgen.PHI_RANGE_DEG)
|
| 81 |
+
material_index = min(int(unit[6] * len(lhsgen.MATERIALS)), len(lhsgen.MATERIALS) - 1)
|
| 82 |
+
material = lhsgen.MATERIALS[material_index]
|
| 83 |
+
velocity = speed * lhsgen.direction(theta_deg, phi_deg)
|
| 84 |
+
density = lhsgen.BASE_DENSITY * mass_ratio
|
| 85 |
+
mass = lhsgen.BASE_MASS * mass_ratio
|
| 86 |
+
case_name = f"case{case_number:03d}"
|
| 87 |
+
case_dir = ROOT / case_name
|
| 88 |
+
case_dir.mkdir(parents=True, exist_ok=True)
|
| 89 |
+
key_path = case_dir / f"{case_name}.key"
|
| 90 |
+
key_lines, ball_center = lhsgen.make_case_key(template, impact, velocity, density, material)
|
| 91 |
+
key_path.write_text("".join(key_lines), encoding="utf-8", newline="\n")
|
| 92 |
+
center = impact["center"]
|
| 93 |
+
new_rows.append(
|
| 94 |
+
{
|
| 95 |
+
"case": case_name,
|
| 96 |
+
"key_file": str(key_path),
|
| 97 |
+
"panel_pid": lhsgen.PANEL_PID,
|
| 98 |
+
"impact_element_id": impact["eid"],
|
| 99 |
+
"impact_x": f"{center[0]:.8f}",
|
| 100 |
+
"impact_y": f"{center[1]:.8f}",
|
| 101 |
+
"impact_z": f"{center[2]:.8f}",
|
| 102 |
+
"ball_center_x": f"{ball_center[0]:.8f}",
|
| 103 |
+
"ball_center_y": f"{ball_center[1]:.8f}",
|
| 104 |
+
"ball_center_z": f"{ball_center[2]:.8f}",
|
| 105 |
+
"velocity_vx": f"{velocity[0]:.8f}",
|
| 106 |
+
"velocity_vy": f"{velocity[1]:.8f}",
|
| 107 |
+
"velocity_vz": f"{velocity[2]:.8f}",
|
| 108 |
+
"impact_speed": f"{speed:.8f}",
|
| 109 |
+
"mass_ratio": f"{mass_ratio:.8f}",
|
| 110 |
+
"impactor_mass": f"{mass:.10f}",
|
| 111 |
+
"impactor_density": f"{density:.10E}",
|
| 112 |
+
"theta_deg": f"{theta_deg:.8f}",
|
| 113 |
+
"phi_deg": f"{phi_deg:.8f}",
|
| 114 |
+
"material_index": material_index,
|
| 115 |
+
"material_name": material["name"],
|
| 116 |
+
"material_young_mpa": f"{material['young_mpa']:.1f}",
|
| 117 |
+
"material_poisson": f"{material['poisson']:.4f}",
|
| 118 |
+
"min_boundary_distance_mm": f"{impact['min_boundary_distance']:.8f}",
|
| 119 |
+
**{
|
| 120 |
+
f"lhs_u_{name}": f"{unit[index]:.10f}"
|
| 121 |
+
for index, name in enumerate(("x", "y", "v", "m", "theta", "phi", "material"))
|
| 122 |
+
},
|
| 123 |
+
}
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
all_rows = old_rows + new_rows
|
| 127 |
+
temporary = manifest.with_suffix(".csv.tmp")
|
| 128 |
+
with temporary.open("w", newline="", encoding="utf-8") as handle:
|
| 129 |
+
writer = csv.DictWriter(handle, fieldnames=list(all_rows[0]))
|
| 130 |
+
writer.writeheader()
|
| 131 |
+
writer.writerows(all_rows)
|
| 132 |
+
temporary.replace(manifest)
|
| 133 |
+
|
| 134 |
+
counts = Counter(row["material_name"] for row in all_rows)
|
| 135 |
+
summary = (
|
| 136 |
+
f"cases={len(all_rows)}\nseed_extension={SEED}\ntrials={TRIALS}\n"
|
| 137 |
+
f"combined_normalized_maximin_score={score:.8f}\n"
|
| 138 |
+
f"material_counts={dict(counts)}\n"
|
| 139 |
+
"case001-case100 preserved; case101-case200 use complementary 200-bin nested LHS strata.\n"
|
| 140 |
+
)
|
| 141 |
+
(ROOT / "lhs_design_summary_200.txt").write_text(summary, encoding="utf-8", newline="\n")
|
| 142 |
+
print(summary, end="")
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
if __name__ == "__main__":
|
| 146 |
+
main()
|
generation_evidence/lhs/floorfrontR/case_manifest.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generation_evidence/lhs/floorfrontR/lhs_design_summary.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
floorfrontR constrained LHS design
|
| 2 |
+
cases=500
|
| 3 |
+
seed=20260728
|
| 4 |
+
trials=128
|
| 5 |
+
normalized_maximin_score=0.17315438
|
| 6 |
+
minimum_xy_spacing_mm=5.02509788
|
| 7 |
+
speed_range_mm_per_s=(1732.05, 5196.15)
|
| 8 |
+
mass_ratio_range=(0.75, 1.25)
|
| 9 |
+
theta_range_deg=(0.0, 15.0)
|
| 10 |
+
phi_range_deg=(0.0, 360.0)
|
| 11 |
+
material_counts={'titanium_rigid': 167, 'aluminum_rigid': 166, 'steel_rigid': 167}
|
| 12 |
+
theta is measured from global +Z; phi is measured in global XY from +X toward +Y.
|
| 13 |
+
Rigid material class controls E/nu used by contact; mass ratio independently scales density.
|
generation_evidence/lhs/floorfrontdriver/case_manifest.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generation_evidence/lhs/floorfrontdriver/lhs_design_summary.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
floorfrontdriver constrained LHS design
|
| 2 |
+
cases=100
|
| 3 |
+
seed=20260721
|
| 4 |
+
trials=128
|
| 5 |
+
normalized_maximin_score=0.34123189
|
| 6 |
+
minimum_xy_spacing_mm=9.70521446
|
| 7 |
+
speed_range_mm_per_s=(1732.05, 5196.15)
|
| 8 |
+
mass_ratio_range=(0.75, 1.25)
|
| 9 |
+
theta_range_deg=(0.0, 15.0)
|
| 10 |
+
phi_range_deg=(0.0, 360.0)
|
| 11 |
+
material_counts={'titanium_rigid': 33, 'steel_rigid': 33, 'aluminum_rigid': 34}
|
| 12 |
+
theta is measured from global +Z; phi is measured in global XY from +X toward +Y.
|
| 13 |
+
Rigid material class controls E/nu used by contact; mass ratio independently scales density.
|
generation_evidence/lhs/floorfrontdriver/lhs_design_summary_200.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cases=200
|
| 2 |
+
seed_extension=20260722
|
| 3 |
+
trials=128
|
| 4 |
+
combined_normalized_maximin_score=0.25806791
|
| 5 |
+
material_counts={'titanium_rigid': 67, 'steel_rigid': 66, 'aluminum_rigid': 67}
|
| 6 |
+
case001-case100 preserved; case101-case200 use complementary 200-bin nested LHS strata.
|
generation_evidence/lhs/floorfrontdriver/lhs_extension_201_500_summary.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
floorfrontdriver sequential constrained LHS extension
|
| 2 |
+
preserved_cases=1-200
|
| 3 |
+
added_cases=201-500
|
| 4 |
+
added_count=300
|
| 5 |
+
total_cases=500
|
| 6 |
+
extension_seed=20260722
|
| 7 |
+
extension_trials=128
|
| 8 |
+
extension_normalized_maximin_score=0.22052899
|
| 9 |
+
extension_minimum_xy_spacing_mm=6.43164167
|
| 10 |
+
combined_material_counts={'titanium_rigid': 167, 'steel_rigid': 166, 'aluminum_rigid': 167}
|
| 11 |
+
The added 300 cases form an independent constrained LHS batch.
|
generation_evidence/lhs/generate_floorfrontR_lhs_cases.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
import generate_floorfrontdriver_lhs_cases as lhs
|
| 4 |
+
import generate_floorfrontdriver_random_cases as base
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
lhs.TEMPLATE = Path("floor_panel_largest_2_pid_2000395_133_floorfrontR_with_ball.key")
|
| 8 |
+
lhs.OUTPUT_ROOT = Path("cases_floorfrontR_lhs_500")
|
| 9 |
+
lhs.DESIGN_NAME = "floorfrontR"
|
| 10 |
+
lhs.DEFAULT_CASES = 500
|
| 11 |
+
lhs.DEFAULT_SEED = 20260728
|
| 12 |
+
lhs.PANEL_PID = 2000395
|
| 13 |
+
|
| 14 |
+
# The shared template parser selects valid panel elements through this module global.
|
| 15 |
+
base.PANEL_PID = lhs.PANEL_PID
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
if __name__ == "__main__":
|
| 19 |
+
lhs.main()
|
generation_evidence/lhs/generate_floorfrontdriver_lhs_cases.py
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import csv
|
| 5 |
+
import math
|
| 6 |
+
from collections import Counter
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
import numpy as np
|
| 10 |
+
|
| 11 |
+
import generate_floorfrontdriver_random_cases as base
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
TEMPLATE = Path("floor_panel_largest_3_pid_2000394_373_floorfrontdriver_with_ball.key")
|
| 15 |
+
OUTPUT_ROOT = Path("cases_floorfrontdriver_lhs_100")
|
| 16 |
+
DESIGN_NAME = "floorfrontdriver"
|
| 17 |
+
DEFAULT_CASES = 100
|
| 18 |
+
DEFAULT_SEED = 20260721
|
| 19 |
+
PANEL_PID = 2000394
|
| 20 |
+
BALL_PID = 9636
|
| 21 |
+
BALL_MID = 174
|
| 22 |
+
BASE_DENSITY = 5.205e-5
|
| 23 |
+
BASE_MASS = 0.01
|
| 24 |
+
BALL_GAP_MM = 5.0
|
| 25 |
+
|
| 26 |
+
SPEED_RANGE = (1732.05, 5196.15)
|
| 27 |
+
MASS_RATIO_RANGE = (0.75, 1.25)
|
| 28 |
+
THETA_RANGE_DEG = (0.0, 15.0)
|
| 29 |
+
PHI_RANGE_DEG = (0.0, 360.0)
|
| 30 |
+
|
| 31 |
+
MATERIALS = (
|
| 32 |
+
{"index": 0, "name": "aluminum_rigid", "young_mpa": 70000.0, "poisson": 0.33},
|
| 33 |
+
{"index": 1, "name": "titanium_rigid", "young_mpa": 110000.0, "poisson": 0.34},
|
| 34 |
+
{"index": 2, "name": "steel_rigid", "young_mpa": 210000.0, "poisson": 0.30},
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def parse_args() -> argparse.Namespace:
|
| 39 |
+
parser = argparse.ArgumentParser(
|
| 40 |
+
description=f"Generate constrained LHS {DESIGN_NAME} impact cases."
|
| 41 |
+
)
|
| 42 |
+
parser.add_argument("--template", type=Path, default=TEMPLATE)
|
| 43 |
+
parser.add_argument("--output-root", type=Path, default=OUTPUT_ROOT)
|
| 44 |
+
parser.add_argument("--cases", type=int, default=DEFAULT_CASES)
|
| 45 |
+
parser.add_argument("--seed", type=int, default=DEFAULT_SEED)
|
| 46 |
+
parser.add_argument("--trials", type=int, default=128)
|
| 47 |
+
parser.add_argument("--overwrite", action="store_true")
|
| 48 |
+
return parser.parse_args()
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def lhs(n: int, dimensions: int, rng: np.random.Generator) -> np.ndarray:
|
| 52 |
+
design = np.empty((n, dimensions), dtype=np.float64)
|
| 53 |
+
for dimension in range(dimensions):
|
| 54 |
+
design[:, dimension] = (rng.permutation(n) + rng.random(n)) / n
|
| 55 |
+
return design
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def pairwise_min_distance(values: np.ndarray) -> float:
|
| 59 |
+
delta = values[:, None, :] - values[None, :, :]
|
| 60 |
+
distance2 = np.einsum("ijk,ijk->ij", delta, delta)
|
| 61 |
+
np.fill_diagonal(distance2, np.inf)
|
| 62 |
+
return float(np.sqrt(distance2.min()))
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def map_xy_to_panel(
|
| 66 |
+
design: np.ndarray,
|
| 67 |
+
candidates: list[dict],
|
| 68 |
+
rng: np.random.Generator,
|
| 69 |
+
) -> tuple[list[dict], np.ndarray]:
|
| 70 |
+
centers = np.asarray([item["center"][:2] for item in candidates], dtype=np.float64)
|
| 71 |
+
low = centers.min(axis=0)
|
| 72 |
+
span = centers.max(axis=0) - low
|
| 73 |
+
normalized = (centers - low) / span
|
| 74 |
+
available = np.ones(len(candidates), dtype=bool)
|
| 75 |
+
selected_indices = np.empty(len(design), dtype=np.int64)
|
| 76 |
+
|
| 77 |
+
# Random order avoids systematically giving early rows the best projection.
|
| 78 |
+
for row_index in rng.permutation(len(design)):
|
| 79 |
+
distance2 = ((normalized - design[row_index, :2]) ** 2).sum(axis=1)
|
| 80 |
+
distance2[~available] = np.inf
|
| 81 |
+
chosen = int(np.argmin(distance2))
|
| 82 |
+
selected_indices[row_index] = chosen
|
| 83 |
+
available[chosen] = False
|
| 84 |
+
|
| 85 |
+
mapped = design.copy()
|
| 86 |
+
mapped[:, :2] = normalized[selected_indices]
|
| 87 |
+
return [candidates[index] for index in selected_indices], mapped
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def make_design(n: int, candidates: list[dict], seed: int, trials: int) -> tuple[np.ndarray, list[dict], float]:
|
| 91 |
+
root_rng = np.random.default_rng(seed)
|
| 92 |
+
best_design = None
|
| 93 |
+
best_impacts = None
|
| 94 |
+
best_score = -np.inf
|
| 95 |
+
|
| 96 |
+
for _ in range(trials):
|
| 97 |
+
trial_seed = int(root_rng.integers(0, np.iinfo(np.int64).max))
|
| 98 |
+
rng = np.random.default_rng(trial_seed)
|
| 99 |
+
design = lhs(n, 7, rng)
|
| 100 |
+
impacts, mapped = map_xy_to_panel(design, candidates, rng)
|
| 101 |
+
material_coordinate = (np.floor(mapped[:, 6] * len(MATERIALS)) + 0.5) / len(MATERIALS)
|
| 102 |
+
scored = mapped.copy()
|
| 103 |
+
scored[:, 6] = material_coordinate
|
| 104 |
+
score = pairwise_min_distance(scored)
|
| 105 |
+
if score > best_score:
|
| 106 |
+
best_design = mapped
|
| 107 |
+
best_impacts = impacts
|
| 108 |
+
best_score = score
|
| 109 |
+
|
| 110 |
+
assert best_design is not None and best_impacts is not None
|
| 111 |
+
return best_design, best_impacts, best_score
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def scale(unit_value: float, limits: tuple[float, float]) -> float:
|
| 115 |
+
return limits[0] + unit_value * (limits[1] - limits[0])
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def direction(theta_deg: float, phi_deg: float) -> np.ndarray:
|
| 119 |
+
theta = math.radians(theta_deg)
|
| 120 |
+
phi = math.radians(phi_deg)
|
| 121 |
+
return np.asarray(
|
| 122 |
+
[math.sin(theta) * math.cos(phi), math.sin(theta) * math.sin(phi), math.cos(theta)],
|
| 123 |
+
dtype=np.float64,
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
def update_mat_rigid(block: list[str], density: float, young_mpa: float, poisson: float) -> tuple[list[str], bool]:
|
| 128 |
+
output = list(block)
|
| 129 |
+
for index, line in enumerate(output[1:], start=1):
|
| 130 |
+
stripped = line.strip()
|
| 131 |
+
if not stripped or stripped.startswith("$"):
|
| 132 |
+
continue
|
| 133 |
+
fields = stripped.split()
|
| 134 |
+
if len(fields) >= 4 and fields[0] == str(BALL_MID):
|
| 135 |
+
output[index] = f"{BALL_MID:10d}{density:10.4E}{young_mpa:10.1f}{poisson:10.4f}\n"
|
| 136 |
+
return output, True
|
| 137 |
+
return output, False
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
def update_initial_velocity(block: list[str], velocity: np.ndarray) -> tuple[list[str], bool]:
|
| 141 |
+
output = list(block)
|
| 142 |
+
for index, line in enumerate(output[1:], start=1):
|
| 143 |
+
stripped = line.strip()
|
| 144 |
+
if not stripped or stripped.startswith("$"):
|
| 145 |
+
continue
|
| 146 |
+
fields = stripped.split()
|
| 147 |
+
if fields and fields[0] == str(BALL_PID):
|
| 148 |
+
values = [BALL_PID, *velocity.tolist(), 0.0, 0.0, 0.0, 0]
|
| 149 |
+
output[index] = (
|
| 150 |
+
f"{values[0]:10d}"
|
| 151 |
+
+ "".join(f"{value:10.3E}" for value in values[1:7])
|
| 152 |
+
+ f"{values[7]:10d}\n"
|
| 153 |
+
)
|
| 154 |
+
return output, True
|
| 155 |
+
return output, False
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
def make_case_key(
|
| 159 |
+
template: dict,
|
| 160 |
+
impact: dict,
|
| 161 |
+
velocity: np.ndarray,
|
| 162 |
+
density: float,
|
| 163 |
+
material: dict,
|
| 164 |
+
) -> tuple[list[str], np.ndarray]:
|
| 165 |
+
impact_center = np.asarray(impact["center"], dtype=np.float64)
|
| 166 |
+
travel_direction = velocity / np.linalg.norm(velocity)
|
| 167 |
+
ball_center = impact_center - travel_direction * (template["ball_radius"] + BALL_GAP_MM)
|
| 168 |
+
output_blocks: list[list[str]] = []
|
| 169 |
+
material_updated = False
|
| 170 |
+
velocity_updated = False
|
| 171 |
+
|
| 172 |
+
for block in template["blocks"]:
|
| 173 |
+
if base.block_is_control_adaptive(block) or base.block_is_end(block):
|
| 174 |
+
continue
|
| 175 |
+
key = block[0].strip().upper()
|
| 176 |
+
if key == "*NODE":
|
| 177 |
+
modified = base.move_ball_nodes_in_node_block(
|
| 178 |
+
block, template["ball_node_ids"], template["ball_center"], ball_center
|
| 179 |
+
)
|
| 180 |
+
elif key == "*PART":
|
| 181 |
+
modified = base.update_part_adpopt_block(block, PANEL_PID, 0)
|
| 182 |
+
modified = base.update_part_adpopt_block(modified, BALL_PID, 0)
|
| 183 |
+
elif key.startswith("*MAT_RIGID"):
|
| 184 |
+
modified, changed = update_mat_rigid(
|
| 185 |
+
block, density, material["young_mpa"], material["poisson"]
|
| 186 |
+
)
|
| 187 |
+
material_updated |= changed
|
| 188 |
+
elif key == "*INITIAL_VELOCITY_RIGID_BODY":
|
| 189 |
+
modified, changed = update_initial_velocity(block, velocity)
|
| 190 |
+
velocity_updated |= changed
|
| 191 |
+
else:
|
| 192 |
+
modified = block
|
| 193 |
+
output_blocks.append(modified)
|
| 194 |
+
|
| 195 |
+
if not material_updated:
|
| 196 |
+
raise RuntimeError(f"Could not update rigid material MID {BALL_MID}")
|
| 197 |
+
if not velocity_updated:
|
| 198 |
+
raise RuntimeError(f"Could not update initial velocity for PID {BALL_PID}")
|
| 199 |
+
|
| 200 |
+
lines = [line for block in output_blocks for line in block]
|
| 201 |
+
lines.append("*END\n")
|
| 202 |
+
return lines, ball_center
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def min_impact_spacing(impacts: list[dict]) -> float:
|
| 206 |
+
xy = np.asarray([item["center"][:2] for item in impacts])
|
| 207 |
+
delta = xy[:, None, :] - xy[None, :, :]
|
| 208 |
+
distance2 = np.einsum("ijk,ijk->ij", delta, delta)
|
| 209 |
+
np.fill_diagonal(distance2, np.inf)
|
| 210 |
+
return float(np.sqrt(distance2.min()))
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
def main() -> None:
|
| 214 |
+
args = parse_args()
|
| 215 |
+
if args.cases < 3:
|
| 216 |
+
raise ValueError("--cases must be at least 3")
|
| 217 |
+
if not args.template.exists():
|
| 218 |
+
raise FileNotFoundError(args.template)
|
| 219 |
+
if args.output_root.exists() and any(args.output_root.iterdir()) and not args.overwrite:
|
| 220 |
+
raise RuntimeError(f"Output root is not empty: {args.output_root}; use --overwrite to replace keys")
|
| 221 |
+
|
| 222 |
+
template = base.parse_template(args.template)
|
| 223 |
+
design, impacts, score = make_design(args.cases, template["candidates"], args.seed, args.trials)
|
| 224 |
+
args.output_root.mkdir(parents=True, exist_ok=True)
|
| 225 |
+
rows = []
|
| 226 |
+
|
| 227 |
+
for index, (unit, impact) in enumerate(zip(design, impacts), start=1):
|
| 228 |
+
speed = scale(float(unit[2]), SPEED_RANGE)
|
| 229 |
+
mass_ratio = scale(float(unit[3]), MASS_RATIO_RANGE)
|
| 230 |
+
theta_deg = scale(float(unit[4]), THETA_RANGE_DEG)
|
| 231 |
+
phi_deg = scale(float(unit[5]), PHI_RANGE_DEG)
|
| 232 |
+
material_index = min(int(unit[6] * len(MATERIALS)), len(MATERIALS) - 1)
|
| 233 |
+
material = MATERIALS[material_index]
|
| 234 |
+
velocity = speed * direction(theta_deg, phi_deg)
|
| 235 |
+
density = BASE_DENSITY * mass_ratio
|
| 236 |
+
mass = BASE_MASS * mass_ratio
|
| 237 |
+
|
| 238 |
+
case_name = f"case{index:03d}"
|
| 239 |
+
case_dir = args.output_root / case_name
|
| 240 |
+
case_dir.mkdir(parents=True, exist_ok=True)
|
| 241 |
+
key_path = case_dir / f"{case_name}.key"
|
| 242 |
+
key_lines, ball_center = make_case_key(template, impact, velocity, density, material)
|
| 243 |
+
key_path.write_text("".join(key_lines), encoding="utf-8", newline="\n")
|
| 244 |
+
center = impact["center"]
|
| 245 |
+
rows.append(
|
| 246 |
+
{
|
| 247 |
+
"case": case_name,
|
| 248 |
+
"key_file": str(key_path),
|
| 249 |
+
"panel_pid": PANEL_PID,
|
| 250 |
+
"impact_element_id": impact["eid"],
|
| 251 |
+
"impact_x": f"{center[0]:.8f}",
|
| 252 |
+
"impact_y": f"{center[1]:.8f}",
|
| 253 |
+
"impact_z": f"{center[2]:.8f}",
|
| 254 |
+
"ball_center_x": f"{ball_center[0]:.8f}",
|
| 255 |
+
"ball_center_y": f"{ball_center[1]:.8f}",
|
| 256 |
+
"ball_center_z": f"{ball_center[2]:.8f}",
|
| 257 |
+
"velocity_vx": f"{velocity[0]:.8f}",
|
| 258 |
+
"velocity_vy": f"{velocity[1]:.8f}",
|
| 259 |
+
"velocity_vz": f"{velocity[2]:.8f}",
|
| 260 |
+
"impact_speed": f"{speed:.8f}",
|
| 261 |
+
"mass_ratio": f"{mass_ratio:.8f}",
|
| 262 |
+
"impactor_mass": f"{mass:.10f}",
|
| 263 |
+
"impactor_density": f"{density:.10E}",
|
| 264 |
+
"theta_deg": f"{theta_deg:.8f}",
|
| 265 |
+
"phi_deg": f"{phi_deg:.8f}",
|
| 266 |
+
"material_index": material_index,
|
| 267 |
+
"material_name": material["name"],
|
| 268 |
+
"material_young_mpa": f"{material['young_mpa']:.1f}",
|
| 269 |
+
"material_poisson": f"{material['poisson']:.4f}",
|
| 270 |
+
"min_boundary_distance_mm": f"{impact['min_boundary_distance']:.8f}",
|
| 271 |
+
**{f"lhs_u_{name}": f"{unit[i]:.10f}" for i, name in enumerate(("x", "y", "v", "m", "theta", "phi", "material"))},
|
| 272 |
+
}
|
| 273 |
+
)
|
| 274 |
+
|
| 275 |
+
manifest = args.output_root / "case_manifest.csv"
|
| 276 |
+
with manifest.open("w", newline="", encoding="utf-8") as handle:
|
| 277 |
+
writer = csv.DictWriter(handle, fieldnames=list(rows[0]))
|
| 278 |
+
writer.writeheader()
|
| 279 |
+
writer.writerows(rows)
|
| 280 |
+
|
| 281 |
+
counts = Counter(row["material_name"] for row in rows)
|
| 282 |
+
summary = (
|
| 283 |
+
f"{DESIGN_NAME} constrained LHS design\n"
|
| 284 |
+
f"cases={args.cases}\nseed={args.seed}\ntrials={args.trials}\n"
|
| 285 |
+
f"normalized_maximin_score={score:.8f}\n"
|
| 286 |
+
f"minimum_xy_spacing_mm={min_impact_spacing(impacts):.8f}\n"
|
| 287 |
+
f"speed_range_mm_per_s={SPEED_RANGE}\n"
|
| 288 |
+
f"mass_ratio_range={MASS_RATIO_RANGE}\n"
|
| 289 |
+
f"theta_range_deg={THETA_RANGE_DEG}\nphi_range_deg={PHI_RANGE_DEG}\n"
|
| 290 |
+
f"material_counts={dict(counts)}\n"
|
| 291 |
+
"theta is measured from global +Z; phi is measured in global XY from +X toward +Y.\n"
|
| 292 |
+
"Rigid material class controls E/nu used by contact; mass ratio independently scales density.\n"
|
| 293 |
+
)
|
| 294 |
+
(args.output_root / "lhs_design_summary.txt").write_text(summary, encoding="utf-8", newline="\n")
|
| 295 |
+
print(summary, end="")
|
| 296 |
+
print(f"manifest={manifest}")
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
if __name__ == "__main__":
|
| 300 |
+
main()
|
generation_evidence/lhs/generate_floorfrontdriver_random_cases.py
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import csv
|
| 2 |
+
import math
|
| 3 |
+
import random
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
TEMPLATE = Path("floor_panel_largest_3_pid_2000394_373_floorfrontdriver_with_ball.key")
|
| 8 |
+
OUTPUT_ROOT = Path("cases_floorfrontdriver_random_50")
|
| 9 |
+
|
| 10 |
+
PANEL_PID = 2000394
|
| 11 |
+
BALL_PID = 9636
|
| 12 |
+
NUM_CASES = 50
|
| 13 |
+
RANDOM_SEED = 20260611
|
| 14 |
+
|
| 15 |
+
MIN_BOUNDARY_DISTANCE_MM = 80.0
|
| 16 |
+
TARGET_PAIRWISE_DISTANCE_MM = 120.0
|
| 17 |
+
MIN_PAIRWISE_DISTANCE_MM = 60.0
|
| 18 |
+
PAIRWISE_RELAX_STEP_MM = 10.0
|
| 19 |
+
BALL_GAP_MM = 5.0
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def is_keyword(line):
|
| 23 |
+
return line.startswith("*")
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_int_fields(line):
|
| 27 |
+
values = []
|
| 28 |
+
for field in line.strip().split():
|
| 29 |
+
try:
|
| 30 |
+
values.append(int(float(field)))
|
| 31 |
+
except ValueError:
|
| 32 |
+
pass
|
| 33 |
+
if len(values) >= 6:
|
| 34 |
+
return values
|
| 35 |
+
|
| 36 |
+
fixed = []
|
| 37 |
+
if len(line) >= 48:
|
| 38 |
+
for i in range(6):
|
| 39 |
+
chunk = line[i * 8 : (i + 1) * 8].strip()
|
| 40 |
+
if not chunk:
|
| 41 |
+
fixed.append(0)
|
| 42 |
+
continue
|
| 43 |
+
try:
|
| 44 |
+
fixed.append(int(chunk))
|
| 45 |
+
except ValueError:
|
| 46 |
+
return values
|
| 47 |
+
return fixed if len(fixed) >= len(values) else values
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def read_blocks(path):
|
| 51 |
+
block = []
|
| 52 |
+
with path.open("r", encoding="utf-8", errors="ignore") as f:
|
| 53 |
+
for line in f:
|
| 54 |
+
if is_keyword(line) and block:
|
| 55 |
+
yield block
|
| 56 |
+
block = [line]
|
| 57 |
+
else:
|
| 58 |
+
block.append(line)
|
| 59 |
+
if block:
|
| 60 |
+
yield block
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def parse_node_line(line):
|
| 64 |
+
fields = line.strip().split()
|
| 65 |
+
if len(fields) < 4:
|
| 66 |
+
return None
|
| 67 |
+
try:
|
| 68 |
+
return int(float(fields[0])), (float(fields[1]), float(fields[2]), float(fields[3]))
|
| 69 |
+
except ValueError:
|
| 70 |
+
return None
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def format_node(nid, xyz):
|
| 74 |
+
x, y, z = xyz
|
| 75 |
+
return f"{nid:8d}{x:16.8f}{y:16.8f}{z:16.8f} 0 0\n"
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def shell_edges(nids):
|
| 79 |
+
clean = []
|
| 80 |
+
for nid in nids:
|
| 81 |
+
if nid > 0 and nid not in clean:
|
| 82 |
+
clean.append(nid)
|
| 83 |
+
if len(clean) < 3:
|
| 84 |
+
return []
|
| 85 |
+
return [tuple(sorted((clean[i], clean[(i + 1) % len(clean)]))) for i in range(len(clean))]
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def centroid(points):
|
| 89 |
+
n = len(points)
|
| 90 |
+
return (
|
| 91 |
+
sum(p[0] for p in points) / n,
|
| 92 |
+
sum(p[1] for p in points) / n,
|
| 93 |
+
sum(p[2] for p in points) / n,
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def xy_distance(a, b):
|
| 98 |
+
return math.hypot(a[0] - b[0], a[1] - b[1])
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def block_is_control_adaptive(block):
|
| 102 |
+
return block[0].strip().upper() == "*CONTROL_ADAPTIVE"
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def block_is_end(block):
|
| 106 |
+
return block[0].strip().upper() == "*END"
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def parse_template(path):
|
| 110 |
+
blocks = list(read_blocks(path))
|
| 111 |
+
nodes = {}
|
| 112 |
+
shell_elements = []
|
| 113 |
+
|
| 114 |
+
for block in blocks:
|
| 115 |
+
key = block[0].strip().upper()
|
| 116 |
+
if key == "*NODE":
|
| 117 |
+
for line in block[1:]:
|
| 118 |
+
stripped = line.strip()
|
| 119 |
+
if not stripped or stripped.startswith("$"):
|
| 120 |
+
continue
|
| 121 |
+
parsed = parse_node_line(line)
|
| 122 |
+
if parsed:
|
| 123 |
+
nodes[parsed[0]] = parsed[1]
|
| 124 |
+
elif key == "*ELEMENT_SHELL":
|
| 125 |
+
for line in block[1:]:
|
| 126 |
+
stripped = line.strip()
|
| 127 |
+
if not stripped or stripped.startswith("$"):
|
| 128 |
+
continue
|
| 129 |
+
fields = parse_int_fields(line)
|
| 130 |
+
if len(fields) >= 6:
|
| 131 |
+
shell_elements.append(fields[:6])
|
| 132 |
+
|
| 133 |
+
panel_elements = [elem for elem in shell_elements if elem[1] == PANEL_PID]
|
| 134 |
+
ball_elements = [elem for elem in shell_elements if elem[1] == BALL_PID]
|
| 135 |
+
if not panel_elements:
|
| 136 |
+
raise SystemExit(f"No panel elements found for PID {PANEL_PID}")
|
| 137 |
+
if not ball_elements:
|
| 138 |
+
raise SystemExit(f"No ball elements found for PID {BALL_PID}")
|
| 139 |
+
|
| 140 |
+
ball_node_ids = {nid for elem in ball_elements for nid in elem[2:6] if nid > 0}
|
| 141 |
+
ball_points = [nodes[nid] for nid in ball_node_ids]
|
| 142 |
+
ball_center = centroid(ball_points)
|
| 143 |
+
ball_radius = max(
|
| 144 |
+
max(p[0] for p in ball_points) - min(p[0] for p in ball_points),
|
| 145 |
+
max(p[1] for p in ball_points) - min(p[1] for p in ball_points),
|
| 146 |
+
max(p[2] for p in ball_points) - min(p[2] for p in ball_points),
|
| 147 |
+
) / 2.0
|
| 148 |
+
|
| 149 |
+
edge_counts = {}
|
| 150 |
+
for elem in panel_elements:
|
| 151 |
+
for edge in shell_edges(elem[2:6]):
|
| 152 |
+
edge_counts[edge] = edge_counts.get(edge, 0) + 1
|
| 153 |
+
|
| 154 |
+
boundary_node_ids = set()
|
| 155 |
+
for edge, count in edge_counts.items():
|
| 156 |
+
if count == 1:
|
| 157 |
+
boundary_node_ids.update(edge)
|
| 158 |
+
boundary_points = [nodes[nid] for nid in boundary_node_ids if nid in nodes]
|
| 159 |
+
|
| 160 |
+
candidates = []
|
| 161 |
+
for elem in panel_elements:
|
| 162 |
+
elem_nodes = [nodes[nid] for nid in elem[2:6] if nid > 0 and nid in nodes]
|
| 163 |
+
if len(elem_nodes) < 3:
|
| 164 |
+
continue
|
| 165 |
+
c = centroid(elem_nodes)
|
| 166 |
+
min_boundary_distance = min(xy_distance(c, bp) for bp in boundary_points)
|
| 167 |
+
if min_boundary_distance >= MIN_BOUNDARY_DISTANCE_MM:
|
| 168 |
+
candidates.append(
|
| 169 |
+
{
|
| 170 |
+
"eid": elem[0],
|
| 171 |
+
"center": c,
|
| 172 |
+
"min_boundary_distance": min_boundary_distance,
|
| 173 |
+
}
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
if len(candidates) < NUM_CASES:
|
| 177 |
+
raise SystemExit(
|
| 178 |
+
f"Only {len(candidates)} safe impact candidates found; need {NUM_CASES}. "
|
| 179 |
+
f"Reduce MIN_BOUNDARY_DISTANCE_MM."
|
| 180 |
+
)
|
| 181 |
+
|
| 182 |
+
return {
|
| 183 |
+
"blocks": blocks,
|
| 184 |
+
"nodes": nodes,
|
| 185 |
+
"panel_elements": panel_elements,
|
| 186 |
+
"ball_node_ids": ball_node_ids,
|
| 187 |
+
"ball_center": ball_center,
|
| 188 |
+
"ball_radius": ball_radius,
|
| 189 |
+
"candidates": candidates,
|
| 190 |
+
"boundary_node_count": len(boundary_node_ids),
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def update_part_adpopt_line(line, adpopt):
|
| 195 |
+
fields = parse_int_fields(line)
|
| 196 |
+
if len(fields) < 3:
|
| 197 |
+
return line
|
| 198 |
+
while len(fields) < 8:
|
| 199 |
+
fields.append(0)
|
| 200 |
+
fields[6] = adpopt
|
| 201 |
+
return "".join(f"{item:10d}" for item in fields[:8]) + "\n"
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
def update_part_adpopt_block(block, pid, adpopt):
|
| 205 |
+
out = []
|
| 206 |
+
replaced = False
|
| 207 |
+
for line in block:
|
| 208 |
+
if (
|
| 209 |
+
not replaced
|
| 210 |
+
and not line.startswith("*")
|
| 211 |
+
and not line.strip().startswith("$")
|
| 212 |
+
and parse_int_fields(line)[:1] == [pid]
|
| 213 |
+
):
|
| 214 |
+
out.append(update_part_adpopt_line(line, adpopt))
|
| 215 |
+
replaced = True
|
| 216 |
+
else:
|
| 217 |
+
out.append(line)
|
| 218 |
+
return out
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
def move_ball_nodes_in_node_block(block, ball_node_ids, old_center, new_center):
|
| 222 |
+
dx = new_center[0] - old_center[0]
|
| 223 |
+
dy = new_center[1] - old_center[1]
|
| 224 |
+
dz = new_center[2] - old_center[2]
|
| 225 |
+
|
| 226 |
+
out = []
|
| 227 |
+
for line in block:
|
| 228 |
+
parsed = parse_node_line(line)
|
| 229 |
+
if parsed and parsed[0] in ball_node_ids:
|
| 230 |
+
nid, xyz = parsed
|
| 231 |
+
out.append(format_node(nid, (xyz[0] + dx, xyz[1] + dy, xyz[2] + dz)))
|
| 232 |
+
else:
|
| 233 |
+
out.append(line)
|
| 234 |
+
return out
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
def make_case_key(template, impact):
|
| 238 |
+
impact_center = impact["center"]
|
| 239 |
+
new_ball_center = (
|
| 240 |
+
impact_center[0],
|
| 241 |
+
impact_center[1],
|
| 242 |
+
impact_center[2] - template["ball_radius"] - BALL_GAP_MM,
|
| 243 |
+
)
|
| 244 |
+
|
| 245 |
+
out_blocks = []
|
| 246 |
+
for block in template["blocks"]:
|
| 247 |
+
if block_is_control_adaptive(block):
|
| 248 |
+
continue
|
| 249 |
+
if block_is_end(block):
|
| 250 |
+
continue
|
| 251 |
+
|
| 252 |
+
key = block[0].strip().upper()
|
| 253 |
+
if key == "*NODE":
|
| 254 |
+
out_blocks.append(
|
| 255 |
+
move_ball_nodes_in_node_block(
|
| 256 |
+
block,
|
| 257 |
+
template["ball_node_ids"],
|
| 258 |
+
template["ball_center"],
|
| 259 |
+
new_ball_center,
|
| 260 |
+
)
|
| 261 |
+
)
|
| 262 |
+
elif key == "*PART":
|
| 263 |
+
modified = update_part_adpopt_block(block, PANEL_PID, 0)
|
| 264 |
+
modified = update_part_adpopt_block(modified, BALL_PID, 0)
|
| 265 |
+
out_blocks.append(modified)
|
| 266 |
+
else:
|
| 267 |
+
out_blocks.append(block)
|
| 268 |
+
|
| 269 |
+
lines = []
|
| 270 |
+
for block in out_blocks:
|
| 271 |
+
lines.extend(block)
|
| 272 |
+
if block and not block[-1].endswith("\n"):
|
| 273 |
+
lines.append("\n")
|
| 274 |
+
lines.append("*END\n")
|
| 275 |
+
return lines, new_ball_center
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
def greedy_select(candidates, min_spacing, rng):
|
| 279 |
+
shuffled = candidates[:]
|
| 280 |
+
rng.shuffle(shuffled)
|
| 281 |
+
selected = []
|
| 282 |
+
|
| 283 |
+
for candidate in shuffled:
|
| 284 |
+
center = candidate["center"]
|
| 285 |
+
if all(xy_distance(center, item["center"]) >= min_spacing for item in selected):
|
| 286 |
+
selected.append(candidate)
|
| 287 |
+
if len(selected) == NUM_CASES:
|
| 288 |
+
return selected
|
| 289 |
+
return selected
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
def farthest_point_select(candidates):
|
| 293 |
+
rng = random.Random(RANDOM_SEED)
|
| 294 |
+
first = rng.choice(candidates)
|
| 295 |
+
selected = [first]
|
| 296 |
+
selected_centers = [first["center"]]
|
| 297 |
+
|
| 298 |
+
remaining = [candidate for candidate in candidates if candidate is not first]
|
| 299 |
+
while len(selected) < NUM_CASES and remaining:
|
| 300 |
+
best_idx = None
|
| 301 |
+
best_dist = -1.0
|
| 302 |
+
for idx, candidate in enumerate(remaining):
|
| 303 |
+
d = min(xy_distance(candidate["center"], center) for center in selected_centers)
|
| 304 |
+
if d > best_dist:
|
| 305 |
+
best_dist = d
|
| 306 |
+
best_idx = idx
|
| 307 |
+
|
| 308 |
+
chosen = remaining.pop(best_idx)
|
| 309 |
+
selected.append(chosen)
|
| 310 |
+
selected_centers.append(chosen["center"])
|
| 311 |
+
|
| 312 |
+
return selected
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
def select_impacts(candidates):
|
| 316 |
+
spacing = TARGET_PAIRWISE_DISTANCE_MM
|
| 317 |
+
while spacing >= MIN_PAIRWISE_DISTANCE_MM:
|
| 318 |
+
rng = random.Random(RANDOM_SEED)
|
| 319 |
+
selected = greedy_select(candidates, spacing, rng)
|
| 320 |
+
if len(selected) == NUM_CASES:
|
| 321 |
+
return selected, spacing
|
| 322 |
+
spacing -= PAIRWISE_RELAX_STEP_MM
|
| 323 |
+
|
| 324 |
+
selected = farthest_point_select(candidates)
|
| 325 |
+
actual_spacing = selected_min_pairwise_distance(selected)
|
| 326 |
+
if actual_spacing < MIN_PAIRWISE_DISTANCE_MM:
|
| 327 |
+
raise SystemExit(
|
| 328 |
+
f"Could not select {NUM_CASES} points with pairwise spacing >= "
|
| 329 |
+
f"{MIN_PAIRWISE_DISTANCE_MM} mm. Best farthest-point spacing: "
|
| 330 |
+
f"{actual_spacing:.6f} mm. Safe candidates: {len(candidates)}"
|
| 331 |
+
)
|
| 332 |
+
return selected, actual_spacing
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
def selected_min_pairwise_distance(impacts):
|
| 336 |
+
min_dist = float("inf")
|
| 337 |
+
for i, a in enumerate(impacts):
|
| 338 |
+
for b in impacts[i + 1 :]:
|
| 339 |
+
min_dist = min(min_dist, xy_distance(a["center"], b["center"]))
|
| 340 |
+
return min_dist
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
def nearest_selected_distance(impact, prior_impacts):
|
| 344 |
+
if not prior_impacts:
|
| 345 |
+
return ""
|
| 346 |
+
return min(xy_distance(impact["center"], other["center"]) for other in prior_impacts)
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
def main():
|
| 350 |
+
if not TEMPLATE.exists():
|
| 351 |
+
raise SystemExit(f"Missing template key: {TEMPLATE}")
|
| 352 |
+
|
| 353 |
+
template = parse_template(TEMPLATE)
|
| 354 |
+
impacts, required_spacing = select_impacts(template["candidates"])
|
| 355 |
+
actual_spacing = selected_min_pairwise_distance(impacts)
|
| 356 |
+
OUTPUT_ROOT.mkdir(exist_ok=True)
|
| 357 |
+
|
| 358 |
+
manifest_path = OUTPUT_ROOT / "case_manifest.csv"
|
| 359 |
+
with manifest_path.open("w", newline="", encoding="utf-8") as csvfile:
|
| 360 |
+
writer = csv.writer(csvfile)
|
| 361 |
+
writer.writerow(
|
| 362 |
+
[
|
| 363 |
+
"case",
|
| 364 |
+
"key_file",
|
| 365 |
+
"panel_pid",
|
| 366 |
+
"impact_element_id",
|
| 367 |
+
"impact_x",
|
| 368 |
+
"impact_y",
|
| 369 |
+
"impact_z",
|
| 370 |
+
"ball_center_x",
|
| 371 |
+
"ball_center_y",
|
| 372 |
+
"ball_center_z",
|
| 373 |
+
"min_boundary_distance_mm",
|
| 374 |
+
"nearest_selected_distance_mm",
|
| 375 |
+
"required_pairwise_distance_mm",
|
| 376 |
+
]
|
| 377 |
+
)
|
| 378 |
+
|
| 379 |
+
prior_impacts = []
|
| 380 |
+
for idx, impact in enumerate(impacts, start=1):
|
| 381 |
+
case_name = f"case{idx:03d}"
|
| 382 |
+
case_dir = OUTPUT_ROOT / case_name
|
| 383 |
+
case_dir.mkdir(exist_ok=True)
|
| 384 |
+
key_path = case_dir / f"{case_name}.key"
|
| 385 |
+
|
| 386 |
+
key_lines, ball_center = make_case_key(template, impact)
|
| 387 |
+
key_path.write_text("".join(key_lines), encoding="utf-8", newline="\n")
|
| 388 |
+
|
| 389 |
+
c = impact["center"]
|
| 390 |
+
nearest = nearest_selected_distance(impact, prior_impacts)
|
| 391 |
+
writer.writerow(
|
| 392 |
+
[
|
| 393 |
+
case_name,
|
| 394 |
+
str(key_path),
|
| 395 |
+
PANEL_PID,
|
| 396 |
+
impact["eid"],
|
| 397 |
+
f"{c[0]:.6f}",
|
| 398 |
+
f"{c[1]:.6f}",
|
| 399 |
+
f"{c[2]:.6f}",
|
| 400 |
+
f"{ball_center[0]:.6f}",
|
| 401 |
+
f"{ball_center[1]:.6f}",
|
| 402 |
+
f"{ball_center[2]:.6f}",
|
| 403 |
+
f"{impact['min_boundary_distance']:.6f}",
|
| 404 |
+
"" if nearest == "" else f"{nearest:.6f}",
|
| 405 |
+
f"{required_spacing:.6f}",
|
| 406 |
+
]
|
| 407 |
+
)
|
| 408 |
+
prior_impacts.append(impact)
|
| 409 |
+
|
| 410 |
+
print(f"Template: {TEMPLATE}")
|
| 411 |
+
print(f"Output root: {OUTPUT_ROOT}")
|
| 412 |
+
print(f"Generated cases: {NUM_CASES}")
|
| 413 |
+
print(f"Candidate safe points: {len(template['candidates'])}")
|
| 414 |
+
print(f"Boundary nodes avoided: {template['boundary_node_count']}")
|
| 415 |
+
print(f"Minimum boundary distance: {MIN_BOUNDARY_DISTANCE_MM} mm")
|
| 416 |
+
print(f"Required pairwise impact distance used: {required_spacing} mm")
|
| 417 |
+
print(f"Actual minimum selected pairwise distance: {actual_spacing:.6f} mm")
|
| 418 |
+
print(f"Manifest: {manifest_path}")
|
| 419 |
+
print("Adaptive disabled: removed *CONTROL_ADAPTIVE and set ADPOPT=0")
|
| 420 |
+
print("Ball velocity kept from template: VZ = 3464.1")
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
if __name__ == "__main__":
|
| 424 |
+
main()
|
generation_evidence/lhs/generate_trunkfloor_lhs_cases.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
import generate_floorfrontdriver_lhs_cases as lhs
|
| 4 |
+
import generate_floorfrontdriver_random_cases as base
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
lhs.TEMPLATE = Path("floor_panel_largest_1_pid_2000447_153_trunkfloor_with_ball.key")
|
| 8 |
+
lhs.OUTPUT_ROOT = Path("cases_trunkfloor_lhs_500")
|
| 9 |
+
lhs.DESIGN_NAME = "trunkfloor"
|
| 10 |
+
lhs.DEFAULT_CASES = 500
|
| 11 |
+
lhs.DEFAULT_SEED = 20260723
|
| 12 |
+
lhs.PANEL_PID = 2000447
|
| 13 |
+
|
| 14 |
+
# The shared template parser selects valid panel elements through this module global.
|
| 15 |
+
base.PANEL_PID = lhs.PANEL_PID
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
if __name__ == "__main__":
|
| 19 |
+
lhs.main()
|
generation_evidence/lhs/trunkfloor/case_manifest.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generation_evidence/lhs/trunkfloor/lhs_design_summary.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
trunkfloor constrained LHS design
|
| 2 |
+
cases=500
|
| 3 |
+
seed=20260723
|
| 4 |
+
trials=128
|
| 5 |
+
normalized_maximin_score=0.17719975
|
| 6 |
+
minimum_xy_spacing_mm=1.43095918
|
| 7 |
+
speed_range_mm_per_s=(1732.05, 5196.15)
|
| 8 |
+
mass_ratio_range=(0.75, 1.25)
|
| 9 |
+
theta_range_deg=(0.0, 15.0)
|
| 10 |
+
phi_range_deg=(0.0, 360.0)
|
| 11 |
+
material_counts={'titanium_rigid': 167, 'aluminum_rigid': 166, 'steel_rigid': 167}
|
| 12 |
+
theta is measured from global +Z; phi is measured in global XY from +X toward +Y.
|
| 13 |
+
Rigid material class controls E/nu used by contact; mass ratio independently scales density.
|
generation_evidence/stress/effective_stress_definition.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
CurvePlot source header observed from the retained LS-PrePost export:
|
| 2 |
+
|
| 3 |
+
Curveplot
|
| 4 |
+
Element History
|
| 5 |
+
Time
|
| 6 |
+
Effective Stress (v-m), ip#max
|
| 7 |
+
Element no.
|
| 8 |
+
2340533 #pts=152
|
| 9 |
+
|
| 10 |
+
Interpretation: for every shell element and exported state, effective_stress
|
| 11 |
+
is the maximum von Mises stress across the available through-thickness
|
| 12 |
+
integration points. It is not a fixed upper, lower, or middle surface value.
|
metadata/LHS_DESIGN.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Constrained-LHS design
|
| 2 |
+
|
| 3 |
+
## Design coordinates
|
| 4 |
+
|
| 5 |
+
Each constrained Latin hypercube design uses seven normalized coordinates:
|
| 6 |
+
|
| 7 |
+
`[x, y, impact_speed, mass_ratio, theta_deg, phi_deg, material_index]`.
|
| 8 |
+
|
| 9 |
+
The continuous domains are:
|
| 10 |
+
|
| 11 |
+
| Parameter | Domain | Unit |
|
| 12 |
+
|---|---:|---|
|
| 13 |
+
| impact speed | [1732.05, 5196.15] | mm/s |
|
| 14 |
+
| mass ratio | [0.75, 1.25] | dimensionless |
|
| 15 |
+
| theta | [0, 15] | degree |
|
| 16 |
+
| phi | [0, 360] | degree |
|
| 17 |
+
|
| 18 |
+
Theta is measured from global +Z. Phi is measured in global XY from +X toward
|
| 19 |
+
+Y. Speed and angles are converted to the Cartesian velocity vector as
|
| 20 |
+
|
| 21 |
+
`v = speed * [sin(theta) cos(phi), sin(theta) sin(phi), cos(theta)]`.
|
| 22 |
+
|
| 23 |
+
Material is a three-level categorical coordinate with balanced counts. It
|
| 24 |
+
selects one of the rigid-impactor E/nu pairs listed in
|
| 25 |
+
`SIMULATION_PROTOCOL.md`; it is not a continuously interpolated material.
|
| 26 |
+
|
| 27 |
+
## Geometry-constrained position sampling
|
| 28 |
+
|
| 29 |
+
Impact positions are panel-shell centroids, not arbitrary points in a
|
| 30 |
+
rectangular three-dimensional box. The topological outer boundary is computed
|
| 31 |
+
from shell edges occurring in only one element. Candidate centroids must be at
|
| 32 |
+
least 80 mm from all outer-boundary nodes in XY.
|
| 33 |
+
|
| 34 |
+
The first two LHS coordinates are projected to the nearest available candidate
|
| 35 |
+
centroid in normalized XY, without reusing a centroid. Consequently:
|
| 36 |
+
|
| 37 |
+
- X and Y are space-filling design coordinates constrained by the mesh;
|
| 38 |
+
- Z is inherited from the selected shell centroid;
|
| 39 |
+
- the geometry JSON ranges are observed coordinate extrema, not continuous LHS
|
| 40 |
+
box bounds.
|
| 41 |
+
|
| 42 |
+
## Maximin selection and seeds
|
| 43 |
+
|
| 44 |
+
For a requested batch, 128 candidate seven-dimensional LHS designs are
|
| 45 |
+
generated. Material coordinates are mapped to category-bin centers for scoring,
|
| 46 |
+
and the design maximizing the normalized minimum pairwise distance is retained.
|
| 47 |
+
|
| 48 |
+
| Geometry | Construction | Seed |
|
| 49 |
+
|---|---|---:|
|
| 50 |
+
| `floorfrontR` | independent single batch | 20260728 |
|
| 51 |
+
| `trunkfloor` | independent single batch | 20260723 |
|
| 52 |
+
| `floorfrontdriver`, cases 001--100 | initial batch | 20260721 |
|
| 53 |
+
| `floorfrontdriver`, cases 101--200 | complementary nested extension | 20260722 |
|
| 54 |
+
| `floorfrontdriver`, cases 201--500 | independent augmentation | 20260722 |
|
| 55 |
+
|
| 56 |
+
Thus, the final set for each geometry contains 500 constrained-LHS cases, but
|
| 57 |
+
the `floorfrontdriver` set is not one monolithic 500-point Latin hypercube.
|
| 58 |
+
The three geometries share design bounds but use different eligible position
|
| 59 |
+
sets and are not case-wise paired.
|
metadata/SIMULATION_PROTOCOL.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Simulation protocol
|
| 2 |
+
|
| 3 |
+
## Scope
|
| 4 |
+
|
| 5 |
+
The three panel datasets use the same impactor construction, parameter bounds,
|
| 6 |
+
boundary-condition rule, contact definition, solver-output settings, and
|
| 7 |
+
compact-result conversion. Their panel meshes, eligible impact locations,
|
| 8 |
+
part identifiers, and LHS seeds differ. Equal case identifiers across
|
| 9 |
+
geometries are not paired simulations.
|
| 10 |
+
|
| 11 |
+
## Units
|
| 12 |
+
|
| 13 |
+
The LS-DYNA models use the tonne--mm--s--N consistent unit system:
|
| 14 |
+
|
| 15 |
+
| Quantity | Unit |
|
| 16 |
+
|---|---|
|
| 17 |
+
| coordinate and displacement | mm |
|
| 18 |
+
| time | s |
|
| 19 |
+
| velocity | mm/s |
|
| 20 |
+
| mass | tonne |
|
| 21 |
+
| density | tonne/mm^3 |
|
| 22 |
+
| force | N |
|
| 23 |
+
| stress and Young's modulus | MPa |
|
| 24 |
+
| angle | degree |
|
| 25 |
+
|
| 26 |
+
## Solver
|
| 27 |
+
|
| 28 |
+
Cases were run with LS-DYNA SMP single precision R12 using the `lsdyna_sp.exe`
|
| 29 |
+
distributed through ANSYS v221. The batch configuration used `ncpu=8` and
|
| 30 |
+
`memory=400m`. The exact R12 sub-build is not retained for every released case.
|
| 31 |
+
The termination time is 0.03 s.
|
| 32 |
+
|
| 33 |
+
## Rigid spherical impactor
|
| 34 |
+
|
| 35 |
+
| Setting | Value |
|
| 36 |
+
|---|---|
|
| 37 |
+
| part ID | 9636 |
|
| 38 |
+
| section ID | 9636 |
|
| 39 |
+
| material ID | 174 |
|
| 40 |
+
| material model | `*MAT_RIGID` |
|
| 41 |
+
| element type | shell |
|
| 42 |
+
| shell formulation | ELFORM=2 |
|
| 43 |
+
| shear factor | SHRF=0.833333 |
|
| 44 |
+
| thickness integration | NIP=3 |
|
| 45 |
+
| shell thickness | 0.1 mm |
|
| 46 |
+
| sphere radius | 12.5 mm |
|
| 47 |
+
| initial gap | 5.0 mm |
|
| 48 |
+
| reference nominal mass | 0.01 tonne |
|
| 49 |
+
| reference density | 5.205e-5 tonne/mm^3 |
|
| 50 |
+
|
| 51 |
+
For impact target p and unit travel direction v_hat, the initial center is
|
| 52 |
+
`c_ball = p - v_hat * (12.5 mm + 5.0 mm)`. No initial angular velocity is
|
| 53 |
+
applied. The generator records `impactor_mass = 0.01 tonne * mu` and writes
|
| 54 |
+
`impactor_density = 5.205e-5 tonne/mm^3 * mu` into the rigid material. The
|
| 55 |
+
released `impactor_mass` should therefore be interpreted as the nominal mass
|
| 56 |
+
recorded by the generator.
|
| 57 |
+
|
| 58 |
+
The material category changes only the rigid impactor's E and nu:
|
| 59 |
+
|
| 60 |
+
| Index | Label | E (MPa) | nu |
|
| 61 |
+
|---:|---|---:|---:|
|
| 62 |
+
| 0 | `aluminum_rigid` | 70000 | 0.33 |
|
| 63 |
+
| 1 | `titanium_rigid` | 110000 | 0.34 |
|
| 64 |
+
| 2 | `steel_rigid` | 210000 | 0.30 |
|
| 65 |
+
|
| 66 |
+
## Panel boundary and contact
|
| 67 |
+
|
| 68 |
+
Panel outer-boundary nodes are determined topologically: nodes belonging to a
|
| 69 |
+
shell edge used by only one panel element are included in the boundary set.
|
| 70 |
+
All six translational and rotational degrees of freedom in that set are fixed
|
| 71 |
+
using `*BOUNDARY_SPC_SET`.
|
| 72 |
+
|
| 73 |
+
The impactor and panel interact through
|
| 74 |
+
`*CONTACT_AUTOMATIC_SURFACE_TO_SURFACE_ID`. Static and dynamic friction
|
| 75 |
+
coefficients are both 0.15. A body acceleration of 9810 mm/s^2 is applied in
|
| 76 |
+
global +Z.
|
| 77 |
+
|
| 78 |
+
Panel materials and shell sections are retained from the cited upstream 2020
|
| 79 |
+
Nissan Rogue Version 3 model. Their full keyword cards and the complete vehicle
|
| 80 |
+
model are not part of this compact release.
|
| 81 |
+
|
| 82 |
+
## Outputs
|
| 83 |
+
|
| 84 |
+
D3PLOT output uses a nominal 0.0002-s interval. Nodal X/Y/Z displacement is
|
| 85 |
+
exported with LS-PrePost `ntime 5/6/7`. Shell effective stress is exported with
|
| 86 |
+
`etime 9`, labeled `Effective Stress (v-m), ip#max`. See
|
| 87 |
+
`TEMPORAL_SAMPLING.md` and the main Datasheet for the compact reduction and
|
| 88 |
+
stress semantics.
|
| 89 |
+
|
| 90 |
+
Representative self-contained keyword inputs and solver `d3hsp`/`matsum`
|
| 91 |
+
outputs were retained as audit material but are not distributed in the public
|
| 92 |
+
dataset.
|
metadata/TEMPORAL_SAMPLING.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Temporal sampling and peak-event time
|
| 2 |
+
|
| 3 |
+
## Raw solver output
|
| 4 |
+
|
| 5 |
+
Each LS-DYNA simulation terminates at 0.03 s. D3PLOT is requested at a nominal
|
| 6 |
+
0.0002-s interval. Actual floating-point state times can differ slightly from
|
| 7 |
+
the nominal values and are therefore stored explicitly.
|
| 8 |
+
|
| 9 |
+
## Compact 17-state sequence
|
| 10 |
+
|
| 11 |
+
Compact conversion uses stride 10 on both nodal displacement and shell stress,
|
| 12 |
+
then appends the final available state when it is not already selected. Across
|
| 13 |
+
all released cases, both `time_indices` and `element_time_indices` equal:
|
| 14 |
+
|
| 15 |
+
`[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 151]`.
|
| 16 |
+
|
| 17 |
+
The first 16 retained states therefore have a nominal spacing of 0.002 s. Index
|
| 18 |
+
151 is the appended terminal state and can be separated from index 150 by much
|
| 19 |
+
less than 0.002 s. Consumers must use the stored `time` and `element_time`
|
| 20 |
+
arrays rather than reconstructing timestamps from an assumed uniform interval.
|
| 21 |
+
|
| 22 |
+
## Discrete peak-event definition
|
| 23 |
+
|
| 24 |
+
Let T17 be the 17 retained states, Vvalid the valid-node set, and u_i(t) the
|
| 25 |
+
three-dimensional nodal displacement. The supplied peak-target builder uses
|
| 26 |
+
|
| 27 |
+
`t* = argmax_(t in T17) max_(i in Vvalid) ||u_i(t)||_2`.
|
| 28 |
+
|
| 29 |
+
The implementation flattens the node-by-retained-state magnitude array and
|
| 30 |
+
uses the first maximum returned by `torch.argmax`. The displacement field and
|
| 31 |
+
the shell von Mises effective-stress field at the same selected retained state
|
| 32 |
+
form the paired peak-event target.
|
| 33 |
+
|
| 34 |
+
Accordingly, `t*` is quantized to the released 17-state grid. It is not an
|
| 35 |
+
interpolated time and is not guaranteed to equal the continuous-time maximum
|
| 36 |
+
over every raw solver state.
|
metadata/dataset.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"title": "Automotive Impact Dataset",
|
| 3 |
-
"version": "1.
|
| 4 |
"release_status": "public-release",
|
| 5 |
"resource_type": "dataset",
|
| 6 |
"total_cases": 1500,
|
|
@@ -33,15 +33,16 @@
|
|
| 33 |
]
|
| 34 |
},
|
| 35 |
"units": {
|
| 36 |
-
"status": "
|
| 37 |
-
"
|
| 38 |
-
"
|
| 39 |
-
"
|
| 40 |
-
"
|
|
|
|
| 41 |
"effective_stress": "MPa",
|
| 42 |
-
"young_modulus": "
|
| 43 |
-
"impactor_mass":
|
| 44 |
-
"impactor_density":
|
| 45 |
"mass_ratio": "dimensionless",
|
| 46 |
"theta_phi": "degree"
|
| 47 |
},
|
|
@@ -54,12 +55,64 @@
|
|
| 54 |
"name": "2020 Nissan Rogue finite-element model",
|
| 55 |
"developer": "CCSA, George Mason University",
|
| 56 |
"sponsor": "NHTSA",
|
| 57 |
-
"exact_version": "
|
| 58 |
"official_page": "https://www.ccsa.gmu.edu/models/2020-nissan-rogue/"
|
| 59 |
},
|
| 60 |
"geometry_metadata": {
|
| 61 |
"floorfrontdriver": "floorfrontdriver_geometry.json",
|
| 62 |
"floorfrontR": "floorfrontR_geometry.json",
|
| 63 |
"trunkfloor": "trunkfloor_geometry.json"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
}
|
| 65 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"title": "Automotive Impact Dataset",
|
| 3 |
+
"version": "1.1.0",
|
| 4 |
"release_status": "public-release",
|
| 5 |
"resource_type": "dataset",
|
| 6 |
"total_cases": 1500,
|
|
|
|
| 33 |
]
|
| 34 |
},
|
| 35 |
"units": {
|
| 36 |
+
"status": "SPECIFIED",
|
| 37 |
+
"system": "tonne-mm-s-N",
|
| 38 |
+
"coordinate": "mm",
|
| 39 |
+
"displacement": "mm",
|
| 40 |
+
"time": "s",
|
| 41 |
+
"velocity": "mm/s",
|
| 42 |
"effective_stress": "MPa",
|
| 43 |
+
"young_modulus": "MPa",
|
| 44 |
+
"impactor_mass": "tonne",
|
| 45 |
+
"impactor_density": "tonne/mm^3",
|
| 46 |
"mass_ratio": "dimensionless",
|
| 47 |
"theta_phi": "degree"
|
| 48 |
},
|
|
|
|
| 55 |
"name": "2020 Nissan Rogue finite-element model",
|
| 56 |
"developer": "CCSA, George Mason University",
|
| 57 |
"sponsor": "NHTSA",
|
| 58 |
+
"exact_version": "Version 3, released August 2024",
|
| 59 |
"official_page": "https://www.ccsa.gmu.edu/models/2020-nissan-rogue/"
|
| 60 |
},
|
| 61 |
"geometry_metadata": {
|
| 62 |
"floorfrontdriver": "floorfrontdriver_geometry.json",
|
| 63 |
"floorfrontR": "floorfrontR_geometry.json",
|
| 64 |
"trunkfloor": "trunkfloor_geometry.json"
|
| 65 |
+
},
|
| 66 |
+
"simulation": {
|
| 67 |
+
"solver": "LS-DYNA SMP single precision R12 via ANSYS v221 lsdyna_sp.exe",
|
| 68 |
+
"exact_r12_subbuild_retained_for_every_case": false,
|
| 69 |
+
"ncpu": 8,
|
| 70 |
+
"memory": "400m",
|
| 71 |
+
"termination_time_s": 0.03,
|
| 72 |
+
"d3plot_nominal_interval_s": 0.0002,
|
| 73 |
+
"gravity_global_z_mm_per_s2": 9810.0,
|
| 74 |
+
"boundary_condition": "topological outer-boundary nodes fixed in all six degrees of freedom",
|
| 75 |
+
"contact": "CONTACT_AUTOMATIC_SURFACE_TO_SURFACE_ID",
|
| 76 |
+
"static_friction": 0.15,
|
| 77 |
+
"dynamic_friction": 0.15
|
| 78 |
+
},
|
| 79 |
+
"impactor": {
|
| 80 |
+
"type": "rigid spherical shell",
|
| 81 |
+
"part_id": 9636,
|
| 82 |
+
"section_id": 9636,
|
| 83 |
+
"material_id": 174,
|
| 84 |
+
"material_model": "MAT_RIGID",
|
| 85 |
+
"radius_mm": 12.5,
|
| 86 |
+
"initial_gap_mm": 5.0,
|
| 87 |
+
"elform": 2,
|
| 88 |
+
"shrf": 0.833333,
|
| 89 |
+
"nip": 3,
|
| 90 |
+
"shell_thickness_mm": 0.1,
|
| 91 |
+
"reference_nominal_mass_tonne": 0.01,
|
| 92 |
+
"reference_density_tonne_per_mm3": 5.205e-05,
|
| 93 |
+
"mass_scaling": "impactor_mass = reference_nominal_mass_tonne * mass_ratio",
|
| 94 |
+
"density_scaling": "impactor_density = reference_density_tonne_per_mm3 * mass_ratio"
|
| 95 |
+
},
|
| 96 |
+
"design": {
|
| 97 |
+
"method": "seven-dimensional constrained Latin hypercube with maximin selection over 128 trials",
|
| 98 |
+
"dimensions": ["position_x", "position_y", "impact_speed", "mass_ratio", "theta", "phi", "material_class"],
|
| 99 |
+
"impact_speed_mm_per_s": [1732.05, 5196.15],
|
| 100 |
+
"mass_ratio": [0.75, 1.25],
|
| 101 |
+
"theta_deg": [0.0, 15.0],
|
| 102 |
+
"phi_deg": [0.0, 360.0],
|
| 103 |
+
"minimum_boundary_distance_mm": 80.0,
|
| 104 |
+
"seeds": {
|
| 105 |
+
"floorfrontR": 20260728,
|
| 106 |
+
"trunkfloor": 20260723,
|
| 107 |
+
"floorfrontdriver_initial": 20260721,
|
| 108 |
+
"floorfrontdriver_extensions": 20260722
|
| 109 |
+
}
|
| 110 |
+
},
|
| 111 |
+
"temporal_sampling": {
|
| 112 |
+
"raw_nominal_interval_s": 0.0002,
|
| 113 |
+
"compact_stride": 10,
|
| 114 |
+
"append_final_state": true,
|
| 115 |
+
"retained_indices": [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 151],
|
| 116 |
+
"peak_time_definition": "discrete argmax of valid-node displacement magnitude over retained states"
|
| 117 |
}
|
| 118 |
}
|
metadata/floorfrontR_geometry.json
CHANGED
|
@@ -102,7 +102,14 @@
|
|
| 102 |
"titanium_rigid": 167
|
| 103 |
},
|
| 104 |
"units": {
|
| 105 |
-
"status": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
"effective_stress": "MPa",
|
| 107 |
"material_young_field_name": "material_young_mpa",
|
| 108 |
"angles": "degrees"
|
|
|
|
| 102 |
"titanium_rigid": 167
|
| 103 |
},
|
| 104 |
"units": {
|
| 105 |
+
"status": "SPECIFIED",
|
| 106 |
+
"system": "tonne-mm-s-N",
|
| 107 |
+
"coordinate": "mm",
|
| 108 |
+
"displacement": "mm",
|
| 109 |
+
"time": "s",
|
| 110 |
+
"velocity": "mm/s",
|
| 111 |
+
"mass": "tonne",
|
| 112 |
+
"density": "tonne/mm^3",
|
| 113 |
"effective_stress": "MPa",
|
| 114 |
"material_young_field_name": "material_young_mpa",
|
| 115 |
"angles": "degrees"
|
metadata/floorfrontdriver_geometry.json
CHANGED
|
@@ -102,7 +102,14 @@
|
|
| 102 |
"titanium_rigid": 167
|
| 103 |
},
|
| 104 |
"units": {
|
| 105 |
-
"status": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
"effective_stress": "MPa",
|
| 107 |
"material_young_field_name": "material_young_mpa",
|
| 108 |
"angles": "degrees"
|
|
|
|
| 102 |
"titanium_rigid": 167
|
| 103 |
},
|
| 104 |
"units": {
|
| 105 |
+
"status": "SPECIFIED",
|
| 106 |
+
"system": "tonne-mm-s-N",
|
| 107 |
+
"coordinate": "mm",
|
| 108 |
+
"displacement": "mm",
|
| 109 |
+
"time": "s",
|
| 110 |
+
"velocity": "mm/s",
|
| 111 |
+
"mass": "tonne",
|
| 112 |
+
"density": "tonne/mm^3",
|
| 113 |
"effective_stress": "MPa",
|
| 114 |
"material_young_field_name": "material_young_mpa",
|
| 115 |
"angles": "degrees"
|
metadata/trunkfloor_geometry.json
CHANGED
|
@@ -102,7 +102,14 @@
|
|
| 102 |
"titanium_rigid": 167
|
| 103 |
},
|
| 104 |
"units": {
|
| 105 |
-
"status": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
"effective_stress": "MPa",
|
| 107 |
"material_young_field_name": "material_young_mpa",
|
| 108 |
"angles": "degrees"
|
|
|
|
| 102 |
"titanium_rigid": 167
|
| 103 |
},
|
| 104 |
"units": {
|
| 105 |
+
"status": "SPECIFIED",
|
| 106 |
+
"system": "tonne-mm-s-N",
|
| 107 |
+
"coordinate": "mm",
|
| 108 |
+
"displacement": "mm",
|
| 109 |
+
"time": "s",
|
| 110 |
+
"velocity": "mm/s",
|
| 111 |
+
"mass": "tonne",
|
| 112 |
+
"density": "tonne/mm^3",
|
| 113 |
"effective_stress": "MPa",
|
| 114 |
"material_young_field_name": "material_young_mpa",
|
| 115 |
"angles": "degrees"
|
release_inventory.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"dataset": "Automotive Impact Dataset",
|
| 3 |
-
"version": "1.
|
| 4 |
"case_files": 1500,
|
| 5 |
"archive_files": 15,
|
| 6 |
"archive_bytes": 5032143218,
|
|
|
|
| 1 |
{
|
| 2 |
"dataset": "Automotive Impact Dataset",
|
| 3 |
+
"version": "1.1.0",
|
| 4 |
"case_files": 1500,
|
| 5 |
"archive_files": 15,
|
| 6 |
"archive_bytes": 5032143218,
|
schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"schema_version": "1.
|
| 3 |
"case_format": "PyTorch serialized plain dictionary",
|
| 4 |
"recommended_load": "torch.load(file, map_location='cpu', weights_only=True)",
|
| 5 |
"state_count": 17,
|
|
@@ -7,16 +7,16 @@
|
|
| 7 |
"case": {"type": "string", "description": "caseNNN identifier"},
|
| 8 |
"panel_pid": {"dtype": "int64", "shape": []},
|
| 9 |
"nid": {"dtype": "int64", "shape": ["N"]},
|
| 10 |
-
"boundary_mask": {"dtype": "bool", "shape": ["N"]},
|
| 11 |
"valid_node_mask": {"dtype": "bool", "shape": ["N"]},
|
| 12 |
"raw_valid_node_mask": {"dtype": "bool", "shape": ["N"]},
|
| 13 |
"filled_node_mask": {"dtype": "bool", "shape": ["N"]},
|
| 14 |
"filled_node_count": {"dtype": "int64", "shape": []},
|
| 15 |
-
"time": {"dtype": "float32", "shape": [17]},
|
| 16 |
-
"time_indices": {"dtype": "int64", "shape": [17]},
|
| 17 |
-
"disp": {"dtype": "float32", "shape": ["N", 17, 3]},
|
| 18 |
-
"element_time": {"dtype": "float32", "shape": [17]},
|
| 19 |
-
"element_time_indices": {"dtype": "int64", "shape": [17]},
|
| 20 |
"element_id": {"dtype": "int64", "shape": ["Ne"]},
|
| 21 |
"repaired_element_ids": {"dtype": "int64", "shape": "variable"},
|
| 22 |
"effective_stress": {
|
|
@@ -30,20 +30,20 @@
|
|
| 30 |
"integration_point_index_retained": false,
|
| 31 |
"units": "MPa"
|
| 32 |
},
|
| 33 |
-
"velocity_vz": {"dtype": "float32", "shape": []},
|
| 34 |
-
"velocity_xyz": {"dtype": "float32", "shape": [3]},
|
| 35 |
-
"impact_speed": {"dtype": "float32", "shape": []},
|
| 36 |
-
"impact_xyz": {"dtype": "float32", "shape": [3]},
|
| 37 |
-
"impact_node_distance": {"dtype": "float32", "shape": ["N"]},
|
| 38 |
-
"ball_center_xyz": {"dtype": "float32", "shape": [3]},
|
| 39 |
"impact_element_id": {"dtype": "int64", "shape": []},
|
| 40 |
-
"mass_ratio": {"dtype": "float32", "shape": []},
|
| 41 |
-
"impactor_mass": {"dtype": "float32", "shape": []},
|
| 42 |
-
"impactor_density": {"dtype": "float32", "shape": []},
|
| 43 |
-
"theta_deg": {"dtype": "float32", "shape": []},
|
| 44 |
-
"phi_deg": {"dtype": "float32", "shape": []},
|
| 45 |
-
"material_young_mpa": {"dtype": "float32", "shape": []},
|
| 46 |
-
"material_poisson": {"dtype": "float32", "shape": []},
|
| 47 |
"material_index": {"dtype": "int64", "shape": []},
|
| 48 |
"material_one_hot": {"dtype": "float32", "shape": [3]},
|
| 49 |
"material_name": {"type": "string"},
|
|
@@ -51,11 +51,11 @@
|
|
| 51 |
"condition_vector": {"dtype": "float32", "shape": [7]}
|
| 52 |
},
|
| 53 |
"mesh_fields": {
|
| 54 |
-
"node_pos": {"dtype": "float32", "shape": ["N", 3]},
|
| 55 |
"edge_index": {"dtype": "int64", "shape": [2, "E"]},
|
| 56 |
"element_node_index": {"dtype": "int64", "shape": ["Ne", 4], "padding": "The third node index is repeated in column four for triangular shells"},
|
| 57 |
"element_node_count": {"dtype": "int64", "shape": ["Ne"], "values": [3, 4]},
|
| 58 |
-
"boundary_mask": {"dtype": "bool", "shape": ["N"]}
|
| 59 |
},
|
| 60 |
"geometry_shapes": {
|
| 61 |
"floorfrontdriver": {"N": 7408, "E": 29572, "Ne": 7374},
|
|
@@ -63,8 +63,21 @@
|
|
| 63 |
"trunkfloor": {"N": 14440, "E": 58074, "Ne": 14589}
|
| 64 |
},
|
| 65 |
"units": {
|
| 66 |
-
"status": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
"effective_stress": "MPa",
|
| 68 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
}
|
| 70 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"schema_version": "1.1.0",
|
| 3 |
"case_format": "PyTorch serialized plain dictionary",
|
| 4 |
"recommended_load": "torch.load(file, map_location='cpu', weights_only=True)",
|
| 5 |
"state_count": 17,
|
|
|
|
| 7 |
"case": {"type": "string", "description": "caseNNN identifier"},
|
| 8 |
"panel_pid": {"dtype": "int64", "shape": []},
|
| 9 |
"nid": {"dtype": "int64", "shape": ["N"]},
|
| 10 |
+
"boundary_mask": {"dtype": "bool", "shape": ["N"], "description": "true for nodes on the topological outer boundary fixed in all six degrees of freedom"},
|
| 11 |
"valid_node_mask": {"dtype": "bool", "shape": ["N"]},
|
| 12 |
"raw_valid_node_mask": {"dtype": "bool", "shape": ["N"]},
|
| 13 |
"filled_node_mask": {"dtype": "bool", "shape": ["N"]},
|
| 14 |
"filled_node_count": {"dtype": "int64", "shape": []},
|
| 15 |
+
"time": {"dtype": "float32", "shape": [17], "units": "s", "description": "exact retained nodal-state times"},
|
| 16 |
+
"time_indices": {"dtype": "int64", "shape": [17], "values": [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 151]},
|
| 17 |
+
"disp": {"dtype": "float32", "shape": ["N", 17, 3], "units": "mm", "description": "nodal Cartesian displacement"},
|
| 18 |
+
"element_time": {"dtype": "float32", "shape": [17], "units": "s", "description": "exact retained shell-state times"},
|
| 19 |
+
"element_time_indices": {"dtype": "int64", "shape": [17], "values": [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 151]},
|
| 20 |
"element_id": {"dtype": "int64", "shape": ["Ne"]},
|
| 21 |
"repaired_element_ids": {"dtype": "int64", "shape": "variable"},
|
| 22 |
"effective_stress": {
|
|
|
|
| 30 |
"integration_point_index_retained": false,
|
| 31 |
"units": "MPa"
|
| 32 |
},
|
| 33 |
+
"velocity_vz": {"dtype": "float32", "shape": [], "units": "mm/s", "description": "global-Z component retained for compatibility"},
|
| 34 |
+
"velocity_xyz": {"dtype": "float32", "shape": [3], "units": "mm/s", "description": "rigid-impactor initial Cartesian velocity"},
|
| 35 |
+
"impact_speed": {"dtype": "float32", "shape": [], "units": "mm/s", "design_domain": [1732.05, 5196.15]},
|
| 36 |
+
"impact_xyz": {"dtype": "float32", "shape": [3], "units": "mm", "description": "selected eligible panel-shell centroid; Z is not independently sampled"},
|
| 37 |
+
"impact_node_distance": {"dtype": "float32", "shape": ["N"], "units": "mm"},
|
| 38 |
+
"ball_center_xyz": {"dtype": "float32", "shape": [3], "units": "mm", "description": "initial spherical-impactor center"},
|
| 39 |
"impact_element_id": {"dtype": "int64", "shape": []},
|
| 40 |
+
"mass_ratio": {"dtype": "float32", "shape": [], "units": "dimensionless", "design_domain": [0.75, 1.25], "description": "common scale factor for reference rigid-impactor mass and density"},
|
| 41 |
+
"impactor_mass": {"dtype": "float32", "shape": [], "units": "tonne", "description": "generator-recorded nominal mass equal to 0.01 * mass_ratio"},
|
| 42 |
+
"impactor_density": {"dtype": "float32", "shape": [], "units": "tonne/mm^3", "description": "rigid-impactor density equal to 5.205e-5 * mass_ratio"},
|
| 43 |
+
"theta_deg": {"dtype": "float32", "shape": [], "units": "degree", "design_domain": [0.0, 15.0], "description": "polar angle from global +Z"},
|
| 44 |
+
"phi_deg": {"dtype": "float32", "shape": [], "units": "degree", "design_domain": [0.0, 360.0], "description": "azimuth in global XY from +X toward +Y"},
|
| 45 |
+
"material_young_mpa": {"dtype": "float32", "shape": [], "units": "MPa", "values": [70000.0, 110000.0, 210000.0], "entity": "rigid_impactor"},
|
| 46 |
+
"material_poisson": {"dtype": "float32", "shape": [], "units": "dimensionless", "values": [0.33, 0.34, 0.30], "entity": "rigid_impactor"},
|
| 47 |
"material_index": {"dtype": "int64", "shape": []},
|
| 48 |
"material_one_hot": {"dtype": "float32", "shape": [3]},
|
| 49 |
"material_name": {"type": "string"},
|
|
|
|
| 51 |
"condition_vector": {"dtype": "float32", "shape": [7]}
|
| 52 |
},
|
| 53 |
"mesh_fields": {
|
| 54 |
+
"node_pos": {"dtype": "float32", "shape": ["N", 3], "units": "mm"},
|
| 55 |
"edge_index": {"dtype": "int64", "shape": [2, "E"]},
|
| 56 |
"element_node_index": {"dtype": "int64", "shape": ["Ne", 4], "padding": "The third node index is repeated in column four for triangular shells"},
|
| 57 |
"element_node_count": {"dtype": "int64", "shape": ["Ne"], "values": [3, 4]},
|
| 58 |
+
"boundary_mask": {"dtype": "bool", "shape": ["N"], "description": "topological outer-boundary nodes"}
|
| 59 |
},
|
| 60 |
"geometry_shapes": {
|
| 61 |
"floorfrontdriver": {"N": 7408, "E": 29572, "Ne": 7374},
|
|
|
|
| 63 |
"trunkfloor": {"N": 14440, "E": 58074, "Ne": 14589}
|
| 64 |
},
|
| 65 |
"units": {
|
| 66 |
+
"status": "SPECIFIED",
|
| 67 |
+
"system": "tonne-mm-s-N",
|
| 68 |
+
"coordinate": "mm",
|
| 69 |
+
"displacement": "mm",
|
| 70 |
+
"time": "s",
|
| 71 |
+
"velocity": "mm/s",
|
| 72 |
+
"mass": "tonne",
|
| 73 |
+
"density": "tonne/mm^3",
|
| 74 |
"effective_stress": "MPa",
|
| 75 |
+
"young_modulus": "MPa"
|
| 76 |
+
},
|
| 77 |
+
"temporal_sampling": {
|
| 78 |
+
"d3plot_nominal_interval_s": 0.0002,
|
| 79 |
+
"compact_stride": 10,
|
| 80 |
+
"append_final_state": true,
|
| 81 |
+
"peak_time_scope": "argmax over valid nodes and 17 retained states"
|
| 82 |
}
|
| 83 |
}
|
scripts/validate_dataset.py
CHANGED
|
@@ -273,7 +273,7 @@ def main() -> None:
|
|
| 273 |
)
|
| 274 |
report = {
|
| 275 |
"dataset": "Automotive Impact Dataset",
|
| 276 |
-
"version": "1.
|
| 277 |
"status": "passed" if not errors else "failed",
|
| 278 |
"cases_validated": 1500,
|
| 279 |
"split_sizes": {key: len(value) for key, value in split.items()},
|
|
@@ -283,8 +283,8 @@ def main() -> None:
|
|
| 283 |
"elapsed_seconds": time.time() - started,
|
| 284 |
"errors": errors,
|
| 285 |
"scope_note": (
|
| 286 |
-
"Technical package validation only; provenance and
|
| 287 |
-
"are documented in the release metadata."
|
| 288 |
),
|
| 289 |
}
|
| 290 |
rendered = json.dumps(report, indent=2, ensure_ascii=False) + "\n"
|
|
|
|
| 273 |
)
|
| 274 |
report = {
|
| 275 |
"dataset": "Automotive Impact Dataset",
|
| 276 |
+
"version": "1.1.0",
|
| 277 |
"status": "passed" if not errors else "failed",
|
| 278 |
"cases_validated": 1500,
|
| 279 |
"split_sizes": {key: len(value) for key, value in split.items()},
|
|
|
|
| 283 |
"elapsed_seconds": time.time() - started,
|
| 284 |
"errors": errors,
|
| 285 |
"scope_note": (
|
| 286 |
+
"Technical package validation only; provenance and remaining "
|
| 287 |
+
"configuration limitations are documented in the release metadata."
|
| 288 |
),
|
| 289 |
}
|
| 290 |
rendered = json.dumps(report, indent=2, ensure_ascii=False) + "\n"
|