3 % depending on collateral reduced basis space information only (e.g.
4 % interpolation DOFs and a local grid).
40 properties (SetAccess =
private, Dependent)
55 % constructor
for the generation of the reduced data.
61 % Alternative synopsis:
63 % a reduced data node and (optionally) extracting smaller matrices.
69 copy_extract(rd, copy, rmodel);
71 fill_fields(rd, rmodel, detailed_data);
73 error('Did not find constructor for your arguments');
77 function conds = get_conds(this)
78 if ~isempty(this.Mmass)
79 conds.Mmass = condest(this.Mmass);
82 conds.BM = condest(this.BM);
85 function grid = get.grid(this)
86 grid = this.grid_local_ext;
89 function M = get.M(this)
90 M = size(this.BM, 2) - this.Mstrich;
93 function yesno = needs_subset_copy(this, rmodel)
94 % function yesno = needs_subset_copy(this, rmodel)
95 % @copybrief ::
GreedyUser.IReducedDataNode.needs_subset_copy()
97 % @copydetails ::
GreedyUser.IReducedDataNode.needs_subset_copy()
101 yesno = this.M ~= rmodel.M || this.Mstrich ~= rmodel.Mstrich;
105 methods(Access=private)
107 function fill_fields(this, rmodel, detailed_data)
108 model_data = detailed_data.model_data;
110 grid = model_data.grid;
112 this.BM = detailed_data.BM;
114 disp(['stencil mode: ' , rmodel.stencil_mode]);
115 disp(['stencil size: ' , num2str(rmodel.local_stencil_size)]);
118 eind = compute_TM_global(this, grid, detailed_data.TM, rmodel);
120 this.TM_global = eind;
123 this.grid_local_ext = gridpart(grid,eind);
124 % else % e.g. struct, or not required local grid:
125 % disp('please gen nice grid class for 1d grid...')
126 % reduced_ei_data.grid_local_ext{oi} = onedgrid_gridpart(grid,eind);
129 glob2loc = zeros(grid.nelements,1);
130 glob2loc(eind) = 1:length(eind);
131 this.TM_local = glob2loc(detailed_data.TM);
133 this.Mmass = detailed_data.QM
' * A * detailed_data.QM;
136 function copy_extract(this, reduced_data, rmodel)
137 MM = rmodel.M + rmodel.Mstrich;
138 if MM > reduced_data.M + reduced_data.Mstrich
139 error('M and M
'' too large
for current size of reduced basis!
');
142 grid = reduced_data.grid_local_ext;
144 % new version with external routine index_ext:
145 eind = compute_TM_global(this, grid, reduced_data.TM_local(1:MM), rmodel);
146 this.TM_global = eind;
147 this.grid_local_ext = gridpart(grid,eind);
149 glob2loc = zeros(grid.nelements,1);
150 glob2loc(eind) = 1:length(eind);
151 this.TM_local = glob2loc(reduced_data.TM_local(1:MM));
152 this.BM = reduced_data.BM(1:MM,1:MM);
153 this.Mmass = reduced_data.Mmass(1:MM,1:MM);
155 % get Q^t W Q for M to M+M'
157 QWQ = this.Mmass(rmodel.
M+1:end,MM);
158 this.factor = norm(QWQ);
165 methods (Access =
public)
166 function eind = compute_TM_global(this, grid, TM, rmodel)
167 if isequal(rmodel.stencil_mode, 'vertex')
168 mask = zeros(1, grid.nelements);
169 nbi = grid.NBI(TM,:);
171 % get indices of TM's neighbour-neighbours
172 nnbi = grid.NBI(unique(nbi(i)),:);
174 [nnbuniq,tally] = unique(sort(nnbi(ni)),'first');
175 tally = [tally(2:end);length(nnbi(ni))+1] - tally;
176 mask(nnbuniq) = tally;
179 mask(mask < 2) = 0; % skip the elements which have no vertex with the
180 % given elements in TM in common
183 eind = index_ext(grid, TM, rmodel.local_stencil_size);
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
Mstrich
number of collateral reduced basis vectors used for error estimation.
Mstrich
control variable for the number of (collateral) reduced basis vectors used for error estimation...
M
number of collateral reduced basis vectors stored in this data node.
reduced model for non-linear evolution problems as given by a NonlinEvol.DetailedModel.
BM
empirical interpolation matrix
Mmass
empirical interpolation mass matrix.
A triangular conforming grid in two dimensions.
Implementation of a Greedy.User.IReducedDataNode storing reduced data depending on collateral reduc...
gridbase grid_local_ext
local grid with added neighbours such that a sparse evaluation of the empirically interpolated operat...
A cartesian rectangular grid in two dimensions with axis parallel elements.
Interface for leaf nodes of the DataTree in Greedy.User.ReducedData objects.
Reduced basis implementation for non-linear evolution equations.
a one dimensional grid implementation
TM_global
indices of grid entities in the the global grid structure where the interpolation points are situated...
Interface classes to be implemented by the Greedy.Algorithm user.
This is the interface for a reduced model providing methods to compute low dimensional reduced simula...
TM_local
indices of grid entities in the grid_local_ext structure where the interpolation points are situated...
Customizable implementation of an abstract greedy algorithm.
Interface class for the generation and storage of reduced basis spaces as described in Module (M2)...
M
control variable for the size of the (collateral) reduced basis used for empirical interpolations...
gridbase grid
synonym for grid_local_ext