rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
demo_rb_lin_evol_oop.m
Go to the documentation of this file.
1 % small collection of RBmatlab's rb-simulation abilities
2 % please inspect the source-file during execution, as the main
3 % purpose is to demonstrate the possibilities of RBmatlab's
4 % rb-philosophy
5 %
6 % this script demonstrates use for object oriented programming
7 % version of models. As example a convection-diffusion model is
8 % used.
9 %
10 % See also
11 % demo_rb_steps_struct.m for the same steps using a struct as model
12 
13 % Bernard Haasdonk 11.4.2007
14 
16 
17 disp('Small demonstration of RBmatlab reduced basis commands');
18 disp(['Please type dbcont after inspecting the workspace variables' ...
19  ' at different halt points.']);
20 disp('Opening figures can be closed.');
21 
22 % detailled simulation:
23 clear;
24 % get problem description
25 descr = convdiff_descr;
26 
27 % add some settings to perform output estimation
28 descr.compute_output_functional = 1;
29 descr.operators_output = @fv_operators_output;
30 descr.output_function_ptr = @output_function_box_mean;
31 
32 % define complete domain for output estimation
33 descr.sbox_xmin = min(descr.xrange);
34 descr.sbox_xmax = max(descr.xrange);
35 descr.sbox_ymin = min(descr.yrange);
36 descr.sbox_ymax = max(descr.yrange);
37 
38 disp(descr);
39 % load models
40 disp('initializing model:');
41 [dmodel, rmodel] = gen_models(descr);
42 
43 
44 %model_data = gen_model_data(dmodel);
45 %detailed_data = gen_detailed_data(rmodel, model_data);
46 %save('demos/datafiles/demos_rb_lin_evol_oop.mat', 'detailed_data');
47 
48 disp(dmodel);
49 disp('loading precomputed detailed_data:');
50 load(fullfile('demos', 'datafiles', 'demos_rb_lin_evol_oop.mat'), ...
51  'detailed_data');
52 disp(detailed_data);
53 
54 %
55 % disp('detailed linear evolution simulation:');
56 % model_data = gen_model_data(dmodel);
57 % sim_data = detailed_simulation(dmodel, model_data);
58 % params.plot_title = 'detailed simulation';
59 % params.plot = @fv_plot;
60 % plot_sim_data(dmodel, model_data, sim_data, params);
61 % disp('Please type dbcont after inspecting the workspace variables');
62 % keyboard;
63 % %
64 % % reduced basis loading and plotting
65 %
66 % clear('sim_data');
67 % disp('reduced basis plotting:');
68 % params.title = 'reduced basis vectors';
69 % params.plot = @fv_plot;
70 % dd_leaf = get_leaf(detailed_data, rmodel);
71 % plot_sequence(dd_leaf.RB(:,1:10),detailed_data.model_data.grid,params);
72 % %plot_mu_frequency(detailed_data.mu_values,params);
73 % disp('Please type dbcont after inspecting the workspace variables');
74 % keyboard;
75 
76 
77 % computation of mu and N-independent matrices
78 disp('computation of mu- and N-independent offline-data:');
79 reduced_data = gen_reduced_data(rmodel, detailed_data);
80 disp('Please type dbcont after inspecting the workspace variables');
81 keyboard;
82 
83 % computation of mu and N-independent matrices
84 disp(['Selection of N and computation of mu-independent but',...
85  ' N-dependent online-data:']);
86 rmodel.N = detailed_data.Nmax;
87 reduced_data = extract_reduced_data_subset(rmodel, reduced_data);
88 disp('Please type dbcont after inspecting the workspace variables');
89 keyboard;
90 
91 % mu-parameter variation: sets the fields of params:
92 % params.c_init = 0; params.beta = 1; params.k = 5e-8;
93 disp('Selection of mu and online-simulation');
94 set_mu(rmodel, [0,1,5e-8]);
95 
96 disp('reduced basis simulation:');
97 simulation_data = rb_simulation(rmodel, reduced_data);
98 disp('Please type dbcont after inspecting the workspace variables');
99 keyboard;
100 
101 % reconstruction and plot of reduced simulation
102 disp('reconstruction of reduced simulation:');
103 simulation_data = rb_reconstruction(rmodel,detailed_data,simulation_data);
104 params.title = 'reduced simulation';
105 
106 dmodel.plot_sim_data(detailed_data.model_data, simulation_data, params);
107 figure;
108 rb_plot_output_estimation(simulation_data,dmodel);
109 disp('Please type dbcont after inspecting the workspace variables');
function [ dmodel , rmodel ] = gen_models(ModelDescr descr,BasisGenDescr bg_descr)
generates an IDetailedModel and an IReducedModel instance from description structures.
Definition: gen_models.m:17
function demo_rb_steps_oop()
small collection of RBmatlab's rb-simulation abilities please inspect the source-file during executio...
function p = fv_plot(gridbase grid, dofs, params)
routine plotting a single fv function of fv_functions.
Definition: fv_plot.m:17
function [ v , l2norm ] = fv_operators_output(model, model_data)
function returning components, coefficients, and complete operator for a linear output functional on ...
function p = plot_sequence(varargin)
plotting a sequence of data slices on polygonal 2d grid (constructed from params if empty) and provid...
Definition: plot_sequence.m:17
function demo_rb_steps_struct()
small collection of RBmatlab's rb-simulation abilities please inspect the source-file during executio...
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.
Definition: plot_sim_data.m:17