1 function res = elastic_membrane(step,params)
2 %
function res = elastic_membrane(params)
4 %
function elastic membrane
6 % B. Haasdonk 12.3.2012
14 model = elastic_membrane_model;
15 model_data = gen_model_data(model);
19 case 1 % detailed simulation with unconstrained fem solver
21 % model = set_mu(model,[1,20]);
22 model = set_mu(model,[1,1]);
23 % model = set_mu(model,[1,0]);
24 model = set_mu(model,[20,0]);
25 model = set_mu(model,[20,1]);
26 model = set_mu(model,[0.3,0]);
27 model.operators = @fem_operators;
28 model.detailed_simulation = @lin_stat_detailed_simulation;
29 model.compute_output_functional = 0;
31 sim_data.U = sim_data.uh.dofs(:);
32 sim_data.L = zeros(size(sim_data.U,1),1);
36 case 2 % detailed simulation with constrained fem solver
38 model = set_mu(model,[20,1]);
40 % model = set_mu(model,[0.3,0]);
45 case 3 % generate greedy reduced basis
47 % rb-estimator with W subbasis
for dual reduced basis:
48 model.RB_generation_mode =
'greedy-rb-estimator';
49 model.supremizer_enrichment = 1; % on/off
50 model.enable_error_estimator = 1;
51 model.RB_stop_Nmax = 20; % should suffice here!
52 model.RB_numintervals = [16,16];
53 model.dual_lin_independence_mode = 1; % use W subbasis
55 disp(
'--------------------------------------------------');
56 disp(model.RB_generation_mode);
58 save(
'elastic_membrane_detailed_data',...
59 'model',
'detailed_data');
60 max_err_sequence7 = detailed_data.RB_info.max_err_sequence;
61 plot(max_err_sequence7);
62 set(gca,
'Yscale',
'log');
63 title(
'greedy rb-estimator, with supr.-enrichment, lin-indep=1');
64 disp(
'press enter to continue');
65 plot_detailed_data(model,detailed_data,[]);
69 load(
'elastic_membrane_detailed_data') % from step 3
70 model.enable_error_estimator = 0;
72 plot_params.plot_title =
'elastic membrane';
73 plot_params.no_lines = 0;
81 load(
'elastic_membrane_detailed_data') % from step 3
82 model.enable_error_estimator = 0;
84 plot_params.plot_title =
'elastic membrane';
85 plot_params.no_lines = 0;
89 % loop_demo_rb_gui(gcf,
'mu_1',0.1);
91 % the problem is, that powerpoint cannot properly play these clips
92 % within a slide. So No compression is used to generate the avi.
93 % Then,
for powerpoint-includion, use Programme/avi2mpeg to generate a
96 % Bernard Haasdonk 25.5.2008
100 outputfn =
'rb_elastic_membrane3.avi';
101 mu_sequence = [0.3*ones(1,41); 0:0.025:1];
103 reduced_data = gen_reduced_data(model,detailed_data);
105 compression =
'None';
106 %compression =
'Cinepak';
107 %compression =
'Indeo5';
108 %compression =
'IV50';
109 %compression =
'Indeo5'; % Indeo3, Cinepak, MSVC, RLE, None
112 mov = avifile(outputfn,
'Fps',fps,
'Quality',quality,...
113 'Compression',compression);
114 plot_params.show_colorbar = 1;
116 for i = 1:length(mu_sequence)
118 model = set_mu(model,mu_sequence(:,i));
119 sim_data = rb_simulation(model,reduced_data);
120 sim_data = rb_reconstruction(model,detailed_data,sim_data);
125 % text(0.1,0.9,text_sequence{i},
'FontSize',30,
'Color',[0,0,1])
129 mov = addframe(mov,F);
function varargout = filecache_function(funcptr, varargin)
function used for file-caching other function calls.
function demo_rb_gui(varargin)
reduced basis demo with sliders
function demo_detailed_gui(varargin)
demo gui for detailed simulations (calling demo_rb_gui after switching some pointers) ...
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.