Skip to content

ricardo0115/StressLSTM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LSTM Stress Prediction from Strain Sequences

This project is a minimal implementation in PyTorch of the LSTM-based approach for stress prediction described in the paper:

FE-LSTM: A hybrid approach to accelerate multiscale simulations of architectured materials using Recurrent Neural Networks and Finite Element Analysis

It demonstrates how to train a recurrent neural network (LSTM) to predict stress tensors from sequences of strain values in a 2D case, using PyTorch.


📖 Reference & Inspiration

This work is inspired by the following research article:

Aymen Danoun, Etienne Prulière, Yves Chemisky (2024) FE-LSTM: A hybrid approach to accelerate multiscale simulations of architectured materials using Recurrent Neural Networks and Finite Element Analysis Computer Methods in Applied Mechanics and Engineering, Volume 429, 117192 https://doi.org/10.1016/j.cma.2024.117192

This paper introduces FE-LSTM, a method combining Finite Element Analysis with Recurrent Neural Networks to efficiently simulate architectured materials at multiple scales.


📂 Project Structure


├── lstm_example.py           # Core model and training logic
├── example_utils.py          # Data loading and plotting utilities
├── datasets/
│   ├── train_dataset.csv     # Training dataset
│   └── test_dataset.csv      # Test dataset
└── README.md


📦 Installation

🔧 1. Create a Conda Environment (Recommended)

conda create -n lstm-env python=3.12
conda activate lstm-env

📥 2. Install Required Packages

pip install torch pandas matplotlib

🚀 Running the Code

Once dependencies are installed, simply run:

python lstm_example.py

This will:

  • Load training and test data from datasets/train_dataset.csv and datasets/test_dataset.csv
  • Train the LSTM model
  • Evaluate the model on the test set
  • Optionally show plots comparing predictions vs ground truth

📊 Dataset Format

Datasets corresponding to FE simulation, using a 2D hole plate case using an Elasto-plastic constitutive power law. Mean strain and mean stress data are stored in the datasets/ folder and include:

  • Input features: total_strain_xx, total_strain_yy, total_strain_xy
  • Target outputs: stress_xx, stress_yy, stress_xy
  • Sequence ID: simulation_load_id (used to group sequence samples)
  • Timestep: with initial timesteps typically excluded

🧠 Model Overview

  • Model: Multi-layer LSTM with a linear projection head
  • Input: Sequences of strain values (T, 3)
  • Output: Sequences of predicted stress values (T, 3)
  • Loss: Mean Squared Error (MSE)

📈 Visualization Tools

Included in example_utils.py:

  • Plot stress–strain curves for each tensor component in separate subplots
  • Plot predicted vs true strain-stress curves for comparison
  • Plot training/testing loss curves for monitoring

💡 Contributing

Feel free to open issues, submit pull requests, or suggest improvements!


About

Minimal implementation in PyTorch of the LSTM-based approach for stress prediction described in the paper: FE-LSTM: A hybrid approach to accelerate multiscale simulations of architectured materials using Recurrent Neural Networks and Finite Element Analysis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages