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
6 %
this script demonstrates use
for object oriented programming
7 % version of models. As example a convection-diffusion model is
13 % Bernard Haasdonk 11.4.2007
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.');
22 % detailled simulation:
24 %
get problem description
25 descr = convdiff_descr;
27 % add some settings to perform output estimation
28 descr.compute_output_functional = 1;
30 descr.output_function_ptr = @output_function_box_mean;
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);
40 disp(
'initializing model:');
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');
49 disp(
'loading precomputed detailed_data:');
50 load(fullfile(
'demos',
'datafiles',
'demos_rb_lin_evol_oop.mat'), ...
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';
61 % disp(
'Please type dbcont after inspecting the workspace variables');
64 % % reduced basis loading and plotting
67 % disp(
'reduced basis plotting:');
68 % params.title =
'reduced basis vectors';
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');
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');
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');
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]);
96 disp(
'reduced basis simulation:');
97 simulation_data = rb_simulation(rmodel, reduced_data);
98 disp(
'Please type dbcont after inspecting the workspace variables');
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';
106 dmodel.plot_sim_data(detailed_data.model_data, simulation_data, params);
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.
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.
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...
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.