Skip to content

ReachOptimum/mlpcp-interp-num

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

160 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mlpcp-interp-num

Machine Learning for Prediction of Constitutive Parameters - Interpolation study with numerical application.

In a nutshell, an interpolation study is performed in the present work, with the purpose of getting ML models independent on the mesh (in case of numerical) or subset (in case of DIC) discretisation scheme, for material parameter prediciton.

📌 A more recent code forked from this repo is used as a follow-up of the current work, testing the proposed approach on experimental DIC data to confirm the practical applicability.

📄 Reference

This repository contains the code used in the work published as:

D. Mitreiro, P. A. Prates, and A. Andrade-Campos,
"Reducing Mesh Dependency in Dataset Generation for Machine Learning Prediction of Constitutive Parameters in Sheet Metal Forming,"
Metals, vol. 15, no. 5, article 534, 2025.
DOI: 10.3390/met15050534

If you use this repository, please cite this paper.

⚙️ Setup

Clone

Open a terminal, change your current working directory to the location where you want the cloned directory, then clone this repository using the URL from the green Code button above.

For example:

git clone <repository-url>

Environment

Next, install Anaconda (or any other you prefer) for managing your Python environments. You can check documentation here.

After the installation, create an empty environment using Python 3.11.10

conda create --name <your_env_name> python=3.11.10
conda activate <your_env_name>

Then, navigate to your repository home folder and install dependencies

pip install -r requirements.txt

🚀 How it works

The methodology of this work is separated into the following steps.

📌 Note: If you already have the dataset, you can skip directly to step 2. Otherwise, the dataset is available upon request from the authors.

1. Abaqus simulations according to Latin Hypercube Sampling (LHS) DOE

📌 Since Abaqus is Windows-only software, the scripts inside the abaqus folder are meant to be run in a Windows environment.

To generate Abaqus samples, run cruciform.py script within abaqus folder

abaqus cae noGUI=cruciform.py

You will also need to get mesh element coordinates. To do that:

  • Open Abaqus and run model_creation.py to create the cruciform-shaped speicmen with defined mesh
  • Then, run centroids.py to extract the coordinates for each centroid
  • Optionally, you can run extract_nodes.py to get the nodes of each mesh element and the coordinates of each node.

At the end of this step, copy all the content from abaqus/data/regular_mesh to data/raw folder.

2. Compile the samples into single feature (x) and target (y) datasets with csv_compile.py

📌 Note: If you skipped step 1 because you already have the dataset, then copy all the content from the .zip archive to the data/raw folder.

📌 From now on, scripts must be always executed from the home folder, so defined paths inside scripts work as expected.

As an example, let's say we want to execute some random_script.py inside src folder. Then, from the home folder, we run

python src/random_script.py

3. Data processing with data_filter.py

This script:

  • Filters the samples by force, i.e. $F_{xx,19}$ must not be greater than $F_{yy,20}$, otherwise the sample is ignored
  • Shuffles all the samples
  • Separates the dataset into train and test

4. Dataset interpolation using multiple grids and methods mesh_interp.py

A way to check the robustness of the interpolation method, is to perform a reverse intepolation (reverse_interp.py) back to the original mesh and test the accuracy.

5. XGBoost train and evaluation with train.py and test.py, respectively

📌 Additionally, you can run train_ori.py and test_ori.py to train and test (respectively) an XGBoost model with original data, ie., without any interpolation. It will be usefull later in this study, to perform a comparison with other models.

6. Case study: synthetic DIC approach

6.1. Choose a random test sample

In this case, the chosen sample is 0.2495_0.1922_0.8078_1.5_1.5_2.3281_160.84_671.78_0.218.csv. Copy this sample from data/raw to data/raw/synthetic_dic folder.

6.2. "Compilation" using csv_compile.py

📌 Before running, do the following modifications in script in order to change the paths:

  • comment lines 13-16
  • uncomment lines 19-22

6.3. Data processing using dic_data_filter.py

6.4. Multiquadric interpolation to the speckle pattern with 5000 points followed by interpolation to 30 x 30 grid using dic_interp.py

6.5. Parameter prediction for the synthetic DIC sample using dic_predict.py

6.6. Comparison between true parameters and the ones predicted by original model and multiquadric model with DIC sample, using dic_comparison.py

  • The obtained results are in metrics
  • XGBoost models and scalers can be found in models
  • Some plots can be performed using the plot scripts in plots
  • All the images generated by plot scripts can be found in images

⚖️ License

This work was developed within ReachOptimum@TEMA research group, University of Aveiro, and is licensed under the MIT License, which allows anyone to use, modify, and distribute this software for free, as long as the original copyright and license notice are included. See the LICENSE file for more details.

About

Study of interpolation applied to datasets on ML for predicting constitutive parameters.

Topics

Resources

License

Stars

Watchers

Forks

Contributors