SimVascular / SimVascular/svZeroDSolver

Add python-based tuning of models

Open
#158 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
22
Forks
44
PR merge metrics
No merged PRs in 30d

Description

Use Case

It is frequently required to tune parameters and boundary conditions in a 0D model to match experimentally derived waveforms or other data.

Problem

One workflow that is "standard" in the lab is to apply Nelder Mead or another optimization algorithm to tune a 0D model or its boundary conditions. Existing code to for these workflows is scattered amongst various scripts and requires significant manual changes to work. A flexible script that allows users to optimize all possible parameters should be included with the repo, along with documentation.

Solution

A flexible python script that calls Nelder Mead from scipy should be added to the solver. This requires a legible user interface to traverse the json file and pass parameters to the optimizer, run the optimizer from scipy (or wherever) and solver, update data structures and repeat. This also should include an interface for the user to select which variables, which could be any constants in the input file, to optimize.

I have implemented such a script from examples of others in the lab. This script is highly effective on my use case but the user interface needs substantial improvement. I had to carefully and manually figure out how to traverse the nested data structures from the json file reads. @ncdorn said he may have code for improving the software interface to the json files.
https://github.com/alexkaiser/svZeroDSolver/commit/782e889b407d7862d34cb78501b7551653592290

Alternatives considered

The calibrator tunes parameters but is limited to certain internal elements, does not tune chambers or boundary conditions and requires computing derivatives.

Additional context

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct and Contributing Guidelines

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced commit 782e889b407d7862d34cb78501b7551653592290 and the solver's JSON input handling. Review how a Python interface could select nested parameters and invoke Nelder-Mead through scipy. Done means a documented, flexible workflow can choose input variables, run optimization with the solver, and update the relevant data structures.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, json, python
Domain
backend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.