sofa-framework / Optimus

Optimus plugin was created to provide a testing environment for data-driven physics-based modeling.
GNU General Public License v2.0
7 stars 7 forks source link
plugin sofa-framework

Advanced methods of state estimation and parameter identification in SOFA

Optimus plugin was created to provide a testing environment for data-driven physics-based modeling (typically finite elements, FE). While actually the plugin implements only stochastic methods based on Kalman filtering, its architecture allows for the implementation of generic prediction--correction schemes where the model is employed as a predictor and correction is performed using given observation data.

The concepts of estimation of state and parameter identification are summarized in a document in doc/OptimusDoc. To generate the PDF, compile the tex file as pdflatex ConceptsBehindOptimus.tex.

Doxygen documentation [HTML and LaTeX] can be generated using the existing Doxygen file located in folder doc: Doxygen Optimus.doxygen.

Compilation and Usage

In order to obtain the plugin, it is necessary to perform git clone of the plugin to your local PC with SOFA installed.

Requirements

Except for SOFA, the plugin dependencies are Eigen and optionally BLAS. It is highly recommended to use Pardiso solver with Optimus, as other solvers in SOFA are less reliable and might impact the estimation.

In-tree build

To compile:

Out-of-tree build

This plugin could be compiled with out-of-tree builds. You might need to add the Sofa installation path to the CMake prefix path. If you compiled Sofa in directory $SOFA_ROOT/build, consider doing an install step (make install, ninja install, etc.).

To compile:

Components

Generic components

These components provide various functionality employed in Optimus scenes.

OptimParams

OptimMonitor

SimulatedStateObservationSource

SimulatedStateObservationStreamer

VTKExporterDA

StochasticPositionHandler

SigmaPointsVTKExporter

AddNoiseEngine

Stochastic filtering

These components are the core of Optimus plugin and implement functionality necessary for stochastic estimation. Compilation of these components must be activated by CMake macro STOCHASTIC_FILTERING.

FilteringAnimationLoop

StochasticStateWrapper

PreStochasticWrapper

MappedStateObservationManager

UKFilterClassic

ROUKFilter

UKFilterSimCorr

ETKFilter

Data

The plugin contains several volume (VTK) and surface (STL) meshes used in the examples, benchmarks and scenes. Most of meshes were generated by GMesh generator.

Visualization

Optimus plugin has several python scripts that allow to show the dynamics of estimated parameters (stiffnesses), variance values, and correlation between parameters. All scripts use Matplotlib python library to draw figures and charts and YAML configuration files to load main scene parameters.

All visualization scripts are stored in python_src/visualisation subfolder in Optimus. To scripts generally require only path to output folder(s) with results, since special subfolders structure, which is recognized by scripts, is generated and YAML is copied to output folder during data assimilation process.

List of scripts:

Examples

In general, Optimus scenes are written in Python(3) (occasionally in XML). It is recommended to use YAML (Python module) to define parameters of scenes. Enormously increases the efficiency and avoids mishaps.

Examples are given in folder examples:

SingleParameterIdentification

MultipleParameterIdentification

SpringStiffnessIdentification

Benchmarks

In order to facilitate development of Optimus, it is highly recommended to create benchmarks or regression tests. The goal of these is to verify that the functionality of Optimus has not been changed. Thus, the main goal of benchmarks is to compare results of simulations to previously generated reliable data. If the comparison shows important difference, it is necesary to identify the source of this change which probably indicates a serious issue either in Optimus or in SOFA itself.

Currently, seven benchmarks have been implemented: assimBC_liver_geomagic_cutting_yaml , assimBC_liver_polynomial_springs_point_cloud_yaml , assimBC_synthBrick , assimStiffness_cylinder_geomagic_yaml , assimStiffness_cylinder_python3_yaml , assimStiffness_cylinder_UKFSimCorr_yaml , and assimStiffness_cylinder_yaml

assimBC_liver_geomagic_cutting_yaml

assimBC_liver_polynomial_springs_point_cloud_yaml

assimBC_synthBrick

All benchmarks are executed using script verify.sh which runs the observation generation, then executes data assimilation and finally computes differences between obtained values and results stored previously.

assimStiffness_cylinder_geomagic_yaml

assimStiffness_cylinder_python3_yaml

assimStiffness_cylinder_UKFSimCorr_yaml

assimStiffness_cylinder_yaml