pymor icon indicating copy to clipboard operation
pymor copied to clipboard

pH DMD Algorithm

Open peoe opened this issue 1 year ago • 10 comments

This PR implements the pH DMD algorithm from @Jonas-Nicodemus arXiv preprint. This algorithm suits itself to non-intrusive inference of port-Hamiltonian systems from time domain system data. Alongside the basic algorithm a simple demo has been implemented showing the use of this algorithm on a full order MSD model and a reduced model thereof.

Currently, the main source is only available as a preprint, upon possible publication, an update in the bibliography may be necessary.

It depends on merging #1836 beforehand to make use of the pH reductors implemented there.

peoe avatar May 05 '23 09:05 peoe

Mirroring external branch in external_pr_2027

github-actions[bot] avatar May 05 '23 09:05 github-actions[bot]

The demo and tests are failing, probably because the msd model was changed in the meantime.

pmli avatar Jun 28 '23 19:06 pmli

This requires some thought on time-stepping, so I postponed it to the next milestone.

pmli avatar Jun 29 '23 14:06 pmli

This requires some thought on time-stepping, so I postponed it to the next milestone.

With regards to time-stepping the main difference consists in the way the implicit methods sample from the control. This point is particularly relevant because in the corresponding paper the authors mention just after Remark 2.3 that they replaced the usual formulation $u((i + \frac{1}{2}) \cdot \delta_t)$ by averaging both control data $\frac{1}{2} (u_{i} + u_{i + 1})$. Unfortunately, the whole procedure depends on the choice of time-stepping algorithm, wherefore the results largely vary even for a "small" MSD model of order $n = 6$ if a different choice is made.

From my point of view, the easiest way forward would be to implement an additional TimeStepper for the pH DMD algorithm providing the required replacement of the control's midpoint evaluation. Alternatively, I could implement the algorithm such that it deviates from the original paper and uses the data we can currently compute within pyMOR, however I do not think that this would be the best choice. What is your opinion on this matter, @pmli?

EDIT: I noticed that the signs in the implicit step are no issue, I misread some code there...

peoe avatar Jul 24 '23 14:07 peoe

  • pymortests/demos.py should be updated to run pymordemos/phdmd.py (the demo is failing currently)

I resolved the conflicts, however I'm having trouble with getting the demos test to run locally. As far as I am aware, adding the line

('phdmd', ['--fom-order=4', '--rom-order=10'])

in the demo test file should allow the demo to run, but for some reason this test just does not cooperate with me. Could you have another look at it @pmli ?

peoe avatar Sep 26 '23 17:09 peoe

Running the demo works fine for me, e.g., using

cd src/pymortests
xvfb-run pytest 'demos.py::test_demos[phdmd:"--fom-order=4 --rom-order=10"]'

pmli avatar Sep 27 '23 17:09 pmli

I tried fixing the implementation, but the demo and tests still fail, so I'll postpone working on this (including if the implementation can be generalized to Operators and VectorArrays).

pmli avatar Nov 10 '23 13:11 pmli

@peoe , @Jonas-Nicodemus, are you still interested in working on this PR? Otherwise we would close it ..

sdrave avatar Feb 29 '24 13:02 sdrave

What needs to be done? Unfortunately, to be honest this is not to high on my priority list right now :/

Jonas-Nicodemus avatar Mar 04 '24 20:03 Jonas-Nicodemus

What needs to be done?

The tests and demos are failing (the algorithm doesn't converge when it is expected to converge). I tried comparing with your code, but I couldn't find a significant difference, so I don't know what the issue is.

There is also the design issue of a specialized time-stepper used in the tests and demos. In principle, it would be better to have it inside pymor.algorithms.timestepping, but that raises questions about whether time steppers should return control and derivative snapshots.

pmli avatar Mar 05 '24 13:03 pmli