# elejeune11/mechanical-mnist architecture

> Architecture diagram of the GitHub repository elejeune11/mechanical-mnist, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/elejeune11/mechanical-mnist
- Repository: https://github.com/elejeune11/mechanical-mnist

## Overview

Mechanical-MNIST is a benchmark dataset and research-code repository for simulating heterogeneous materials and building metamodels from MNIST bitmaps. The main workflow maps bitmaps to material properties, runs finite-element simulations, prepares data, trains models, and evaluates or visualizes predictions. The README also documents four loading scenarios and outputs for strain energy, reaction force, and displacement. Source excerpts show parts of the simulation, preparation, training, and plotting code; links among unsampled components are included only where the README documents them.

Main entry points: [`data/mnist_img_train.txt.zip`](https://github.com/elejeune11/mechanical-mnist/blob/master/data/mnist_img_train.txt.zip) (MNIST bitmaps), [`data/summary_psi_train_all.txt`](https://github.com/elejeune11/mechanical-mnist/blob/master/data/summary_psi_train_all.txt) (FEA results), [`create_metamodels`](https://github.com/elejeune11/mechanical-mnist/tree/master/create_metamodels) (Model outputs), [`generate_dataset/Uniaxial_Extension_FEA_train_FEniCS.py`](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Uniaxial_Extension_FEA_train_FEniCS.py) (Uniaxial train FEA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Finite-element simulations"]
  node_sim_uniax_train["Uniaxial train FEA"]
  node_sim_uniax_test["Uniaxial test FEA"]
  node_sim_biax_train["Equibiaxial train FEA"]
  node_sim_biax_test["Equibiaxial test FEA"]
  node_sim_comp_train["Compression train FEA"]
  node_sim_comp_test["Compression test FEA"]
  node_sim_shear_train["Shear train FEA"]
  node_sim_shear_test["Shear test FEA"]
  node_simulation_results[("FEA results")]
end

subgraph group_data["Dataset preparation"]
  node_inputs[("MNIST bitmaps")]
  node_prepare["Prepare model inputs"]
  node_prepared_data[("Prepared arrays")]
end

subgraph group_models["Metamodels"]
  node_fnn["Energy FNN"]
  node_cnn["Energy CNN"]
  node_predict["PyTorch predictions"]
  node_disp_mlpr["Displacement MLPR"]
  node_bitmap_mlpr["Bitmap MLPR"]
  node_model_outputs[("Model outputs")]
end

subgraph group_analysis["Evaluation and plots"]
  node_energy_error["Energy error plots"]
  node_full_field["Full-field plots<br/>[plot_full_field.py]"]
end

node_researcher(("Researcher"))

node_researcher -.->|"runs"| node_sim_uniax_train
node_researcher -.->|"runs"| node_sim_uniax_test
node_inputs -.->|"defines material"| node_sim_uniax_train
node_inputs -.->|"defines material"| node_sim_uniax_test
node_inputs -.->|"defines material"| node_sim_biax_train
node_inputs -.->|"defines material"| node_sim_biax_test
node_inputs -.->|"defines material"| node_sim_comp_train
node_inputs -.->|"defines material"| node_sim_comp_test
node_inputs -.->|"defines material"| node_sim_shear_train
node_inputs -.->|"defines material"| node_sim_shear_test
node_sim_uniax_train -.->|"produces"| node_simulation_results
node_sim_uniax_test -.->|"produces"| node_simulation_results
node_sim_biax_train -.->|"produces"| node_simulation_results
node_sim_biax_test -.->|"produces"| node_simulation_results
node_sim_comp_train -.->|"produces"| node_simulation_results
node_sim_comp_test -.->|"produces"| node_simulation_results
node_sim_shear_train -.->|"produces"| node_simulation_results
node_sim_shear_test -.->|"produces"| node_simulation_results
node_simulation_results -.->|"loads results"| node_prepare
node_inputs -.->|"loads bitmaps"| node_prepare
node_prepare -->|"saves arrays"| node_prepared_data
node_prepared_data -->|"trains on"| node_fnn
node_prepared_data -->|"trains on"| node_cnn
node_prepared_data -->|"loads arrays"| node_predict
node_prepared_data -.->|"trains on"| node_disp_mlpr
node_prepared_data -.->|"trains on"| node_bitmap_mlpr
node_fnn -.->|"writes predictions"| node_model_outputs
node_cnn -.->|"writes predictions"| node_model_outputs
node_predict -->|"saves predictions"| node_model_outputs
node_disp_mlpr -.->|"writes predictions"| node_model_outputs
node_bitmap_mlpr -.->|"writes predictions"| node_model_outputs
node_model_outputs -->|"compares energy"| node_energy_error
node_model_outputs -->|"plots fields"| node_full_field

click node_inputs "https://github.com/elejeune11/mechanical-mnist/blob/master/data/mnist_img_train.txt.zip"
click node_sim_uniax_train "https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Uniaxial_Extension_FEA_train_FEniCS.py"
click node_sim_uniax_test "https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Uniaxial_Extension_FEA_test_FEniCS.py"
click node_sim_biax_train "https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Equibiaxial_Extension_FEA_train_FEniCS.py"
click node_sim_biax_test "https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Equibiaxial_Extension_FEA_test_FEniCS.py"
click node_sim_comp_train "https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Confined_Compression_FEA_train_FEniCS.py"
click node_sim_comp_test "https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Confined_Compression_FEA_test_FEniCS.py"
click node_sim_shear_train "https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Shear_FEA_train_FEniCS.py"
click node_sim_shear_test "https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Shear_FEA_test_FEniCS.py"
click node_simulation_results "https://github.com/elejeune11/mechanical-mnist/blob/master/data/summary_psi_train_all.txt"
click node_prepare "https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/set_up_input_data.py"
click node_prepared_data "https://github.com/elejeune11/mechanical-mnist/tree/master/create_metamodels"
click node_fnn "https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/nn_regress_psi_fnn.py"
click node_cnn "https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/nn_regress_psi_cnn.py"
click node_predict "https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/pytorch_model_make_predictions.py"
click node_disp_mlpr "https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/predict_disp_MLPR.py"
click node_bitmap_mlpr "https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/predict_bitmap_MLPR.py"
click node_energy_error "https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/plot_nn_error_regress_psi.py"
click node_full_field "https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/plot_full_field.py"
click node_model_outputs "https://github.com/elejeune11/mechanical-mnist/tree/master/create_metamodels"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sim_uniax_train,node_sim_uniax_test,node_sim_biax_train,node_sim_biax_test,node_sim_comp_train,node_sim_comp_test,node_sim_shear_train,node_sim_shear_test,node_simulation_results toneBlue
class node_inputs,node_prepare,node_prepared_data toneAmber
class node_fnn,node_cnn,node_predict,node_disp_mlpr,node_bitmap_mlpr,node_model_outputs toneMint
class node_energy_error,node_full_field toneRose
class node_researcher toneIndigo
```

## Components

### Finite-element simulations

- [Uniaxial train FEA](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Uniaxial_Extension_FEA_train_FEniCS.py): `generate_dataset/Uniaxial_Extension_FEA_train_FEniCS.py`
- [Uniaxial test FEA](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Uniaxial_Extension_FEA_test_FEniCS.py): `generate_dataset/Uniaxial_Extension_FEA_test_FEniCS.py`
- [Equibiaxial train FEA](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Equibiaxial_Extension_FEA_train_FEniCS.py): `generate_dataset/Equibiaxial_Extension_FEA_train_FEniCS.py`
- [Equibiaxial test FEA](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Equibiaxial_Extension_FEA_test_FEniCS.py): `generate_dataset/Equibiaxial_Extension_FEA_test_FEniCS.py`
- [Compression train FEA](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Confined_Compression_FEA_train_FEniCS.py): `generate_dataset/Confined_Compression_FEA_train_FEniCS.py`
- [Compression test FEA](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Confined_Compression_FEA_test_FEniCS.py): `generate_dataset/Confined_Compression_FEA_test_FEniCS.py`
- [Shear train FEA](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Shear_FEA_train_FEniCS.py): `generate_dataset/Shear_FEA_train_FEniCS.py`
- [Shear test FEA](https://github.com/elejeune11/mechanical-mnist/blob/master/generate_dataset/Shear_FEA_test_FEniCS.py): `generate_dataset/Shear_FEA_test_FEniCS.py`
- [FEA results](https://github.com/elejeune11/mechanical-mnist/blob/master/data/summary_psi_train_all.txt): `data/summary_psi_train_all.txt`

### Dataset preparation

- [MNIST bitmaps](https://github.com/elejeune11/mechanical-mnist/blob/master/data/mnist_img_train.txt.zip): `data/mnist_img_train.txt.zip`
- [Prepare model inputs](https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/set_up_input_data.py): `create_metamodels/set_up_input_data.py`
- [Prepared arrays](https://github.com/elejeune11/mechanical-mnist/tree/master/create_metamodels): `create_metamodels`

### Metamodels

- [Energy FNN](https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/nn_regress_psi_fnn.py): `create_metamodels/nn_regress_psi_fnn.py`
- [Energy CNN](https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/nn_regress_psi_cnn.py): `create_metamodels/nn_regress_psi_cnn.py`
- [PyTorch predictions](https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/pytorch_model_make_predictions.py): `create_metamodels/pytorch_model_make_predictions.py`
- [Displacement MLPR](https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/predict_disp_MLPR.py): `create_metamodels/predict_disp_MLPR.py`
- [Bitmap MLPR](https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/predict_bitmap_MLPR.py): `create_metamodels/predict_bitmap_MLPR.py`
- [Model outputs](https://github.com/elejeune11/mechanical-mnist/tree/master/create_metamodels): `create_metamodels`

### Evaluation and plots

- [Energy error plots](https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/plot_nn_error_regress_psi.py): `create_metamodels/plot_nn_error_regress_psi.py`
- [Full-field plots](https://github.com/elejeune11/mechanical-mnist/blob/master/create_metamodels/plot_full_field.py): `create_metamodels/plot_full_field.py`

### Other components

- **Researcher**

## Connections

- Researcher → Uniaxial train FEA: runs
- Researcher → Uniaxial test FEA: runs
- MNIST bitmaps → Uniaxial train FEA: defines material (evidence: `README.md`)
- MNIST bitmaps → Uniaxial test FEA: defines material (evidence: `README.md`)
- MNIST bitmaps → Equibiaxial train FEA: defines material (evidence: `README.md`)
- MNIST bitmaps → Equibiaxial test FEA: defines material (evidence: `README.md`)
- MNIST bitmaps → Compression train FEA: defines material (evidence: `README.md`)
- MNIST bitmaps → Compression test FEA: defines material (evidence: `README.md`)
- MNIST bitmaps → Shear train FEA: defines material (evidence: `README.md`)
- MNIST bitmaps → Shear test FEA: defines material (evidence: `README.md`)
- Uniaxial train FEA → FEA results: produces (evidence: `README.md`)
- Uniaxial test FEA → FEA results: produces (evidence: `README.md`)
- Equibiaxial train FEA → FEA results: produces (evidence: `README.md`)
- Equibiaxial test FEA → FEA results: produces (evidence: `README.md`)
- Compression train FEA → FEA results: produces (evidence: `README.md`)
- Compression test FEA → FEA results: produces (evidence: `README.md`)
- Shear train FEA → FEA results: produces (evidence: `README.md`)
- Shear test FEA → FEA results: produces (evidence: `README.md`)
- FEA results → Prepare model inputs: loads results (evidence: `README.md`)
- MNIST bitmaps → Prepare model inputs: loads bitmaps (evidence: `README.md`)
- Prepare model inputs → Prepared arrays: saves arrays (evidence: `create_metamodels/set_up_input_data.py`)
- Prepared arrays → Energy FNN: trains on (evidence: `create_metamodels/nn_regress_psi_fnn.py`)
- Prepared arrays → Energy CNN: trains on (evidence: `create_metamodels/nn_regress_psi_cnn.py`)
- Prepared arrays → PyTorch predictions: loads arrays (evidence: `create_metamodels/pytorch_model_make_predictions.py`)
- Prepared arrays → Displacement MLPR: trains on (evidence: `README.md`)
- Prepared arrays → Bitmap MLPR: trains on (evidence: `README.md`)
- Energy FNN → Model outputs: writes predictions (evidence: `README.md`)
- Energy CNN → Model outputs: writes predictions (evidence: `README.md`)
- PyTorch predictions → Model outputs: saves predictions (evidence: `create_metamodels/pytorch_model_make_predictions.py`)
- Displacement MLPR → Model outputs: writes predictions (evidence: `README.md`)
- Bitmap MLPR → Model outputs: writes predictions (evidence: `README.md`)
- Model outputs → Energy error plots: compares energy (evidence: `create_metamodels/plot_nn_error_regress_psi.py`)
- Model outputs → Full-field plots: plots fields (evidence: `create_metamodels/plot_full_field.py`)
