2 % reduced model
for linear stationary problems as given by a
3 % LinStatDune.DetailedModel.
6 enable_error_estimator =
false;
12 function rm = ReducedModel(dmodel, bg_descr)
13 %
function rm = ReducedModel(detailed_model, basis_generator)
14 % Constructor
for the reduced model.
17 % dmodel: of type LinStatDune.DetailedModel
22 function rb_sim_data = rb_simulation(rmodel, reduced_data)
23 %
function rb_sim_data = rb_simulation(rmodel, reduced_data)
24 % reduced simulation
for linear stationary finite volume schemes
25 descr = rmodel.detailed_model.descr;
29 LI_coeff = descr.coeff_ops.LI(cmu);
30 f_coeff = descr.coeff_ops.f(cmu);
32 LIN = lincomb_sequence(reduced_data.AN_comp, LI_coeff);
33 fN = lincomb_sequence(reduced_data.fN_comp, f_coeff);
35 KII_coeff = kron(LI_coeff, LI_coeff);
36 mI_coeff = kron(LI_coeff, f_coeff);
37 m_coeff = kron(f_coeff, f_coeff);
38 KII = lincomb_sequence(reduced_data.KII, KII_coeff);
39 mI = lincomb_sequence(reduced_data.mI, mI_coeff);
40 m = lincomb_sequence(reduced_data.m, m_coeff);
52 res_norm = sqrt(res_norm_sqr);
57 Delta = descr.L_I_inv_norm_bound(cmu) * res_norm;
59 rb_sim_data.Delta = Delta;
62 function this = set_mu(
this, mu)
63 %
function this = set_mu(
this, mu, propagate)
64 % sets the active parameter vector `\mu \in {\cal M}`
66 % The parameter
set here, is used by the detailed_simulation() function.
68 % The default implementation sets all fieldnames 'descr.mu_names' in the
72 % mu: The parameter vector `\boldsymbol\mu`.
77 assert(length(mu) == length(this.descr.mu_names));
80 % this.descr.mexptr(
'set_mu', mu);
83 function mu = get_mu(
this)
84 %
function mu = get_mu(
this)
85 % returns the active parameter vector `\boldsymbol\mu \in {\cal M}`
87 % The
default implementation returns a vector of the values of the fields
88 % of the #descr structure with names
'descr.mu_names'.
91 % mu: The parameter vector `\boldsymbol\mu`
95 this.mu = get_mu(this.detailed_model);
99 % mu = this.descr.mexptr('get_mu');
102 function rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data)
103 % function rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data)
107 % detailed_data: of type LinEvol.DetailedData
108 % rb_sim_data: struct holding reduced simulation data returned by
112 % rb_sim_data: struct holding the reduced simulation results and their
115 dd_leaf = get_leaf(detailed_data, this);
117 dd_leaf = detailed_data;
119 dune_sim_data = this.descr.mexptr('rb_reconstruction', dd_leaf.model_data, rb_sim_data);
120 rb_sim_data =
structcpy(rb_sim_data, dune_sim_data);
123 function c = copy(this)
124 % function c = copy(this)
128 % c: an
object of type LinEvol.
ReducedModel which is a deep copy of this
object.
134 function Delta = get_estimators_from_sim_data(rb_sim_data)
135 % function Delta = get_estimators_from_sim_data(sim_data)
139 Delta = rb_sim_data.Delta;
142 function Delta = get_estimator_from_sim_data(rb_sim_data)
143 % function Delta = get_estimator_from_sim_data(sim_data)
147 Delta = rb_sim_data.Delta(end);