Datasets:
Tasks:
Other
Formats:
json
Size:
10K - 100K
Tags:
agentfem
soft-robotics
programmable-matter
structural-mechanics
inverse-design
scientific-machine-learning
License:
Release v0.1 verified programmable rod data and native FE checks
Browse filesFiles changed (44)
- LICENSE-CODEAdded+159
- LICENSE-DATAAdded+8
- README.mdAdded+163
- SCHEMA.mdAdded+127
- SHA256SUMS.jsonAdded+45
- assets/overview.pngAdded
- cases/fig9/agentfem.tomlAdded+8
- cases/fig9/case.pyAdded+369
- cases/fig9/paper_reference.pyAdded+107
- native_fe/figures/native_agentfem_vs_paper.pngAdded
- native_fe/native_fe_metrics.csvAdded+4
- native_fe/paraview/native_agentfem_fig9.pvdAdded+8
- native_fe/paraview/native_agentfem_fig9000000.pvtuAdded+20
- native_fe/paraview/native_agentfem_fig9000001.pvtuAdded+20
- native_fe/paraview/native_agentfem_fig9000002.pvtuAdded+20
- native_fe/paraview/native_agentfem_fig9_p0_000000.vtuAdded
- native_fe/paraview/native_agentfem_fig9_p0_000001.vtuAdded
- native_fe/paraview/native_agentfem_fig9_p0_000002.vtuAdded
- native_fe/paraview_checks.jsonAdded+90
- native_fe/scientific/p2_coefficients.h5Added+3
- native_fe/xdmf/native_agentfem_fig9.h5Added+3
- native_fe/xdmf/native_agentfem_fig9.xdmfAdded+61
- reports/additional_baselines.jsonAdded+625
- reports/baselines.jsonAdded+184
- reports/environment.jsonAdded+11
- reports/generation.jsonAdded+30
- reports/inverse_checks.jsonAdded
- reports/validation.jsonAdded+40
- requirements.txtAdded+6
- src/generate.pyAdded+98
- src/inference.pyAdded+27
- src/inverse.pyAdded+41
- src/package.pyAdded+68
- src/rod.pyAdded+104
- src/train.pyAdded+68
- states/parameter_ood.jsonl.gzAdded+3
- states/test.jsonl.gzAdded+3
- states/train.jsonl.gzAdded+3
- states/validation.jsonl.gzAdded+3
- tests/check_paraview.pyAdded+25
- tests/evaluate_release.pyAdded+42
- tests/validate.pyAdded+85
- validation/paired_resolution.jsonl.gzAdded+3
- validation/rejected_attempts.jsonAdded+1
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159Apache LicenseVersion 2.0, January 2004http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, anddistribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyrightowner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entitiesthat control, are controlled by, or are under common control with that entity.For the purposes of this definition, "control" means (i) the power, direct orindirect, to cause the direction or management of such entity, whether bycontract or otherwise, or (ii) ownership of fifty percent (50%) or more of theoutstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercisingpermissions granted by this License.
"Source" form shall mean the preferred form for making modifications, includingbut not limited to software source code, documentation source, and configurationfiles.
"Object" form shall mean any form resulting from mechanical transformation ortranslation of a Source form, including but not limited to compiled object code,generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form,made available under the License, as indicated by a copyright notice that isincluded in or attached to the work.
"Derivative Works" shall mean any work, whether in Source or Object form, thatis based on (or derived from) the Work and for which the editorial revisions,annotations, elaborations, or other modifications represent, as a whole, anoriginal work of authorship. For the purposes of this License, Derivative Worksshall not include works that remain separable from, or merely link (or bind byname) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the originalversion of the Work and any modifications or additions to that Work orDerivative Works thereof, that is intentionally submitted to Licensor forinclusion in the Work by the copyright owner or by an individual or Legal Entityauthorized to submit on behalf of the copyright owner. For the purposes of thisdefinition, "submitted" means any form of electronic, verbal, or writtencommunication sent to the Licensor or its representatives, including but notlimited to communication on electronic mailing lists, source code controlsystems, and issue tracking systems that are managed by, or on behalf of, theLicensor for the purpose of discussing and improving the Work, but excludingcommunication that is conspicuously marked or otherwise designated in writing bythe copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalfof whom a Contribution has been received by Licensor and subsequentlyincorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of thisLicense, each Contributor hereby grants to You a perpetual, worldwide,non-exclusive, no-charge, royalty-free, irrevocable copyright license toreproduce, prepare Derivative Works of, publicly display, publicly perform,sublicense, and distribute the Work and such Derivative Works in Source orObject form.
3. Grant of Patent License. Subject to the terms and conditions of this License,each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,no-charge, royalty-free, irrevocable (except as stated in this section) patentlicense to make, have made, use, offer to sell, sell, import, and otherwisetransfer the Work, where such license applies only to those patent claimslicensable by such Contributor that are necessarily infringed by theirContribution(s) alone or by combination of their Contribution(s) with the Workto which such Contribution(s) was submitted. If You institute patent litigationagainst any entity (including a cross-claim or counterclaim in a lawsuit)alleging that the Work or a Contribution incorporated within the Workconstitutes direct or contributory patent infringement, then any patent licensesgranted to You under this License for that Work shall terminate as of the datesuch litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work orDerivative Works thereof in any medium, with or without modifications, and inSource or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copyof this License; and
(b) You must cause any modified files to carry prominent notices stating thatYou changed the files; and
(c) You must retain, in the Source form of any Derivative Works that Youdistribute, all copyright, patent, trademark, and attribution notices from theSource form of the Work, excluding those notices that do not pertain to any partof the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, thenany Derivative Works that You distribute must include a readable copy of theattribution notices contained within such NOTICE file, excluding those noticesthat do not pertain to any part of the Derivative Works, in at least one of thefollowing places: within a NOTICE text file distributed as part of theDerivative Works; within the Source form or documentation, if provided alongwith the Derivative Works; or, within a display generated by the DerivativeWorks, if and wherever such third-party notices normally appear. The contents ofthe NOTICE file are for informational purposes only and do not modify theLicense. You may add Your own attribution notices within Derivative Works thatYou distribute, alongside or as an addendum to the NOTICE text from the Work,provided that such additional attribution notices cannot be construed asmodifying the License.
You may add Your own copyright statement to Your modifications and may provideadditional or different license terms and conditions for use, reproduction, ordistribution of Your modifications, or for any such Derivative Works as awhole, provided Your use, reproduction, and distribution of the Work otherwisecomplies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, anyContribution intentionally submitted for inclusion in the Work by You to theLicensor shall be under the terms and conditions of this License, without anyadditional terms or conditions. Notwithstanding the above, nothing herein shallsupersede or modify the terms of any separate license agreement you may haveexecuted with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names,trademarks, service marks, or product names of the Licensor, except as requiredfor reasonable and customary use in describing the origin of the Work andreproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to inwriting, Licensor provides the Work (and each Contributor provides itsContributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied, including, without limitation, any warranties orconditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR APARTICULAR PURPOSE. You are solely responsible for determining theappropriateness of using or redistributing the Work and assume any risksassociated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether intort (including negligence), contract, or otherwise, unless required byapplicable law (such as deliberate and grossly negligent acts) or agreed to inwriting, shall any Contributor be liable to You for damages, including anydirect, indirect, special, incidental, or consequential damages of any characterarising as a result of this License or out of the use or inability to use theWork (including but not limited to damages for loss of goodwill, work stoppage,computer failure or malfunction, or any and all other commercial damages orlosses), even if such Contributor has been advised of the possibility of suchdamages.
9. Accepting Warranty or Additional Liability. While redistributing the Work orDerivative Works thereof, You may choose to offer, and charge a fee for,acceptance of support, warranty, indemnity, or other liability obligationsand/or rights consistent with this License. However, in accepting suchobligations, You may act only on Your own behalf and on Your soleresponsibility, not on behalf of any other Contributor, and only if You agree toindemnify, defend, and hold each Contributor harmless for any liability incurredby, or claims asserted against, such Contributor by reason of your accepting anysuch warranty or additional liability.
END OF TERMS AND CONDITIONS12345678Data and original generated figures: Copyright 2026 Haoming Luo.Licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).https://creativecommons.org/licenses/by/4.0/Legal terms: https://creativecommons.org/licenses/by/4.0/legalcode
Attribute AgentFEM Morph Lab, the dataset version/revision, and indicate changes.Code is separately Apache-2.0 (LICENSE-CODE). The cited JMPS article and its figuresare not distributed here and are not relicensed by this dataset.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163---license: cc-by-4.0language:- en- zhtask_categories:- othersize_categories:- 10K<n<100Ktags:- agentfem- soft-robotics- programmable-matter- structural-mechanics- inverse-design- scientific-machine-learningpretty_name: AgentFEM Programmable Soft Rodsconfigs:- config_name: equilibria data_files: - split: train path: states/train.jsonl.gz - split: validation path: states/validation.jsonl.gz - split: test path: states/test.jsonl.gz - split: parameter_ood path: states/parameter_ood.jsonl.gz---
# AgentFEM · Programmable Soft Rods
**Learn shapes. Distinguish branches. Design actuation.**

**216 physical scenarios · 648 equilibrium sweeps · 16,200 states**
Planar flexible rods driven by end loads, three-zone intrinsic curvature, andmicroscale forces. Each state contains its centerline, angle and strain fields,control parameters, local stability, and solver evidence.
[Models & solver](https://huggingface.co/HaomingLuo/AgentFEM-Morph-Rod-Surrogates) ·[AgentFEM](https://github.com/haoming-luo/agentfem) · [Mechanics & schema](SCHEMA.md)
## What can you study?
- Shape prediction under different actuation mechanisms.- Multi-solution regression: identical loading can admit straight, up-bent and down-bent states.- Bounded inverse design of endpoint positions or complete centerlines.- Resolution sensitivity and local equilibrium stability.
This is the first data release of **AgentFEM Morph Lab**, a project on programmableflexible structures. The JMPS microforce rod is one featured mechanism, alongsideconventional loading and distributed eigen-curvature actuation.
## Contents
| Collection | Included ||---|---|| End-force / end-moment rods | 72 scenarios, 5,400 equilibrium samples || Three-zone intrinsic-curvature rods | 72 scenarios, 5,400 equilibrium samples || Microforce rods | 72 scenarios, 5,400 samples across up/down/straight branches || Paired resolution checks | 216 pairs, 48 vs 96 angle elements || Native AgentFEM solids | 3 independent Figure 9 cases, actual downward solutions || Reproducibility | Source, tests, schema, numerical reports, hashes |
The 1D corpus is produced by the supplied NumPy/SciPy angle-FE solver. The three2D checks use native AgentFEM/FEniCSx. Sample frames are not independent scenarios;reversible sweeps can revisit the same shape.
## Load a sample
```pythonfrom datasets import load_datasetdata = load_dataset("HaomingLuo/AgentFEM-Programmable-Soft-Rods", "equilibria")sample = data["test"][0]print(sample["controls"], sample["tip"], sample["stability"])```
Without the datasets library:
```pythonimport gzip, jsonfrom huggingface_hub import hf_hub_downloadpath = hf_hub_download("HaomingLuo/AgentFEM-Programmable-Soft-Rods", "states/test.jsonl.gz", repo_type="dataset")with gzip.open(path, "rt") as f: sample = json.loads(next(f))```
## Validation
- Axial extension and constant-curvature analytic checks pass.- Energy gradient and tangent verified by finite differences.- First continuum bifurcation load: absolute discrepancy **1.09e-8** in dimensionless p.- Figure 9 independent BVP vs 96-element rod: centerline RMSE below **5.87e-5 L**.- All 216 resolution pairs: maximum centerline RMSE **1.72e-4 L**.- Three 2D equivalent-solid vs paper-continuum errors: **0.758%, 0.176%, 0.394% of L**.- PVD and XDMF both opened and warped in ParaView; all three fields share one geometry.
Full evidence: [validation](reports/validation.json), [generation](reports/generation.json),[native FE metrics](native_fe/native_fe_metrics.csv), [ParaView checks](native_fe/paraview_checks.json).These measurements apply to the stated checks, not an accuracy guarantee for arbitrary rods.
## Splits and baselines
126 training / 27 validation / 27 test / 36 stiffness-OOD scenes. All sweeps,mirrored branches and mesh pairs of a scene stay in the same partition. The testsplit was not used for fitting or checkpoint selection; there is no sealed testor geometry-OOD benchmark in this release.
| Predictor | Supplied branch? | Test centerline RMSE / L ||---|---:|---:|| Ordinary MLP | No | 0.27097 || Branch-conditioned nearest neighbor | Yes | 0.13899 || Branch-conditioned MLP | Yes | 0.00661 |
The ordinary MLP receives ambiguous multi-solution inputs; this is an inputidentifiability demonstration, not proof of a superior neural architecture.The conditioned MLP's mean test endpoint error is **0.00784 L**. Stiffness-OODcenterline RMSE is **0.00941 L**. See [all baseline results](reports/baselines.json).
## Physical scope
Dimensionless, conservative planar rods; fixed clamp; force control. Stabilitylabels come from the constrained discrete energy Hessian. Sweeps are quasi-staticequilibria, not physical-time trajectories. The supplied inverse examples usebounded intrinsic curvature and numerical forward verification. They do notestablish general reachability, snap-through dynamics, contact or robot hardware control.
See [SCHEMA.md](SCHEMA.md) for equations, normalization, sampling, branch semantics,and the difference between the paper's end force p and effective resultant p+2h.
## 中文
**可编程柔性杆:从形状预测到驱动设计。**
首批包含三类问题:端力/端矩驱动、三段本征曲率驱动,以及 JMPS 论文中的微结构驱动。216 个独立场景、648 条平衡状态扫描、16,200 个采样状态;另有216 组网格加密对照和 3 个 AgentFEM 二维实体核验算例。
数据可用于形状预测、多解回归和逆向设计。上下弯分支及同场景的不同路径不跨训练/测试划分。三段本征曲率是一种理想化驱动模型;当前不含真实跳跃动力学、接触或硬件实验。二维结果实际求解得到下弯形状,未在绘图时翻转。
下载 `native_fe/paraview/` 后打开 PVD,使用 `U` 做 Warp By Vector;XDMF 的位移为 P1 插值副本,完整 Q2 系数另存于 `native_fe/scientific/`。
## Reproduce and cite
Version **0.1.0**, seed **20261014**. Install `requirements.txt`, then follow[SCHEMA.md](SCHEMA.md#reproduction). Native FE additionally requires AgentFEM/FEniCSx.
Data and generated figures: **CC BY 4.0**. Code: **Apache-2.0**. The paper is cited,not redistributed or relicensed.
Theory reference: Yang Ye, Andrea Piccolroaz, Davide Bigoni,*Three Homogenization Models for a Nonlinear Heterogeneous Rod with Microscale Dead Loading*,[DOI: 10.1016/j.jmps.2026.106870](https://doi.org/10.1016/j.jmps.2026.106870).
Please cite **Haoming Luo, AgentFEM Morph Lab: Programmable Soft Rods, v0.1.0 (2026)**,the dataset URL and revision, and the theory reference when using the microforce cases.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127# Morph Rods v0.1: mechanics and data contract
## Scope and units
Planar unshearable, extensible, conservative elastic rods, clamped at s=0.All coordinates are divided by reference length L; forces by EA; moments by EA L;curvature is kappa L; potential energy by EA L. `chi = EI/(EA L^2)`.Positive fx denotes tension; positive fy points upward. No gravity, contact,friction, inertia, material hysteresis, or physical-time evolution is included.
The generated 1D data use this project's angle finite-element implementation inNumPy/SciPy. They are NOT 16,200 AgentFEM solid-FE runs. Three separately packaged2D cases use native AgentFEM/FEniCSx. The hinge chain is a separate reference.
## Energy
Let a=fx+2h, g=4h delta, theta be the rod tangent angle, andf(theta)=a cos(theta)+fy sin(theta). Axial strain is eliminated exactly asepsilon=f(theta). With prescribed intrinsic curvature kappa0(s), the reducedenergy is, up to an additive control-dependent constant:
Pi = integral[ chi/2 (theta' - kappa0)^2 - f(theta) - f(theta)^2/2 + g cos(theta) ] ds - moment * theta(1).
For h=0 this is a conventional extensible elastica with eigen-curvature. Forkappa0=0 and moment=fy=0, the microforce term reproduces the homogenized Model (i)of Ye, Piccolroaz & Bigoni, DOI 10.1016/j.jmps.2026.106870. The theory belongs tothose authors. Our additions are the implementation, checks, data organization,surrogate baselines, and bounded inverse-design example.
Theta uses linear FE nodes; strain and potential terms use midpoint quadrature.The clamp angle is eliminated. The default is 48 elements, with 96-element pairedchecks. Three constant intrinsic-curvature regions partition the reference lengthequally. They describe idealized actuation, not a calibrated pneumatic actuator.
For the paper's original chain, theta of the first cell is fixed and n-1 hingerotations remain; kr=chi*n. Do not interpret chain cell count as continuum FEresolution. The paper reference uses n=15,30,60,120 in validation.
## Fields
- `scene_id`, `split`: a physical parameter draw and its fixed partition.- `path_id`, `step`, `path_parameter`: ordered equilibrium samples, NOT seconds.- `family`: end_load, intrinsic_curvature, or microforce.- `controls`: chi, fx, fy, moment, h, delta, k1, k2, k3.- `z`: 48 free angle DOFs; append theta(0)=0 at the front.- `angle`, `strain`: 48 element-midpoint values.- `centerline`: 65 [x/L,y/L] points at uniformly spaced reference coordinate s/L.- `tip`: endpoint [x/L,y/L].- `energy`: reduced total potential with the convention above. Do not interpret its difference across changed controls as dissipated work.- `residual`: infinity norm of the reduced free-angle energy gradient.- `lambda_min_over_chi`: smallest generalized Hessian eigenvalue divided by chi. Angular mass is the same midpoint quadrature matrix, not physical inertia.- `stability`: stable if eigenvalue>1e-4, unstable if < -1e-4, critical otherwise. This is LOCAL stability under fixed dead loads and the stated clamp, in this discretized conservative model; it is not a hardware safety margin.- `branch`: coarse descriptor up/down by tip y, or straight if max|z|<1e-5. This is not a universal enumeration of every nonlinear equilibrium branch.- `seed_source`, `solver_trace`, `fallback_nfev`: numerical initialization, residual/step evidence, optional root-solver work count.- `previous_id`, `continuous_stable_pair`: adjacent accepted stable samples with max angle-DOF change<0.2 rad. This heuristic does NOT certify the unsampled interval or prove reachability from the unloaded state.
## Sampling and partitions
216 scenes, 72 per family: 60 ID + 12 stiffness-OOD. Each scene has three orderedsweeps and 25 samples per sweep, giving 648 sweeps and 16,200 states. Reversiblesweeps and unloaded endpoints may repeat shapes: these are NOT 16,200 independentscenarios or unique geometries.
Each family uses 42 training, 9 validation, 9 test and 12 OOD scenes. All mirroredbranches, all sweeps, and paired resolutions stay with their parent scene.Parameter-OOD increases chi beyond the training interval; it does not establishgeometry, path, or discretization OOD capability. Test is held out from fittingand checkpoint selection, but is not a permanently sealed benchmark.
ID chi: log-uniform [1e-4,10^-2.5]; OOD chi: log-uniform [10^-2.5,10^-2.1].End loads: fx/chi in [0,2], fy/chi in [-2,2], moment/chi in [-1,1].Curvature controls: each ki in [-2.4,2.4].Microforce scenes: h/chi in [4,30], delta in [.05,.35], p starts at pcr-.2chiand decreases to pcr-c chi with c in [2,8]. Here p=fx and pcr is the firstcontinuum bifurcation root. Up/down/straight solutions are deliberately seeded.The unstable straight states are retained, not followed as a physical motion.
No initial-imperfection distribution, subcritical branch atlas, snap dynamics,self-contact validation, or hardware data are provided in v0.1.
## Native 2D evidence
Three Figure 9 cases: Q2 plane-stress Saint-Venant--Kirchhoff solid, nu=0,EA=1, thickness=sqrt(12 chi), plus the paper's orientation potential. This is anequivalent finite-thickness realization, not a resolved hinge microstructure.`U` is solved downward, not reflected for plotting. PVD/VTU carries Q2 displacementand DG0 MISES/microforce potential. XDMF/HDF5 carries P1-interpolated U and DG0 fieldson a single geometry per case. Exact serial Q2 coefficients, coordinates and cellDOF maps are retained in scientific/p2_coefficients.h5. These coefficients requirethe supplied element convention/case to interpret; they are not a universal restart.Case indices 0,1,2 are independent loads, NOT a transient trajectory.
## Baselines
Ordinary and branch-conditioned MLP: two hidden layers of width 96 with tanh,48 angle outputs, Adam, seed14, 401 epochs; checkpoint selected by validationangle MSE. Only training data define input normalization. Branch conditioning issupplied information, not predicted by a hidden classifier. The ordinary baselineis intentionally ambiguous on mirrored multi-solution inputs: its worse resultdemonstrates the missing-input problem, not architectural superiority.The branch-conditioned 1-nearest-neighbor baseline receives the same branch label.Raw neural estimates require mechanical correction before equilibrium/stabilityclaims. The correction can change a predicted branch; check the returned state.
## Reproduction
python tests/validate.py python src/generate.py python src/train.py python tests/evaluate_release.py python src/inverse.py
Native FE requires AgentFEM/FEniCSx separately:
agentfem run --project cases/fig9 --name downward
Dependencies and measured versions are in requirements.txt and reports/environment.json.123456789101112131415161718192021222324252627282930313233343536373839404142434445{ "LICENSE-CODE": "4a8e89fe65965e0b5ab34a6a1b8faa412666e426ce92500dba6af0c8f3e0ca0b", "LICENSE-DATA": "6717316458f84621b0f3f1201d7099d8df9fd9545b50c302b120c342833d0094", "README.md": "a7b9aa8f31be88c2261cf35b7d06dfff543aa6fa6e250942e80e16a7e249ac79", "SCHEMA.md": "6c85472623acf231c460ece0b03288fd4b04558ef089a654c35108fcc97ae098", "assets/overview.png": "844ed9eef3ca4f32b13513bfe21de96f27d4ef5113a07bad7117556d15d9fa52", "cases/fig9/agentfem.toml": "97f65c98b01ed94ebd331cdc4be2f5d76db8dcefbcc9aa0ffbd1589fd82af6d9", "cases/fig9/case.py": "51684e93a66cd75ca9e688dd2210b1252c16d439763ba60de0f7d533e82311fa", "cases/fig9/paper_reference.py": "e6797a4f82b5018503b8c659f494ccf91204321cb9b5bf41a63b79924c206526", "native_fe/figures/native_agentfem_vs_paper.png": "aab6e9ddc1d9624e726319b555f77163a944eee2261b00f728990b6584cd5c6d", "native_fe/native_fe_metrics.csv": "6f6d6e5973d75bff4dc4edab12540971fe324ddf23ba601ca0679f79c644bef2", "native_fe/paraview/native_agentfem_fig9.pvd": "bfd9cb9607222d716791d948140a13147ec84d887fd88b6e2e640dd5cfeed06e", "native_fe/paraview/native_agentfem_fig9000000.pvtu": "9740e14ecbc8b1cc63897005cd853aa1e4330549a9794b1a2a09c3473b3a6567", "native_fe/paraview/native_agentfem_fig9000001.pvtu": "761ce2c62cfb600069aa8b48141917872620065b1fa36114ad4019c1370e1237", "native_fe/paraview/native_agentfem_fig9000002.pvtu": "560a09d9b844906bf21c3751aa7802d0b9764f2790c18bd9d785ebe1f837e6af", "native_fe/paraview/native_agentfem_fig9_p0_000000.vtu": "b080e8bc0150257c78959bab88ad74ae859d35724d8dbdf1c040fb9ccbb4a92b", "native_fe/paraview/native_agentfem_fig9_p0_000001.vtu": "1f0acd4f1b14a49da74310a401ccae0046770edab3ceeec6f7167cd29954595a", "native_fe/paraview/native_agentfem_fig9_p0_000002.vtu": "54b40de06d684d2d8142d1af6fc0a3f31a2b945ccc582c53e2524e6869401ff5", "native_fe/paraview_checks.json": "b0848ab988da2ea49769e813e340e072ae046c6cb173f39019d2b4d31d7a11a3", "native_fe/scientific/p2_coefficients.h5": "5492eef2a5f5bb0d713f8ba21c512e9f677835e0395b11900dfd4d13b08d89e1", "native_fe/xdmf/native_agentfem_fig9.h5": "9be172050b961662fb54b57be1abffcd7698520308e804bd164677025b1d58e7", "native_fe/xdmf/native_agentfem_fig9.xdmf": "b25d10a258de002e3b546e9813fba94245d2514f530c106103f5484c649be335", "reports/additional_baselines.json": "7184e6e33f23dd9cd73da4e35131d7e4ac2906627932b62eea1ae8b1c3482bf9", "reports/baselines.json": "32b6297c11b6a5e1134222b4e88bba5edca922940bb895cd89b1cf97044a2e81", "reports/environment.json": "0f80f1c3fb99529e87e892c5d418ee7def8b72695d14fa325809d35904eeb9e1", "reports/generation.json": "1343aff2e6b4e2e46fbb15e50159084671a9dbba7718f92807088b599d88041a", "reports/inverse_checks.json": "1e4714f41a076aef394cdcfb60965546c72852f57ff8b423f3e8b1fc9704eaa7", "reports/validation.json": "77ba910278c57771a3944eb81e2df17b262fe6e903e37f412c171f9a73755fe7", "requirements.txt": "109b4a8df3c120bd4301525eab1bd89f974e95291aeb1c441b4c3c8db5edb098", "src/generate.py": "2d7b2866400386f3e0d73e796f534b6aed8e493a7e6c646b71ade698fe82a00b", "src/inference.py": "b07695dcfaaa90493a2efafc6944b2e708a48a8c16dc27b497218c59b9b7598a", "src/inverse.py": "6e34886daf04dfefbcd241060c91505006704c3aaf9edeca9fa38f66d35242dc", "src/package.py": "1fd297836c20bcfd9cc51f4b2ed62204b8de9027f5dd33fcd3075d6548ae53b8", "src/rod.py": "4011c7f72047d0de9da63f18187abf818ed49c711ebe349c1b285e763ddad12a", "src/train.py": "57090fde92cc3e80e28f54856534817bb447708d1095d82a33f6c13492741be2", "states/parameter_ood.jsonl.gz": "7795bd454c08eaaf2c93a86e54a60354337bf3e52a94c8c91d039b82811d631a", "states/test.jsonl.gz": "ce1c3a1bfa3d141ee188041664e8043f611fd218612e609aa8ec090f14bae379", "states/train.jsonl.gz": "60ce6d411294a8bcffe96cd893a66b8b5eb539c2cdef3fad6fa2a1a3fc55d537", "states/validation.jsonl.gz": "235cf1d9221fc6ffa31e20ca186ab15db2cf06ca8d575c4157eeead88b3f9f10", "tests/check_paraview.py": "3575e185754a68aa3482537dd750cb6cbc280f26dc6eb41375bc8ce2931c4fa6", "tests/evaluate_release.py": "657e5d01c8246a1c140bbdf8b7dcdf1c1f94fe09df71163f076e3846b5f7b973", "tests/validate.py": "12ac0c9f9ff841142bb79e5eb53af1cde1d699ae259d723bb568725d7c4b7fa1", "validation/paired_resolution.jsonl.gz": "68a217ba0ad15b5a6bc5119b61577eddd7e6126f6edd2fa6acbb3d07d50615cd", "validation/rejected_attempts.json": "37517e5f3dc66819f61f5a7bb8ace1921282415f10551d2defa5c3eb0985b570"}12345678[project]name = "ye_2026_fig9_reproduction"entrypoint = "case.py"schema_version = "0.2.0"
[run]output_directory = "outputs"
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369"""Native AgentFEM FE reproduction of Ye et al. (2026), Figure 9.
The paper's homogenized orientational potential is added to a finite-thicknessSaint-Venant--Kirchhoff solid. AgentFEM owns the mesh, P2 displacement field,material, boundary conditions, Newton solve, DG0 projections, ParaView series,result manifest and run provenance. The paper equations are used only as anindependent reference and as the Newton initial guess."""
from __future__ import annotations
from pathlib import Pathimport syssys.path.insert(0, str(Path(__file__).resolve().parent))
import matplotlib.pyplot as pltimport numpy as npimport h5pyimport copyimport xml.etree.ElementTree as ETimport uflfrom dolfinx import fem
from agentfem import ( constitutive, fields, io, mesh, models, problems, project, results, solvers, studies,)from agentfem.constitutive import geometric_elasticity, hyperelasticity
from paper_reference import ( CHI, DELTA, H, LOADS, critical_load_continuum, critical_load_discrete, solve_continuum, solve_discrete,)
def build_native_model(*, nx=100, ny=4): thickness = float(np.sqrt(12.0 * CHI)) young = 1.0 / thickness domain = mesh.rectangle( (0.0, -0.5 * thickness), (1.0, 0.5 * thickness), (nx, ny), cell_type="quadrilateral", ) model = models.create( study=studies.static_solid( dimension=2, assumption="plane_stress", nonlinear=True, ), mesh=domain, name="homogenized_microforce_rod", ) displacement = model.field(fields.displacement(domain, degree=2)) displacement.value.name = "U" material = model.material( constitutive.saint_venant_kirchhoff( young=young, poisson=0.0, plane_stress=True, name="EA=1_EI=chi", ) ) left = mesh.boundary(domain, lambda x: np.isclose(x[0], 0.0), name="clamp") right = mesh.boundary(domain, lambda x: np.isclose(x[0], 1.0), name="loaded_end") model.clamp(displacement, on=left)
u = displacement.value F = ufl.Identity(2) + ufl.grad(u) axial_vector = ufl.dot(F, ufl.as_vector((1.0, 0.0))) axial_stretch = ufl.sqrt(ufl.dot(axial_vector, axial_vector)) cosine = axial_vector[0] / axial_stretch load_p = fem.Constant(domain, 0.0) elastic_density = geometric_elasticity.energy(F, material) microforce_density = -4.0 * H * DELTA / thickness * (1.0 - cosine) effective_force = load_p + 2.0 * H potential = ( (elastic_density + microforce_density) * ufl.dx - (effective_force / thickness) * u[0] * right.measure ) residual = ufl.derivative(potential, u, displacement.test) jacobian = ufl.derivative(residual, u, displacement.trial) nonlinear = problems.nonlinear( residual, u, jacobian=jacobian, constraints=model.constraints, solver_options=solvers.NewtonSolverOptions( absolute_tolerance=1.0e-9, relative_tolerance=1.0e-9, maximum_iterations=80, line_search="basic", ), name="ye_2026_model_i_native_fe", )
sigma = hyperelasticity.cauchy_stress(u, material) mises_expression = ufl.sqrt( sigma[0, 0] ** 2 - sigma[0, 0] * sigma[1, 1] + sigma[1, 1] ** 2 + 3.0 * sigma[0, 1] ** 2 ) mises = results.prepare_projection( mises_expression, domain=domain, family="DG", degree=0, name="MISES", ) orientation_energy = results.prepare_projection( microforce_density, domain=domain, family="DG", degree=0, name="MICROFORCE_POTENTIAL", ) return { "domain": domain, "model": model, "displacement": displacement, "material": material, "problem": nonlinear, "load_p": load_p, "mises": mises, "orientation_energy": orientation_energy, "thickness": thickness, "young": young, "nx": nx, "ny": ny, }
def seed_from_reference(displacement, p): sample, theta, center_x, center_y = solve_continuum(float(p))
def initial(x): s = np.clip(x[0], 0.0, 1.0) xc = np.interp(s, sample, center_x) yc = np.interp(s, sample, center_y) angle = np.interp(s, sample, theta) transverse = x[1] return np.vstack( ( xc - s - transverse * np.sin(angle), yc + transverse * np.cos(angle) - transverse, ) )
displacement.value.interpolate(initial) return sample, center_x, center_y
def sample_centerline(displacement, count=301): s = np.linspace(0.0, 1.0, count) values = np.asarray( [results.probe(displacement, at=(float(x), 0.0)) for x in s], dtype=float, ) return s, s + values[:, 0], values[:, 1]
def comparison_plot(path: Path, cases): figure, axes = plt.subplots(1, 3, figsize=(13.4, 4.7), constrained_layout=True) for axis, case in zip(axes, cases): axis.plot( case["reference_x"], case["reference_y"], color="#e31a1c", lw=3.2, label="Paper Model (i)", ) axis.plot( case["fe_x"], case["fe_y"], color="#00a6a6", lw=2.0, ls="--", label="AgentFEM P2 solid", ) axis.plot( case["discrete_x"], case["discrete_y"], "o-", color="#111827", markerfacecolor="#facc15", markeredgecolor="#1d4ed8", lw=1.1, ms=3.0, label="Paper discrete n=15", ) axis.set_aspect("equal", adjustable="box") axis.grid(alpha=0.18) axis.set_xlabel(r"$x/L$") axis.set_ylabel(r"$y/L$") axis.set_title( rf"$p={case['p']:.6f}$" + "\n" + rf"AgentFEM vs Model (i): {100*case['fe_nrmse']:.3f}%", fontsize=11, ) handles, labels = axes[0].get_legend_handles_labels() figure.legend(handles, labels, loc="lower center", ncol=3, frameon=False) figure.suptitle( "Native AgentFEM finite-element reproduction of Ye et al. (2026), Figure 9\n" + rf"P2 StVK solid; $\chi=10^{{-4}},\;\delta=0.1,\;h=0.01$", fontsize=14, ) figure.savefig(path, dpi=220, bbox_inches="tight", facecolor="white") plt.close(figure)
def main(): run = project.current_run() native = build_native_model(nx=100, ny=4) cases = [] pvd = run.artifact("paraview/native_agentfem_fig9.pvd") xdmf = run.artifact("xdmf/native_agentfem_fig9.xdmf") exact = run.artifact("scientific/p2_coefficients.h5") exact.parent.mkdir(parents=True, exist_ok=True) with io.ParaViewTimeSeries(pvd, native["domain"]) as writer, io.XDMFTimeSeries(xdmf, native["domain"]) as xwriter, h5py.File(exact, "w") as h5: h5.attrs["note"] = "Independent load cases, not physical time. Exact P2 coefficients; XDMF U is interpolated to P1." h5.create_dataset("dof_coordinates", data=native["displacement"].value.function_space.tabulate_dof_coordinates()) h5.create_dataset("cell_dofs", data=native["displacement"].value.function_space.dofmap.list) h5.attrs["element"] = "Q2 vector, block size 2, serial coefficients" for frame, p in enumerate(LOADS): sample, reference_x, reference_y = seed_from_reference( native["displacement"], float(p) ) native["load_p"].value = float(p) native["problem"].solve() group = h5.create_group(f"case_{frame}") group.attrs["p"] = float(p) group.create_dataset("U_P2", data=native["displacement"].value.x.array) mises = native["mises"].solve() orientation = native["orientation_energy"].solve() xwriter.write_fields(float(frame), io.interpolate_for_xdmf(native["displacement"], name="U"), mises, orientation) writer.write_fields( float(frame), native["displacement"], mises, orientation, )
s, fe_x, fe_y = sample_centerline(native["displacement"]) assert fe_y[-1] < 0.0, "FE must solve the downward branch, not flip it in plotting" group.create_dataset("centerline", data=np.column_stack([s, fe_x, fe_y])) target_x = np.interp(s, sample, reference_x) target_y = np.interp(s, sample, reference_y) fe_nrmse = float( np.sqrt(np.mean((fe_x - target_x) ** 2 + (fe_y - target_y) ** 2)) ) _, discrete_x, discrete_y = solve_discrete(float(p)) cases.append( { "p": float(p), "reference_x": reference_x, "reference_y": reference_y, "fe_x": fe_x, "fe_y": fe_y, "discrete_x": discrete_x, "discrete_y": discrete_y, "fe_nrmse": fe_nrmse, "fe_tip_error": float( np.hypot(fe_x[-1] - reference_x[-1], fe_y[-1] - reference_y[-1]) ), "newton_iterations": int(native["problem"].last_solve_info.iterations), "residual_norm": float(native["problem"].last_solve_info.function_norm), } )
# DOLFINx emits one temporal collection per field. Merge attributes onto # one geometry per case so readers do not display undeformed duplicates. original = ET.parse(xdmf).getroot().find("Domain") base = original.find("Grid") merged = ET.Element("Xdmf", Version="3.0") domain_xml = ET.SubElement(merged, "Domain") series = ET.SubElement(domain_xml, "Grid", Name="Independent_cases", GridType="Collection", CollectionType="Temporal") for frame in range(len(LOADS)): grid = ET.SubElement(series, "Grid", Name=f"case_{frame}", GridType="Uniform") grid.append(copy.deepcopy(base.find("Topology"))) grid.append(copy.deepcopy(base.find("Geometry"))) ET.SubElement(grid, "Time", Value=str(frame)) for collection in original.findall("Grid[@CollectionType='Temporal']"): grid.append(copy.deepcopy(collection.findall("Grid")[frame].find("Attribute"))) ET.indent(merged) ET.ElementTree(merged).write(xdmf, encoding="utf-8", xml_declaration=True)
table = np.asarray( [ [ item["p"], item["fe_nrmse"], item["fe_tip_error"], item["newton_iterations"], item["residual_norm"], ] for item in cases ] ) metrics_path = run.artifact("native_fe_metrics.csv") np.savetxt( metrics_path, table, delimiter=",", header="p,agentfem_centerline_nrmse_over_L,tip_error_over_L,newton_iterations,residual_norm", comments="", ) figure_path = run.artifact("figures/native_agentfem_vs_paper.png") comparison_plot(figure_path, cases)
result = results.SimulationResult( "ye_2026_fig9_native_fe", metadata={ "paper": { "title": "Three Homogenization Models for a Nonlinear Heterogeneous Rod with Microscale Dead Loading", "doi": "10.1016/j.jmps.2026.106870", "target": "Figure 9 / homogenized Model (i)", }, "formulation": { "mesh": f"{native['nx']} x {native['ny']} quadrilateral", "field": "P2 displacement", "material": "plane-stress Saint-Venant--Kirchhoff", "microforce_term": "Eq. (42) orientation potential", "solver": "AgentFEM Newton", "EA": 1.0, "EI": CHI, "thickness": native["thickness"], "young": native["young"], }, }, ) result.add_history( "centerline_nrmse", LOADS, np.asarray([item["fe_nrmse"] for item in cases]), abscissa_name="dimensionless_load_p", abscissa_unit=None, description="RMS centerline distance normalized by L against paper Model (i).", ) result.add_quantity("continuum_critical_load", critical_load_continuum()) result.add_quantity("discrete_n15_critical_load", critical_load_discrete()) result.add_field( "native_agentfem_fields", artifact=pvd, description="ParaView PVD series containing U, MISES and MICROFORCE_POTENTIAL.", ) result.add_artifact("comparison_figure", figure_path) result.add_artifact("metrics", metrics_path) result.add_artifact("exact_p2_coefficients", exact) result.add_artifact("xdmf_p1_visualization", xdmf) run.publish(result) return result
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107"""Published reduced-order reference equations for Ye et al. (2026), Fig. 9."""
from __future__ import annotations
import numpy as npfrom scipy.integrate import solve_bvpfrom scipy.optimize import root
N_CELLS = 15CHI = 1.0e-4DELTA = 0.1H = 0.01LOADS = np.asarray([-0.017159, -0.016428, -0.016316])
def critical_load_continuum() -> float: discriminant = 1.0 - np.pi**2 * CHI + 16.0 * H * DELTA return -0.5 * (1.0 + 4.0 * H - np.sqrt(discriminant))
def critical_load_discrete() -> float: omega2 = 4.0 * np.sin(np.pi / (2.0 * (2 * N_CELLS - 1))) ** 2 discriminant = 1.0 - 4.0 * CHI * N_CELLS**2 * omega2 + 16.0 * H * DELTA return -0.5 * (1.0 + 4.0 * H - np.sqrt(discriminant))
def discrete_residual(unknown: np.ndarray, p: float) -> np.ndarray: theta = np.concatenate(([0.0], np.asarray(unknown, dtype=float))) epsilon = (p + 2.0 * H) * np.cos(theta) l0 = 1.0 / N_CELLS kr = CHI / l0 force_term = ( p * l0 * (1.0 + epsilon) + 2.0 * H * l0 * (1.0 - 2.0 * DELTA + epsilon) ) * np.sin(theta) residual = np.empty(N_CELLS - 1) for i in range(1, N_CELLS - 1): residual[i - 1] = ( kr * (theta[i + 1] - 2.0 * theta[i] + theta[i - 1]) - force_term[i] ) residual[-1] = kr * (-theta[-1] + theta[-2]) - force_term[-1] return residual
def solve_discrete(p: float): index = np.arange(1, N_CELLS) mode = np.sin(np.pi * index / (2 * N_CELLS - 1)) accepted = [] for amplitude in (0.25, 0.5, 0.9, 1.4, 2.0, 2.7): solved = root(discrete_residual, amplitude * mode, args=(p,), tol=1.0e-11) if solved.success and np.linalg.norm(discrete_residual(solved.x, p), ord=np.inf) < 1.0e-8: if np.max(np.abs(solved.x)) > 1.0e-3: accepted.append(solved.x) if not accepted: raise RuntimeError(f"No nontrivial discrete equilibrium for p={p}") accepted.sort(key=lambda value: np.max(np.abs(value))) selected = accepted[0] if np.mean(selected) > 0.0: selected = -selected theta = np.concatenate(([0.0], selected)) epsilon = (p + 2.0 * H) * np.cos(theta) segment = (1.0 / N_CELLS) * (1.0 + epsilon) x = np.concatenate(([0.0], np.cumsum(segment * np.cos(theta)))) y = np.concatenate(([0.0], np.cumsum(segment * np.sin(theta)))) return theta, x, y
def solve_continuum(p: float): xi = np.linspace(0.0, 1.0, 401) a = p + 2.0 * H
def ode(_, state): theta, curvature, _, _ = state stretch = 1.0 + a * np.cos(theta) coefficient = (a + a**2 * np.cos(theta) - 4.0 * H * DELTA) / CHI return np.vstack( ( curvature, coefficient * np.sin(theta), stretch * np.cos(theta), stretch * np.sin(theta), ) )
def boundary(left, right): return np.asarray([left[0], right[1], left[2], left[3]])
candidates = [] for amplitude in (0.35, 0.7, 1.2, 1.8, 2.5, 3.0): initial = np.zeros((4, xi.size)) initial[0] = -amplitude * np.sin(0.5 * np.pi * xi) initial[1] = -amplitude * 0.5 * np.pi * np.cos(0.5 * np.pi * xi) initial[2] = xi initial[3] = -0.15 * amplitude * xi**2 solved = solve_bvp(ode, boundary, xi, initial, tol=2.0e-8, max_nodes=30000) if solved.success and np.max(np.abs(solved.y[0])) > 1.0e-3: candidates.append(solved) if not candidates: raise RuntimeError(f"No nontrivial continuum equilibrium for p={p}") candidates.sort(key=lambda item: np.max(np.abs(item.y[0]))) dense = np.linspace(0.0, 1.0, 601) theta, _, x, y = candidates[0].sol(dense) if y[-1] >= 0.0: raise RuntimeError("Expected a genuinely downward BVP solution") return dense, theta, x, y1234p,agentfem_centerline_nrmse_over_L,tip_error_over_L,newton_iterations,residual_norm-1.715900000000000064e-02,7.575428453639602815e-03,1.119233677119880511e-02,4.000000000000000000e+00,6.895025525547140624e-10-1.642800000000000163e-02,1.757494573423452888e-03,3.422975216107892408e-03,4.000000000000000000e+00,2.715729605228601333e-13-1.631600000000000064e-02,3.939945259508586747e-03,8.022228083031593057e-03,5.000000000000000000e+00,1.384756571661825286e-1212345678<?xml version="1.0"?><VTKFile type="Collection" version="1.0"> <Collection> <DataSet timestep="0" part="0" file="native_agentfem_fig9000000.pvtu" /> <DataSet timestep="1" part="0" file="native_agentfem_fig9000001.pvtu" /> <DataSet timestep="2" part="0" file="native_agentfem_fig9000002.pvtu" /> </Collection></VTKFile>1234567891011121314151617181920<?xml version="1.0"?><VTKFile type="PUnstructuredGrid" version="1.0"> <PUnstructuredGrid GhostLevel="1"> <PPointData> <PDataArray type="Int64" Name="vtkOriginalPointIds" IdType="1" /> <PDataArray type="UInt8" Name="vtkGhostType" /> <PDataArray type="Float64" Name="U" NumberOfComponents="3" /> </PPointData> <PCellData> <PDataArray type="UInt8" Name="vtkGhostType" /> <PDataArray type="Int64" Name="vtkOriginalCellIds" IdType="1" /> <PDataArray type="Float64" Name="MISES" NumberOfComponents="1" /> <PDataArray type="Float64" Name="MICROFORCE_POTENTIAL" NumberOfComponents="1" /> </PCellData> <PPoints> <PDataArray type="Float64" NumberOfComponents="3" /> </PPoints> <Piece Source="native_agentfem_fig9_p0_000000.vtu" /> </PUnstructuredGrid></VTKFile>1234567891011121314151617181920<?xml version="1.0"?><VTKFile type="PUnstructuredGrid" version="1.0"> <PUnstructuredGrid GhostLevel="1"> <PPointData> <PDataArray type="Int64" Name="vtkOriginalPointIds" IdType="1" /> <PDataArray type="UInt8" Name="vtkGhostType" /> <PDataArray type="Float64" Name="U" NumberOfComponents="3" /> </PPointData> <PCellData> <PDataArray type="UInt8" Name="vtkGhostType" /> <PDataArray type="Int64" Name="vtkOriginalCellIds" IdType="1" /> <PDataArray type="Float64" Name="MISES" NumberOfComponents="1" /> <PDataArray type="Float64" Name="MICROFORCE_POTENTIAL" NumberOfComponents="1" /> </PCellData> <PPoints> <PDataArray type="Float64" NumberOfComponents="3" /> </PPoints> <Piece Source="native_agentfem_fig9_p0_000001.vtu" /> </PUnstructuredGrid></VTKFile>1234567891011121314151617181920<?xml version="1.0"?><VTKFile type="PUnstructuredGrid" version="1.0"> <PUnstructuredGrid GhostLevel="1"> <PPointData> <PDataArray type="Int64" Name="vtkOriginalPointIds" IdType="1" /> <PDataArray type="UInt8" Name="vtkGhostType" /> <PDataArray type="Float64" Name="U" NumberOfComponents="3" /> </PPointData> <PCellData> <PDataArray type="UInt8" Name="vtkGhostType" /> <PDataArray type="Int64" Name="vtkOriginalCellIds" IdType="1" /> <PDataArray type="Float64" Name="MISES" NumberOfComponents="1" /> <PDataArray type="Float64" Name="MICROFORCE_POTENTIAL" NumberOfComponents="1" /> </PCellData> <PPoints> <PDataArray type="Float64" NumberOfComponents="3" /> </PPoints> <Piece Source="native_agentfem_fig9_p0_000002.vtu" /> </PUnstructuredGrid></VTKFile>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990[ { "file": "paraview/native_agentfem_fig9.pvd", "frames": [ { "case_index": 0.0, "points": 1809, "cells": 400, "warped_bounds": [ -0.4102637698244209, 0.17193084453662033, -0.5912272501257055, 0.01732050807568877, 0.0, 0.0 ] }, { "case_index": 1.0, "points": 1809, "cells": 400, "warped_bounds": [ -8.326672684688674e-19, 0.33781986720525436, -0.8120184934245555, 0.01732050807568877, 0.0, 0.0 ] }, { "case_index": 2.0, "points": 1809, "cells": 400, "warped_bounds": [ -8.326672684688674e-19, 0.6275646846141524, -0.6970659159573344, 0.01732050807568877, 0.0, 0.0 ] } ] }, { "file": "xdmf/native_agentfem_fig9.xdmf", "frames": [ { "case_index": 0.0, "points": 505, "cells": 400, "warped_bounds": [ -0.4102637767791748, 0.17193083465099335, -0.5912272334098816, 0.017320508137345314, 0.0, 0.0 ] }, { "case_index": 1.0, "points": 505, "cells": 400, "warped_bounds": [ -5.418929016846788e-20, 0.3378198742866516, -0.8120185136795044, 0.017320508137345314, 0.0, 0.0 ] }, { "case_index": 2.0, "points": 505, "cells": 400, "warped_bounds": [ -3.4813637682224506e-20, 0.6275646686553955, -0.6970659494400024, 0.017320508137345314, 0.0, 0.0 ] } ] }]123version https://git-lfs.github.com/spec/v1oid sha256:5492eef2a5f5bb0d713f8ba21c512e9f677835e0395b11900dfd4d13b08d89e1size 178608123version https://git-lfs.github.com/spec/v1oid sha256:9be172050b961662fb54b57be1abffcd7698520308e804bd164677025b1d58e7size 8809612345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061<?xml version='1.0' encoding='utf-8'?><Xdmf Version="3.0"> <Domain> <Grid Name="Independent_cases" GridType="Collection" CollectionType="Temporal"> <Grid Name="case_0" GridType="Uniform"> <Topology TopologyType="Quadrilateral" NumberOfElements="400" NodesPerElement="4"> <DataItem Dimensions="400 4" NumberType="Int" Format="HDF">native_agentfem_fig9.h5:/Mesh/mesh/topology</DataItem> </Topology> <Geometry GeometryType="XY"> <DataItem Dimensions="505 2" Format="HDF">native_agentfem_fig9.h5:/Mesh/mesh/geometry</DataItem> </Geometry> <Time Value="0" /> <Attribute Name="U" AttributeType="Vector" Center="Node"> <DataItem Dimensions="505 3" Format="HDF">native_agentfem_fig9.h5:/Function/U/0</DataItem> </Attribute> <Attribute Name="MISES" AttributeType="Scalar" Center="Cell"> <DataItem Dimensions="400 1" Format="HDF">native_agentfem_fig9.h5:/Function/MISES/0</DataItem> </Attribute> <Attribute Name="MICROFORCE_POTENTIAL" AttributeType="Scalar" Center="Cell"> <DataItem Dimensions="400 1" Format="HDF">native_agentfem_fig9.h5:/Function/MICROFORCE_POTENTIAL/0</DataItem> </Attribute> </Grid> <Grid Name="case_1" GridType="Uniform"> <Topology TopologyType="Quadrilateral" NumberOfElements="400" NodesPerElement="4"> <DataItem Dimensions="400 4" NumberType="Int" Format="HDF">native_agentfem_fig9.h5:/Mesh/mesh/topology</DataItem> </Topology> <Geometry GeometryType="XY"> <DataItem Dimensions="505 2" Format="HDF">native_agentfem_fig9.h5:/Mesh/mesh/geometry</DataItem> </Geometry> <Time Value="1" /> <Attribute Name="U" AttributeType="Vector" Center="Node"> <DataItem Dimensions="505 3" Format="HDF">native_agentfem_fig9.h5:/Function/U/1</DataItem> </Attribute> <Attribute Name="MISES" AttributeType="Scalar" Center="Cell"> <DataItem Dimensions="400 1" Format="HDF">native_agentfem_fig9.h5:/Function/MISES/1</DataItem> </Attribute> <Attribute Name="MICROFORCE_POTENTIAL" AttributeType="Scalar" Center="Cell"> <DataItem Dimensions="400 1" Format="HDF">native_agentfem_fig9.h5:/Function/MICROFORCE_POTENTIAL/1</DataItem> </Attribute> </Grid> <Grid Name="case_2" GridType="Uniform"> <Topology TopologyType="Quadrilateral" NumberOfElements="400" NodesPerElement="4"> <DataItem Dimensions="400 4" NumberType="Int" Format="HDF">native_agentfem_fig9.h5:/Mesh/mesh/topology</DataItem> </Topology> <Geometry GeometryType="XY"> <DataItem Dimensions="505 2" Format="HDF">native_agentfem_fig9.h5:/Mesh/mesh/geometry</DataItem> </Geometry> <Time Value="2" /> <Attribute Name="U" AttributeType="Vector" Center="Node"> <DataItem Dimensions="505 3" Format="HDF">native_agentfem_fig9.h5:/Function/U/2</DataItem> </Attribute> <Attribute Name="MISES" AttributeType="Scalar" Center="Cell"> <DataItem Dimensions="400 1" Format="HDF">native_agentfem_fig9.h5:/Function/MISES/2</DataItem> </Attribute> <Attribute Name="MICROFORCE_POTENTIAL" AttributeType="Scalar" Center="Cell"> <DataItem Dimensions="400 1" Format="HDF">native_agentfem_fig9.h5:/Function/MICROFORCE_POTENTIAL/2</DataItem> </Attribute> </Grid> </Grid> </Domain></Xdmf>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625{ "branch_conditioned_1nn": { "centerline_rmse_over_L": 0.13898504238123274, "tip_mean_error_over_L": 0.15082045203689934 }, "neural_batched_ms_per_state": 0.0008765032387101182, "corrector_median_ms": 0.34977076575160027, "corrector_checks": [ { "id": "end_load_000_ramp_00", "accepted": true, "branch_preserved": true, "tip_error": 5.713519573546008e-17 }, { "id": "end_load_000_ramp_20", "accepted": true, "branch_preserved": true, "tip_error": 1.1997663265215437e-10 }, { "id": "end_load_000_unload_15", "accepted": true, "branch_preserved": true, "tip_error": 7.290108295062502e-11 }, { "id": "end_load_000_staged_10", "accepted": true, "branch_preserved": true, "tip_error": 9.712210605662558e-11 }, { "id": "end_load_012_ramp_05", "accepted": true, "branch_preserved": true, "tip_error": 4.4713741996549127e-07 }, { "id": "end_load_012_unload_00", "accepted": true, "branch_preserved": true, "tip_error": 2.349724530588667e-11 }, { "id": "end_load_012_unload_20", "accepted": true, "branch_preserved": true, "tip_error": 1.6299620512787293e-07 }, { "id": "end_load_012_staged_15", "accepted": true, "branch_preserved": true, "tip_error": 2.8376611541645903e-12 }, { "id": "end_load_015_ramp_10", "accepted": true, "branch_preserved": true, "tip_error": 1.1892927603218958e-06 }, { "id": "end_load_015_unload_05", "accepted": true, "branch_preserved": true, "tip_error": 3.666454743459296e-12 }, { "id": "end_load_015_staged_00", "accepted": true, "branch_preserved": true, "tip_error": 3.815883427380623e-18 }, { "id": "end_load_015_staged_20", "accepted": true, "branch_preserved": true, "tip_error": 4.010247463629644e-12 }, { "id": "end_load_017_ramp_15", "accepted": true, "branch_preserved": true, "tip_error": 6.638475515026393e-10 }, { "id": "end_load_017_unload_10", "accepted": true, "branch_preserved": true, "tip_error": 6.2649249971295e-10 }, { "id": "end_load_017_staged_05", "accepted": true, "branch_preserved": true, "tip_error": 5.139535805398536e-07 }, { "id": "end_load_034_ramp_00", "accepted": true, "branch_preserved": true, "tip_error": 4.910984090454133e-17 }, { "id": "end_load_034_ramp_20", "accepted": true, "branch_preserved": true, "tip_error": 1.2253298143879764e-11 }, { "id": "end_load_034_unload_15", "accepted": true, "branch_preserved": true, "tip_error": 4.665351948252804e-06 }, { "id": "end_load_034_staged_10", "accepted": true, "branch_preserved": true, "tip_error": 5.873060257541643e-13 }, { "id": "end_load_037_ramp_05", "accepted": true, "branch_preserved": true, "tip_error": 7.259387172620046e-08 }, { "id": "end_load_037_unload_00", "accepted": true, "branch_preserved": true, "tip_error": 3.1549746482562244e-09 }, { "id": "end_load_037_unload_20", "accepted": true, "branch_preserved": true, "tip_error": 8.430107338688936e-08 }, { "id": "end_load_037_staged_15", "accepted": true, "branch_preserved": true, "tip_error": 2.333017023396121e-07 }, { "id": "end_load_040_ramp_10", "accepted": true, "branch_preserved": true, "tip_error": 1.6542147378324227e-09 }, { "id": "end_load_040_unload_05", "accepted": true, "branch_preserved": true, "tip_error": 2.123356214112997e-09 }, { "id": "end_load_040_staged_00", "accepted": true, "branch_preserved": true, "tip_error": 1.0089630592240623e-16 }, { "id": "end_load_040_staged_20", "accepted": true, "branch_preserved": true, "tip_error": 2.1906716409310014e-09 }, { "id": "end_load_050_ramp_15", "accepted": true, "branch_preserved": true, "tip_error": 2.745436766772867e-06 }, { "id": "end_load_050_unload_10", "accepted": true, "branch_preserved": true, "tip_error": 3.6682109332775024e-06 }, { "id": "end_load_050_staged_05", "accepted": true, "branch_preserved": true, "tip_error": 9.55561598569722e-07 }, { "id": "end_load_054_ramp_00", "accepted": true, "branch_preserved": true, "tip_error": 1.189347195671338e-17 }, { "id": "end_load_054_ramp_20", "accepted": true, "branch_preserved": true, "tip_error": 2.0095102567616816e-06 }, { "id": "end_load_054_unload_15", "accepted": true, "branch_preserved": true, "tip_error": 2.9869502978294934e-06 }, { "id": "end_load_054_staged_10", "accepted": true, "branch_preserved": true, "tip_error": 1.1405695879619652e-06 }, { "id": "intrinsic_curvature_001_ramp_05", "accepted": true, "branch_preserved": true, "tip_error": 1.2188344440854238e-11 }, { "id": "intrinsic_curvature_001_unload_00", "accepted": true, "branch_preserved": true, "tip_error": 6.070421348564216e-09 }, { "id": "intrinsic_curvature_001_unload_20", "accepted": true, "branch_preserved": true, "tip_error": 6.279524867416008e-12 }, { "id": "intrinsic_curvature_001_staged_15", "accepted": true, "branch_preserved": true, "tip_error": 1.0282430084674248e-10 }, { "id": "intrinsic_curvature_002_ramp_10", "accepted": true, "branch_preserved": true, "tip_error": 2.830062791762887e-12 }, { "id": "intrinsic_curvature_002_unload_05", "accepted": true, "branch_preserved": true, "tip_error": 1.7045955868265643e-11 }, { "id": "intrinsic_curvature_002_staged_00", "accepted": true, "branch_preserved": true, "tip_error": 2.5989229576287947e-17 }, { "id": "intrinsic_curvature_002_staged_20", "accepted": true, "branch_preserved": true, "tip_error": 2.2576685904069937e-10 }, { "id": "intrinsic_curvature_007_ramp_15", "accepted": true, "branch_preserved": true, "tip_error": 7.550331073633704e-11 }, { "id": "intrinsic_curvature_007_unload_10", "accepted": true, "branch_preserved": true, "tip_error": 7.436805524774105e-11 }, { "id": "intrinsic_curvature_007_staged_05", "accepted": true, "branch_preserved": true, "tip_error": 3.481135094081288e-07 }, { "id": "intrinsic_curvature_014_ramp_00", "accepted": true, "branch_preserved": true, "tip_error": 2.3030261147212925e-17 }, { "id": "intrinsic_curvature_014_ramp_20", "accepted": true, "branch_preserved": true, "tip_error": 2.7479332855005862e-09 }, { "id": "intrinsic_curvature_014_unload_15", "accepted": true, "branch_preserved": true, "tip_error": 2.950730575812304e-11 }, { "id": "intrinsic_curvature_014_staged_10", "accepted": true, "branch_preserved": true, "tip_error": 1.5207153454372993e-09 }, { "id": "intrinsic_curvature_026_ramp_05", "accepted": true, "branch_preserved": true, "tip_error": 6.561980104684226e-07 }, { "id": "intrinsic_curvature_026_unload_00", "accepted": true, "branch_preserved": true, "tip_error": 1.1102247340114048e-08 }, { "id": "intrinsic_curvature_026_unload_20", "accepted": true, "branch_preserved": true, "tip_error": 5.208375532011217e-07 }, { "id": "intrinsic_curvature_026_staged_15", "accepted": true, "branch_preserved": true, "tip_error": 7.364085678097339e-09 }, { "id": "intrinsic_curvature_030_ramp_10", "accepted": true, "branch_preserved": true, "tip_error": 1.1005130722312953e-11 }, { "id": "intrinsic_curvature_030_unload_05", "accepted": true, "branch_preserved": true, "tip_error": 1.1405395889319545e-10 }, { "id": "intrinsic_curvature_030_staged_00", "accepted": true, "branch_preserved": true, "tip_error": 3.219402825924145e-17 }, { "id": "intrinsic_curvature_030_staged_20", "accepted": true, "branch_preserved": true, "tip_error": 2.3063564718432202e-10 }, { "id": "intrinsic_curvature_034_ramp_15", "accepted": true, "branch_preserved": true, "tip_error": 4.394481302590971e-11 }, { "id": "intrinsic_curvature_034_unload_10", "accepted": true, "branch_preserved": true, "tip_error": 1.7996602804957778e-11 }, { "id": "intrinsic_curvature_034_staged_05", "accepted": true, "branch_preserved": true, "tip_error": 8.773624015527173e-13 }, { "id": "intrinsic_curvature_036_ramp_00", "accepted": true, "branch_preserved": true, "tip_error": 4.634964287375531e-18 }, { "id": "intrinsic_curvature_036_ramp_20", "accepted": true, "branch_preserved": true, "tip_error": 1.348864169653577e-11 }, { "id": "intrinsic_curvature_036_unload_15", "accepted": true, "branch_preserved": true, "tip_error": 1.2003039457884168e-11 }, { "id": "intrinsic_curvature_036_staged_10", "accepted": true, "branch_preserved": true, "tip_error": 2.857402141123093e-09 }, { "id": "intrinsic_curvature_049_ramp_05", "accepted": true, "branch_preserved": true, "tip_error": 6.077877782048024e-08 }, { "id": "intrinsic_curvature_049_unload_00", "accepted": true, "branch_preserved": true, "tip_error": 1.9982613712293267e-09 }, { "id": "intrinsic_curvature_049_unload_20", "accepted": true, "branch_preserved": true, "tip_error": 6.836604854617364e-08 }, { "id": "intrinsic_curvature_049_staged_15", "accepted": true, "branch_preserved": true, "tip_error": 4.083441044428953e-07 }, { "id": "microforce_001_down_10", "accepted": true, "branch_preserved": true, "tip_error": 2.7517764614967345e-06 }, { "id": "microforce_001_straight_05", "accepted": true, "branch_preserved": true, "tip_error": 5.768912148970819e-07 }, { "id": "microforce_001_up_00", "accepted": true, "branch_preserved": true, "tip_error": 1.3670849271572689e-06 }, { "id": "microforce_001_up_20", "accepted": true, "branch_preserved": true, "tip_error": 1.1095390603831054e-07 }, { "id": "microforce_009_down_15", "accepted": true, "branch_preserved": true, "tip_error": 1.791408572988469e-07 }, { "id": "microforce_009_straight_10", "accepted": true, "branch_preserved": true, "tip_error": 4.8630567980386464e-08 }, { "id": "microforce_009_up_05", "accepted": true, "branch_preserved": true, "tip_error": 1.0718840963745841e-07 }, { "id": "microforce_010_down_00", "accepted": true, "branch_preserved": true, "tip_error": 3.480849816897002e-08 }, { "id": "microforce_010_down_20", "accepted": true, "branch_preserved": true, "tip_error": 1.1958511977095623e-08 }, { "id": "microforce_010_straight_15", "accepted": true, "branch_preserved": true, "tip_error": 9.700193205386223e-11 }, { "id": "microforce_010_up_10", "accepted": true, "branch_preserved": true, "tip_error": 7.186442512894125e-07 }, { "id": "microforce_029_down_05", "accepted": true, "branch_preserved": true, "tip_error": 2.8097916963807202e-09 }, { "id": "microforce_029_straight_00", "accepted": true, "branch_preserved": true, "tip_error": 1.5923767705948783e-08 }, { "id": "microforce_029_straight_20", "accepted": true, "branch_preserved": true, "tip_error": 1.1465258978568242e-08 }, { "id": "microforce_029_up_15", "accepted": true, "branch_preserved": true, "tip_error": 1.4023108406382885e-07 }, { "id": "microforce_031_down_10", "accepted": true, "branch_preserved": true, "tip_error": 2.1323890663030994e-06 }, { "id": "microforce_031_straight_05", "accepted": true, "branch_preserved": true, "tip_error": 1.8737178237880017e-07 }, { "id": "microforce_031_up_00", "accepted": true, "branch_preserved": true, "tip_error": 1.1751143881128007e-06 }, { "id": "microforce_031_up_20", "accepted": true, "branch_preserved": true, "tip_error": 4.2569030372265784e-08 }, { "id": "microforce_033_down_15", "accepted": true, "branch_preserved": true, "tip_error": 9.136252812365038e-08 }, { "id": "microforce_033_straight_10", "accepted": true, "branch_preserved": true, "tip_error": 2.240343447720724e-08 }, { "id": "microforce_033_up_05", "accepted": true, "branch_preserved": true, "tip_error": 2.6297745247689965e-09 }, { "id": "microforce_037_down_00", "accepted": true, "branch_preserved": true, "tip_error": 1.134554997372794e-06 }, { "id": "microforce_037_down_20", "accepted": true, "branch_preserved": true, "tip_error": 1.1229456873087092e-07 }, { "id": "microforce_037_straight_15", "accepted": true, "branch_preserved": true, "tip_error": 1.0649448688240376e-07 }, { "id": "microforce_037_up_10", "accepted": true, "branch_preserved": true, "tip_error": 2.4869383910580255e-06 }, { "id": "microforce_047_down_05", "accepted": true, "branch_preserved": true, "tip_error": 3.152254769359579e-06 }, { "id": "microforce_047_straight_00", "accepted": true, "branch_preserved": true, "tip_error": 7.818380700057634e-09 }, { "id": "microforce_047_straight_20", "accepted": true, "branch_preserved": true, "tip_error": 1.5431327401546222e-08 }, { "id": "microforce_047_up_15", "accepted": true, "branch_preserved": true, "tip_error": 3.8964605452957895e-07 }, { "id": "microforce_055_down_10", "accepted": true, "branch_preserved": true, "tip_error": 2.6380689401879157e-06 }, { "id": "microforce_055_straight_05", "accepted": true, "branch_preserved": true, "tip_error": 8.820089710383261e-08 }, { "id": "microforce_055_up_00", "accepted": true, "branch_preserved": true, "tip_error": 6.329517053747379e-07 }, { "id": "microforce_055_up_20", "accepted": true, "branch_preserved": true, "tip_error": 8.086550582849113e-08 } ], "number_scenes": 216, "number_paths": 648, "sampled_stable_pairs": 13654}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184{ "ordinary": { "training_seconds": 9.469062707852572, "best_validation_angle_mse": 0.5325946807861328, "best_epoch": 175, "splits": { "train": { "states": 9450, "centerline_rmse_over_L": 0.2876402123158852, "tip_mean_error_over_L": 0.2758412063003781, "tip_p95_error_over_L": 1.3709718723783264, "branch_accuracy": 0.7560846560846561, "families": { "end_load": { "centerline_rmse_over_L": 0.008660688386444413, "tip_mean_error_over_L": 0.010720162702538583 }, "intrinsic_curvature": { "centerline_rmse_over_L": 0.017302987509425837, "tip_mean_error_over_L": 0.02753935074302976 }, "microforce": { "centerline_rmse_over_L": 0.4978315722443727, "tip_mean_error_over_L": 0.789264105455566 } } }, "validation": { "states": 2025, "centerline_rmse_over_L": 0.2772618309801568, "tip_mean_error_over_L": 0.26522754817754857, "tip_p95_error_over_L": 1.350459783369911, "branch_accuracy": 0.7550617283950617, "families": { "end_load": { "centerline_rmse_over_L": 0.0054981715867303375, "tip_mean_error_over_L": 0.007655388366930514 }, "intrinsic_curvature": { "centerline_rmse_over_L": 0.02199192544955959, "tip_mean_error_over_L": 0.029069048383501175 }, "microforce": { "centerline_rmse_over_L": 0.4796962518924147, "tip_mean_error_over_L": 0.758958207782214 } } }, "test": { "states": 2025, "centerline_rmse_over_L": 0.27097307618454236, "tip_mean_error_over_L": 0.26332069407816006, "tip_p95_error_over_L": 1.324666341267705, "branch_accuracy": 0.7595061728395062, "families": { "end_load": { "centerline_rmse_over_L": 0.01258676348938492, "tip_mean_error_over_L": 0.017343709033959896 }, "intrinsic_curvature": { "centerline_rmse_over_L": 0.018546808034216416, "tip_mean_error_over_L": 0.028707976863230157 }, "microforce": { "centerline_rmse_over_L": 0.46880359783959163, "tip_mean_error_over_L": 0.7439103963372901 } } }, "parameter_ood": { "states": 2700, "centerline_rmse_over_L": 0.31099709293692207, "tip_mean_error_over_L": 0.3105775533562281, "tip_p95_error_over_L": 1.4254575954845419, "branch_accuracy": 0.7307407407407407, "families": { "end_load": { "centerline_rmse_over_L": 0.016934717319539314, "tip_mean_error_over_L": 0.026384041569860444 }, "intrinsic_curvature": { "centerline_rmse_over_L": 0.034150610882093556, "tip_mean_error_over_L": 0.051634731786840624 }, "microforce": { "centerline_rmse_over_L": 0.5373123175317468, "tip_mean_error_over_L": 0.8537138867119832 } } } } }, "branch_conditioned": { "training_seconds": 10.021918333135545, "best_validation_angle_mse": 0.0003538956225384027, "best_epoch": 373, "splits": { "train": { "states": 9450, "centerline_rmse_over_L": 0.0036564542466527806, "tip_mean_error_over_L": 0.004660886595197838, "tip_p95_error_over_L": 0.013352837772448264, "branch_accuracy": 0.951005291005291, "families": { "end_load": { "centerline_rmse_over_L": 0.001954592498102367, "tip_mean_error_over_L": 0.002872378421773722 }, "intrinsic_curvature": { "centerline_rmse_over_L": 0.0030893070908413777, "tip_mean_error_over_L": 0.004508324274736663 }, "microforce": { "centerline_rmse_over_L": 0.005171530028766592, "tip_mean_error_over_L": 0.006601957089083131 } } }, "validation": { "states": 2025, "centerline_rmse_over_L": 0.007790775422665098, "tip_mean_error_over_L": 0.00850362012458513, "tip_p95_error_over_L": 0.030204327965714442, "branch_accuracy": 0.9432098765432099, "families": { "end_load": { "centerline_rmse_over_L": 0.002559192870527483, "tip_mean_error_over_L": 0.0036740723304681737 }, "intrinsic_curvature": { "centerline_rmse_over_L": 0.012074923761816205, "tip_mean_error_over_L": 0.014751192088026343 }, "microforce": { "centerline_rmse_over_L": 0.005453007707401057, "tip_mean_error_over_L": 0.007085595955260876 } } }, "test": { "states": 2025, "centerline_rmse_over_L": 0.006606571244686814, "tip_mean_error_over_L": 0.00783664011337499, "tip_p95_error_over_L": 0.027372971794891447, "branch_accuracy": 0.9274074074074075, "families": { "end_load": { "centerline_rmse_over_L": 0.004345665533552764, "tip_mean_error_over_L": 0.005946189596474241 }, "intrinsic_curvature": { "centerline_rmse_over_L": 0.009162369474475147, "tip_mean_error_over_L": 0.010607649815447867 }, "microforce": { "centerline_rmse_over_L": 0.005301558970441207, "tip_mean_error_over_L": 0.006956080928202864 } } }, "parameter_ood": { "states": 2700, "centerline_rmse_over_L": 0.009411141971015478, "tip_mean_error_over_L": 0.010912692785005286, "tip_p95_error_over_L": 0.042834881364826174, "branch_accuracy": 0.9022222222222223, "families": { "end_load": { "centerline_rmse_over_L": 0.0038858871588121832, "tip_mean_error_over_L": 0.0060025543991917025 }, "intrinsic_curvature": { "centerline_rmse_over_L": 0.014754143191724783, "tip_mean_error_over_L": 0.018902846975711853 }, "microforce": { "centerline_rmse_over_L": 0.00573793684723761, "tip_mean_error_over_L": 0.007832676980112299 } } } } }}1234567891011{ "numpy": "2.4.6", "scipy": "1.17.1", "torch": "2.13.0", "safetensors": "0.8.0", "matplotlib": "3.11.0", "h5py": "3.16.0", "python": "3.11.15", "platform": "macOS-26.6.2-arm64-arm-64bit", "agentfem_commit": "36f4c1b06ce8a37988eea50bd139fd2d3513985d"}123456789101112131415161718192021222324252627282930{ "version": "0.1.0", "seed": 20261014, "accepted_states": 16200, "rejected_attempts": 0, "scenes": 216, "paired_resolution_cases": 216, "seconds": 7.868317000102252, "splits": { "train": 9450, "validation": 2025, "test": 2025, "parameter_ood": 2700 }, "families": { "end_load": 5400, "intrinsic_curvature": 5400, "microforce": 5400 }, "stability": { "stable": 14400, "unstable": 1800, "critical": 0 }, "max_residual": 9.981284949452698e-11, "mesh_audit_max_rmse": 0.00017190907534690302, "mesh_audit_median_rmse": 4.567330866247305e-05, "python": "3.11.15", "numpy": "2.4.6"}12345678910111213141516171819202122232425262728293031323334353637383940{ "gradient_fd_max_abs": 9.39636538607562e-13, "hessian_fd_max_abs": 8.915951310584092e-12, "axial_tip_error": 4.440892098500626e-16, "circular_tip_errors_n24_48_96": [ 9.803535554763446e-05, 2.4507498546971404e-05, 6.1267908707274595e-06 ], "critical_load_analytic": -0.016260722307687474, "critical_load_discrete_rod96": -0.016260733236409513, "critical_load_error": 1.092872203845019e-08, "fig9_rod96_centerline_rmse_over_L": [ 5.866723365639996e-05, 3.3195723854766535e-05, 4.0061907625982e-05 ], "fig9_chain_tip_errors_n15_30_60_120": [ [ 0.06878181113063606, 0.03458991708982865, 0.017347626270992015, 0.00868715805212931 ], [ 0.10183627474426794, 0.05039220186844308, 0.02507094317590472, 0.012504879101960199 ], [ 0.16309490255187659, 0.07830363538498472, 0.03844061583017705, 0.01905561851287658 ] ], "chain_critical_eigenvalue": -1.412907187228135e-13, "passed": true}123456numpy>=2.0,<3scipy>=1.14,<2torch>=2.4,<3safetensors>=0.4,<1matplotlib>=3.8,<4h5py>=3.10,<41234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798"""Grouped deterministic equilibrium dataset; no physical-time claims."""from pathlib import Pathfrom dataclasses import asdictimport json,time,platform,hashlibimport numpy as npfrom rod import Rod,Controls,serial
ROOT=Path(__file__).resolve().parents[1]
def generate(): rng=np.random.default_rng(20261014) r=Rod(48); records=[]; rejected=[]; audits=[] start=time.perf_counter() # Each family has 60 ID scenes and 12 parameter-OOD scenes; all paths and # mirrored branches of a scene share a single split. for family in ['end_load','intrinsic_curvature','microforce']: order=rng.permutation(60) assignment={int(j):('train' if i<42 else 'validation' if i<51 else 'test') for i,j in enumerate(order)} for j in range(72): split=assignment[j] if j<60 else 'parameter_ood' scene=f'{family}_{j:03d}' chi=float(10**rng.uniform(-4,-2.5)) if j<60 else float(10**rng.uniform(-2.5,-2.1)) base=Controls(chi=chi) if family=='microforce': base.h=float(chi*rng.uniform(4,30));base.delta=float(rng.uniform(.05,.35)) pc=(-1+np.sqrt(1+16*base.h*base.delta-np.pi**2*chi))/2-2*base.h paths=['down','straight','up'] maxcompression=float(rng.uniform(2,8)) else: fx=float(chi*rng.uniform(0,2));fy=float(chi*rng.uniform(-2,2));moment=float(chi*rng.uniform(-1,1)) ks=rng.uniform(-2.4,2.4,3) if family=='intrinsic_curvature' else np.zeros(3) paths=['ramp','unload','staged'] for path in paths: prev=None for step,t in enumerate(np.linspace(0,1,25)): c=Controls(**asdict(base)) seed_source='previous_equilibrium' if prev is not None else 'zero' seed=None if prev is None else prev['z'] if family=='microforce': # All points below the first critical load; these are branch # sweeps, NOT claims about spontaneous branch selection. c.fx=float(pc-chi*(.2+(maxcompression-.2)*t)) sign={'down':-1,'straight':0,'up':1}[path] if prev is None: seed=r.mode_seed(sign*1.2);seed_source='signed_mode_initialization' if sign==0:seed=np.zeros(r.d);seed_source='exact_straight' else: alpha=float(1-t if path=='unload' else t) c.fx=fx*alpha;c.fy=fy*alpha;c.moment=moment*alpha ramps=np.clip(3*alpha-np.arange(3),0,1) if path=='staged' else np.full(3,alpha) c.k1,c.k2,c.k3=map(float,ks*ramps) result=r.solve(c,seed) if family=='microforce' and path!='straight' and (result['tip'][1]*sign<1e-4 or not result['accepted']): for amp in [.6,1.6,2.5,3.]: result=r.solve(c,r.mode_seed(sign*amp));seed_source='signed_mode_retry' if result['accepted'] and result['tip'][1]*sign>1e-4:break valid=result['accepted'] if family=='microforce' and path!='straight':valid &= result['tip'][1]*sign>1e-4 row=dict(id=f'{scene}_{path}_{step:02d}',scene_id=scene,split=split,family=family, path_id=f'{scene}_{path}',path_kind=path,step=step,path_parameter=float(t), controls=asdict(c),model='angle_FE_midpoint_n48',seed_source=seed_source,**serial(result)) row['branch']='straight' if np.max(np.abs(result['z']))<1e-5 else ('up' if result['tip'][1]>0 else 'down') row['previous_id']=None if prev is None else prev['id'] row['continuous_stable_pair']=bool(prev is not None and prev['stability']=='stable' and result['stability']=='stable' and np.max(np.abs(prev['z']-result['z']))<.2) if valid: records.append(row);prev={**result,'id':row['id']} else: rejected.append(row);prev=None # One paired mesh audit per scenario, assigned the same scene/split. if path==paths[-1] and prev is not None: fine=Rod(96) seed=np.interp(np.linspace(0,1,97)[1:],np.linspace(0,1,49),np.r_[0,prev['z']]) f=fine.solve(c,seed) audits.append(dict(scene_id=scene,split=split,coarse_id=prev['id'],controls=asdict(c), fine=serial(f),centerline_rmse=float(np.sqrt(np.mean(np.sum((f['centerline']-prev['centerline'])**2,axis=1)))))) if j%12==0:print(f'{family} {j}/72: accepted={len(records)} rejected={len(rejected)}',flush=True) out=ROOT/'data';out.mkdir(exist_ok=True) for name,rows in [('equilibria',records),('rejected_attempts',rejected),('paired_resolution',audits)]: with (out/f'{name}.jsonl').open('w') as f: for row in rows:f.write(json.dumps(row,allow_nan=False,separators=(',',':'))+'\n') summary=dict(version='0.1.0',seed=20261014,accepted_states=len(records),rejected_attempts=len(rejected),scenes=216, paired_resolution_cases=len(audits),seconds=time.perf_counter()-start, splits={s:sum(v['split']==s for v in records) for s in ['train','validation','test','parameter_ood']}, families={s:sum(v['family']==s for v in records) for s in ['end_load','intrinsic_curvature','microforce']}, stability={s:sum(v['stability']==s for v in records) for s in ['stable','unstable','critical']}, max_residual=max(v['residual'] for v in records), mesh_audit_max_rmse=max(v['centerline_rmse'] for v in audits), mesh_audit_median_rmse=float(np.median([v['centerline_rmse'] for v in audits])), python=platform.python_version(),numpy=np.__version__) # Guard against leakage and malformed paths before publication. grouped={} for v in records:grouped.setdefault(v['scene_id'],set()).add(v['split']) assert all(len(s)==1 for s in grouped.values()) assert all(v['fine']['accepted'] for v in audits) (ROOT/'reports/generation.json').write_text(json.dumps(summary,indent=2)) print(json.dumps(summary,indent=2))
if __name__=='__main__':generate()123456789101112131415161718192021222324252627"""Load safetensors baseline; optionally correct using the released mechanics."""from pathlib import Pathimport jsonimport numpy as npimport torchfrom safetensors.torch import load_filefrom train import features,networkfrom rod import Rod,Controls
def predict(controls,branch='down',model_dir=None,correct=False): folder=Path(model_dir) if model_dir else Path(__file__).resolve().parents[1]/'models' name='branch_conditioned' if branch is not None else 'ordinary' config=json.loads((folder/f'{name}.json').read_text()) net=network(config['architecture'][0]);net.load_state_dict(load_file(str(folder/f'{name}.safetensors')));net.eval() x=(np.array(features(controls,branch))-config['mean'])/config['std'] with torch.no_grad():z=net(torch.tensor(x,dtype=torch.float32)).numpy() rod=Rod(48);c=Controls(**controls) if correct:return rod.solve(c,z) th=rod.A@z;stretch=1+(c.fx+2*c.h)*np.cos(th)+c.fy*np.sin(th) xy=np.vstack([np.zeros(2),np.cumsum(stretch[:,None]*np.column_stack([np.cos(th),np.sin(th)])/48,axis=0)]) return dict(z=z,centerline=xy,tip=xy[-1],note='Raw neural estimate; stability is not certified.')
if __name__=='__main__': c=dict(chi=.0001,fx=-.016428,fy=0.,moment=0.,h=.01,delta=.1,k1=0.,k2=0.,k3=0.) for corrected in [False,True]: r=predict(c,'down',correct=corrected) print('corrected' if corrected else 'neural','tip',r['tip'],'residual',r.get('residual'),'stability',r.get('stability'))1234567891011121314151617181920212223242526272829303132333435363738394041"""Mechanics-based bounded intrinsic-curvature design; no neural claims."""from dataclasses import asdictimport numpy as npfrom scipy.optimize import least_squaresfrom rod import Rod,Controls,serial
def forward(k): r=Rod(48) c=Controls(chi=.001,fx=.0003,fy=-.0001,k1=float(k[0]),k2=float(k[1]),k3=float(k[2])) seed=np.cumsum(np.repeat(k,16))/48 return r.solve(c,seed),c
def design(target,shape=False): target=np.asarray(target) def residual(k): result,_=forward(k) mismatch=result['centerline']-target if shape else result['tip']-target return np.r_[mismatch.ravel()*20,.002*k] candidates=[least_squares(residual,np.full(3,s),bounds=(-2.4,2.4),max_nfev=70,ftol=1e-10,xtol=1e-10,gtol=1e-10) for s in [-1.,0.,1.]] best=min(candidates,key=lambda r:np.linalg.norm(residual(r.x))) state,c=forward(best.x) path=[] for t in np.linspace(0,1,25): step,cc=forward(t*best.x) path.append(dict(t=float(t),controls=asdict(cc),**serial(step))) err=float(np.linalg.norm(state['tip']-target)) if not shape else float(np.sqrt(np.mean(np.sum((state['centerline']-target)**2,axis=1)))) return dict(target=target.tolist(),controls=asdict(c),error_over_L=err,matched=bool(err<.005 and state['accepted']),stable_sampled_path=all(p['accepted'] and p['stability']=='stable' for p in path),path=path)
if __name__=='__main__': from pathlib import Path import json rng=np.random.default_rng(50);results=[] for i in range(12): known,_=forward(rng.uniform(-2,2,3)) shape=i>=8 result=design(known['centerline'] if shape else known['tip'],shape) result['task']='shape' if shape else 'tip' assert result['matched'] and result['stable_sampled_path'] results.append(result) (Path(__file__).resolve().parents[1]/'reports/inverse_checks.json').write_text(json.dumps(results)) print('Inverse checks:',len(results),'max error/L:',max(r['error_over_L'] for r in results))1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Explicit publication whitelist, generated summaries and figures."""from pathlib import Pathimport json,gzip,shutil,hashlib,platform,importlib.metadataimport numpy as npimport matplotlibmatplotlib.use('Agg')import matplotlib.pyplot as pltR=Path(__file__).resolve().parents[1]
def main(): rows=[json.loads(l) for l in (R/'data/equilibria.jsonl').open()] dataset=R/'release/dataset';model=R/'release/model' for root in [dataset,model]: for d in ['src','tests','reports','assets']: (root/d).mkdir(parents=True,exist_ok=True) for folder in ['src','tests']: for p in (R/folder).glob('*.py'):shutil.copy2(p,root/folder/p.name) for p in (R/'reports').glob('*.json'):shutil.copy2(p,root/'reports'/p.name) for name in ['SCHEMA.md','requirements.txt','LICENSE-CODE','LICENSE-DATA']:shutil.copy2(R/name,root/name) (dataset/'states').mkdir(exist_ok=True) for split in ['train','validation','test','parameter_ood']: with gzip.open(dataset/f'states/{split}.jsonl.gz','wt') as f: for row in rows: if row['split']==split:f.write(json.dumps(row,allow_nan=False,separators=(',',':'))+'\n') (dataset/'validation').mkdir(exist_ok=True) with gzip.open(dataset/'validation/paired_resolution.jsonl.gz','wt') as f:f.write((R/'data/paired_resolution.jsonl').read_text()) (dataset/'validation/rejected_attempts.json').write_text('[]\n') native=R/'cases/fig9/outputs/003-downward-single-geometry' for folder in ['paraview','xdmf','scientific','figures']: shutil.copytree(native/folder,dataset/'native_fe'/folder,dirs_exist_ok=True) for name in ['native_fe_metrics.csv','paraview_checks.json']:shutil.copy2(native/name,dataset/'native_fe'/name) (dataset/'cases/fig9').mkdir(parents=True,exist_ok=True) for name in ['case.py','paper_reference.py','agentfem.toml']:shutil.copy2(R/'cases/fig9'/name,dataset/'cases/fig9'/name) shutil.copytree(R/'models',model/'models',dirs_exist_ok=True) environment={name:importlib.metadata.version(name) for name in ['numpy','scipy','torch','safetensors','matplotlib','h5py']} environment.update(python=platform.python_version(),platform=platform.platform(),agentfem_commit='36f4c1b06ce8a37988eea50bd139fd2d3513985d') for root in [R,dataset,model]:(root/'reports/environment.json').write_text(json.dumps(environment,indent=2)) plt.rcParams.update({'font.family':'DejaVu Sans','text.color':'#e6efed','axes.labelcolor':'#8fa5a7','xtick.color':'#61777c','ytick.color':'#61777c'}) fig,axes=plt.subplots(1,3,figsize=(15,6),facecolor='#091317') titles=['Driven by force','Programmed curvature','One load. Three branches.'] families=['end_load','intrinsic_curvature','microforce'] for ax,family,title in zip(axes,families,titles): ax.set_facecolor('#091317');ax.set_aspect('equal');ax.set_xlim(-.55,1.1);ax.set_ylim(-1.05,1.05) ax.set_xticks([]);ax.set_yticks([]) for sp in ax.spines.values():sp.set_visible(False) ax.axhline(0,color='#244048',lw=.5);ax.axvline(0,color='#244048',lw=.5) if family=='microforce': chosen=[v for v in rows if v['scene_id']=='microforce_000' and v['step']==16] else: chosen=[v for v in rows if v['family']==family and v['path_kind']=='ramp' and v['step']==24][::5][:12] for i,v in enumerate(chosen): xy=np.array(v['centerline']);color='#e3ac72' if v['branch']=='straight' else '#78d6ca' ax.plot(*xy.T,color=color,alpha=.3+.7*(i+1)/len(chosen),lw=2.2) ax.scatter(*xy[-1],s=12,color=color,zorder=4) ax.scatter(0,0,s=40,color='#f1f5ed',zorder=5) ax.set_title(title,fontsize=13,loc='left',pad=20,color='#eff6f1') fig.text(.055,.93,'AgentFEM / MORPH LAB',color='#78d6ca',fontsize=12,weight='bold') fig.text(.055,.055,'Programmable rods · Equilibrium branches · Inverse shape design',fontsize=15,color='#f1f5ed') fig.subplots_adjust(top=.82,bottom=.15,wspace=.14,left=.055,right=.97) for root in [dataset,model]:fig.savefig(root/'assets/overview.png',dpi=140,facecolor=fig.get_facecolor()) plt.close(fig) # Only original code/data/figures enter release. Never include paper PDF, # authentication, failed-run scratch, local absolute-path execution logs. for root in [dataset,model]: hashes={str(p.relative_to(root)):hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(root.rglob('*')) if p.is_file() and p.name!='SHA256SUMS.json'} (root/'SHA256SUMS.json').write_text(json.dumps(hashes,indent=2)) print('Packaged',len(rows),'states')
if __name__=='__main__':main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104"""Conservative planar extensible rod. L=EA=1; chi=EI/(EA L^2).
Rod: linear angle FE, midpoint axial elimination. Chain: Ye et al. (2026)cell rotations, first cell clamped; kr=chi*n. Independent implementationsshare ONLY the reduced local energy density. No contact or dynamics.SPDX-License-Identifier: Apache-2.0"""from dataclasses import dataclass, asdictimport numpy as npfrom scipy.linalg import solve, eighfrom scipy.optimize import root
@dataclassclass Controls: chi: float = .001 fx: float = 0. fy: float = 0. moment: float = 0. h: float = 0. delta: float = .1 k1: float = 0. k2: float = 0. k3: float = 0.
class Rod: def __init__(self, n=48, kind="rod"): self.n, self.kind, self.ds = n, kind, 1/n if kind == "rod": self.d = n A = np.zeros((n,n+1)); B = A.copy() for i in range(n): A[i,i:i+2] = .5 B[i,i:i+2] = [-n,n] self.A,self.B = A[:,1:],B[:,1:] self.mass = (A[:,1:].T@A[:,1:])/n elif kind == "chain": self.d = n-1 self.A = np.eye(n)[:,1:] self.B = np.diff(np.eye(n),axis=0)[:,1:]*n self.mass = np.eye(n-1)/n else: raise ValueError(kind) self.s = (np.arange(n)+.5)/n
def terms(self, z, c): angle=self.A@z intrinsic=np.array([c.k1,c.k2,c.k3])[np.minimum((np.arange(self.B.shape[0])+.5)*3/self.B.shape[0],2).astype(int)] curvature=self.B@z-intrinsic a=c.fx+2*c.h f=a*np.cos(angle)+c.fy*np.sin(angle) fp=-a*np.sin(angle)+c.fy*np.cos(angle) g=4*c.h*c.delta density=-f-.5*f*f+g*np.cos(angle) energy=self.ds*(.5*c.chi*(curvature@curvature)+density.sum())-c.moment*z[-1] local_g=-(1+f)*fp-g*np.sin(angle) local_h=(1+f)*f-fp*fp-g*np.cos(angle) grad=self.ds*(c.chi*self.B.T@curvature+self.A.T@local_g) grad[-1]-=c.moment tangent=self.ds*(c.chi*self.B.T@self.B+self.A.T@(local_h[:,None]*self.A)) return energy,grad,tangent
def solve(self,c,seed=None): z=np.zeros(self.d) if seed is None else np.array(seed,dtype=float).copy() it=0; trace=[]; fallback_nfev=0 for it in range(60): _,r,K=self.terms(z,c) trace.append(dict(iteration=it,residual_inf=float(np.max(np.abs(r))))) if np.max(np.abs(r))<1e-10: break try: dz=solve(K,-r,assume_a='sym') except Exception: break old=np.linalg.norm(r) step=1. for _ in range(16): trial=z+step*dz if np.linalg.norm(self.terms(trial,c)[1])<old: break step*=.5 else: break z=trial trace[-1]['accepted_step_scale']=step residual=float(np.max(np.abs(self.terms(z,c)[1]))) if residual>1e-9: sol=root(lambda v:self.terms(v,c)[1],z,jac=lambda v:self.terms(v,c)[2],tol=1e-10) z=sol.x; fallback_nfev=sol.nfev energy,r,K=self.terms(z,c) residual=float(np.max(np.abs(r))) angle=self.A@z stretch=1+(c.fx+2*c.h)*np.cos(angle)+c.fy*np.sin(angle) admissible=bool(np.min(stretch)>(2*c.delta if c.h!=0 else 0)) good=bool(residual<1e-9 and admissible and np.all(np.isfinite(z))) eig=float(eigh(K,self.mass,subset_by_index=[0,0],eigvals_only=True)[0]/c.chi) if good else None stability='unknown' if eig is None else ('stable' if eig>1e-4 else 'unstable' if eig< -1e-4 else 'critical') segments=self.ds*stretch[:,None]*np.column_stack([np.cos(angle),np.sin(angle)]) xy=np.vstack([np.zeros(2),np.cumsum(segments,axis=0)]) # Output resampled on reference coordinate, not current arc length. center=np.column_stack([np.interp(np.linspace(0,1,65),np.linspace(0,1,self.n+1),xy[:,j]) for j in range(2)]) return dict(z=z,centerline=center,angle=angle,strain=stretch-1,energy=float(energy),residual=residual, iterations=it+1,accepted=good,lambda_min_over_chi=eig,stability=stability, tip=center[-1],min_stretch=float(stretch.min()),solver_trace=trace,fallback_nfev=fallback_nfev)
def mode_seed(self,amplitude): s=np.arange(1,self.d+1)/self.n return amplitude*np.sin(np.pi*s/2)
def serial(result): return {k:(v.tolist() if isinstance(v,np.ndarray) else v) for k,v in result.items()}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Matched ordinary/branch-conditioned MLP baselines. Grouped splits only."""import osos.environ.setdefault('OMP_NUM_THREADS','1')from pathlib import Pathimport json,timeimport numpy as npimport torchfrom torch import nnfrom safetensors.torch import save_fileROOT=Path(__file__).resolve().parents[1]torch.set_num_threads(2)
def features(c,branch=None): chi=c['chi'];a=c['fx']+2*c['h'] x=[np.log10(chi),a/chi,c['fy']/chi,c['moment']/chi,4*c['h']*c['delta']/chi,c['k1'],c['k2'],c['k3']] if branch is not None:x += [float(branch==b) for b in ['down','straight','up']] return x
def network(d):return nn.Sequential(nn.Linear(d,96),nn.Tanh(),nn.Linear(96,96),nn.Tanh(),nn.Linear(96,48))
def reconstruct(z,rows): full=np.column_stack([np.zeros(len(z)),z]);th=(full[:,1:]+full[:,:-1])/2 a=np.array([v['controls']['fx']+2*v['controls']['h'] for v in rows])[:,None] fy=np.array([v['controls']['fy'] for v in rows])[:,None] stretch=1+a*np.cos(th)+fy*np.sin(th) xy=np.stack([np.cos(th),np.sin(th)],axis=-1)*stretch[:,:,None]/48 xy=np.concatenate([np.zeros((len(z),1,2)),np.cumsum(xy,axis=1)],axis=1) return xy
def main(): rows=[json.loads(l) for l in (ROOT/'data/equilibria.jsonl').open()] splits={s:np.array([i for i,r in enumerate(rows) if r['split']==s]) for s in ['train','validation','test','parameter_ood']} truth=np.array([r['z'] for r in rows],dtype='float32') out=ROOT/'models';out.mkdir(exist_ok=True);report={} for conditioned in [False,True]: name='branch_conditioned' if conditioned else 'ordinary' torch.manual_seed(14);rng=np.random.default_rng(14) x=np.array([features(r['controls'],r['branch'] if conditioned else None) for r in rows],dtype='float32') mean=x[splits['train']].mean(0);std=x[splits['train']].std(0);std[std<1e-6]=1 X=torch.from_numpy((x-mean)/std);Y=torch.from_numpy(truth) net=network(x.shape[1]);opt=torch.optim.Adam(net.parameters(),lr=.002) best=float('inf');best_epoch=0;start=time.perf_counter() for epoch in range(401): net.train() for idx in np.array_split(rng.permutation(splits['train']),19): opt.zero_grad();loss=(net(X[idx])-Y[idx]).square().mean();loss.backward();opt.step() net.eval() with torch.no_grad():val=float((net(X[splits['validation']])-Y[splits['validation']]).square().mean()) if val<best: best=val;best_epoch=epoch;weights={k:v.clone().contiguous() for k,v in net.state_dict().items()} if epoch%100==0:print(name,epoch,'val angle MSE',val,flush=True) net.load_state_dict(weights);save_file(weights,str(out/f'{name}.safetensors')) (out/f'{name}.json').write_text(json.dumps(dict(mean=mean.tolist(),std=std.tolist(),conditioned=conditioned,architecture=[x.shape[1],96,96,48],activation='tanh',n=48,features='see inference.py / features',best_epoch=best_epoch),indent=2)) with torch.no_grad():pred=net(X).numpy() predicted=reconstruct(pred,rows);target=reconstruct(truth,rows) result={'training_seconds':time.perf_counter()-start,'best_validation_angle_mse':best,'best_epoch':best_epoch,'splits':{}} for s,idx in splits.items(): dist=np.linalg.norm(predicted[idx]-target[idx],axis=2) br=np.where(np.max(np.abs(pred[idx]),axis=1)<.01,'straight',np.where(predicted[idx,-1,1]>0,'up','down')) result['splits'][s]=dict(states=len(idx),centerline_rmse_over_L=float(np.sqrt(np.mean(dist**2))),tip_mean_error_over_L=float(np.mean(dist[:,-1])),tip_p95_error_over_L=float(np.quantile(dist[:,-1],.95)),branch_accuracy=float(np.mean(br==np.array([rows[i]['branch'] for i in idx])))) result['splits'][s]['families']={} for family in ['end_load','intrinsic_curvature','microforce']: select=np.array([rows[i]['family']==family for i in idx]) result['splits'][s]['families'][family]=dict(centerline_rmse_over_L=float(np.sqrt(np.mean(dist[select]**2))),tip_mean_error_over_L=float(np.mean(dist[select,-1]))) report[name]=result (ROOT/'reports/baselines.json').write_text(json.dumps(report,indent=2));print(json.dumps(report,indent=2))
if __name__=='__main__':main()123version https://git-lfs.github.com/spec/v1oid sha256:7795bd454c08eaaf2c93a86e54a60354337bf3e52a94c8c91d039b82811d631asize 6410565123version https://git-lfs.github.com/spec/v1oid sha256:ce1c3a1bfa3d141ee188041664e8043f611fd218612e609aa8ec090f14bae379size 4826022123version https://git-lfs.github.com/spec/v1oid sha256:60ce6d411294a8bcffe96cd893a66b8b5eb539c2cdef3fad6fa2a1a3fc55d537size 22495011123version https://git-lfs.github.com/spec/v1oid sha256:235cf1d9221fc6ffa31e20ca186ab15db2cf06ca8d575c4157eeead88b3f9f10size 483644612345678910111213141516171819202122232425"""Verify native exported fields and warp the actual negative branch."""import json,sysfrom pathlib import Pathfrom paraview.simple import OpenDataFile,UpdatePipeline,WarpByVector,Deleteroot=Path(sys.argv[1]);checks=[]for relative in ['paraview/native_agentfem_fig9.pvd','xdmf/native_agentfem_fig9.xdmf']: source=OpenDataFile(str(root/relative));UpdatePipeline(proxy=source) times=list(source.TimestepValues) assert len(times)==3 frames=[] for t in times: source.UpdatePipeline(t) assert 'U' in source.PointData.keys() # XDMF readers may expose scalar DG0 grids as blocks; the single-geometry # guarantee is specifically tested for the PVD delivery. assert 'MISES' in source.CellData.keys() assert 'MICROFORCE_POTENTIAL' in source.CellData.keys() assert source.GetDataInformation().GetNumberOfCells()==400 warp=WarpByVector(Input=source);warp.Vectors=['POINTS','U'];warp.ScaleFactor=1 warp.UpdatePipeline(t);bounds=list(warp.GetDataInformation().GetBounds()) assert bounds[2]<-.05 frames.append(dict(case_index=t,points=warp.GetDataInformation().GetNumberOfPoints(),cells=warp.GetDataInformation().GetNumberOfCells(),warped_bounds=bounds)) Delete(warp) checks.append(dict(file=relative,frames=frames));Delete(source)(root/'paraview_checks.json').write_text(json.dumps(checks,indent=2));print(json.dumps(checks,indent=2))123456789101112131415161718192021222324252627282930313233343536373839404142"""Additional same-information baseline and exact-solver timing."""from pathlib import Pathimport json,sys,timeimport numpy as npfrom scipy.spatial import cKDTreesys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src'))from train import features,reconstruct,networkfrom rod import Rod,Controlsfrom safetensors.torch import load_fileimport torchR=Path(__file__).resolve().parents[1]rows=[json.loads(l) for l in (R/'data/equilibria.jsonl').open()]train=[v for v in rows if v['split']=='train'];test=[v for v in rows if v['split']=='test']x=np.array([features(v['controls']) for v in train]);mean=x.mean(0);std=x.std(0);std[std<1e-6]=1pred=[]for v in test: allowed=np.array([t['branch']==v['branch'] for t in train]) subset=np.flatnonzero(allowed) distances=np.sum(((x[subset]-features(v['controls']))/std)**2,axis=1) pred.append(train[subset[np.argmin(distances)]]['z'])p=reconstruct(np.array(pred),test);true=reconstruct(np.array([v['z'] for v in test]),test)report={'branch_conditioned_1nn':{'centerline_rmse_over_L':float(np.sqrt(np.mean(np.sum((p-true)**2,axis=2)))),'tip_mean_error_over_L':float(np.mean(np.linalg.norm(p[:,-1]-true[:,-1],axis=1)))}}config=json.loads((R/'models/branch_conditioned.json').read_text());net=network(11);net.load_state_dict(load_file(str(R/'models/branch_conditioned.safetensors')));net.eval()sample=test[::20];xt=torch.tensor((np.array([features(v['controls'],v['branch']) for v in sample])-config['mean'])/config['std'],dtype=torch.float32)with torch.no_grad(): for _ in range(10):net(xt) start=time.perf_counter() for _ in range(100):z=net(xt) report['neural_batched_ms_per_state']=(time.perf_counter()-start)*1000/(100*len(sample))r=Rod();times=[];corr=[]for i,v in enumerate(sample): start=time.perf_counter();result=r.solve(Controls(**v['controls']),z[i].numpy());times.append(time.perf_counter()-start) corr.append(dict(id=v['id'],accepted=result['accepted'],branch_preserved=bool((v['branch']=='straight' and np.max(np.abs(result['z']))<1e-5) or (v['branch']=='up' and result['tip'][1]>1e-5) or (v['branch']=='down' and result['tip'][1]<-1e-5)),tip_error=float(np.linalg.norm(result['tip']-v['tip']))))report['corrector_median_ms']=float(1000*np.median(times));report['corrector_checks']=corrassert all(c['accepted'] and c['branch_preserved'] for c in corr)# Exact duplicate geometries can occur at zero load and on reversible sweeps;# scene-disjoint split is guaranteed, shape-disjointness is NOT claimed.report['number_scenes']=len({r['scene_id'] for r in rows})report['number_paths']=len({r['path_id'] for r in rows})report['sampled_stable_pairs']=sum(r['continuous_stable_pair'] for r in rows)(R/'reports/additional_baselines.json').write_text(json.dumps(report,indent=2))print({k:v for k,v in report.items() if k!='corrector_checks'})12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485"""Independent checks, mandatory before data publication."""import sys,jsonfrom pathlib import Pathsys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src'))from rod import Rod,Controlsimport numpy as npfrom scipy.integrate import solve_bvpfrom scipy.optimize import brentq
def run(): checks={} r=Rod(24); c=Controls(chi=.004,fx=.005,fy=.002,h=.001,k1=.3,k2=-.2,k3=.6) z=.4*np.sin(np.linspace(0,np.pi/2,r.d)); e,g,K=r.terms(z,c) eps=1e-6; eye=np.eye(r.d) gn=np.array([(r.terms(z+eps*v,c)[0]-r.terms(z-eps*v,c)[0])/(2*eps) for v in eye]) Kn=np.column_stack([(r.terms(z+eps*v,c)[1]-r.terms(z-eps*v,c)[1])/(2*eps) for v in eye]) checks['gradient_fd_max_abs']=float(np.max(np.abs(g-gn))) checks['hessian_fd_max_abs']=float(np.max(np.abs(K-Kn))) assert checks['gradient_fd_max_abs']<1e-8 and checks['hessian_fd_max_abs']<1e-8 axial=r.solve(Controls(fx=.03)) checks['axial_tip_error']=float(np.linalg.norm(axial['tip']-[1.03,0])) assert checks['axial_tip_error']<1e-12 circular=[] for n in [24,48,96]: rr=Rod(n); cc=Controls(k1=1.2,k2=1.2,k3=1.2) ans=rr.solve(cc,np.linspace(0,1.2,n+1)[1:]) exact=np.array([np.sin(1.2)/1.2,(1-np.cos(1.2))/1.2]) circular.append(float(np.linalg.norm(ans['tip']-exact))) checks['circular_tip_errors_n24_48_96']=circular assert circular[2]<circular[1]<circular[0] and circular[-1]<1e-5 rr=Rod(96); cc=Controls(chi=1e-4,h=.01,delta=.1) pc=(-1+np.sqrt(1+16*cc.h*cc.delta-np.pi**2*cc.chi))/2-2*cc.h def eig(p): cc.fx=p return rr.solve(cc)['lambda_min_over_chi'] pn=brentq(eig,pc-.001,pc+.001,xtol=1e-13) checks['critical_load_analytic']=pc; checks['critical_load_discrete_rod96']=pn checks['critical_load_error']=abs(pc-pn) assert abs(pc-pn)<1e-7 # Independent solve_bvp of paper Eqs.52-53, negative branch. Not our FE energy. errors=[]; chain_errors=[] for p in [-.017159,-.016428,-.016316]: chi,h,d=1e-4,.01,.1; a=p+2*h s=np.linspace(0,1,101) def fun(s,y): th=y[0]; stretch=1+a*np.cos(th) return np.vstack([y[1],(a*stretch-4*h*d)*np.sin(th)/chi,stretch*np.cos(th),stretch*np.sin(th)]) def bc(l,r): return [l[0],r[1],l[2],l[3]] candidates=[] for amp in [-.3,-1.,-2.]: y=np.vstack([amp*np.sin(np.pi*s/2),amp*np.pi/2*np.cos(np.pi*s/2),s,amp*s*s/2]) b=solve_bvp(fun,bc,s,y,tol=1e-9,max_nodes=10000) if b.success and b.y[3,-1]<-1e-3: candidates.append(b) assert candidates b=min(candidates,key=lambda b:abs(b.y[0,-1])) target=b.sol(np.linspace(0,1,65))[2:4].T c=Controls(chi=chi,h=h,delta=d,fx=p) arod=Rod(96); out=arod.solve(c,b.sol(np.linspace(0,1,97))[0,1:]) assert out['accepted'] and out['tip'][1]<0 and out['stability']=='stable' errors.append(float(np.sqrt(np.mean(np.sum((out['centerline']-target)**2,axis=1))))) one=[] for n in [15,30,60,120]: rc=Rod(n,'chain'); v=rc.solve(c,b.sol(np.arange(1,n)/n)[0]) assert v['accepted'] and v['tip'][1]<0 one.append(float(np.linalg.norm(v['tip']-target[-1]))) assert one[-1]<one[0] chain_errors.append(one) checks['fig9_rod96_centerline_rmse_over_L']=errors checks['fig9_chain_tip_errors_n15_30_60_120']=chain_errors assert max(errors)<.001 # Exact chain linear critical load verifies the independently assembled hinge boundary. rc=Rod(15,'chain'); c=Controls(chi=1e-4,h=.01) omega2=4*np.sin(np.pi/(2*(2*15-1)))**2 expected=(-1+np.sqrt(1-4*c.chi*15**2*omega2+16*c.h*c.delta))/2-2*c.h c.fx=expected; v=rc.solve(c) checks['chain_critical_eigenvalue']=v['lambda_min_over_chi'] assert abs(v['lambda_min_over_chi'])<1e-8 checks['passed']=True return checks
if __name__=='__main__': checks=run() p=Path(__file__).resolve().parents[1]/'reports/validation.json' p.write_text(json.dumps(checks,indent=2)) print(json.dumps(checks,indent=2))123version https://git-lfs.github.com/spec/v1oid sha256:68a217ba0ad15b5a6bc5119b61577eddd7e6126f6edd2fa6acbb3d07d50615cdsize 8681501[]LICENSE-CODEAdded+159
LICENSE-DATAAdded+8
README.mdAdded+163
SCHEMA.mdAdded+127
SHA256SUMS.jsonAdded+45
assets/overview.pngAdded

Large File Pointer Details
- SHA256: 844ed9eef3ca4f32b13513bfe21de96f27d4ef5113a07bad7117556d15d9fa52
- Pointer size: 130 Bytes
- Size of remote file: 96.2 kB
cases/fig9/agentfem.tomlAdded+8
cases/fig9/case.pyAdded+369
cases/fig9/paper_reference.pyAdded+107
native_fe/figures/native_agentfem_vs_paper.pngAdded

Large File Pointer Details
- SHA256: aab6e9ddc1d9624e726319b555f77163a944eee2261b00f728990b6584cd5c6d
- Pointer size: 131 Bytes
- Size of remote file: 266 kB
native_fe/native_fe_metrics.csvAdded+4
native_fe/paraview/native_agentfem_fig9.pvdAdded+8
native_fe/paraview/native_agentfem_fig9000000.pvtuAdded+20
native_fe/paraview/native_agentfem_fig9000001.pvtuAdded+20
native_fe/paraview/native_agentfem_fig9000002.pvtuAdded+20
native_fe/paraview/native_agentfem_fig9_p0_000000.vtuAdded
native_fe/paraview/native_agentfem_fig9_p0_000001.vtuAdded
native_fe/paraview/native_agentfem_fig9_p0_000002.vtuAdded
native_fe/paraview_checks.jsonAdded+90
native_fe/scientific/p2_coefficients.h5Added+3
native_fe/xdmf/native_agentfem_fig9.h5Added+3
native_fe/xdmf/native_agentfem_fig9.xdmfAdded+61
reports/additional_baselines.jsonAdded+625
reports/baselines.jsonAdded+184
reports/environment.jsonAdded+11
reports/generation.jsonAdded+30
reports/inverse_checks.jsonAdded
reports/validation.jsonAdded+40
requirements.txtAdded+6
src/generate.pyAdded+98
src/inference.pyAdded+27
src/inverse.pyAdded+41
src/package.pyAdded+68
src/rod.pyAdded+104
src/train.pyAdded+68
states/parameter_ood.jsonl.gzAdded+3
states/test.jsonl.gzAdded+3
states/train.jsonl.gzAdded+3
states/validation.jsonl.gzAdded+3
tests/check_paraview.pyAdded+25
tests/evaluate_release.pyAdded+42
tests/validate.pyAdded+85
validation/paired_resolution.jsonl.gzAdded+3
validation/rejected_attempts.jsonAdded+1