-
Notifications
You must be signed in to change notification settings - Fork 39
Snapshot dmd #289
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
Snapshot dmd #289
Conversation
with DMD. Pivoting the DMD changes to derived class SnapshotDMD in future commits. Turned off "window overlap" in parametric_dw_csv.
construct SnapshotDMD as a separat PR.
SnapshotInterpolator and its unit test.
to the wave equation example. Improved wave equation example to include projected initial conditions in later windows, as well as print output to a specified directory to keep the running directory clean.
the wave equation example.
relevant PR Comments.
modified example run for wave equation.
statements to guarantee strictly increasing input / output ts, that there are >2 input ts, and that there are >1 output ts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! An exciting enhancement to DMD. Thanks, @ptranq
lib/algo/SnapshotDMD.cpp
Outdated
d_snapshots = new_snapshots; | ||
d_sampled_times = new_times; | ||
d_dt = d_sampled_times[2]->getData()[0]-d_sampled_times[1]->getData()[0]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
lib/algo/SnapshotDMD.h
Outdated
Vector* state_offset) : | ||
DMD(eigs, phi_real, phi_imaginary, k, dt, t_offset, state_offset) {} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
{ | ||
result_u = dmd_u[curr_window]->predict(ts[i]); | ||
cout << "Projecting solution for new window at " << ts[i] << endl; | ||
dmd_u[curr_window+1]->projectInitialCondition(result_u, ts[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me to better understand the changes, I guess this projection is not necessarily relevant to the snapshot interpolation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. This is simply projecting the initial conditions in each subsequent window to come from the final conditions of the preceding window. This makes the DMD solution be a prediction across the entire time domain, instead of a series of approximations each across only a single window.
examples/dmd/wave_equation.cpp
Outdated
// wave_equation -tf 2 -nwinsamp 25 -rdim 27 -visit -snap -proj | ||
// | ||
// Output 2: | ||
// Relative error of DMD solution (u) at t_final: 2 is 0.0029577152 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that the error is higher than the original outputs, with a mixed effect of enabling snapshot interpolation and the projection of initial condition. It could be helpful if we know which one is the source of the increase of the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the output for command 1 to reflect what I obtain on quartz. I get a different error than what was reported previously while running on this branch, and confirmed the same (new) numbers on the master branch. Additionally, I have added two new examples: the first performs the current "command 1" with projection enabled, and the second performs the current "command 2" with projection disabled. The errors are much closer together and should, hopefully, clear things up.
} | ||
protected: | ||
/** | ||
* @brief Obtain DMD model interpolant at desired parameter point by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is just declaring the existing function as a friend
, I don't think we need to copy the comments here. They are already in ParametricDMD.h. Maybe just a 1-line comment like See ParametricDMD.h for documentation.
The comments could be removed also from existing files like DMD.h and NonuniformDMD.h, since they are just duplicated. I wonder if there is a better design, perhaps with getParametricDMD
being a method of the base DMD
class, but we can leave that question for another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure of the original intention of parametricDMD being its own class. It would be my preference to leave the comments here, so that it is easy to find out what each one does, since this function provides essential functionality to the class. If noone else agrees, I am happy to ditch them though.
* | ||
*****************************************************************************/ | ||
|
||
// Description: Implementation of the AdaptiveDMD algorithm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AdaptiveDMD
-> SnapshotDMD
Adds the SnapshotDMD class derived from DMD. This class essentially performs DMD but interpolates the current snapshots to new "artificial snapshots" in large enough quantity to produce a DMD ROM with the given reduced dimension. This interpolation is performed with the SnapshotInterpolator class, specifically with PCHIP interpolation.
The wave_equation example is extended to provide the option of using snapshotDMD, as well minor improvements to provide the option to use initial condition projection for windows after the first, and the option to provide an output directory to minimize clutter after running the example.