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

Modifications to elliptic eigenproblem example #280

Closed siuwuncheung closed 3 months ago

siuwuncheung commented 6 months ago

This is a follow up PR for #266 to enable the followings:

  1. Use eigenspace projection for error calculation
  2. Add boundary condition switch
  3. Clean up to retain only 4 problems, i.e. poisson, heterogeneous diffusion, Schrodinger equation with harmonic potential, Schrodinger equation with Gaussian potential well
  4. Extend to 3D examples
  5. Change some variable names

With the command lines,

./elliptic_eigenproblem_global_rom -offline -p 2 -rs 2 -id 0 -a 0 -n 4
./elliptic_eigenproblem_global_rom -offline -p 2 -rs 2 -id 1 -a 1 -n 4
./elliptic_eigenproblem_global_rom -merge -p 2 -rs 2 -ns 2 -n 4
./elliptic_eigenproblem_global_rom -fom -p 2 -rs 2 -a 0.5 -n 4 -visit
./elliptic_eigenproblem_global_rom -online -p 2 -rs 2 -a 0.5 -ef 1.0 -n 4 -visit

the output is

FOM solution for eigenvalue 0 = 19.878564
ROM solution for eigenvalue 0 = 19.878631
Absolute error of ROM solution for eigenvalue 0 = 6.6618756e-05
Relative error of ROM solution for eigenvalue 0 = 3.3512861e-06
FOM solution for eigenvalue 1 = 53.177886
ROM solution for eigenvalue 1 = 53.179662
Absolute error of ROM solution for eigenvalue 1 = 0.0017768914
Relative error of ROM solution for eigenvalue 1 = 3.3414104e-05
FOM solution for eigenvalue 2 = 53.177886
ROM solution for eigenvalue 2 = 53.179662
Absolute error of ROM solution for eigenvalue 2 = 0.0017769039
Relative error of ROM solution for eigenvalue 2 = 3.3414339e-05
FOM solution for eigenvalue 3 = 81.245811
ROM solution for eigenvalue 3 = 81.246105
Absolute error of ROM solution for eigenvalue 3 = 0.00029387266
Relative error of ROM solution for eigenvalue 3 = 3.6170808e-06
Relative l2 error of ROM eigenvector 0 = 0.0023815683
Relative l2 error of ROM eigenvector 1 = 0.0097810599
Relative l2 error of ROM eigenvector 2 = 0.0097816076
Relative l2 error of ROM eigenvector 3 = 0.0043291658

N.B.: It is a FOM issue rather than a ROM issue. If the Gaussian center falls on a grid point, the eigenvalue calculation for Schrodinger equation can be very unstable.