1 classdef ReducedModel < Greedy.User.IReducedModel
2 % reduced model
for non-linear evolution problems as given by a
3 % TwoPhaseFlow.DetailedModel.
5 % This is compatible with Greedy.User.
IReducedModel and can therefore make
6 % use of @ref Greedy.User.
IDetailedData "detailed data objects" created by
10 enable_error_estimator = false;
15 properties (Dependent)
16 % current time instance
24 % This constant is used
for a consistency check of the model descr with
26 ddescr_checks = struct(...
27 'init_values_algorithm', {{@(x) isequal(
class(x),
'function_handle')}}...
35 % Constructor
for the reduced model.
38 % dmodel: of type TwoPhaseFlow.DetailedModel
40 if nargin == 1 || isempty(bg_descr)
43 %
this implements a copy constructor
if necessary...
45 % are we NOT a copy constructor?
46 if ~(isempty(bg_descr) || isa(dmodel,
'TwoPhaseFlow.ReducedModel'))
51 TwoPhaseFlow.ReducedModel.ddescr_checks);
52 error(
'Consistency check for TwoPhaseFlow.ReducedModel failed.');
59 function N = get_N(
this,
id)
63 N = get_by_description(this.N,
id);
66 function set_N(this,
id, val)
67 set(this.N, get_index(this.N,
id), val);
70 function M = get_M(this,
id)
71 M = get_by_description(this.M,
id);
74 function set_M(this,
id, val)
75 set(this.M, get_index(this.M,
id), val);
79 function c = copy(this)
80 % function c = copy(this)
84 % c: an
object of type TwoPhaseFlow.
ReducedModel which is a deep copy
89 function rb_sim_data = rb_simulation(rmodel, reduced_data, sim_data, dd)
90 % function rb_sim_data = rb_simulation(rmodel, reduced_data)
91 % forwards the reduced simulation to the method rb_simulation_impl()
92 % after getting a suitable reduced data
leaf element.
96 % sim_data: structure holding simulation data, i.e. Dof-vectors with
97 % fields 'S', 'U', 'P' for the saturation, velocity and
98 % pressure field concentrations. This can be used for
99 % reference computations. @default []
101 % reference computations. @default []
104 % rb_sim_data: structure holding the coefficient vectors of the reduced
105 % simulations and optional error estimators.
106 reduced_data_leaf = get_leaf(reduced_data, rmodel);
109 rb_sim_data = rb_simulation_impes_impl(rmodel, reduced_data_leaf);
111 rb_sim_data = rb_simulation_impes_impl(rmodel, reduced_data_leaf, sim_data, dd);
115 rb_sim_data = rb_simulation_impl(rmodel, reduced_data_leaf);
117 rb_sim_data = rb_simulation_impl(rmodel, reduced_data_leaf, sim_data, dd);
126 rb_sim_data = rb_simulation_impl(this, reduced_data, sim_data, dd);
132 rb_sim_data = rb_simulation_impes_impl(this, reduced_data, sim_data, dd);
134 function a0 = rb_init_values(this, detailed_data,
decomp_mode)
135 % function a0 = rb_init_values(this, detailed_data,
decomp_mode)
141 % detailed_data: detailed data tree
leaf object of type Greedy.DataTree.Detailed.PODEILeafNode.
144 % a0: coefficient vector of size 'N x 1' for the initial values.
153 rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data);
158 function Delta = get_estimators_from_sim_data(rb_sim_data)
159 % function Delta = get_estimators_from_sim_data(rb_sim_data)
163 Delta = rb_sim_data.Delta;
166 function Delta = get_estimator_from_sim_data(rb_sim_data)
167 % function Delta = get_estimator_from_sim_data(rb_sim_data)
171 Delta = rb_sim_data.Delta(end);
177 function t = get.t(this)
181 function set.t(this, t)
182 this.detailed_model.t = t;
185 function tstep = get.tstep(this)
186 tstep = this.descr.tstep;
189 function set.tstep(this, tstep)
190 this.detailed_model.tstep = tstep;