Adaptnet is a Python pipeline to predict mesh adaptation to a physical problem, given an initial CAD and boundary conditions.
This pipeline relies on:
- Meshnet network for predicting mesh parameters given a CAD model.
- Graphnet network for predicting the solution of a PDE given a mesh.
Both models are based on the PyTorch Geometric library. And both networks are based on the MeshGraphNets architecture.
conda env create -f src/envs/adaptnet_no_builds.yml
conda activate adaptnetDownload the Meshnet and Graphnet repositories in the same folder as Adaptnet:
git clone https://github.com/UgoPelissier/meshnet.git
git clone https://github.com/UgoPelissier/graphnet.gitYour folder should look like this:
├── .vscode
├── graphnet
├── meshnet
├── scripts
├── src
├── .gitignore
└── README.md
Follow the instructions in the README.md files of Meshnet and Graphnet to download the data and train the models. This will generate checkpoint files in the meshnet/logs/version_$VERSION_NUMBER/checkpoints and graphnet/logs/version_$VERSION_NUMBER/checkpoints folders.
Alternatively, if you already have the datasets, you can use the scripts in scripts to train and test the models:
bash ./scripts/meshnet/train.sh
bash ./scripts/meshnet/test.shbash ./scripts/graphnet/train.sh
bash ./scripts/graphnet/test.shFor testing, you can change the --checkpoint variable to the path of the checkpoint you want to test inside the test.sh file.
Create a data folder in src:
mkdir src/dataand put your CAD file inside it. For instance, src folder could look like this:
└── src
├── configs
└── data
└── cad_500
├── cad_500.geo_unrolled
└── cad_500.geo
├── envs
├── utils
├── __init__.py
├── main.py
└── dataset.py
Open the src/configs/config.yaml file, check, and change the parameters marked with # TODO if needed.
Then, run Adaptnet:
bash ./scripts/predict.sh env=$ENV_NAME (mines or safran)