Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pH DMD Algorithm #2027

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

pH DMD Algorithm #2027

wants to merge 26 commits into from

Conversation

peoe
Copy link
Contributor

@peoe peoe commented May 5, 2023

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.

@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

Mirroring external branch in external_pr_2027

@pmli pmli self-requested a review May 5, 2023 13:02
@pmli pmli added the pr:new-feature Introduces a new feature label May 5, 2023
@Jonas-Nicodemus Jonas-Nicodemus self-requested a review May 5, 2023 17:50
@pmli pmli added this to the 2023.1 milestone May 9, 2023
@sdrave sdrave removed the autoupdate label May 12, 2023
@pmli
Copy link
Member

pmli commented Jun 28, 2023

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

@pmli pmli modified the milestones: 2023.1, 2023.2 Jun 28, 2023
@pmli
Copy link
Member

pmli commented Jun 29, 2023

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

src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
@peoe
Copy link
Contributor Author

peoe commented Jul 24, 2023

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...

src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
docs/source/bibliography.bib Outdated Show resolved Hide resolved
docs/source/bibliography.bib Outdated Show resolved Hide resolved
docs/source/bibliography.bib Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
src/pymor/algorithms/phdmd.py Outdated Show resolved Hide resolved
Copy link
Member

@pmli pmli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments:

  • pymortests/demos.py should be updated to run pymordemos/phdmd.py (the demo is failing currently)
  • the conflicts should be resolved (in particular, msd_example from pymor.models.examples should be used in pymordemos/phlti.py)

src/pymordemos/phdmd.py Show resolved Hide resolved
@peoe
Copy link
Contributor Author

peoe commented Sep 26, 2023

  • 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 ?

@pmli
Copy link
Member

pmli commented Sep 27, 2023

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
Copy link
Member

pmli commented Nov 10, 2023

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).

@sdrave sdrave removed this from the 2023.2 milestone Nov 28, 2023
@sdrave sdrave unassigned pmli Feb 29, 2024
@sdrave
Copy link
Member

sdrave commented Feb 29, 2024

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

@Jonas-Nicodemus
Copy link
Contributor

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

@pmli
Copy link
Member

pmli commented Mar 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:new-feature Introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants