>[!warning] >This content has not been peer reviewed. # Tensile Test — Code Script: `rst_tensile_test.py`. ## Purpose Computes the uniaxial stress-strain curve from the RST **inverted fidelity** equation: $\sigma(\varepsilon) = E\,\varepsilon \times \mu\!\left(\frac{N}{\varepsilon},\, n\right)$ where N is the substrate rendering capacity (saturation threshold) and n is the effective lattice connectivity (transition sharpness). The script verifies Hooke's law (elastic limit), identifies yield (0.2% offset) and ultimate strength, and supports three analysis modes: 1. **Single material** (default): compute and plot one curve. 2. **Discovery fit** (`--discovery`): fit N, n for 17 pure metals; compare to Ramberg-Osgood; analyze crystal-structure correlations. 3. **Temperature check** (`--temperature`): fit N, n for Cu (FCC) and Fe (BCC) at 6 temperatures each; verify topology invariance vs thermal dependence. 4. **Shape comparison** (`--shapes`): overlay RST and R-O full curves for 7 selected metals; compute R², RMSE, and identify the discriminating strain range. 5. **Experimental validation** (`--validate`): fit RST and R-O to complete experimental stress-strain curves from three open-access datasets (Mendeley Al 6061-T651, KupferDigital brass, NIST Al 6061-T6 compression); report full-curve R² and RMSE. ## Engine Uses `mu_rst(eta, n)` from `rst_engine.core` with the inverted argument η = N/ε. The corrected model directly computes σ = Eε × μ(N/ε, n) without iterative root-finding (vectorized). The original gravity-sector function `solve_omega` is retained for the legacy `--batch` mode. ## Parameters - **E (Pa):** Young's modulus. From Materials Project (elasticity: K, G → E) when API key is set and `--material` is given; else default 200 GPa. - **N:** Substrate rendering capacity (dimensionless, strain units). Higher N → higher saturation stress. Approximately σ_u/E. - **n:** Effective lattice connectivity / transition sharpness. Low n (≈0.35) = gradual FCC-type transition; high n (≈1.0) = sharp BCC-type yield. - **--material:** Materials Project ID (default `mp-134` Al). - **--fit, --target-yield-mpa, --target-ultimate-mpa:** Fit N, n to match target yield and ultimate. ## Built-in data ### MATERIAL_DATABASE (17 ductile metals) Annealed pure metals at room temperature. Sources: ASM Handbooks, MatWeb. Includes formula, crystal structure (FCC/BCC/HCP), coordination number, melting point, E, σ_y, σ_u. Brittle semiconductors (Si, C-diamond, Ge) excluded. ### Temperature data (Cu, Fe) 6 temperature points each (77–673 K) with E(T), σ_y(T), σ_u(T) from ASM/NIST cryogenic references. ## Output ### Single material mode - `tensile_test.png`: stress vs strain with yield and ultimate markers. - `tensile_test_rst_vs_classical.png`: RST curve vs Hooke line. ### Discovery mode (`--discovery`) - `tensile_discovery_correlations.png`: three-panel figure (N vs T/Tₘ, n vs crystal structure, RST vs R-O loss). - `tensile_discovery_results.csv`: full results table. - Console: per-material fits, crystal-type averages, Spearman correlation. ### Temperature mode (`--temperature`) - `tensile_temperature_check.png`: four-panel figure (N(T) and n(T) for Cu and Fe). - Console: per-temperature fits, summary statistics. ### Shape comparison mode (`--shapes`) - `tensile_shape_comparison.png`: two-row panels per material — top: overlaid RST (colored) and R-O (gray) curves; bottom: residual (RST − R-O) in MPa with peak-deviation marker. - Console: per-material R², RMSE, max deviation strain. ### Experimental validation mode (`--validate`) - `tensile_validation_experimental.png`: multi-panel figure with experimental data (dots), RST fit (solid), and R-O fit (dashed), plus residual panels. - Console: per-specimen R² and RMSE for both models, summary statistics per dataset. - Requires experimental data in `experimental_data/` subfolders (see README.md in each folder for download instructions). ### Batch mode (`--batch`) - `tensile_test_20materials_rst_vs_classical.png`: RST vs classical for up to 20 materials (requires MP API key). Uses the legacy solve_omega model. ## Run From workspace root: ``` # Single material (default) python "expanded theory applied/further applications/Tensile Test/rst_tensile_test.py" # Discovery fit: 17 metals, crystal-structure correlation python "expanded theory applied/further applications/Tensile Test/rst_tensile_test.py" --discovery # Temperature check: Cu (FCC) + Fe (BCC) at 6 temperatures python "expanded theory applied/further applications/Tensile Test/rst_tensile_test.py" --temperature # With Materials Project API python "expanded theory applied/further applications/Tensile Test/rst_tensile_test.py" --material mp-134 # Shape comparison: RST vs R-O curve shapes for 7 metals python "expanded theory applied/further applications/Tensile Test/rst_tensile_test.py" --shapes # Experimental validation (requires data in experimental_data/ folders) python "expanded theory applied/further applications/Tensile Test/rst_tensile_test.py" --validate --eps-max 0.10 # Batch (20 materials from MP, legacy model) python "expanded theory applied/further applications/Tensile Test/rst_tensile_test.py" --batch # Fit N, n to match targets python "expanded theory applied/further applications/Tensile Test/rst_tensile_test.py" --material mp-13 --fit --target-yield-mpa 250 --target-ultimate-mpa 300 ``` ## Experimental data (kept out of git) The `--validate` mode reads experimental stress-strain curves from `experimental_data/` subfolders. Raw data files are excluded via `.gitignore`; each folder contains a `README.md` with the download URL, DOI, and license. | Subfolder | Dataset | DOI | |:---|:---|:---| | `mendeley_al6061/` | Al 6061-T651, 9 lots, 6 temperatures | [10.17632/rd6jm9tyb6.2](https://doi.org/10.17632/rd6jm9tyb6.2) | | `nist_al6061_compression/` | Al 6061-T6, dynamic compression | [10.18434/mds2-3090](https://doi.org/10.18434/mds2-3090) | | `kupfer_copper/` | CuZn38As brass, tensile | [10.5281/zenodo.10820299](https://doi.org/10.5281/zenodo.10820299) | To reproduce: download each dataset from the DOI link above, extract into the corresponding subfolder, then run `--validate`. ## Materials Project API (key kept out of git) - Install: `pip install mp-api`. - API key is **never committed**. Two options: 1. **Recommended:** Copy `Tensile Test/.env.example` to `Tensile Test/.env`, paste your key: `MP_API_KEY=your_key`. The file `.env` is in `.gitignore`. 2. Or set env var `MP_API_KEY` or `MAPI_KEY` before running. - Script reads key from env first, then from `Tensile Test/.env` if present. ## Dependencies - `numpy`, `matplotlib`, `scipy` (core). - `mp-api` (optional, for Materials Project integration). - `rst_engine` (workspace package: `mu_rst`, `solve_omega`).