1 function quadr_nonlin_script(step)
2 %
function quadr_nonlin_script(step)
4 % Script demonstrating quadratically nonlinear diffusion problem
7 % B. Haasdonk 8.12.2011
14 plot_params.axis_equal = 0;
15 plot_params.no_lines = 0;
20 model_data = gen_model_data(model);
21 model = set_mu(model,[0.1,1]);
22 sim_data = detailed_simulation(model, model_data);
26 % setting rb-pointers to dummy-functions, such that
27 % rb simulation does simply
do a full simulation:
29 model.gen_detailed_data = @(model,model_data) model_data;
30 model.gen_reduced_data = @(model,detailed_data) detailed_data;
31 model.rb_simulation = model.detailed_simulation;
32 model.rb_reconstruction = ...
33 @(model,detailed_data,rb_sim_data) ...
35 % end of setting pointers.
36 model_data = gen_model_data(model);
37 detailed_data = gen_detailed_data(model, model_data);
40 case 3 % simple reduced basis generation and plot
42 model_data = gen_model_data(model);
43 detailed_data = gen_detailed_data(model, model_data);
44 plot(model_data.grid.X(2:end-1),detailed_data.RB)
45 title([
'Reduced basis with ',...
46 num2str(size(detailed_data.RB,2)),...
49 case 4 % reduced simulation and error
for single parameter
52 model_data = gen_model_data(model);
53 detailed_data = gen_detailed_data(model, model_data);
54 reduced_data = gen_reduced_data(model, detailed_data);
56 model = set_mu(model,mu);
57 rb_sim_data = rb_simulation(model, reduced_data);
58 rb_sim_data = rb_reconstruction(model, detailed_data, rb_sim_data)
59 sim_data = detailed_simulation(model, model_data);
61 err.u = sim_data.u - rb_sim_data.u;
62 plot_params.title = ['error u-uN for mu=',num2str(mu)];
65 plot_params.title = ['uN and u for mu=',num2str(mu)];
66 plot_params.legend ={
'u',
'u_N'};
68 joint.u = [rb_sim_data.u, sim_data.u];
73 model_data = gen_model_data(model);
74 detailed_data = gen_detailed_data(model, model_data);
78 error(
'step unknown');
function demo_rb_gui(varargin)
reduced basis demo with sliders
function model = quadratic_poisson_model()
quadratic poisson equation on unit interval
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.