1 % small script demonstrating RB-approach
for the fuelcell-gdl with
2 % the simtech image initial data
4 % Bernard Haasdonk 24.5.2008
6 disp(
'THIS SCRIPT STILL USES VERY OLD MECHANISM')
7 disp('MUST BE UPDATED!');
9 step = 1; % single simulation
10 %step = 2; % dummy reduced basis & comparison of reduced to detailed simulation
11 %step = 3; % real reduced basis generation and store as detailed_data
12 %step = 4; % time comparison
15 %load demo_lin_evol_params;
17 model.detailedfname = 'ulm_detailed.mat';
18 model.RB_generation_mode = 'greedy_uniform_fixed';
19 model.RB_numintervals = [10 4 4];
20 model.mu_names ={
'c_init' 'beta' 'k'};
21 model.mu_ranges ={[0 1] [0 1] [0 5.0000e-008]};
22 model.RB_stop_Nmax = 100;
25 %params.name_convective_num_flux =
'enquist_osher';
27 model.init_values_ptr = @init_values_grey_image;
28 %model.name_init_values =
'grey_image';
29 %model.c_init_filename =
'simtech_binary.bmp';
30 model.c_init_filename =
'uulm_grey_inv_scaled_resized.bmp';
33 model.c_init_xmin = model.xrange(1);
34 model.c_init_xmax = model.xrange(2);
35 model.c_init_ymin = model.yrange(1);
36 model.c_init_ymax = model.yrange(2);
37 model.c_init_xdivisions = (0.1:0.1:1.0) *...
38 (model.xrange(2)-model.xrange(1));
44 %grid = construct_grid(model);
45 %params.lxf_lambda = 1.0194e+003;
46 %fv_search_max_lxf_lambda([],model);
55 model_data = gen_model_data(model);
57 %detailed_data.grid = grid;
61 disp(
'performing single detailed simulation')
62 sim_data = detailed_simulation(model, model_data);
64 % plot_element_data_sequence(detailed_data.grid,U,model);
65 case 2 % construct dummy reduced basis by single trajectory and simulate
66 U = detailed_simulation(model,detailed_data);
67 A = feval(model.inner_product_matrix_algorithm,detailed_data.grid,model);
68 UON = orthonormalize(U,A);
69 detailed_data.RB = UON;
70 disp('reduced simulation:')
71 offline_data = rb_offline_prep(detailed_data,model);
72 model.N = size(detailed_data.RB,2);
73 reduced_data = rb_online_prep(offline_data, model);
74 simulation_data = rb_simulation(reduced_data,model);
75 Uappr = rb_reconstruction(detailed_data,simulation_data);
77 model.title = 'reduced simulation result';
78 plot_element_data_sequence(detailed_data.grid,Uappr,model);
79 model.title = 'detailed simulation result';
80 plot_element_data_sequence(detailed_data.grid,U,model);
81 case 3 % generate good reduced basis
82 disp('constructing reduced basis')
83 detailed_data = gen_detailed_data(model,model_data);
86 save(fullfile(rbmatlabresult,model.detailedfname),...
87 'detailed_data','model');
88 plot(detailed_data.RB_info.max_err_sequence);
89 set(gca,'Yscale','log');
90 title('RB-generation error convergence');
93 load(fullfile(rbmatlabresult,model.detailedfname));
94 disp('reduced simulation:')
95 offline_data = rb_offline_prep(detailed_data,model);
96 model.N = size(detailed_data.RB,2);
98 reduced_data = rb_online_prep(offline_data, model);
100 simulation_data = rb_simulation(reduced_data,model);
102 disp(['time for online phase: t = ',num2str(t)]);
104 disp('full simulation:')
106 U = detailed_simulation(detailed_data.grid, model);
108 disp(['time for detailed simulation: t = ',num2str(t)]);
111 load(fullfile(rbmatlabresult,model.detailedfname));
113 plot_params.axis_tight = 1;
116 error('step number unknown!');
123 % TO BE ADJUSTED TO NEW SYNTAX
function [ L_E_conv , bdir_E_conv ] = fv_operators_conv_explicit_engquist_osher(model, model_data, U, NU_ind)
computes convection contribution to finite volume time evolution matrices, or their Frechet derivati...
function model = convdiff_model(dummy)
function creating a simple model for a linear convection diffusion problem
function demo_rb_gui(varargin)
reduced basis demo with sliders
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.
function detailed_data = rb_basis_generation(model, detailed_data)
reduced basis construction with different methods