rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
burgers_fem.m
Go to the documentation of this file.
1 % hauptskript fuer burgers-fem-rb
2 
3 params = [];
4 
5 % Data settings (k is diffusivity):
6 params.name_dirichlet_values = 'gauss_convcomb';
7 params.udir_height = 3;
8 params.k = 1; %linear test 1
9 params.cx = 0;
10 params.cy = 0;
11 params.udir_amplitude = 1;
12 params.udir_xscale = 1;
13 params.name_diffusivity = 'homogeneous';
14 params.name_velocity = 'linear';
15 params.T = 0.2;
16 params.nt = 2;
17 params.newton_eps = 1e-5;
18 params.max_newton_steps = 10;
19 params.fixed_newton_steps = 1; % turn on or off
20 
21 % RB settings
22 params.rb_problem_type = 'burgers_fem';
23 params.mu_names = {'k','cx','cy','udir_height','udir_amplitude','udir_xscale'};
24 params.mu_ranges = {[1,2],[-5,5],[-5,5],[1,6],[1,2],[1,1000]};
25 params.offline_path = ...
26  '/usr/people/naddel/fuelcell/probs/Burger/BURGER_OFFLINE_DATA';
27 
28 params.verbose = 5;
29 
30 % select here, whether subset-selection of reduced basis is to be
31 % performed or not:
32 select_offline_subset = 0;
33 %select_offline_subset = 1;
34 
35 % RB Simulation:
36 detailed_data = rb_detailed_prep(params);
37 offline_data = rb_offline_prep(detailed_data, params);
38 
39 params.N = 4;
40 
41 if select_offline_subset
42  % perhaps play around with accuracy threshold 1e-10 in the
43  % following line
44  indices = regular_submatrix_indices(offline_data.M,1e-10);
45  % for test:
46  %indices = [1,2];
47  offline_data = rb_burgers_fem_offline_subset(offline_data,indices);
48  old_N = params.N;
49  params.N = length(indices);
50 end;
51 
52 reduced_data = rb_online_prep(offline_data, params);
53 params = set_mu([0.1, 0,0, 3,1,1],params);
54 %linear test 0.1,0,0,1,1,1
55 
56 simulation_data = rb_simulation(reduced_data,params);
57 
58 if select_offline_subset
59  % extension of simulation output by null-entries for not used
60  % basisvectors
61  params.N = old_N;
62  a = zeros(params.N,size(simulation_data.a,2));
63  a(indices,:) = simulation_data.a;
64  simulation_data.a = a;
65 end;
66 
67 disp(simulation_data.a);
68 
69 
70 cd /usr/people/naddel/fuelcell/probs/Burger/BURGER_OFFLINE_DATA/
71 
72 fid = open_writefile('matrixB');
73 store_dune_matrix(fid,simulation_data.b);
74 fclose(fid);
75 
76 fid = open_writefile('matrixA');
77 store_dune_matrix(fid,simulation_data.a);
78 fclose(fid);
79 
80 % TO BE ADJUSTED TO NEW SYNTAX
81 %| \docupdate
function offline_data_subset = rb_burgers_fem_offline_subset(offline_data, indices)
function extracting a subset of the offline data