Skip to content

bertoldi-collab/DifFlexMM

Repository files navigation

DifFlexMM

Made with Python Python tests Paper DOI arXiv GitHub license Hits

Differentiable Flexible Mechanical Metamaterials

movie_s3_astronaut_light.mp4

🌅 Why DifFlexMM?

🚀 The goal of this framework is to push the boundary of designable dynamic behaviors achievable by nonlinear mechanical metamaterials.

🤖 Through the power of differentiable simulations, the framework removes the typical limitations of metamaterial design e.g. periodicity, intuition-based design, manual tuning, single-task design, etc., and enables the automated discovery of non-periodic, multi-functional, and reprogrammable metamaterials in the nonlinear dynamic regime.

🚁 Overview

This repository provides a fully differentiable dynamic design framework for 2D flexible mechanical metamaterials i.e. a network of rigid units connected by flexible ligaments. The main physical ingredients of the model are:

  • 🥌 Rigid-body kinematics of the units.
  • 🎈 Elastic ligaments modeled by customizable energy functions.
  • 💥 Energy-based contact interactions between rigid units.

With these ingredients, flexible mechanical metamaterials define a rich space of nonlinear dynamic behaviors that can be navigated by the framework.

🔭 From a high-level perspective, the framework facilitates the construction of the mapping between design parameters and the desired behavior of the metamaterial system.

Code mapping

By leverging JAX, this complex mapping is implemented in a differentiable fashion, thus allowing gradients to flow through the entire dynamic simulation. In particular, differentiability is provided with respect to:

  • Geometric paramaters: arbitrary parametrizations can be defined in the geometry module.
  • Ligament paramaters: energy functions can be defined in the energy module.
  • Damping parameters: linear viscous damping as defined in the loading module.
  • Driving parameters: arbitrary driving functions can be applied to any degree of freedom.
  • Loading parameters: arbitrary loading functions can be applied to any degree of freedom.
  • Initial conditions: initial positions and velocities of the system.
  • and any other paramater present in the ControlParams data structure.

The main entry point of the simulator is the setup_dynamic_solver(...) in the dynamics module. This function takes all the fixed mappings (geometry, energy, loading, etc.) and returns a differentiable function that simulates the metamaterial dynamics. Arbitrary forward problems can be defined by chaining this simulator function with any desired objective function.

📜 Paper

This repository contains all the code developed for the paper:

G. Bordiga, E. Medina, S. Jafarzadeh, C. Boesch, R. P. Adams, V. Tournat, K. Bertoldi. Automated discovery of reprogrammable nonlinear dynamic metamaterials. Nature Materials. (2024).

🎯 Solved design problems

The framework has been used to design a variety of mechanical metamaterials with different functionalities.

Task/tasks description Notebooks Data 💾 Video
🌟 Focusing energy at a single target location Quads, Kagome Quads, Kagome Quads, Kagome
️🗡️ Splitting energy between different target locations Quads Quads Quads
Focusing multiple inputs at the same target location Quads Quads Quads
️💫 Reprogramming focusing target via static pre-compression Quads Quads Quads
🌟🛡️ Switching between focusing and protection task Quads Quads Quads
🌀 Nonlinear motion conversion Quads Quads Quads

💾 All data generated or used for the paper can be downloaded from DOI. To access and visualize the data:

  • Extract data.zip in the root directory of the repository.
  • Load and visualize optimization results for all the solved problems using the provided notebooks.
  • Load and visualize experimental data using the notebooks in the exp folder.

⬇️ Installation

DifFlexMM only

Assuming you have access to the repo and ssh keys are set up in your GitHub account, you can install the package with

pip install git+ssh://git@github.com/bertoldi-collab/DifFlexMM.git

DifFlexMM with examples of solved design problems

Clone the repository, cd into the DifFlexMM folder, and install with

pip install -e .

🤝 Contributing

Expand here

The dependency management of the project is done via poetry.

To get started:

  • Install poetry.
  • Clone the repository.
  • cd into the root directory and run poetry install. This will create the poetry environment with all the necessary dependencies.
  • If you are using vscode, search for venv path in the settings and paste ~/.cache/pypoetry/virtualenvs in the venv path field. Then select the poetry enviroment as python enviroment for the project.

📝 Citation

If you use this code in your research or anywhere, please cite the paper:

@article{bordiga_2024,
    title   = {Automated Discovery of Reprogrammable Nonlinear Dynamic Metamaterials},
    author  = {Bordiga, Giovanni and Medina, Eder and Jafarzadeh, Sina and B{\"o}sch, Cyrill and Adams, Ryan P. and Tournat, Vincent and Bertoldi, Katia},
    year    = {2024},
    journal = {Nature Materials},
    volume  = {23},
    number  = {11},
    pages   = {1486--1494},
    issn    = {1476-4660},
    doi     = {10.1038/s41563-024-02008-6},
}