test  = { 'sod' } ;
nflux = { 'LaxFriedrichs' } ;

% setup the model
Linear2x2Model( 'setup', 1 ) ;

% get names of variable
names = Linear2x2Model( 'get_names' ) ;

% Initial left and right state
UL = [0.5 ; 2   ];
UR = [1   ; 0.5 ];

PRB . Uinit     = [ UL * ones(1,50) UR * ones(1,50) ] ; % initial condition
PRB . Xnodes    = [ -1:2/100:1 ] ; % boundary cells nodes
PRB . FinalTime = 0.1  ; % final time
PRB . StepTime  = 0.01 ; % save a frame every StepTime
PRB . CFL       = 0.9  ;
PRB . left_bc   = 'free' ; % left boundary condition type
PRB . right_bc  = 'free' ; % right boundary condition type

% Exact solution of the riemann problem sampled of fine mesh
Xe = [ -1:2/1000:1 ] ;
Ue = Linear2x2Model( 'riemann', UL, UR, PRB . FinalTime, Xe ) ;

for j=1:length(nflux)
    
  ok = input( ['Start flux: ' nflux{j} ' [q=quit] ' ], 's' ) ;
  if ok == 'q' ; break ; end ;

  handleFig = figure('Position',[10+j*25 10+j*25 1000 800],'color','w') ;

  % call the solver
  [ UFRAMES, TFRAMES ] = Solver(PRB,@Linear2x2Model,@LaxFriedrichs) ;

  % evalute cell center
  X = (PRB . Xnodes(1:end-1)+PRB . Xnodes(2:end))/2 ;

  % extract last frame
  U = UFRAMES(:,:,end) ;

  for i=1:2
    subplot(2,1,i);
    plot(Xe, Ue(i,:), '-b',  'LineWidth', 2, 'Color', 'green') ; hold on ;
    plot(X,  U(i,:),  '-ok', 'MarkerFaceColor','r');
    title([names{i} ' solver: ' nflux{j}], 'FontSize', 24, 'FontName', 'Arial' );
  end
end
