1 function quadr_nonlin_script(step)
2 %
function quadr_nonlin_script(step)
4 % step 1: detailed simulation and plot
7 % B. Haasdonk 8.12.2011
16 model_data = gen_model_data(model);
17 model = set_mu(model,[0.1,1]);
18 sim_data = detailed_simulation(model, model_data);
22 % setting rb-pointers to dummy-functions, such that
23 % rb simulation does simply do a full simulation:
24 model = quadratic_poisson_model;
25 model.gen_detailed_data = @(model,model_data) model_data;
26 model.gen_reduced_data = @(model,detailed_data) detailed_data;
27 model.rb_simulation = model.detailed_simulation;
28 model.rb_reconstruction = ...
29 @(model,detailed_data,rb_sim_data) ...
31 % end of setting pointers.
32 model_data = gen_model_data(model);
33 detailed_data = gen_detailed_data(model, model_data);
36 case 3 % simple reduced basis generation and plot
38 model_data = gen_model_data(model);
39 detailed_data = gen_detailed_data(model, model_data);
40 plot(model_data.grid.X(2:end-1),detailed_data.RB)
41 title([
'Reduced basis with ',...
42 num2str(size(detailed_data.RB,2)),...
45 case 4 % reduced simulation and error
for single parameter
48 model_data = gen_model_data(model);
49 detailed_data = gen_detailed_data(model, model_data);
50 reduced_data = gen_reduced_data(model, detailed_data);
52 model = set_mu(model,mu);
53 rb_sim_data = rb_simulation(model, reduced_data);
54 rb_sim_data = rb_reconstruction(model, detailed_data, rb_sim_data)
55 sim_data = detailed_simulation(model, model_data);
58 err.u = sim_data.u - rb_sim_data.u;
59 plot_params.title = ['error u-uN for mu=',num2str(mu)];
62 plot_params.title = ['uN and u for mu=',num2str(mu)];
63 plot_params.legend ={
'u',
'u_N'};
65 joint.u = [rb_sim_data.u, sim_data.u];
70 model_data = gen_model_data(model);
71 detailed_data = gen_detailed_data(model, model_data);
75 error(
'step unknown');