Download code/document_t4_structural_dynamics_v1.py from HaomingLuo/AgentFEM-Structural-Dynamics-Virtual-Sensing: direct link, hf CLI and curl.
- Browser
- Download file 13.6 kB
-
https://huggingface.co/datasets/HaomingLuo/AgentFEM-Structural-Dynamics-Virtual-Sensing/resolve/main/code/document_t4_structural_dynamics_v1.py
- Command line
-
hf download hf://datasets/HaomingLuo/AgentFEM-Structural-Dynamics-Virtual-Sensing/code/document_t4_structural_dynamics_v1.py
-
curl -L -o document_t4_structural_dynamics_v1.py https://huggingface.co/datasets/HaomingLuo/AgentFEM-Structural-Dynamics-Virtual-Sensing/resolve/main/code/document_t4_structural_dynamics_v1.py
13.6 kB
| """Write the T4 v1 data card, quality report, and concise project summary.""" | |
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| try: | |
| from .t4_structural_dynamics_v1 import DATA_DIR, ROOT, load_config | |
| except ImportError: | |
| from t4_structural_dynamics_v1 import DATA_DIR, ROOT, load_config | |
| ARTIFACT_DIR = ROOT / "artifacts" / "t4_structural_dynamics_v1" | |
| def pct(value: float) -> str: | |
| return f"{100.0 * value:.3f}%" | |
| def main() -> None: | |
| config = load_config() | |
| quality = json.loads((DATA_DIR / "quality.json").read_text(encoding="utf-8")) | |
| manifest = json.loads((DATA_DIR / "manifest.json").read_text(encoding="utf-8")) | |
| metrics = json.loads((ARTIFACT_DIR / "baseline_metrics.json").read_text(encoding="utf-8")) | |
| test = metrics["cohorts"]["test_all"] | |
| test_id = metrics["cohorts"]["test_id"] | |
| test_eood = metrics["cohorts"]["test_excitation_ood"] | |
| test_pood = metrics["cohorts"]["test_parameter_ood"] | |
| total_bytes = sum(item["bytes"] for item in manifest["shards"]) | |
| card = f"""--- | |
| license: cc-by-4.0 | |
| task_categories: | |
| - time-series-forecasting | |
| - feature-extraction | |
| - other | |
| tags: | |
| - finite-element-analysis | |
| - structural-dynamics | |
| - virtual-sensing | |
| - reduced-order-modeling | |
| - out-of-distribution | |
| - agentfem | |
| --- | |
| # AgentFEM Structural Dynamics and Virtual Sensing | |
| T4 v1.1 contains **512 complete finite-element trajectories from 128 independent structural configurations**. Each configuration is a damped, aluminum-like plane-stress cantilever with varied geometry, stiffness, density, damping, and load amplitude. Four transient loads probe impulse response, sub-resonant vibration, near-resonant vibration, and swept-frequency response. | |
| > **Version notice.** Release v1.1.0 supersedes v1.0.0. A publication-time model audit found that AgentFEM 0.3.7 reconstructed each component-wise displacement constraint on the parent vector space during implicit dynamics, doubling constrained scalar degrees of freedom at the clamp. All 512 trajectories were regenerated with component-preserving kinematic boundary conditions. The immutable v1.0.0 tag is retained for provenance and must not be used for model training or physical comparison. | |
| The dataset connects two views of the same dynamics: five sparse displacement sensors sampled at every time step and displacement/velocity/acceleration fields saved throughout the structure. It supports virtual sensing, full-field reconstruction, reduced-order dynamics, system identification, neural operators, and tests of whether a learned model remains reliable under unseen excitation patterns or physical parameters. | |
|  | |
| ## What is independent | |
| The reported sample count is the number of **complete trajectories**, not the number of time frames. The 128 physical configurations are sampled once, simulated under four excitations, and kept together when forming training, validation, and test sets. Thus fields from the same structure never cross an evaluation boundary. | |
| ## Physics and discretization | |
| - linear isotropic elastodynamics under the plane-stress assumption; | |
| - aluminum-like ranges: Young's modulus 60--80 GPa, density 2500--2900 kg/m³, Poisson ratio 0.33; | |
| - length 0.80--1.20 m, height 0.035--0.065 m, target modal damping 0.5--3.0%, traction amplitude 0.5--5.0 kPa; | |
| - 24 × 2 quadrilateral mesh with Q2 displacement interpolation; | |
| - implicit Newmark integration, 0.5 s duration, 0.000125 s step; | |
| - 4,001 sensor states and 201 full-field frames per trajectory; | |
| - AgentFEM `{config['software']['agentfem_version']}` at commit `{config['software']['agentfem_commit']}`, DOLFINx `{config['software']['dolfinx_version']}`. | |
| These are bounded synthetic structures rather than measurements of a named commercial alloy or component. Every realized parameter, excitation, sensor coordinate, mesh, and solver setting is stored with the data. | |
| ## Leakage-safe evaluation protocol | |
| | Cohort | Configurations | Trajectories | Purpose | | |
| |---|---:|---:|---| | |
| | Train | 96 | 384 | model fitting | | |
| | Validation | 16 | 64 | model selection | | |
| | Test ID | 8 | 32 | unseen in-range structures | | |
| | Test excitation OOD | 4 | 16 | unseen frequency regimes | | |
| | Test parameter OOD | 4 | 16 | physical parameters outside the training box | | |
| The OOD cases are frozen before baseline fitting. `design.json` records the complete design and `index.csv` / `index.jsonl` provide trajectory-level metadata. | |
| ## Data layout | |
| Eight HDF5 shards contain 16 configurations each. A trajectory group stores: | |
| | Array | Shape | Meaning | | |
| |---|---:|---| | |
| | `time_s` | 4001 | sensor time grid | | |
| | `force_scale` | 4001 | nondimensional excitation history | | |
| | `sensor_displacement_m` | 4001 × 5 | vertical displacement at five beam stations | | |
| | `fields/time_s` | 201 | full-field time grid | | |
| | `fields/displacement_m` | 201 × 245 × 3 | nodal displacement | | |
| | `fields/velocity_m_per_s` | 201 × 245 × 3 | nodal velocity | | |
| | `fields/acceleration_m_per_s2` | 201 × 245 × 3 | nodal acceleration | | |
| Each trajectory also includes strain and kinetic energy, external work, damping dissipation, and the discrete energy-balance residual. Four representative configurations are additionally supplied as native XDMF/HDF5 histories for ParaView. | |
| ## Verification | |
| - all 128 configurations and 512 trajectories completed with finite arrays; | |
| - maximum first-frequency error against the Euler--Bernoulli reference: `{pct(quality['maximum_first_frequency_relative_error'])}`; | |
| - maximum modal/transient first-frequency difference: `{pct(quality['maximum_modal_transient_frequency_relative_difference'])}`; | |
| - maximum discrete energy-balance residual: `{pct(quality['maximum_energy_balance_relative_residual'])}`; | |
| - maximum five-sensor history change after halving the time step: `{pct(quality['time_refinement']['maximum_five_sensor_history_relative_l2'])}` across eight frozen configurations; | |
| - all completeness, split, frequency, energy, and time-refinement gates passed. | |
| The analytical frequency check is an independent low-order reference, not an assertion that beam theory reproduces every two-dimensional effect. | |
| ## Reproducible lower baselines | |
| A compact PCA-16 plus ridge package is fitted only on the 96 training configurations. PCA retains `{pct(metrics['pca_explained_energy'])}` of training displacement-field energy. On the full frozen test set: | |
| - sparse sensors → current full field: relative L2 `{pct(test['sparse_sensor_reconstruction_relative_l2'])}`, RMSE `{1e3 * test['sparse_sensor_reconstruction_rmse_m']:.4f} mm`; | |
| - autonomous second-order latent rollout: relative L2 `{pct(test['latent_second_order_rollout_relative_l2'])}`, RMSE `{1e3 * test['latent_second_order_rollout_rmse_m']:.4f} mm`. | |
| | Test subset | Sensor-to-field relative L2 | Latent rollout relative L2 | | |
| |---|---:|---:| | |
| | ID | {pct(test_id['sparse_sensor_reconstruction_relative_l2'])} | {pct(test_id['latent_second_order_rollout_relative_l2'])} | | |
| | Excitation OOD | {pct(test_eood['sparse_sensor_reconstruction_relative_l2'])} | {pct(test_eood['latent_second_order_rollout_relative_l2'])} | | |
| | Parameter OOD | {pct(test_pood['sparse_sensor_reconstruction_relative_l2'])} | {pct(test_pood['latent_second_order_rollout_relative_l2'])} | | |
| The baselines define transparent lower bars; they are not presented as state-of-the-art architectures. | |
| ## Minimal loading | |
| ```python | |
| from load_t4_structural_dynamics_v1 import trajectory_ids, load_trajectory | |
| ids = trajectory_ids('.') | |
| sample = load_trajectory(ids[0], '.', include_fields=True) | |
| print(sample['record']) | |
| print(sample['arrays']['sensor_displacement_m'].shape) | |
| print(sample['arrays']['displacement_m'].shape) | |
| ``` | |
| ## Scope | |
| T4 v1.1 isolates linear, small-deformation structural dynamics. It does not include plasticity, contact, joints, geometric nonlinearity, damage, sensor noise, or experimental uncertainty. Those effects should be added as separately versioned challenges so that the source of each difficulty remains measurable. | |
| Data are CC BY 4.0. Code in `code/` is Apache-2.0 licensed. The eight formal shards occupy `{total_bytes / 2**30:.2f} GiB`. | |
| """ | |
| quality_report = f"""# T4 v1.1 quality report | |
| ## Release decision | |
| **PASS.** The formal cohort contains 128 independent configurations and 512 complete trajectories. Every stored array is finite, all split counts match the frozen protocol, and all numerical gates pass. | |
| ## Numerical evidence | |
| | Check | Frozen limit | Observed maximum | Result | | |
| |---|---:|---:|---| | |
| | Euler--Bernoulli first-frequency relative error | 1.5% | {pct(quality['maximum_first_frequency_relative_error'])} | pass | | |
| | Modal/transient first-frequency relative difference | 0.5% | {pct(quality['maximum_modal_transient_frequency_relative_difference'])} | pass | | |
| | Discrete energy-balance relative residual | 2.0% | {pct(quality['maximum_energy_balance_relative_residual'])} | pass | | |
| | Time-step halving, five-sensor history relative L2 | 3.0% | {pct(quality['time_refinement']['maximum_five_sensor_history_relative_l2'])} | pass | | |
| The time-step audit was fixed in advance at configuration IDs {quality['time_refinement']['configuration_ids']}. Its median history change is {pct(quality['time_refinement']['median_five_sensor_history_relative_l2'])}. The cohort-wide median first-frequency error is {pct(quality['median_first_frequency_relative_error'])}; the median modal/transient frequency difference is {pct(quality['median_modal_transient_frequency_relative_difference'])}; the median maximum energy residual is {pct(quality['median_energy_balance_relative_residual'])}. | |
| ## Data-integrity evidence | |
| - configurations: {quality['configuration_count']}/128; | |
| - trajectories: {quality['trajectory_count']}/512; | |
| - split counts: {quality['split_trajectories']}; | |
| - missing configurations: {quality['missing_configurations']}; | |
| - invalid or non-finite entries: {quality['invalid_entries']}; | |
| - publication shards: 8, each containing 16 complete configurations; | |
| - release hashes are generated after the whitelist package is assembled. | |
| ## Baseline protocol | |
| PCA bases and ridge weights use only the 96 training configurations. Validation and test structures are never included in fitting. Results are reported separately for ID, excitation-OOD, and parameter-OOD cohorts. The baseline file stores all fitted means, scales, bases, and coefficients needed for exact reuse. | |
| ## Interpretation boundary | |
| The tests establish consistency for the declared linear plane-stress problem and parameter domain. They do not validate nonlinear materials, contact, joints, damage, experimental noise, or industrial component geometry. | |
| """ | |
| summary = f"""# T4:结构动力学与虚拟传感 v1.1 | |
| ## 解决的问题 | |
| 结构振动时,工程现场通常只能布置少量传感器,而设计、诊断和控制希望知道整个结构在每一时刻怎样运动。T4 把这两种信息放在同一条有限元轨迹中:五个位置的稀疏位移观测,以及全结构的位移、速度和加速度场。它可用于研究“由少量测点重建全场”和“由当前状态预测后续振动”。 | |
| ## 数据规模与难度 | |
| 正式版含128个独立悬臂结构、512条完整动力轨迹。长度、截面高度、弹性模量、密度、阻尼和载荷幅值共同变化;每个结构经历脉冲、亚共振正弦、近共振正弦和扫频四种载荷。训练、验证、测试按结构分组,另设未见频率范围和未见物理参数范围两类外推测试。 | |
| 每条轨迹包含4,001个传感器时刻和201帧全场,共保存位移、速度、加速度、能量收支、网格与完整求解条件。时间帧没有被重复计作独立样本。 | |
| ## 数值可信度 | |
| 128个结构、512条轨迹全部完成且数组有限。首阶频率相对解析梁理论的最大误差为{pct(quality['maximum_first_frequency_relative_error'])},模态—瞬态频率最大差异为{pct(quality['maximum_modal_transient_frequency_relative_difference'])},最大能量平衡残差为{pct(quality['maximum_energy_balance_relative_residual'])};8个预先冻结结构将时间步减半后,五传感器完整历程最大变化为{pct(quality['time_refinement']['maximum_five_sensor_history_relative_l2'])}。全部低于发布门槛。 | |
| v1.1 修正了 v1.0.0 中隐式动力学将分量边界条件扩展到整个向量空间的问题。旧标签仅保留为溯源记录,后续研究统一使用 v1.1.0。 | |
| ## 可直接使用的研究入口 | |
| 数据按8个HDF5分片发布,并附轻量读取器、生成代码、冻结划分、ParaView代表性全场、质量证据与PCA/岭回归基线。简单基线已分别给出常规测试、激励外推和参数外推结果,后续可公平比较时序网络、神经算子、状态空间模型、数据同化与虚拟传感方法。 | |
| ## 当前边界 | |
| 本版聚焦线弹性、小变形、平面应力和确定性观测,适合作为清晰、可复现的基础台阶。非线性、连接与接触、损伤、噪声、实验数据和真实复杂结构将在后续版本中分别引入,避免多个困难一次混在一起而无法判断模型到底学会了什么。 | |
| """ | |
| ARTIFACT_DIR.mkdir(parents=True, exist_ok=True) | |
| (DATA_DIR / "README.md").write_text(card, encoding="utf-8") | |
| (ARTIFACT_DIR / "QUALITY_REPORT.md").write_text(quality_report, encoding="utf-8") | |
| (ROOT / "docs" / "T4_STRUCTURAL_DYNAMICS_V1.md").write_text(summary, encoding="utf-8") | |
| print(json.dumps({"data_card": str(DATA_DIR / 'README.md'), "quality_report": str(ARTIFACT_DIR / 'QUALITY_REPORT.md'), "summary": str(ROOT / 'docs' / 'T4_STRUCTURAL_DYNAMICS_V1.md')})) | |
| if __name__ == "__main__": | |
| main() | |