rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
nonlin_symmetry_model.m
1 function model=nonlin_symmetry_model(params)
2 % function model=nonlin_symmetry_model(params)
3 %
4 % optional fields of params:
5 % size: problem size ( 0.1, 0.2, 0.5, 1, 2, 3, ... )
6 
7 if nargin < 1 || ~isfield(params, 'size')
8  params.size = 1;
9 end
10 
11 model = nonlin_evol_model_default;
12 model.name = 'nonlin_symmetry';
13 model.gridtype = 'rectgrid';
14 model.xnumintervals = 120 * params.size;
15 model.ynumintervals = 60 * params.size;
16 model.xrange = [0,2];
17 model.yrange = [0,1];
18 
19 % set all to neuman-boundary by specifying "rectangles", all
20 % boundary within is set to boundary type
21 %model.bnd_rect_corner1 = [-1; ...
22 % -1];
23 %model.bnd_rect_corner2 = [ 2; ...
24 % 2];
25 
26 % -1 means dirichlet, -2 means neumann
27 %model.bnd_rect_index = [-2]; % first is dirichlet, second neuman
28 
29 % time discretization
30 model.T = 0.3;
31 model.nt = 100 * params.size; % guess and adjust later
32 %model.nt = 25 * params.size; % guess and adjust later
33 
34 %model.T = 0.4;
35 %model.nt = 80; % guess and adjust later
36 %model.nt = 100; % guess and adjust later
37 %model.T = 0.1;
38 %model.nt = 50; % guess and adjust later
39 %model.400 => non-bounded u
40 
41 % output settings
42 model.verbose = 1;
43 model.debug = 0;
44 
45 % data functions
46 %model.name_init_values = 'blobs';
47 %model.radius = 0.1;
48 %model.gamma = 100;
49 %model.beta = 1; % init data weight between 0 and 1
50 
51 % name of function in rbmatlab/datafunc/init_values
52 model.init_values_ptr = @init_values_waveproduct;
53 % parameters for data functions
54 model.c_init_min = 0.0;
55 model.c_init_max = 1.0;
56 model.c_init_phase_x = 0.0;
57 model.c_init_phase_y = 0.0;
58 model.c_init_freq_x = 2*pi;
59 model.c_init_freq_y = 2*pi;
60 %model.c_init_lo = 1.0;
61 %model.c_init_lo = 0.0;
62 %model.c_init_lo = -1.0;
63 
64 % name of function in RBmatlab/datafunc/dirichlet_values
65 %model.name_dirichlet_values = 'homogeneous';
66 %model.c_dir = 0;
67 
68 % name of function in RBmatlab/datafunc/neuman_values
69 %model.name_neuman_values = 'homogeneous';
70 %model.c_neu = 0;
71 
72 %model.name_neuman_values = 'homogeneous';
73 %model.c_neu = 0;
74 
75 % convective flux
76 %model.name_flux = 'burgers_parabola';
77 model.conv_flux_ptr = @conv_flux_burgers;
78 %| \todo this could also be done explicitly (analytic derivative)
79 model.conv_flux_derivative_ptr = @conv_flux_forward_difference;
80 % for simplifying computation in case of linear flux:
81 model.flux_linear = 0;
82 % diagonal velocity field
83 model.flux_vx = 1;
84 model.flux_vy = 1;
85 %model.flux_quad_degree = 2;
86 model.flux_pdeg = 1; % burgers exponent
87 
88 % rb-formulation
89 %model.mu_names = {'c_init_lo','vrot_angle'};
90 model.mu_names = {'flux_pdeg'};
91 model.mu_ranges = {[1,2]};
92 model.rb_problem_type = 'nonlin_evol';
93 %model.problem_type = 'lin_evol';
94 
95 % finite volume settings
96 %model.name_convective_num_flux = 'lax-friedrichs';
97 %model.lxf_lambda = 1.66
98 %model.lxf_lambda = 1.25;
99 %model.lxf_lambda = 0.35355;
100 %model.lxf_lambda = fv_search_max_lxf_lambda([],model);
101 %keyboard;
102 model.num_conv_flux_ptr = @fv_num_conv_flux_engquist_osher;
103 model.fv_expl_conv_weight = 1.0;
104 model.fv_impl_conv_weight = 0.0;
105 model.ei_space_operators = { model.L_E_local_ptr };
106 model.newton_solver = false;
107 model.newton_steps = 60;
108 model.operators_conv_implicit = ...
110 model.implicit_gradient_operators_algorithm = ...
112 
113 % projection of analytical initial data to discrete function
114 model.init_values_algorithm = @fv_init_values;
115 model.implicit_operators_algorithm = @fv_operators_implicit;
116 % get mass matrix for inner product computation from DOF-vectors
117 model.data_const_in_time = 1;
118 
119 % settings for empirical interpolation
120 par.range = model.mu_ranges;
121 model.ei_numintervals = [9]; % 8x8 parameter grid
122 model.Mmax = 300;
123 %model.Mmax = 160; % take 150 for sim, 10 for error-est
124 model.ei_detailed_savepath = ['nonlin_symmetry_detailed_', ...
125  num2str(length(model.ei_numintervals))];
126 model.ei_operator_savepath = ['nonlin_symmetry_ei_operator_', ...
127  num2str(length(model.ei_numintervals))];
128 model.ei_time_indices = 1:model.nt;
129 
130 model.CRB_generation_mode = 'param-time-space-grid';
131 model.ei_target_error = 'interpol';
132 
133 model.flux_quad_degree = 1;
134 
135 % settings for reduced basis generation
136 %model.operators_algorithm = 'fv_operators_implicit_explicit';
137 %model.init_values_algorithm = 'fv_init_values';
138 %model.inner_product_matrix_algorithm = 'fv_inner_product_matrix';
139 %model.lxf_lambda = 1.0194e+003;
140 %model.data_const_in_time = 1;
141 model.error_norm = 'l2';
142 % 'RB_extension_max_error_snapshot'};
143 model.RB_stop_timeout = 2*60*60; % 2 hours
144 model.RB_stop_epsilon = 1e-5;
145 model.RB_error_indicator = 'error'; % true error
146 %model.RB_error_indicator = 'estimator'; % Delta from rb_simulation
147 model.RB_stop_Nmax = 135;
148 model.RB_generation_mode = 'greedy_uniform_fixed';
149 model.RB_numintervals = model.ei_numintervals;
150 model.RB_detailed_train_savepath = model.ei_detailed_savepath;
151 
152 model.t = 0;
153 model.tstep = 1;
154 model.decomp_mode = 0;
155 model.orthonormalize = @model_orthonormalize_qr;
156 model.ei_time_indices = 1:model.nt+1;
157 model.plot = @fv_plot;
158 %model.mu = zeros(size(model.mu_names));
159 
160 model.enable_error_estimator = 1;
161 model.Mstrich = 1;
162 
163 %| \docupdate
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 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 p = fv_plot(gridbase grid, dofs, params)
routine plotting a single fv function of fv_functions.
Definition: fv_plot.m:17
function num_flux = fv_num_conv_flux_engquist_osher(model, model_data, U, NU_ind)
Function computing a numerical convective Engquist-Osher flux matrix.