LLNL / libROM

Model reduction library with an emphasis on large scale parallelism and linear subspace methods
https://www.librom.net
Other
201 stars 36 forks source link

understanding hyper-reduction in libROM #186

Open gokhalen opened 1 year ago

gokhalen commented 1 year ago

I've been going through

https://github.com/LLNL/libROM/blob/master/examples/prom/poisson_global_rom.cpp

and it seems understandable. I want to extend it by implementing hyper-reduction.

With that in mind I'm looking at the two hyper-reduction examples

https://github.com/LLNL/libROM/blob/master/examples/prom/nonlinear_elasticity_global_rom.cpp https://github.com/LLNL/libROM/blob/master/examples/prom/mixed_nonlinear_diffusion.cpp

And trying to correlate the description of hyper-reduction with your JCP Paper:

A fast and accurate physics-informed neural network reduced order model with shallow masked autoencoder

and your SIAM paper

SNS: A Solution-Based Nonlinear Subspace Method For Time-Dependent Model Order Reduction

Is there a better approach to understanding, and later implementing, how hyper-reduction is done in libROM?

chldkdtn commented 1 year ago

These are good resources. You may want to check out S-OPT paper as well because S-OPT improves the current state-of-the-art hyper-reduction technique, i.e., DEIM. See this paper ( https://arxiv.org/abs/2203.16494 )

gokhalen commented 1 year ago

@chldkdtn

I've been going through the nonlinear elasticity example line by line

https://github.com/LLNL/libROM/blob/master/examples/prom/nonlinear_elasticity_global_rom.cpp

What I'd like to know is what *Hsinv which is computed by the sampling routines S_OPT, GNAT or DEIM corresponds to in the paper SNS: A Solution-Based Nonlinear Subspace Method For Time-Dependent Model Order Reduction or any other paper. Is it P_DEIM or P_GNAT in the paper I mentioned?

Thanks,

Nachiket

dylan-copeland commented 1 year ago

Hi Nachiket,

Hsinv is the inverse or pseudo-inverse of the sampled basis, of dimension (number of samples) x (basis dimension):

Hsinv = new CAROM::Matrix(nsamp_H, hdim, false);

The DEIM case results in a square matrix, so Hsinv is an inverse. The GNAT case is over-sampled DEIM with more samples than basis vectors, so Hsinv is a pseudo-inverse (but the transpose is stored, so it is multiplied with transpose). The same goes for S-OPT. In the SNS or S-OPT paper, this is (Z^T \phi_f)^{-1}, where the inverse is pseudo-inverse when oversampling is used.

Best regards, Dylan

gokhalen commented 1 year ago

@dylan-copeland

Is it fair to say the the essence of hyper-reduction is to replace the operators V_x,V_v by the associated operators on the sample mesh V_x_sp, V_v_sp ? This is in essence what seems to be the difference in Mult_Hyperreduced and Mult_FullOrder in

https://github.com/LLNL/libROM/blob/c3bfef5890118a2963a497d512617ffa6e3f4f48/examples/prom/nonlinear_elasticity_global_rom.cpp

Apart from the special procedure to obtain H(x) using

    fomSp->H->Mult(*psp_x, zH);
    smm->GetSampledValues("H", zH, zN);

The quality of the sample mesh seems to determine accuracy.

dylan-copeland commented 1 year ago

@gokhalen Yes, the quality of the sample mesh does determine accuracy. More samples implies a larger sample mesh and better accuracy.

The essense of hyper-reduction is to replace full-order (FOM) evaluation of a nonlinear term with a sparse evaluation on a sample mesh that is hopefully much smaller than the FOM mesh. Expensive FOM evaluation in a ROM formulation would be of the form B^T f(x) where f is a nonlinear function of the variable x, with variable ROM basis B. Hyper-reduction is of the form

B^T \Phi (Z^T \Phi)^{-1} Z^T f

where \Phi is a ROM basis for the term f. Note that B^T \Phi is of reduced dimension and can be precomputed and stored; (Z^T \Phi)^{-1} is the pseudo-inverse discussed above; and Z^T f is evaluated on the sample mesh.

gokhalen commented 1 year ago

@dylan-copeland Thanks for your answer. What I am trying to do, is to find a correspondence between the formulation you presented above (and in papers) and the implementation in

https://github.com/LLNL/libROM/blob/c3bfef5890118a2963a497d512617ffa6e3f4f48/examples/prom/nonlinear_elasticity_global_rom.cpp

Which is why I said that I think the essence of implementation is to replace the operators V_x,V_v by the associated operators on the sample mesh V_x_sp, V_v_sp ? This is in essence what seems to be the difference in Mult_Hyperreduced and Mult_FullOrder.

Could you, or someone else confirm?

Thanks,

Nachiket

dylan-copeland commented 1 year ago

V_x lifts to the full-order space on the full-order mesh, whereas V_x_sp lifts to the sample mesh space on the sample mesh. These liftings are computed before the nonlinear term f is evaluated. In my notation above, the hyper-reduced version evaluates

B^T \Phi (Z^T \Phi)^{-1} Z^T f(B_sp x)