1 function model = buckley_leverett_model(params)
2 %
function model = buckley_leverett_model(params)
4 % optional fields of params:
5 % model_size: -
'big' simulations are done on a larger grid with very
7 % -
'small' simulations are done on a smaller grid with
9 % model_type: -
'buckley_leverett' -- A Buckley-Leverett problem
11 model = nonlin_evol_model_default;
12 model.name =
'buckley_leverett_model';
13 model.rb_problem_type =
'bl';
14 %% data that is definitely used outside of the detailed simulations
15 % model.mu_names = {
'diff_m',
'diff_p',
'hill_height'};
16 % model.mu_ranges = {[0,0.5],[0.01,100],[0,0.3]};
17 model.mu_names = {
'diff_k0'};
18 model.mu_ranges = {[0.01, 0.5]};
21 %% data that might be of interest outside of the detailed simulations
25 %% finite volume settings
26 % model.diffusivity_ptr = @diffusivity_buckley_leverett;
27 % model.diffusivity_derivative_ptr = @diffusivity_buckley_leverett_derivative;
28 model.diffusivity_ptr = @diffusivity_buckley_leverett_simple;
29 model.diffusivity_derivative_ptr = @diffusivity_buckley_leverett_simple_derivative;
33 model.flux_linear = 0;
34 model.name_flux =
'exponential';
35 model.geometry_transformation =
'none';
37 model.newton_solver = 1;
38 model.collect_newton_steps =
false;
39 model.newton_steps = 60;
43 model.operators_conv_implicit = @fv_operators_zero;
44 model.operators_neumann_implicit = @fv_operators_zero;
45 model.fv_expl_conv_weight = 1.0;
46 model.fv_impl_diff_weight = 1.0;
47 model.implicit_gradient_operators_algorithm = ...
51 % lxf_lambda = fv_search_max_lxf_lambda([],
56 model.xnumintervals = 100;
57 model.ynumintervals = 100;
60 % model.dirichlet_values_ptr = @dirichlet_values_uplow;
62 % model.dir_box_xrange = [-1 2];
63 % model.dir_box_yrange = 0.5 + [1/320 3/320];
64 % model.c_dir_left = 1;
65 % model.c_dir_right = 1;
67 % model.c_dir_low = 0.5;
68 % model.dir_middle = 0.7;
69 model.dirichlet_values_ptr = @(glob, params) params.c_low * ones(length(glob),1);
71 % model.dirichlet_values_ptr = @dirichlet_values_leftright;
72 model.c_dir_left = 0.0;
73 model.c_dir_right = 0.0;
74 model.dir_middle = 0.5;
77 % pointer to
function in rbmatlab/datafunc/neumann_values
78 %model.neumann_values_ptr = @neumann_values_homogeneous;
79 model.neumann_values_ptr = @neumann_values_zero;
82 % name of
function in rbmatlab/datafunc/init_values/
83 % model.init_values_ptr = @init_values_transformed_blobs;
84 % model.init_values_ptr = @init_values_bars;
85 model.init_values_ptr = @init_values_bl;
86 % parameters
for data functions
88 model.filecache_velocity_matrixfile_extract = 0;
90 % settings
for CRB generation
91 model.CRB_generation_mode =
'param-time-space-grid';
92 model.RB_generation_mode =
'greedy_refined';
93 model.RB_refinement_mode =
'uniform';
94 model.RB_stop_max_refinement_level = 3;
95 model.RB_val_rand_seed = 12345;
96 model.refinement_theta = 0.6;
98 model.sMmax = {50, 50};
101 model.ei_stop_on_Mmax = 1;
102 % build ei-basis with WHOLE trajectory
103 model.ei_target_error =
'linfty';
104 model.RB_stop_max_val_train_ratio = 1.4;
106 % target accuracy epsilon:
108 % decide, whether estimator or
true error is error-indicator
for greedy
109 model.RB_error_indicator =
'error'; %
true error
110 % RB_error_indicator =
'estimator'; % Delta from rb_simulation
111 % RB_error_indicator =
'ei_estimator_test'; % Delta from rb_simulation testet
114 model.divclean_mode =
false;
115 model.flux_quad_degree = 1;
122 % set all to dirichlet-boundary by specifying
"rectangles", all
123 % boundary within is set to boundary type by bnd_rect_index
124 model.bnd_rect_corner1 = [-0.999999, 0; ...
126 model.bnd_rect_corner2 = [ 2, 0.999999; ...
128 % -1 means dirichlet, -2 means neumann
129 model.bnd_rect_index = [ -2, -2 ];
131 if isfield(params,
'separate_CRBs') && params.separate_CRBs
132 model.separate_CRBs = params.separate_CRBs;
135 savepath_infix =
'_one_CRB';
138 model.ei_detailed_savepath = [model.name,
'_',params.model_type,...
139 savepath_infix,
'_ei_data_interpol'];
140 model.ei_operator_savepath = [model.name,
'_',params.model_type,...
141 savepath_infix,
'_ei_operators_interpol'];
142 model.RB_detailed_val_savepath = [model.name,
'_',params.model_type,...
143 savepath_infix,
'_RB_val_detailed'];
144 model.RB_detailed_train_savepath = [model.name,
'_',params.model_type,...
145 savepath_infix,
'_RB_train_detailed'];
146 % model.RB_detailed_train_savepath = model.ei_detailed_savepath;
148 if isfield(params,
'model_size')
149 if strcmp(params.model_size, 'big') == 1
150 model.xnumintervals = 200;
151 model.ynumintervals = 200;
153 if strcmp(params.model_size, 'small') == 1
154 model.xnumintervals = 50;
155 model.ynumintervals = 50;
159 if isfield(params, 'model_type')
161 model.diff_K = 1.0000;
165 model.bl_lambda = 0.3;
166 model.newton_regularisation = false;
170 model.mu_names = {
'diff_K',
'c_low',
'bl_lambda'};
171 model.mu_ranges = {[0.1,2],[0.0,0.04],[0.1,0.4]};
172 model.adaptive_time_split_mode =
false;
173 model.ei_stop_epsilon_first = 5e-3;
174 model.ei_stop_epsilon = 1e-6;
175 model.minimum_time_slice = 5;
176 model.time_split_Mmax = 75;
178 model.extend_crb =
true;
179 model.skip_search =
true;
181 % model.mu_names = {
'bl_mu2',
'diff_K',
'bl_lambda'};
182 % model.mu_ranges = {[1,50],[0,2],[0.1,0.4]};
183 % model.ei_numintervals = [8,4,3,3];
184 % model.RB_numintervals = [8,4,3,3];
185 model.ei_numintervals = [4,3,3];
186 model.RB_numintervals = [2,1,1];
188 model.RB_stop_Nmax = 250;
189 model.RB_stop_epsilon = 5e-4;
190 model.RB_stop_timeout = 5*60*60;
191 model.bnd_rect_index = [-1,-1];
192 model.separate_CRBs =
false;
193 model.ei_space_operators = { model.L_E_local_ptr , model.L_I_local_ptr };
195 model.c_height = 0.4;
197 %
if isfield(params,
'use_laplacian') && params.use_laplacian
198 % model.laplacian_derivative_ptr = @(glob, U, model) ...
200 % model.laplacian_ptr = @(glob, U, model) ...
202 % model.diffusivity_ptr = @(glob, U, model) ...
203 %
struct(
'K',1,
'epsilon',0);
204 % model.diffusivity_derivative = @(glob, U, model) ...
205 %
struct(
'K',1,
'epsilon',0);
206 % model.implicit_gradient_operators_algorithm = ...
209 % elseif strcmp(params.model_type,
'eoc')
210 % model.xnumintervals = 10;
211 % model.ynumintervals = 10;
212 % model.diff_k0 = 0.05;
215 % model.init_values_ptr = @exact_function_heat_equation;
216 % model.dirichlet_values_ptr = @exact_function_heat_equation;
217 % model.bnd_rect_index = [ -1, -1 ];
218 % elseif strcmp(params.model_type,
'eoc_nonlinear')
219 % model.xnumintervals = 10;
220 % model.ynumintervals = 10;
221 % model.newton_regularisation = 0;
222 % model.diff_k0 = 0.0;
224 % model.diff_p = 1.0;
229 % model.data_const_in_time =
false;
230 % model.bnd_rect_index = [ -1, -2 ];
231 % elseif strcmp(params.model_type,
'buckley_leverett')
235 model.model_type = params.model_type;
237 model.implicit_nonlinear = false;
239 model.data_const_in_time = true;
243 if ~isfield(model, 'ei_space_operators')
244 model.ei_space_operators = { model.L_E_local_ptr, model.L_I_local_ptr };
247 if isfield(params,
'verbose')
248 model.verbose = params.verbose;
function [ L_I_diff , bdir_I_diff ] = fv_operators_diff_implicit_gradient(model, model_data, U, NU_ind)
computes diffusion contributions 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 num_flux_mat = fv_num_diff_flux_gradient(model, model_data, U, NU_ind)
computes a numerical diffusive flux for a diffusion problem
function [ flux , lambda ] = conv_flux_brooks_corey_simple(glob, U, params)
convective flux for Buckley-Leverett problem with Brooks-Corey functions
function [ flux , lambda ] = conv_flux_brooks_corey_simple_derivative(glob, U, params)
convective flux for Buckley-Leverett problem with Brooks-Corey functions
function model = model_default(model, T, nt)
model = model_default(model)
function [ flux , lambda ] = conv_flux_brooks_corey(glob, U, params)
convective flux for Buckley-Leverett problem with Brooks-Corey functions
function model = unitcube(model)
function adding fields to model for generating a 2D rectgrid with 100 x 100 elements on the unit-squa...
function [ L_I_diff_jac , bdir_I_diff_jac ] = fv_frechet_operators_diff_implicit_gradient(model, model_data, U, NU_ind)
computes a jacobian of implicit non-linear diffusion contributions to time evolution matrices at a po...
function buckley_leverett()
small script demonstrating a buckley leverett problem discretization and RB model reduction ...
function res = exact_function_plaplace(glob, params)
This is the first function from http://eqworld.ipmnet.ru/en/solutions/npde/npde1201.pdf.
function [ flux , lambda ] = conv_flux_brooks_corey_derivative(glob, U, params)
convective flux for Buckley-Leverett problem with Brooks-Corey functions
function num_flux = fv_num_conv_flux_engquist_osher(model, model_data, U, NU_ind)
Function computing a numerical convective Engquist-Osher flux matrix.