3 %
function testing the implementation of the RB-Method
for
4 % Parametrized Variational Inequalities.
5 % In particular 1D FEM model of a hanging elastic rope with different
6 % elasticities in subdomains.
8 % B. Haasdonk, I.Maier 31.05.2011
14 model = elastic_rope_model(params);
15 disp(
'model created');
16 model_data = gen_model_data(model);
18 fn =
'detailed_data_vi.mat';
21 % detailed simulation and
plot
22 disp(
'begin detailed simulation');
23 sim_data = detailed_simulation(model,model_data);
25 plot_params.plot_title =
'detailed solution & obstacle';
28 %g = model.obstacle(model_data.X,model);
31 %
plot(model_data.X,g,
'c',
'Linewidth',4);
32 %title(
'detailed solution & obstacle');
36 disp(
'compute snapshots');
37 detailed_data = gen_detailed_data(model,model_data);
38 %save(
'detailed_data_vi.mat',
'model',
'detailed_data');
40 reduced_data = gen_reduced_data(model,detailed_data);
42 % rb simulation and
plot
43 disp(
'begin reduced simulation');
44 rb_sim_data = rb_simulation(model,reduced_data);
45 rb_sim_data = rb_reconstruction(model,detailed_data,rb_sim_data);
47 plot_params.plot_title =
'reduced solution & obstacle';
51 disp(
'compute errors and norms');
52 K = model.get_inner_product_matrix(model,model_data);
53 U_err = sqrt((rb_sim_data.U-sim_data.U)
' * K * (rb_sim_data.U- ...
55 L_R = K \ (rb_sim_data.L-sim_data.L);
56 L_err = sqrt((rb_sim_data.L-sim_data.L)' * L_R);
57 disp([
'error (U-UN): ',num2str(U_err)]);
58 disp([
'error (L-LN): ',num2str(L_err)]);
60 U_norm = sqrt(sim_data.U
' * K * sim_data.U);
62 L_norm = sqrt(sim_data.L' * L_R);
63 disp([
'norm U: ',num2str(U_norm)]);
64 disp([
'norm L: ',num2str(L_norm)]);
66 save(fn,
'model',
'detailed_data');
74 model.mu_fix = 30/200;
76 plot_params.no_lines = 0;
77 plot_params.axis_tight = 1;
function demo_rb_gui(varargin)
reduced basis demo with sliders
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.
function p = plot(params)
plot of a rectgrid via plot_polygon_grid()
function demo_vi()
function testing the implementation of the RB-Method for Parametrized Variational Inequalities...