January 2, 2024 (v1) Software Open Software and DataSet of "A QA-SQP assisted FE for non-linear and history-dependent mechanics"

Click to #Development of QA-SQP for non-linear and history-dependent mechanical problems

This directory contains the source code and numerical benchmarks published in [^1]

## Dependencies and Prerequisites

* Python, pandas, numpy, matplotlib are pre requisites.
* For generating mesh and for vizualization, gmsh ([www.gmsh.info](www.gmsh.info)) is required.
* Dwave Ocean Tools ([https://docs.ocean.dwavesys.com/en/stable/getting_started.html](https://docs.ocean.dwavesys.com/en/stable/getting_started.html))

## Structure of Repository

* [src](./src): Python source code
* [examples](./examples): Some finite element tests 
* [paper](./paper): Python codes of the benchmarks in the paper [^1]

## Run an analysis

For example, the example [examples/J2-SA](./examples/J2-SA) run a finite element simulation using Simulated Annealing
``` bash
 python3 run.py
```

## Reproduce paper[^1] results and figures

* The tests require access to the annealer. 
    * Token needs to be provided in sampler = EmbeddingComposite(DWaveSampler(connection_close=True)) -> sampler = EmbeddingComposite(DWaveSampler(token="",connection_close=True))
* To use the Simulated Annealing instead, one has to replace the three lines
    * sampler = EmbeddingComposite(DWaveSampler(connection_close=True))
    * SA = lambda J: sampler.sample_qubo(J, num_reads=100,label="twoDTest")
    * quboOptFunc = lambda J: QUBO.qubo_solve_sampler(J,sampler)
    * by
    * SA = lambda J: SimulatedAnnealingSampler().sample_qubo(J,num_reads=100)
    * quboOptFunc =lambda J: QUBO.qubo_solve_sampler(J,SA)

* Figures 2, 3, and 4: in the folder [paper/QA-SQP/1D-elastic](./paper/QA-SQP/1D-elastic)
    * Run tests: ```python3 run.py```
    * Extract figures: ```python3 plotData.py```
* Figures 5, 6, and 7: in the folder [paper/QA-SQP/1D-elastoplastic](./paper/QA-SQP/1D-elastoplastic)
    * Run tests: ```python3 run.py```
    * Extract figures: ```python3 plotData.py```
      
* Figures 9, 11, 12: in the folder [paper/QA-SQP/2D-elastoplastic](./paper/QA-SQP/2D-elastoplastic)
    * Run classical finite element simulation: ``` python3 runFEM.py```
    * Run tests: ```python3 run.py```
    * Extract figures: ```python3 plotData.py```     

## Reproduce paper[^1] figures only
* Figures 2, 3, and 4: in the folder [paper/QA-SQP-results/1D-elastic](./paper/QA-SQP-results/1D-elastic)
    * Extract figures: ```python3 plotData.py```
* Figures 5, 6, and 7: in the folder [paper/QA-SQP-results/1D-elastoplastic](./paper/QA-SQP-results/1D-elastoplastic)
    * Extract figures: ```python3 plotData.py```
      
* Figures 9, 11, 12: in the folder [paper/QA-SQP-results/2D-elastoplastic](./paper/QA-SQP-results/2D-elastoplastic)
    * Extract figures: ```python3 plotData.py```     

 

[^1]: The work is described in:  
"_Nguyen V.-D., Wu L., Remacle F. and Noels L. (2024)._ A quantum annealing-sequential quadratic programming assisted finite element simulation for non-linear and history-dependent mechanical problems  European Journal of Mechanics; A/Solids. [doi:?????](https://dx.doi.org/10.1016/?????)" which can be downloaded [here](https://hdl.handle.net/????). We would be grateful if you could cite this publication in case you use the files.add a brief description of the dataset (Markdown and LaTeX enabled).

Introducing paper: A quantum annealing-sequential quadratic programming assisted finite element simulation for non-linear and history-dependent mechanical problems