rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
FVDetailedModelDefault.m
1 classdef FVDetailedModelDefault < Greedy.User.IDetailedModel
2  % Interface specialization of an IDetailedModel ready to use with Greedy
3  % algorithms for (time dependent) @ref fv discretizations.
4  %
5 
6  properties (Constant)
7 
8  end
9  methods
10  function rbmdmed = FVDetailedModelDefault(descr)
11  % function rbmdmed = IDetailedModel(descr)
12  % Constructor for this class
13  %
14  rbmdmed = rbmdmed@Greedy.User.IDetailedModel(descr);
15 
16  if ~isfield(descr, 'init_values_algorithm')
17  rbmdmed.descr.init_values_algorithm = @fv_init_values;
18  end
19  if ~isfield(descr, 'inner_product_matrix_algorithm')
20  rbmdmed.descr.inner_product_matrix_algorithm = @fv_inner_product_matrix;
21  end
22 
23  end
24 
25  function UON = orthonormalize(this, model_data, U)
26  % function UON = orthonormalize(model, model_data, U)
27  % @copybrief GreedyUser::IDetailedModelorthonormalize()
28  %
29  % @copydetails GreedyUser::IDetailedModelorthonormalize()
30  %
31  % This implements an orthonormalization with help of the QR method.
32 
33  % UON = model.orthonormalize(model, model_data, U, eps);
34  UON = model_orthonormalize_qr(this.descr, model_data, U, 1e-10);
35  end
36 
37  function U0 = init_values_algorithm(dmodel, model_data)
38  % function UO = init_values_algorithm(model, model_data)
39  % @copybrief GreedyUser::IDetailedModelinit_values_algorithm()
40  %
41  % @copydetails GreedyUser::IDetailedModelinit_values_algorithm()
42  %
43  % This calls the function pointer defined in the #descr structure field
44  % 'init_values_algorithm'.
45  U0 = dmodel.descr.init_values_algorithm(dmodel.descr, model_data);
46  end
47 
48  function UV = inner_product(this, model_data, U, V)
49  % function UV = inner_product(this, model_data, U, V)
51  %
53  %
54  % This uses the 'W'=get_inner_product_matrix() method in order to compute
55  % the inner product `\langle u_h, v_h \rangle = U' W V`
56  W = Greedy.User.FVDetailedModelDefault.get_inner_product_matrix(model_data);
57  UV = U' * W * V;
58  end
59 
60  end
61 
62  methods(Static)
63  function errs = l2_error_sequence_algorithm(U, Uapprox, model_data)
64  % function errs = l2_error_sequence_algorithm(U, Uapprox, model_data)
65  % @copybrief GreedyUser::IDetailedModell2_error_sequence_algorithm()
66  %
67  % @copydetails GreedyUser::IDetailedModell2_error_sequence_algorithm()
68  %
69  % This function calls fv_l2_error()
70  errs = fv_l2_error(U, Uapprox, Greedy.User.FVDetailedModelDefault.get_inner_product_matrix(model_data));
71  end
72 
73  function errs = linfty_error_sequence_algorithm(U, Uapprox, model_data)
74  % function errs = linfty_error_sequence_algorithm(U, Uapprox, model_data)
75  % @copybrief GreedyUser::IDetailedModellinfty_error_sequence_algorithm()
76  %
77  % @copydetails GreedyUser::IDetailedModellinfty_error_sequence_algorithm()
78  %
79  % This function calls fv_linfty_error();
80  errs = fv_linfty_error(U, Uapprox, []);
81  end
82 
83  function W = get_inner_product_matrix(model_data)
84  % function W = get_inner_product_matrix(model_data)
85  % @copybrief GreedyUser::IDetailedModelget_inner_product_matrix()
86  %
87  % @copydetails GreedyUser::IDetailedModelget_inner_product_matrix()
88  %
89  % Required fields of model_data:
90  % W: the inner product matrix
91  % This function returns the inner product matrix stored in 'model_data'
92  W = model_data.W;
93  end
94 
95  end
96 
97 end
Interface class for all kind of reduced basis generation algorithms
Definition: Interface.m:18
virtual function UV = inner_product(ModelData model_data, U, V)
computes the inner project between the Dof vectors of two discrete functions
This is and IDetailedModel interface specialization for detailed models that shall be suitable for Gr...
function linfty_error = fv_linfty_error(U1, U2, W)
compute the infinity-norm error between two Dof vectors.
descr
The description structure holding information about the analytical parametrized problem and its discr...
Interface classes to be implemented by the Greedy.Algorithm user.
Interface specialization of an IDetailedModel ready to use with Greedy algorithms for (time dependent...
function l2_error = fv_l2_error(U1, U2, W)
function computing the l2-error between the two fv-functions or function sequences in U1...
Definition: fv_l2_error.m:17
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1