rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
riemann_burgers_model.m
1 function model = riemann_burgers_model(params)
2 %function model = riemann_burgers_model(params)
3 %
4 % function generating a model of a non-viscous burgers flow
5 % developing either a rarefaction wave or a moving shock-front.
6 % Model is used for the hyp2008 paper and demo_rb_riemann_burgers
7 % Currently, params is ignored.
8 
9 % Bernard Haasdonk 18.3.2010
10 
11 if nargin < 1
12  params = [];
13 % params.size = 1;
14 end
15 
16 model = nonlin_evol_model_default;
17 
18 model.gridtype = 'rectgrid';
19 if isfield(params,'xnumintervals')
20  model.xnumintervals = params.xnumintervals;
21 else
22  model.xnumintervals = 100;
23 end;
24 
25 if model.xnumintervals>100
26  error('please adjust time-step number to fine grid resolution!');
27 end;
28 
29 if isfield(params,'ynumintervals')
30  model.ynumintervals = params.ynumintervals;
31 else
32  model.ynumintervals = 100;
33 end;
34 
35 model.xrange = [0,1];
36 model.yrange = [0,1];
37 
38 % set upper and lower to neuman noflow
39 % set left and right to dirichlet
40 
41 %epsilon = 1e-6;
42 model.bnd_rect_corner1 = [-1, 0-eps, 1-eps; ...
43  -1, 0-eps, 0-eps];
44 model.bnd_rect_corner2 = [ 2, 0+eps, 1+eps; ...
45  2, 1+eps, 1+eps];
46 
47 % -1 means dirichlet, -2 means neuman
48 model.bnd_rect_index = [-2,-1,-1];
49 
50 % time discretization
51 %model.T = 0.5/10;
52 %model.nt = 100/10; % guess and adjust later
53 model.T = 0.5;
54 model.nt = 100; % guess and adjust later
55 
56 %model.T = 0.4;
57 %model.nt = 80; % guess and adjust later
58 %model.nt = 100; % guess and adjust later
59 %model.T = 0.1;
60 %model.nt = 50; % guess and adjust later
61 %model.400 => non-bounded u
62 
63 % output settings
64 model.verbose = 9;
65 model.axis_equal = 1;
66 model.clim = [-1,1];
67 model.debug = 0;
68 
69 % data functions
70 %model.name_init_values = 'blobs';
71 %model.radius = 0.1;
72 %model.gamma = 100;
73 %model.beta = 1; % init data weight between 0 and 1
74 
75 % name of function in rbmatlab/datafunc/init_values
76 %model.name_init_values = 'waveproduct';
77 %model.name_init_values = 'leftright';
78 %model.name_init_values = 'as_dirichlet';
79 model.init_values_ptr = @init_values_as_dirichlet;
80 
81 %model.c_init_max = 1.0;
82 %model.c_init_phase_x = 0.0;
83 %model.c_init_phase_y = 0.0;
84 %model.c_init_freq_x = 2*pi;
85 %model.c_init_freq_y = 2*pi;
86 
87 %model.c_init_lo = 1.0;
88 %model.c_init_lo = 0.0;
89 %model.c_init_lo = -1.0;
90 
91 % name of function in RBmatlab/datafunc/dirichlet_values
92 %disp('todo: dirichlet values!');
93 %model.name_dirichlet_values = 'leftright';
94 model.dirichlet_values_ptr = @dirichlet_values_leftright;
95 model.c_dir_left = -1.0;
96 model.c_dir_right = 0.0;
97 model.dir_middle = 0.5;
98 
99 % name of function in RBmatlab/datafunc/neuman_values
100 model.neumann_values_ptr = @neumann_values_zero;
101 %model.name_neuman_values = 'zero';
102 %model.name_neuman_values = 'homogeneous';
103 %model.c_neu = 0;
104 
105 % convective flux
106 %model.name_flux = 'burgers_parabola';
107 model.conv_flux_ptr = @conv_flux_burgers;
108 %| \todo this could also be done explicitly (analytic derivative)
109 model.conv_flux_derivative_ptr = @conv_flux_forward_difference;
110 % for simplifying computation in case of linear flux:
111 model.flux_linear = 0;
112 % diagonal velocity field
113 model.flux_vx = 1;
114 model.flux_vy = 0;
115 %model.flux_quad_degree = 2;
116 model.flux_pdeg = 2; % burgers exponent
117 
118 % rb-formulation
119 %model.mu_names = {'c_init_lo','vrot_angle'};
120 % themiddle parameter makes u_init not decomposable...
121 %model.mu_names = {'c_dir_left','c_dir_right','dir_middle'};
122 model.mu_names = {'c_dir_left','c_dir_right','flux_vx'};
123 %model.mu_ranges = {[0,1],[0,1],[0,1]};
124 model.mu_ranges = {[-1,1],[-1,1],[-1,1]};
125 model.rb_problem_type = 'nonlin_evol';
126 %model.problem_type = 'lin_evol';
127 
128 % finite volume settings
129 %model.name_diffusive_num_flux = 'none';
130 %model.name_convective_num_flux = 'lax-friedrichs';
131 %model.lxf_lambda = 1.66
132 %model.lxf_lambda = 1.25;
133 %model.lxf_lambda = 0.35355;
134 %model.lxf_lambda = fv_search_max_lxf_lambda([],model);
135 %keyboard;
136 %model.name_convective_num_flux = 'engquist-osher';
137 model.num_conv_flux_ptr = @fv_num_conv_flux_engquist_osher;
138 model.fv_expl_conv_weight = 1.0;
139 
140 % projection of analytical initial data to discrete function
141 model.init_values_algorithm = @fv_init_values;
142 %model.implicit_operators_algorithm = @fv_operators_implicit;
143 % get mass matrix for inner product computation from DOF-vectors
144 model.data_const_in_time = 1;
145 
146 %model.init_values_algorithm = 'fv_init_values';
147 %model.implicit_operators_algorithm = 'fv_operators_implicit';
148 % get mass matrix for inner product computation from DOF-vectors
149 %model.inner_product_matrix_algorithm = 'fv_inner_product_matrix';
150 %model.data_const_in_time = 1;
151 
152 % settings for empirical interpolation
153 par.range = model.mu_ranges;
154 model.ei_numintervals = [4,4,4]; % 5^3 parameter grid
155 %model.ei_numintervals = [9]; % 8x8 parameter grid
156 %model.Mmax = 300;
157 model.Mmax = 100;
158 model.M = 100;
159 model.ei_detailed_savepath = 'nonlin_symmetry_detailed_200';
160 model.ei_operator_savepath = 'nonlin_symmetry_ei_operator_200';
161 model.ei_time_indices = 1:model.nt;
162 model.CRB_generation_mode = 'param-time-space-grid';
163 model.ei_target_error = 'interpol';
164 model.flux_quad_degree = 1;
165 
166 
167 % the following may be required:
168 %model.L_E_local_name = 'fv_conv_explicit_space';
169 
170 %model.ei_numintervals = [2,2,2]; % 5^3 parameter grid
171 %model.ei_numintervals = [4,4]; % 5^2 parameter grid
172 %model.Mmax = 300;
173 %model.Mmax = 150;
174 %model.ei_detailed_savepath = ei_detailed_savepath;
175 %model.ei_operator_savepath = ei_operator_savepath;
176 %model.ei_time_indices = 1:model.nt;
177 %model.CRB_generation_mode = 'param-time-space-grid';
178 %model.ei_target_error = 'interpol';
179 
180 % settings for reduced basis generation
181 %model.detailed_simulation_algorithm = 'detailed_simulation';
182 %model.operators_algorithm = 'fv_operators_implicit_explicit';
183 %model.init_values_algorithm = 'fv_init_values';
184 %model.inner_product_matrix_algorithm = 'fv_inner_product_matrix';
185 %model.error_algorithm = 'fv_error';
186 %model.lxf_lambda = 1.0194e+003;
187 %model.data_const_in_time = 1;
188 model.error_norm = 'l2';
189 %model.RB_extension_algorithm = 'RB_extension_PCA_fixspace';
190 % 'RB_extension_max_error_snapshot'};
191 %model.RB_stop_timeout = 2*60*60; % 2 hours
192 %model.RB_stop_epsilon = 1e-5;
193 %model.RB_error_indicator = 'error'; % true error
194 %model.RB_error_indicator = 'estimator'; % Delta from rb_simulation
195 %model.RB_stop_Nmax = 100;
196 %model.RB_generation_mode = 'uniform_fixed';
197 model.RB_generation_mode = 'PCA_trajectories';
198 model.RB_mu_list = {[1,0,1],[0,1,-1]}; % two shock-trajectories in
199  % different direction
200 %model.RB_numintervals = model.ei_numintervals;
201 %model.RB_detailed_train_savepath = model.ei_detailed_savepath;
202 
203 % parameters such that demo_rb_gui looks nicer:
204 model.yscale_uicontrols = 0.6;
205 model.xscale_gui = 0.5;
206 model.show_colorbar = 0;
207 model.clim = [-1,1];
208 
209 model.t = 0;
210 %model.tstep = 1;
211 model.decomp_mode = 0;
212 model.orthonormalize = @model_orthonormalize_qr;
213 model.plot = @fv_plot;
214 model.error_estimation = 0; % turn off rb error estimation
215 
216 %model.gen_reduced_data = @nonlin_evol_gen_reduced_data;
217 %model.rb_operators = @nonlin_evol_rb_operators;
218 %model.set_time = @set_time_default;
219 %model.set_mu = @set_mu_default;
220 %model.reduced_data_subset = @nonlin_evol_reduced_data_subset;
221 %model.rb_simulation = @nonlin_evol_rb_simulation;
function Udirichlet = dirichlet_values(model, X, Y)
UDIRICHLET = DIRICHLET_VALUES([X],[Y], MODEL) Examples dirichlet_values([0,1,2],[1,1,1],struct(name_dirichlet_values, homogeneous, ... c_dir, 1)) dirichlet_values([0:0.1:1],[0],struct(name_dirichlet_values, xstripes, ... c_dir, [0 1 2], ... dir_borders, [0.3 0.6])) dirichlet_values([0:0.1:1],[0],struct(name_dirichlet_values, box, ... c_dir, 1, ... dir_box_xrange, [0.3 0.6], ... dir_box_yrange, [-0.1 0.1]))
function reduced_data = nonlin_evol_gen_reduced_data(model, detailed_data, params)
method which produces reduced_data, which is the data, that will be passed to an online-algorithm.
function p = fv_plot(gridbase grid, dofs, params)
routine plotting a single fv function of fv_functions.
Definition: fv_plot.m:17
function demo_rb_gui(varargin)
reduced basis demo with sliders
Definition: demo_rb_gui.m:17
function demo_rb_riemann_burgers()
demo_rb_riemann_burgers
function reduced_data_subset = nonlin_evol_reduced_data_subset(model, reduced_data)
method which modifies reduced_data, which is the data, that will be passed to the online-simulation a...
function num_flux = fv_num_conv_flux_engquist_osher(model, model_data, U, NU_ind)
Function computing a numerical convective Engquist-Osher flux matrix.