rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
SimpleDetailedData.m
2  % a very simple detailed data implementation gathering several detailed
3  % snapshots spanning the reduced basis space.
4  %
5  % If this IDetailedData implementation is used, a simple reduced basis
6  % with snapshots from detailed simulations for directly specified
7  % parameters is generated. The list of parameters is given by 'mu_list'.
8  % Alternatively, the basis generation method can be customized with
9  % the field 'customized_basis_generation_ptr'.
10 
11  properties
12  % matrix of size 'H x N' holding the Dof vectors of the reduced basis
13  % snapshot vectors spanning the reduced basis space `{\cal W}_{\text{red}}
14  % \subset {\cal W}_h`
15  RB;
16 
17  % a list of mu vectors for which snapshots shall be added to the
18  % reduced basis space
19  %
20  % @default: By default only the barycenter of the parameter domain defined
21  % by ModelDescr.mu_ranges is in this list.
22  %
23  mu_list;
24 
25  % boolean flag indicating whether a POD shall be applied to the reduced
26  % basis vectors.
27  do_pod = false;
28 
29  % boolean flag indicating whether the reduced basis vectors shall be
30  % orthonormalized.
31  do_orthonormalize = false;
32 
33  % function handle to custom basis generation algorithm, the
34  customized_basis_generation_ptr = [];
35 
36  end
37 
38  methods
39  function sdd = SimpleDetailedData(rmodel, model_data)
40  % function sdd = SimpleDetailedData(rmodel, model_data)
41  % constructor for the SimpleDetailedData class
42  %
43 
44  sdd = sdd@IDetailedData(rmodel.bg_descr, model_data);
45 
46  if ~isempty(sdd.customized_basis_generation_ptr)
47  sdd.RB = sdd.customized_basis_generation_ptr(rmodel, sdd);
48  else
49  if isempty(sdd.mu_list)
50  sdd.mu_list = {cellfun(@mean, rmodel.descr.mu_ranges, 'UniformOutput', true)};
51  end
52 
53  Utot = [];
54  for m = 1:length(sdd.mu_list)
55  set_mu(rmodel,sdd.mu_list{m});
56  sim_data = detailed_simulation(rmodel,model_data);
57  if isempty(Utot)
58  Utot = rmodel.get_dofs_from_sim_data(sim_data);
59  else
60  U = rmodel.get_dofs_from_sim_data(sim_data);
61  Utot = [Utot U];
62  end;
63  end;
64 
65  if sdd.do_pod
66  Utot = PCA_fixspace(Utot, []);
67  end
68  if sdd.do_orthonormalize
69  A = rmodel.descr.get_inner_product_matrix(model_data);
70  Utot = orthonormalize_gram_schmidt(Utot, A);
71  end
72  sdd.RB = Utot;
73  end
74  end
75 
76  function delete_rb(this, index)
77  % function this = delete_rb(this, index)
78  % removes certain reduced basis functions.
79  %
80  % Parameters:
81  % index: an index vector of reduced basis functions to be removed
82  this.RB = this.RB(:,setdiff(1:size(this.RB,2), index));
83  end
84 
85  function siz = get_rb_size(this, dummy)
86  % function siz = get_rb_size(this, dummy)
87  % returns the dimension of the stored reduced basis space
88 
89  siz = size(this.RB, 2);
90  end
91 
92  end
93 
94 end
a very simple detailed data implementation gathering several detailed snapshots spanning the reduced ...
Struct with control fields for the analytical PDE functions, the discretization and the parametrizati...
Definition: dummyclasses.c:15
Interface class for the generation and storage of reduced basis spaces as described in Module (M2)...
Definition: IDetailedData.m:17