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