rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
DetailedModel.m
1 classdef DetailedModel < Greedy.User.FVDetailedModelDefault
2  % IDetailedModel implementation for a non linear evolution problem
3  %
4  % This is a detailed model for a problem of this type
5  % @f{align}
6  % \partial_t u(x;t,\mu) - {\cal L}(t,\mu)[u(x,t;\mu)] &= 0 \qquad &\text{in }& \Omega \times [0, T], \\\\
7  % u(x;0,\mu) &= u_0(x;\mu) \qquad &\text{in }& \Omega \times \{0\}
8  % @f}
9  % with suitable boundary conditions and (non-linear) operators `{\cal
10  % L}(t,\mu) : {\cal W} \to {\cal W}` parametrized over the Time-parameter
11  % domain `[0,T] \times {\cal M}`.
12  %
13  % The numerical scheme for the numerical solution of this problem is assumed
14  % to be of the
15  % -# following type:
16  % @f{align*}
17  % u_h(\cdot;t^0,\mu) &= {\cal M}_h[u_0] \\\\
18  % \left(\text{Id} - \Delta t^k {\cal L}_{h, I}(t^{k+1},\mu)\right)[u_h(\cdot;t^{k+1},\mu)]
19  % &=
20  % \left(\text{Id} + \Delta t^k {\cal L}_{h, E}(t^{k},\mu)\right)[u_h(\cdot;t^{k},\mu)]
21  % @f}
22  % -# or with a Newton solver for non-linearities in the implicit case:
23  % ``
24  % u_h(\cdot;t^0,\mu) = {\cal M}_h[u_0],
25  % ``
26  % where the equation
27  % ``
28  % F[u_h(\cdot;t^{k+1},\mu), u_h(\cdot;t^k,\mu)] =0
29  % ``
30  % is solved subsequently for the operator `F:V_h\times V_h \to V_h` defined by
31  % ``
32  % F[u_h;v_h] :=
33  % \left(\text{Id} + \Delta t^k {\cal L}_{h, I}(t^{k+1},\mu)\right)[u_h]
34  % -
35  % \left(\text{Id} + \Delta t^k {\cal L}_{h, E}(t^{k},\mu)\right)[v_h]
36  % ``
37  % with a Newton scheme, minimizing defects `\| \delta_h^{k+1,\nu+1}\| \leq
38  % R_{\text{Newton}}` by solving
39  % ``
40  % D_1 F|_{u_h^{k+1,\nu}}[\delta_h^{k+1,\nu+1};u_h^k] = -F[u_h^{k+1,\nu};u_h^k]
41  % ``
42  % with `u_h^{k+1,\nu+1} := u_h^{k+1,\nu}`, `u_h^{k,0}:=u_h^k`,
43  % `u_h^{k+1}:=u_h^{k+1, \nu_{\max}(k)}` and
44  % `\nu_{\max}(k) = \min_{\nu} \| \delta_h^{k+1,\nu} \| \leq R_{\text{Newton}}`
45  %
46  % Furthermore the discretization consists of
47  % - a time discretization `0 = t^0 \leq t^1 = t^0 + \Delta t^0 \leq \ldots
48  % \leq t^{K+1} = t^{K} + \Delta t^{K} = T`,
49  % - discrete space operators `{\cal L}_{h, I}(t,\mu):{\cal W}_h \to {\cal
50  % W}_h` and `{\cal L}_{h, E}(t,\mu):{\cal W}_h \to {\cal W}_h` parametrized
51  % over the Time-Parameter domain `[0,T] \times {\cal M}` and
52  % - a projection operator `{\cal M}_h : {\cal W} \to {\cal W}_h`
53  %
54  %
55 
56  properties(Constant)
57  % This constant is used for a consistency check of the model descr with
58  % help of DetailedModelBaseIf.struct_check()
59  model_checks = struct(...
60  'fv_impl_diff_weight', {{@isscalar}},...
61  'fv_expl_diff_weight', {{@isscalar}},...
62  'fv_impl_conv_weight', {{@isscalar}},...
63  'fv_expl_conv_weight', {{@isscalar}},...
64  'newton_solver', {{@isscalar}},...
65  'implicit_nonlinear', {{@isscalar}},...
66  'L_E_local_ptr', {{@(x) isequal(class(x), 'function_handler')}},...
67  'L_I_local_ptr', {{@(x) isequal(class(x), 'function_handler')}}...
68  );
69 
70  % This constant is used for a consistency check of the model descr with
71  % help of DetailedModelBaseIf.struct_check()
72  %
73  % This check is only executed if we use a Newton scheme
74  newton_checks = struct(...
75  'newton_steps', {{@isscalar}},...
76  'implicit_operators_algorithm', {{@(x) isequal(class(x), 'function_handler')}},...
77  'implicit_gradient_operators_algorithm',...
78  {{@(x) isequal(class(x), 'function_handler')}},...
79  'newton_epsilon', {{@isscalar}}...
80  );
81  end
82 
83  properties (Dependent)
84  % current time instance
85  t;
86 
87  % current time step
88  tstep;
89  end
90 
91  properties
92  % boolean flag indicating whether conditions of system matrices shall be computed.
93  compute_conditions = false;
94  end
95 
96  methods
97  function dm = DetailedModel(descr)
98  % function dm = DetailedModel(descr)
99  % constructor
100  %
101  % This checks and stores the model description structure
102  %
103  % Required fields of descr:
104  % newton_solver: boolean flag indicating whether we are using a Newton
105  % scheme for the discretization.
106  dm = dm@Greedy.User.FVDetailedModelDefault(descr);
108  error('Consistency check of description for nonlinear evolution problems failed!');
109  end
111  error('Consistency check of description for Newton solver problems failed!');
112  end
113  end
114 
115  sim_data = detailed_simulation(model, model_data);
116 
117  model_data = gen_model_data(model);
118 
119  p = plot_sim_data(dmodel, model_data, sim_data, plot_params);
120  end
121 
122  methods (Static)
123 
124  function U = get_dofs_from_sim_data(sim_data)
125 
126  U = sim_data.U;
127 
128  end
129 
130  function snapshot = get_dofs_at_time(sim_data, time_index)
131 
132  snapshot = sim_data(:,time_index);
133  end
134 
135  end
137  methods
138  function t = get.t(this)
139  t = this.descr.t;
140  end
141 
142  function set.t(this, t)
143  this.descr.t = t;
144  end
145 
146  function tstep = get.tstep(this)
147  tstep = this.descr.tstep;
148  end
149 
150  function set.tstep(this, tstep)
151  this.descr.tstep = tstep;
152  end
153  end
154 
155 end
IDetailedModel implementation for a non linear evolution problem.
Definition: DetailedModel.m:18
static const newton_checks
This constant is used for a consistency check of the model descr with help of DetailedModelBaseIf.st...
static function ok = struct_check(descr, checks)
executes checks on the fields of a structure object
Definition: IModel.m:210
Reduced basis implementation for non-linear evolution equations.
Interface classes to be implemented by the Greedy.Algorithm user.
static const model_checks
This constant is used for a consistency check of the model descr with help of DetailedModelBaseIf.st...
Definition: DetailedModel.m:82
Interface specialization of an IDetailedModel ready to use with Greedy algorithms for (time dependent...
This is the interface for a detailed model providing methods to compute high dimensional simulation s...
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.
Definition: plot_sim_data.m:17
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1