function driverBurgersFD_POD_DEIM
%
% To run, type: driverBurgersFD_POD_DEIM
%
% Compare the solutions of the Burgers'Equation from 
% 1) Full order system 
% 2) POD reduced sytem 
% 3) POD-DEIM reduced system
%
% Burgers'equation:
% 
% \frac{\partial}{\partial t} y(x,t) = \nu\frac{\partial^2}{\partial x^2}y(x,t)
% - \frac{\partial}{\partial x}\left(\frac{y(x,t)^2}{2} \right)  &  &x \in [0,1], t \ge 0
% 
% y(0,t) = y(1,t) =0, t \ge 0  
% y(x,0) = y_0(x),   x \in [0,1],
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Nov 4, 2010
%

set(0, 'defaultaxesfontsize',12,'defaultaxeslinewidth',1,...
       'defaultlinelinewidth',1,'defaultpatchlinewidth',0.7,...
       'defaulttextfontsize',12);

%% Solve the full-order system and collect snapshots

n = 100; % inner grid points

[solf, t_full] = BurgersFD_Full(n); 


fprintf(1,'CPU Time(sec) for solving Full system: %12.6e\n\n',t_full);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% POD reduced system

k = 20; 

[solk, Vk, t_POD] =  BurgersFD_POD(k);
solPOD = Vk*solk;
errPOD = norm(solf-solPOD,'fro')^2; 

fprintf(1,'CPU Time(sec) for solving POD reduced system: %12.6e\n',t_POD);
fprintf(1,'Error of POD reduced order solution %12.6e\n\n',errPOD );

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DEIM reduced system

k = 20; 
m = 20; 
 
[solk, Vk, t_DEIM ] =  BurgersFD_POD_DEIM(k,m);
solDEIM = Vk*solk;
errDEIM = norm(solf-solDEIM,'fro')^2; 

fprintf(1,'CPU Time (sec)for solving POD-DEIM reduced system: %12.6e\n',t_DEIM);
fprintf(1,'Error of POD-DEIM reduced order solution: %12.6e\n',errDEIM );
