rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
dom_dec_model.m
Go to the documentation of this file.
1 function model = dom_dec_model(base_model,params)
2 % function model = dom_dec_model(base_model,params)
3 % function creating a domain-decomposition-model with an arbitrary
4 % model and optional params.
5 %
6 % The domain in model is decomposed into
7 % two parts. one can specify multiple rectangles in
8 % params.dd_rect_corner1/2, which are used for constructing the
9 % grids of the first subdomain. the second subdomain then is the
10 % complement of the first.
11 
12 % I.Maier, 01.07.2011
13 
14 % default parameters
15 if nargin < 2
16  params = [];
17 end;
18 
19 if ~isfield(params,{'dd_rect_corner1','dd_rect_corner2'})
20  params.dd_rect_corner1 = {[0,0],[0.25,0],[0.75,0]};
21  params.dd_rect_corner2 = {[0.25,0.25],[0.75,0.75],[1,0.5]};
22 end;
23 if ~isfield(params,'RB_extension_method')
24  params.RB_extension_method = 'A';
25 end;
26 if ~isfield(params,'RB_sequence_mode')
27  params.RB_sequence_mode = 0;
28 end;
29 if ~isfield(params,'RB_numintervals')
30  params.RB_numintervals = 4;
31 end;
32 
33 model = [];
34 model.verbose = 1;
35 model.decomp_mode = 0; %default
36 model.base_model = base_model;
37 model.dirichlet_side = 1; % 1 or 2
38 
39 if isfield(base_model,'mu_names')
40  model.mu_names = base_model.mu_names;
41  model.mu_ranges = base_model.mu_ranges;
42 
43  model.mu_ref = zeros(length(model.mu_ranges),1);
44  for i = 1:length(model.mu_ranges)
45  model.mu_ref(i) = (model.mu_ranges{i}(1) + ...
46  model.mu_ranges{i}(2))/2;
47  end;
48 end;
49 
50 % required funtion pointers for the simulations
51 model.set_mu = @dom_dec_set_mu;
52 model.get_mu = @get_mu_default;
53 model.gen_model_data = @dom_dec_gen_model_data;
54 model.operators = @dom_dec_operators;
55 model.operators_output = base_model.operators_output;
56 model.detailed_simulation = @dom_dec_detailed_simulation;
57 model.get_dofs_from_sim_data = @dom_dec_get_dofs_from_sim_data;
58 model.gen_detailed_data = @dom_dec_gen_detailed_data;
59 model.gen_reduced_data = @dom_dec_gen_reduced_data;
60 model.get_rb_size = @dom_dec_get_rb_size;
61 model.orthonormalize = @dom_dec_orthonormalize;
62 model.rb_simulation = @dom_dec_rb_simulation;
63 model.rb_reconstruction = @dom_dec_rb_reconstruction;
64 model.compute_error = @dom_dec_compute_error;
65 model.plot_sim_data = @dom_dec_plot_sim_data;
66 model.get_inner_product_matrices = @ ...
67  dom_dec_get_inner_product_matrices;
68 model.set_rb_in_detailed_data = @dom_dec_set_rb_in_detailed_data;
69 model.get_rb_from_detailed_data = @ ...
70  dom_dec_get_rb_from_detailed_data;
71 model.RB_extension_PCA_fixspace = @ ...
72  dom_dec_RB_extension_PCA_fixspace;
73 model.RB_extension_eigenbasis = @ dom_dec_RB_extension_eigenbasis;
74 
75 % geometry:
76 model.dd_rect_corner1 = params.dd_rect_corner1;
77 model.dd_rect_corner2 = params.dd_rect_corner2;
78 
79 % settings for the detailed simulation:
80 model.maxiter = 10000;
81 model.det_sim_tol = 1e-12;
82 model.relaxation_factor = 1; % the optimal relaxation parameter is
83  % multiplied by this factor
84 
85 % settings for the basis generation:
86 model.RB_generation_mode = 'POD_greedy';
87 model.RB_generation_epsilon = 1e-14;
88 model.RB_extension_method = params.RB_extension_method;
89 model.RB_extension_PCA_modes = 1;
90 model.RB_sequence_mode = params.RB_sequence_mode;
91 model.N_max = {100 100};
92 
93 model.RB_init_mode = 'random';
94 model.N_eigenbasis = 0;
95 model.RB_error_indicator = 'rb_error_estimate';
96 model.RB_greedy_tolerance = 1e-06;
97 
98 if isfield(base_model,'mu_names')
99  model.RB_numintervals = params.RB_numintervals * ...
100  ones(length(base_model.mu_names),1);
101 end;
102 
103 % settings for the reduced simulation:
104 model.RB_approximate_thetaN = 1;
105 model.RB_maxiterN = 10000;
106 model.RB_sim_tol = 1e-12;
107 
108 if isfield(base_model,'coercivity_alpha')
109  model.coercivity_alpha = base_model.coercivity_alpha;
110 end;
111 if isfield(base_model,'continuity_gamma')
112  model.continuity_gamma = base_model.continuity_gamma;
113 end;
114 
115 if isfield(base_model,'mu_names')
116  % default mu values
117  model = set_mu_default(model,get_mu(base_model));
118 end;
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
Definition: verbose.m:17
function model = dom_dec_set_mu(model, mu)
Trivial function setting the parameter in model and model.base_model.
function sim_data = dom_dec_detailed_simulation(model, model_data)
the detailed solution is computed via the iterative Dirichlet-Neumann schema.
function [ A , r , A_gamma , r_gamma ] = dom_dec_operators(model, model_data)
Function computing all required matrizes for the simulation.
function reduced_data = dom_dec_gen_reduced_data(model, detailed_data)
all required offline data for the rb-simulation is computed. there are two ingredients for the error ...
function detailed_data = dom_dec_gen_detailed_data(model, model_data)
function generating the reduced basis functions.
function model = dom_dec_model(base_model, params)
function creating a domain-decomposition-model with an arbitrary model and optional params...
Definition: dom_dec_model.m:17
function rb_sim_data = dom_dec_rb_simulation(model, reduced_data)
Realization of the iterative schema for RB methods according to my diploma thesis.