KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Basics3_Nonlinear.m
Go to the documentation of this file.
1 namespace demos{
2 
3 
4 /* (Autoinserted by mtoc++)
5  * This source code has been filtered by the mtoc++ executable,
6  * which generates code that can be processed by the doxygen documentation tool.
7  *
8  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
9  * Except for the comments, the function bodies of your M-file functions are untouched.
10  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
11  * attached source files that are highly readable by humans.
12  *
13  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
14  * the correct locations in the source code browser.
15  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
16  */
17 
18 function Basics3_Nonlinear() {
19 
20 
21 /* Please see Basics1 and Basics2 for more elementary setups. For the
22  * burgers model, most of the setup has been moved into class constructors
23  * of classes inheriting from models.BaseFullModel and models.BaseFirstOrderSystem. */
24 
25 dim = 500;
26 
27 /* % Model and system setup
28  * The original burgers model has a nonzero initial condition and no inputs.
29  * we add the same things here as also been used in the a-posteriori error
30  * estimation paper. */
31 m = models.burgers.Burgers(dim,2);
32 /* This solver solves the linear part implicitly and the nonlinear party
33  * explicitly. */
34 m.ODESolver= solvers.SemiImplicitEuler(m);
35 /* This determines the plot angle for the burgers plots. */
36 m.PlotAzEl= [-49 34];
37 m.SaveTag= sprintf(" burgers_d%d_fx1_bs1 ",m.Dimension);
38 
39 s = m.System;
40 /* Zero initial value */
41 s.x0= dscomponents.ConstInitialValue(zeros(dim,1));
42 /* Add Inputs */
43 x = linspace(m.Omega(1),m.Omega(2),dim+2);
44 x = x(2:end-1);
45 pos1 = logical((x >= .1) .* (x <= .3));
46 pos2 = logical((x >= .6) .* (x <= .7));
47 s.Inputs[1] = @(t)[sin(2*t*pi); (t>.2)*(t<.4)];
48 B = zeros(dim,2);
49 B(pos1,1) = 4*exp(-((x(pos1)-.2)/.03).^2);
50 B(pos2,2) = 4;
51 s.B= dscomponents.LinearInputConv(B);
52 
53 /* % Setup reduction */
54 m.TrainingInputs= 1;
55 
56 /* Sampling - log-grid */
57 p = m.System.Params(1);
58 p.Range= [0.01, 0.06];
59 p.Desired= 20;
60 p.Spacing= " log ";
61 m.Sampler= sampling.GridSampler;
62 
63 /* Space reduction
64  * m.ComputeTrajectoryFxiData = true; */
65 p = spacereduction.PODReducer;
66 /* p.IncludeTrajectoryFxiData = true; */
67 p.IncludeFiniteDifferences= false;
68 p.IncludeBSpan= true;
69 p.Mode= " abs ";
70 p.Value= 50;
71 m.SpaceReducer= p;
72 
73 /* Approximation of nonlinearity: Choose DEIM method here */
74 a = approx.DEIM;
75 a.MaxOrder= 100;
76 m.Approx= a;
77 
78 /* Run offline phase */
79 m.offlineGenerations;
80 save basic3_nonlinear;
81 /* load basic3_nonlinear; */
82 
83 /* % Build reduced model and do some analysis
84  * Details on construction of reduced models see Basics2! */
85 r = m.buildReducedModel;
86 /* Set the reduced DEIM approximation order to 25, and 10 orders for the
87  * error estimator. */
88 r.System.f.Order= [25 10];
89 mu = m.getRandomParam(1,1);
90 ma = ModelAnalyzer(r);
91 ma.compareRedFull(mu,1);
92 ma.analyzeError(mu,1);
93 
94 /* % Goodie: start the DEIM error estimator analyzer! */
96 }
119 };
ModelAnalyzer: Analysis tools for reduced models and approximations.
Definition: ModelAnalyzer.m:17
function Basics3_Nonlinear()
Basics3_Nonlinear:
function varargout = DEIMEstimatorAnalyzer(varargin)
DEIMESTIMATORANALYZER MATLAB code for DEIMEstimatorAnalyzer.fig DEIMESTIMATORANALYZER, by itself, creates a new DEIMESTIMATORANALYZER or raises the existing singleton*.
A boolean value.