1 function model = riemann_burgers_model(params)
2 %
function model = riemann_burgers_model(params)
4 %
function generating a model of a non-viscous burgers flow
5 % developing either a rarefaction wave or a moving shock-front.
7 % Currently, params is ignored.
9 % Bernard Haasdonk 18.3.2010
16 model = nonlin_evol_model_default;
18 model.gridtype =
'rectgrid';
19 if isfield(params,
'xnumintervals')
20 model.xnumintervals = params.xnumintervals;
22 model.xnumintervals = 100;
25 if model.xnumintervals>100
26 error('please adjust time-step number to fine grid resolution!');
29 if isfield(params,'ynumintervals')
30 model.ynumintervals = params.ynumintervals;
32 model.ynumintervals = 100;
38 % set upper and lower to neuman noflow
39 % set left and right to dirichlet
42 model.bnd_rect_corner1 = [-1, 0-eps, 1-eps; ...
44 model.bnd_rect_corner2 = [ 2, 0+eps, 1+eps; ...
47 % -1 means dirichlet, -2 means neuman
48 model.bnd_rect_index = [-2,-1,-1];
52 %model.nt = 100/10; % guess and adjust later
54 model.nt = 100; % guess and adjust later
57 %model.nt = 80; % guess and adjust later
58 %model.nt = 100; % guess and adjust later
60 %model.nt = 50; % guess and adjust later
61 %model.400 => non-bounded u
70 %model.name_init_values = 'blobs';
73 %model.beta = 1; % init data weight between 0 and 1
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;
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;
87 %model.c_init_lo = 1.0;
88 %model.c_init_lo = 0.0;
89 %model.c_init_lo = -1.0;
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;
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';
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
115 %model.flux_quad_degree = 2;
116 model.flux_pdeg = 2; % burgers exponent
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';
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);
136 %model.name_convective_num_flux =
'engquist-osher';
138 model.fv_expl_conv_weight = 1.0;
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;
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;
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
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;
167 % the following may be required:
168 %model.L_E_local_name =
'fv_conv_explicit_space';
170 %model.ei_numintervals = [2,2,2]; % 5^3 parameter grid
171 %model.ei_numintervals = [4,4]; % 5^2 parameter grid
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';
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;
204 model.yscale_uicontrols = 0.6;
205 model.xscale_gui = 0.5;
206 model.show_colorbar = 0;
211 model.decomp_mode = 0;
212 model.orthonormalize = @model_orthonormalize_qr;
214 model.error_estimation = 0; % turn off rb error estimation
217 %model.rb_operators = @nonlin_evol_rb_operators;
218 %model.set_time = @set_time_default;
219 %model.set_mu = @set_mu_default;
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.
function demo_rb_gui(varargin)
reduced basis demo with sliders
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.