3 % Non-linear evolution equation with geometry transformation and an example of
4 % the Richards equation
6 % Included in the following presentations:
10 % Included in the following papers:
11 % - Diploma thesis of Martin Drohmann
12 % - Algoritmy proceedings 2009
14 % See also: demo_richards_fv()
16 % optional fields of params:
17 % model_size: -
'big' simulations are done on a larger grid with very
19 % -
'small' simulations are done on a smaller grid with
22 % -
'linear_heat_trapezoidal' on transformed domain linear heat equation
23 % with a trapezoidal geometry parametrisation. on reference
24 % domain a linear convection-diffusion-reaction problem. It
25 % still depends on empirical interpolation, however, because
26 % of non-affine parameter dependencies of the operators
27 % introduced by geometry parametrisation. Note, that
28 % diffusion term is discretized explicitly.
29 % -
'linear_heat_polynomial' on transformed domain linear heat equation
30 % with polynomial geometry parametrization. On reference
31 % domain a linear convection-diffusion-reaction problem.
32 % Note, that diffusion term is discretized explicitly.
33 % -
'nonlinear_richards_trapezoidal' on transformed domain real Richards
34 % equation example with trapezoidal geometry parametrisation
35 % and a gravity induced convection term. On reference
36 % domain a non-linear convection-diffusion-reaction problem.
37 % Note, that diffusion term is discretized explicitly.
38 % -
'linear_heat_polynomial_implicit' On transformed domain
39 % lienar heat equation with polynomial geometry
40 % parametrisation. On reference domain a linear
41 % convection-diffusion-reaction problem with non-affine
42 % parameter dependence (resolved by EI). The diffusion term
43 % is discretized implicitly.
44 % -
'test' very small heat equation example suitable
for
48 model.name =
'richards_fv_model';
49 model.rb_problem_type =
'NonlinEvol';
50 %% data that is definitely used outside of the detailed simulations
51 % mu_names = {
'c_init',
'hill_height'};
52 % mu_ranges = {[-1,0],[-0.1,0.1]};
53 model.mu_names = {
'c_dir_low',
'hill_height'};
54 model.mu_ranges = {[0,0.5],[0.0,0.4]};
57 %% data that might be of interest outside of the detailed simulations
61 %% finite volume settings
62 model.diffusivity_ptr = @diffusivity_homogeneous;
63 model.diffusivity_tensor_ptr = @diffusivity_tensor_richards;
64 % diffusivity_ptr = @diffusivity_linear_gradient;
71 model.flux_linear =
true;
72 model.name_flux =
'richards';
75 model.operators_diff_implicit = @fv_operators_diff_implicit_gradient_tensor;
76 model.operators_conv_implicit = @fv_operators_zero;
77 model.operators_neumann_implicit = @fv_operators_zero;
78 model.fv_expl_conv_weight = 1.0;
79 model.fv_expl_diff_weight = 1.0;
80 model.fv_expl_react_weight = 1.0;
83 % lxf_lambda = fv_search_max_lxf_lambda([],
88 model.xnumintervals = 100;
89 model.ynumintervals = 80;
92 model.dirichlet_values_ptr = @dirichlet_values_uplow;
94 model.dir_box_xrange = [-1 2];
95 model.dir_box_yrange = 0.5 + [1/320 3/320];
97 model.c_dir_right = 1;
99 model.c_dir_low = 0.5;
100 model.dir_middle = 0.7;
101 % name_dirichlet_values =
'homogeneous';
104 % pointer to
function in rbmatlab/datafunc/neumann_values
105 %neumann_values_ptr = @neumann_values_homogeneous;
106 model.neumann_values_ptr = @neumann_values_zero;
109 % name of
function in rbmatlab/datafunc/init_values/
110 model.init_values_ptr = @init_values_transformed_blobs;
111 % parameters
for data functions
112 model.blob_height = 0.1;
115 model.filecache_velocity_matrixfile_extract = 0;
117 model.geometry_spline_type =
'cubic';
118 model.hill_height = 0.0;
119 model.geometry_transformation_spline_x = [ 0 0.5 1 ];
120 model.geometry_transformation_spline_y = [ 0 -0.033 0 ];
126 model.divclean_mode =
false;
127 model.flux_quad_degree = 1;
131 model.velocity_ptr = @velocity_richards;
133 model.conv_flux_derivative_ptr = @(glob, U, params) params.velocity_ptr(glob, params);
136 model.data_const_in_time = 0;
138 % set all to dirichlet-boundary by specifying
"rectangles", all
139 % boundary within is set to boundary type by bnd_rect_index
140 model.bnd_rect_corner1 = [-0.999999, 0; ...
142 model.bnd_rect_corner2 = [ 2, 0.999999; ...
144 % -1 means dirichlet, -2 means neumann
145 model.bnd_rect_index = [ -1, -2 ];
147 %
if isfield(params,
'separate_CRBs') && params.separate_CRBs
148 % model.separate_CRBs = params.separate_CRBs;
149 % savepath_infix =
'';
151 % savepath_infix =
'_one_CRB';
154 model.ei_space_operators = { model.L_E_local_ptr };
158 model.geometry_transformation =
'spline';
160 model.stencil_mode =
'vertex';
161 model.local_stencil_size = 1;
163 if isfield(params,
'model_size')
164 if strcmp(params.model_size, 'big') == 1
165 model.xnumintervals = 200;
166 model.ynumintervals = 200;
168 if strcmp(params.model_size, 'small') == 1
169 model.xnumintervals = 50;
170 model.ynumintervals = 50;
175 model.implicit_nonlinear = false;
176 if isfield(params, 'model_type')
177 if strcmp(params.model_type, 'nonlinear') == 1
178 model.geometry_spline_type = 'cubic';
180 elseif strcmp(params.model_type, 'linear_heat_trapezoidal') == 1
181 model.geometry_spline_type = 'affine';
185 elseif strcmp(params.model_type, 'richards_affine') == 1
186 model.geometry_spline_type = 'affine';
187 model.diffusivity_ptr = @diffusivity_richards_nonlinear;
188 model.init_values_ptr = @init_values_transformed_blobs_richards;
189 % set parameters for nonlinear gradient
192 model.clim = [0.22,0.40];
193 % set new time parameters
196 model.c_dir_up = 0.32;
197 model.c_dir_low = 0.35;
198 model.xnumintervals = 80;
199 model.ynumintervals = 100;
200 % set default mu values
202 model.hill_height = 0.50;
203 % choose different mu vector
204 model.mu_names = {
'hill_height',
'c_init'};
205 model.mu_ranges = {[0,0.5],[0.22,0.34]};
206 % only neumann boundaries
207 model.bnd_rect_index = [ -2, -2 ];
209 ht = @(t)(t-0.218)./(0.52-0.218);
210 model.richards_perm_ptr = @(t)(2.1*ht(t).^0.5.*(1-(1-ht(t).^(7/6)).^(6/7)).^2);
211 model.richards_retention_ptr = @(t)(35.2574./(1./(3.311258.*t-0.7218543).^(6/7)-1).^(6/7)./(3.311258.*t-0.721854).^(13/7));
213 elseif strcmp(params.model_type,
'implicit_nonaffine_linear') == 1
214 model.implicit_nonlinear =
true;
215 model.hill_height = 0.4;
216 model.geometry_spline_type =
'cubic';
217 % model.mu_names = {
'hill_height',
'blob_height'};
218 model.mu_ranges = {[0,0.4], [0.0,0.3]};
220 % model.bnd_rect_index = [ -2, -2 ];
224 model.fv_expl_diff_weight = 0.0;
225 model.fv_impl_diff_weight = 1.0;
226 model.data_const_in_time = 1;
229 model.ei_space_operators = { model.L_E_local_ptr, model.L_I_local_ptr };
230 elseif strcmp(params.model_type,
'test')
233 model.geometry_spline_type = 'affine';
235 model.data_const_in_time = true;
237 error(['selected model type "', params.model_type, '" is unknown.']);
240 model.model_type = params.model_type;
242 % error norm for residual in error estimation
243 model.error_norm = 'l2';
250 % % settings for CRB generation
252 % model.sMmax = {50, 50};
253 % model.ei_stop_on_Mmax = 1;
254 % % build ei-basis with WHOLE trajectory
255 % model.ei_target_error =
'interpol';
256 % model.ei_numintervals = [2,4];
258 % model.RB_stop_Nmax = 50;
259 % model.RB_stop_epsilon = 1e-5;
260 % model.RB_stop_max_val_train_ratio = inf;
261 % model.RB_numintervals = [2,4];
263 % % target accuracy epsilon:
265 % % decide, whether estimator or
true error is error-indicator
for greedy
266 % model.RB_error_indicator =
'error'; %
true error
267 % % RB_error_indicator =
'estimator'; % Delta from rb_simulation
268 % % RB_error_indicator =
'ei_estimator_test'; % Delta from rb_simulation testet against
true error
272 %% model.ei_numintervals = [5,6];
273 %% model.RB_numintervals = [5,6];
277 %% model.ei_numintervals = [2,2];
278 %% model.RB_numintervals = [2,2];
280 %% model.RB_stop_Nmax = 5;
281 %% model.M = model.Mmax;
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
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 data = postprocess_gravity(data, glob, params)
subtracts a previously added addent induced by gravitational effects.
function model = richards_fv_descr(params)
Non-linear evolution equation with geometry transformation and an example of the Richards equation...
function num_flux = fv_num_diff_flux_gradient_tensor(model, model_data, U, NU_ind)
computes a numerical diffusive flux for a diffusion problem including a tensor
function model = model_default(model, T, nt)
model = model_default(model)
Reduced basis implementation for non-linear evolution equations.
function model = unitcube(model)
function adding fields to model for generating a 2D rectgrid with 100 x 100 elements on the unit-squa...
function num_flux = fv_num_conv_flux_engquist_osher(model, model_data, U, NU_ind)
Function computing a numerical convective Engquist-Osher flux matrix.
function [ flux , lambda ] = conv_flux_linear(glob, U, params)
function computing the convective flux of a convection problem.