libROM
v1.0
Data-driven physical simulation library
|
#include <NonuniformDMD.h>
Public Member Functions | |
NonuniformDMD (int dim, bool alt_output_basis=false, Vector *state_offset=NULL, Vector *derivative_offset=NULL) | |
Constructor. More... | |
NonuniformDMD (std::string base_file_name) | |
Constructor. More... | |
~NonuniformDMD () | |
Destroy the NonuniformDMD object. | |
void | setOffset (Vector *offset_vector, int order) override |
Set the offset of a certain order. | |
void | load (std::string base_file_name) override |
Load the object state to a file. More... | |
void | save (std::string base_file_name) override |
Save the object state to a file. More... | |
Public Member Functions inherited from CAROM::DMD | |
DMD (int dim, double dt, bool alt_output_basis=false, Vector *state_offset=NULL) | |
Constructor. Basic DMD with uniform time step size. More... | |
DMD (std::string base_file_name) | |
Constructor. DMD from saved models. More... | |
virtual | ~DMD () |
Destroy the DMD object. | |
virtual void | takeSample (double *u_in, double t) |
Sample the new state, u_in. Any samples in d_snapshots taken at the same or later time will be erased. More... | |
virtual void | train (double energy_fraction, const Matrix *W0=NULL, double linearity_tol=0.0) |
Train the DMD model with energy fraction criterion. More... | |
virtual void | train (int k, const Matrix *W0=NULL, double linearity_tol=0.0) |
Train the DMD model with specified reduced dimension. More... | |
void | projectInitialCondition (const Vector *init, double t_offset=-1.0) |
Project new initial condition using d_phi. Calculate pinv(phi) x init, or more precisely, (phi* x phi)^{-1} x phi* x init, where phi* is the conjugate transpose. More... | |
Vector * | predict (double t, int deg=0) |
Predict state given a time. Uses the projected initial condition of the training dataset (the first column). More... | |
double | getTimeOffset () const |
Get the time offset contained within d_t_offset. | |
int | getNumSamples () const |
Returns the number of samples taken. More... | |
int | getDimension () const |
const Matrix * | getSnapshotMatrix () |
Get the snapshot matrix contained within d_snapshots. | |
void | load (const char *base_file_name) |
Load the object state from a file. More... | |
void | save (const char *base_file_name) |
Save the object state to a file. More... | |
void | summary (std::string base_file_name) |
Output the DMD record in CSV files. | |
Protected Member Functions | |
NonuniformDMD (std::vector< std::complex< double >> eigs, Matrix *phi_real, Matrix *phi_imaginary, int k, double dt, double t_offset, Vector *state_offset, Vector *derivative_offset) | |
Constructor. More... | |
Protected Member Functions inherited from CAROM::DMD | |
DMD (int dim, bool alt_output_basis=false, Vector *state_offset=NULL) | |
Constructor. Variant of DMD with non-uniform time step size. More... | |
DMD (std::vector< std::complex< double >> eigs, Matrix *phi_real, Matrix *phi_imaginary, int k, double dt, double t_offset, Vector *state_offset) | |
Constructor. Specified from DMD components. More... | |
DMD () | |
Unimplemented default constructor. | |
DMD (const DMD &other) | |
Unimplemented copy constructor. | |
DMD & | operator= (const DMD &rhs) |
Unimplemented assignment operator. | |
std::pair< Matrix *, Matrix * > | phiMultEigs (double t, int deg=0) |
Internal function to multiply d_phi with the eigenvalues. | |
void | constructDMD (const Matrix *f_snapshots, int rank, int num_procs, const Matrix *W0, double linearity_tol) |
Construct the DMD object. | |
const Matrix * | createSnapshotMatrix (std::vector< Vector * > snapshots) |
Get the snapshot matrix contained within d_snapshots. | |
Friends | |
void | getParametricDMD (NonuniformDMD *¶metric_dmd, std::vector< Vector * > ¶meter_points, std::vector< NonuniformDMD * > &dmds, Vector *desired_point, std::string rbf, std::string interp_method, double closest_rbf_val, bool reorthogonalize_W) |
Obtain DMD model interpolant at desired parameter point by interpolation of DMD models from training parameter points. More... | |
Additional Inherited Members | |
Protected Attributes inherited from CAROM::DMD | |
int | d_rank |
The rank of the process this object belongs to. | |
int | d_num_procs |
The number of processors being run on. | |
int | d_dim |
The total dimension of the sample vector. | |
double | d_dt = -1.0 |
The time step size between samples. | |
double | d_t_offset |
The time offset of the first sample. | |
std::vector< Vector * > | d_snapshots |
std::vector holding the snapshots. | |
std::vector< Vector * > | d_sampled_times |
The stored times of each sample. | |
Vector * | d_state_offset = NULL |
State offset in snapshot. | |
bool | d_trained |
Whether the DMD has been trained or not. | |
bool | d_init_projected |
Whether the initial condition has been projected. | |
int | d_num_singular_vectors |
The maximum number of singular vectors. | |
std::vector< double > | d_sv |
std::vector holding the signular values. | |
double | d_energy_fraction |
The energy fraction used to obtain the DMD modes. | |
int | d_k |
The number of columns used after obtaining the SVD decomposition. | |
Matrix * | d_basis = NULL |
The left singular vector basis. | |
bool | d_alt_output_basis = false |
Whether to use the alternative basis for output, i.e. phi = U^(+)*V*Omega^(-1)*X. | |
Matrix * | d_A_tilde = NULL |
A_tilde. | |
Matrix * | d_phi_real = NULL |
The real part of d_phi. | |
Matrix * | d_phi_imaginary = NULL |
The imaginary part of d_phi. | |
Matrix * | d_phi_real_squared_inverse = NULL |
The real part of d_phi_squared_inverse. | |
Matrix * | d_phi_imaginary_squared_inverse = NULL |
The imaginary part of d_phi_squared_inverse. | |
Vector * | d_projected_init_real = NULL |
The real part of the projected initial condition. | |
Vector * | d_projected_init_imaginary = NULL |
The imaginary part of the projected initial condition. | |
std::vector< std::complex< double > > | d_eigs |
A vector holding the complex eigenvalues of the eigenmodes. | |
Class NonuniformDMD implements the modified DMD algorithm on the given snapshot matrix with non-uniform sampling time steps. Instead of linearly approximating the discrete dynamics x(t+dt) = Ax(t) in the original DMD, this algorithm approximates the continuous dynamics linearly by dx/dt = Ax.
Definition at line 36 of file NonuniformDMD.h.
CAROM::NonuniformDMD::NonuniformDMD | ( | int | dim, |
bool | alt_output_basis = false , |
||
Vector * | state_offset = NULL , |
||
Vector * | derivative_offset = NULL |
||
) |
Constructor.
[in] | dim | The full-order state dimension. |
[in] | alt_output_basis | Whether to use the alternative basis for output, i.e. phi = U^(+)*V*Omega^(-1)*X. |
[in] | state_offset | The state offset. |
[in] | derivative_offset | The derivative offset. |
Definition at line 19 of file NonuniformDMD.cpp.
CAROM::NonuniformDMD::NonuniformDMD | ( | std::string | base_file_name | ) |
Constructor.
[in] | base_file_name | The base part of the filename of the database to load when restarting from a save. |
Definition at line 29 of file NonuniformDMD.cpp.
|
protected |
Constructor.
[in] | eigs | d_eigs |
[in] | phi_real | d_phi_real |
[in] | phi_imaginary | d_phi_imaginary |
[in] | k | d_k |
[in] | dt | d_dt |
[in] | t_offset | d_t_offset |
[in] | state_offset | d_state_offset |
[in] | derivative_offset | d_derivative_offset |
Definition at line 41 of file NonuniformDMD.cpp.
|
overridevirtual |
Load the object state to a file.
[in] | base_file_name | The base part of the filename to load the database to. |
Reimplemented from CAROM::DMD.
Definition at line 139 of file NonuniformDMD.cpp.
|
overridevirtual |
Save the object state to a file.
[in] | base_file_name | The base part of the filename to save the database to. |
Reimplemented from CAROM::DMD.
Definition at line 154 of file NonuniformDMD.cpp.
|
friend |
Obtain DMD model interpolant at desired parameter point by interpolation of DMD models from training parameter points.
[in] | parametric_dmd | The interpolant DMD model at the desired point. |
[in] | parameter_points | The training parameter points. |
[in] | dmds | The DMD objects associated with each training parameter point. |
[in] | desired_point | The desired point at which to create a parametric DMD. |
[in] | rbf | The RBF type ("G" == gaussian, "IQ" == inverse quadratic, "IMQ" == inverse multiquadric) |
[in] | interp_method | The interpolation method type ("LS" == linear solve, "IDW" == inverse distance weighting, "LP" == lagrangian polynomials) |
[in] | closest_rbf_val | The RBF parameter determines the width of influence. Set the RBF value of the nearest two parameter points to a value between 0.0 to 1.0 |
[in] | reorthogonalize_W | Whether to reorthogonalize the interpolated W (basis) matrix. |