1 function OK = test_rb_lin_evol
2 %
function OK = test_rb_lin_evol
4 %
function performing the whole sequence of reduced basis approximation
5 % and testing, whether the error prediction of the reduced model is
6 % indeed smaller than the real error.
8 % OK == 1
if test is OK, otherwise 0
10 % Bernard Haasdonk 20.8.2007
14 model = init_model(
'convdiff_model');
15 disp(
'linear evolution problem loaded');
18 %
do not compute the detailed data, but simply load
19 load(
'test_rb_lin_evol_data',
'detailed_data');
21 model_data = gen_model_data(model);
23 detailed_data = gen_detailed_data(model, model_data)
24 save('test_rb_lin_evol_data', 'detailed_data', 'model');
27 detailed_data.grid = construct_grid(model);
31 %model.RB_stop_Nmax = 100;
32 %detailed_data = gen_detailed_data(model, model_data);
33 %save('/tmp/temp.mat','detailed_data','model','model_data');
35 reduced_data = gen_reduced_data(model, detailed_data);
36 disp('offline preparation terminated');
38 model.N = size(detailed_data.RB,2);
40 reduced_data = extract_reduced_data_subset(model, reduced_data);
42 disp('online preparation terminated');
44 mus = {[0,0,0],[0.1,0.1,0.1e-8]};
45 elim = [5.7e-9, 2.4e-07]; % error limits
48 model = model.set_mu(model, mus{m});
52 rb_simulation_data = rb_simulation(model,reduced_data);
54 disp(
'rb simulation terminated');
56 rb_simulation_data = rb_reconstruction(model,detailed_data,rb_simulation_data);
58 disp(
'reconstruction finished');
60 simulation_data = detailed_simulation(model, detailed_data);
62 disp(
'detailed simulation finished');
64 err = model.error_algorithm(simulation_data.U,rb_simulation_data.U,detailed_data.W,model);
66 disp(
'error computation finished');
68 if err(end) > elim(m);
69 disp(
'reduced error is too large!!!');
73 if err(end) < elim(m)*0.1;
74 disp(
'reduced error is too small!!!');
78 if rb_simulation_data.Delta(end) < err(end)
79 disp('rb_prediction smaller than true error!!!');