4 %
function testing the implementation of the RB-Method for
5 % Parametrizes Variational Inequalities
11 model = elastic_rope_model(params);
12 disp(
'model created');
13 model_data = gen_model_data(model);
15 fn =
'detailed_data_vi.mat';
18 % detailed simulation and
plot
19 disp(
'begin detailed simulation');
20 sim_data = detailed_simulation(model,model_data);
22 plot_params.plot_title =
'detailed solution & obstacle';
25 %g = model.obstacle(model_data.X,model);
28 %
plot(model_data.X,g,
'c',
'Linewidth',4);
29 %title(
'detailed solution & obstacle');
33 disp(
'compute snapshots');
34 detailed_data = gen_detailed_data(model,model_data);
35 %save(
'detailed_data_vi.mat',
'model',
'detailed_data');
37 reduced_data = gen_reduced_data(model,detailed_data);
39 % rb simulation and
plot
40 disp(
'begin reduced simulation');
41 rb_sim_data = rb_simulation(model,reduced_data);
42 rb_sim_data = rb_reconstruction(model,detailed_data,rb_sim_data);
44 plot_params.plot_title =
'reduced solution & obstacle';
48 disp(
'compute errors and norms');
49 K = model.get_inner_product_matrix(model,model_data);
50 U_err = sqrt((rb_sim_data.U-sim_data.U)
' * K * (rb_sim_data.U- ...
52 L_R = K \ (rb_sim_data.L-sim_data.L);
53 L_err = sqrt((rb_sim_data.L-sim_data.L)' * L_R);
54 disp([
'error (U-UN): ',num2str(U_err)]);
55 disp([
'error (L-LN): ',num2str(L_err)]);
57 U_norm = sqrt(sim_data.U
' * K * sim_data.U);
59 L_norm = sqrt(sim_data.L' * L_R);
60 disp([
'norm U: ',num2str(U_norm)]);
61 disp([
'norm L: ',num2str(L_norm)]);
63 save(fn,
'model',
'detailed_data');
71 model.mu_fix = 30/200;
73 plot_params.no_lines = 0;
74 plot_params.axis_tight = 1;