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
Burgers.m
Go to the documentation of this file.
1 namespace models{
2 namespace burgers{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
19 class Burgers
20  :public models.BaseFullModel {
39  public: /* ( Constant ) */
40 
41  static const Omega = "[0 1]";
42 
43 
44  public: /* ( Dependent ) */
45 
47 
48 
49  private:
50 
51  fDim;
52 
53 
54  public:
55 
56  PlotAzEl = "[]";
65  public:
66 
67  Burgers(integer dim,integer version) {
68  this = this@models.BaseFullModel;
69  if nargin < 2
70  version = 1;
71  if nargin < 1
72  dim = 2000;
73  end
74  end
75  this.T= 1;
76  this.dt= .01;
77 
78  if version == 1
79  this.System= models.burgers.BurgersSys(this);
80  this.ODESolver= solvers.MLode15i;
81  this.SaveTag= sprintf(" burgers_1D_d%d_combRHS ",dim);
82  this.Name= sprintf(" 1D-%dd unsteady Burgers equation (combined RHS) ",dim);
83  elseif version == 2
84  this.System= models.burgers.BurgersSys_A(this);
85  this.System.MaxTimestep= this.dt;
86  this.ODESolver= solvers.SemiImplicitEuler(this);
87  this.System.MaxTimestep= this.dt;
88  this.SaveTag= sprintf(" burgers_1D_d%d ",dim);
89  this.Name= sprintf(" 1D-%dd unsteady Burgers equation ",dim);
90  end
91  this.Dimension= dim;
92 
93  this.SpaceReducer= spacereduction.PODGreedy;
94  this.SpaceReducer.Eps= 1e-9;
95 
96  a = approx.DEIM(this.System);
97  a.MaxOrder= 80;
98  this.Approx= a;
99 
100  this.ErrorEstimator= error.DEIMEstimator;
101  }
115  function plot(double t,matrix<double> y,pm_ax) {
116  if nargin < 4
117  pm_ax = PlotManager;
118  pm_ax.LeaveOpen= true;
119  end
120  nt = length(t);
121  y = [zeros(nt,1) y^t zeros(nt,1)]; /* add boundaries */
122 
123  xx = linspace(this.Omega(1), this.Omega(2), this.fDim+2);
124 
125  if ~ishandle(pm_ax)
126  pm_ax = pm_ax.nextPlot(" burgers ",sprintf(" %s: dim=%d ",this.Name,this.fDim)," x "," t ");
127  end
128  surfc(pm_ax,xx,t,y);
129  shading interp;
130  zlabel(" y ");
131  rotate3d on;
132  if ~isempty(this.PlotAzEl)
133  view(this.PlotAzEl);
134  end
135  }
136 
137 
138 
139 #if 0 //mtoc++: 'set.Dimension'
140 function Dimension(value) {
141  this.fDim= value;
142  this.System.newDim;
143  this.Data.SimCache.clearTrajectories;
144  }
145 
146 #endif
147 
148 
149 
150 #if 0 //mtoc++: 'get.Dimension'
151 function dim = Dimension() {
152  dim = this.fDim;
153  }
154 
155 #endif
156 
162 };
163 }
164 }
165 
char Name
The name of the Model.
Definition: BaseModel.m:117
PlotAzEl
Azimuth and elevation to use for model plotting.
Definition: Burgers.m:56
error.BaseEstimator ErrorEstimator
The associated error estimator for this model.
Burgers(integer dim,integer version)
Creates a new instance of the Burgers model.
Definition: Burgers.m:67
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
double dt
The desired time-stepsize for simulations.
Definition: BaseModel.m:291
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
Definition: BaseModel.m:102
static const Omega
Definition: Burgers.m:41
An integer value.
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
Definition: PlotManager.m:17
logical LeaveOpen
Flag indicating if the plots should be left open once the PlotManager is deleted (as variable) ...
Definition: PlotManager.m:213
solvers.BaseSolver ODESolver
The solver to use for the ODE. Must be an instance of any solvers.BaseSolver subclass.
Definition: BaseModel.m:315
approx.BaseApprox Approx
The approximation method for the CoreFunction.
double T
The final timestep up to which to simulate.
Definition: BaseModel.m:271
data.ModelData Data
The full model's data container. Defaults to an empty container.
spacereduction.BaseSpaceReducer SpaceReducer
The reduction algorithm for subspaces.
function plot(double t,matrix< double > y, pm_ax)
Definition: Burgers.m:115
double MaxTimestep
The maximum timestep allowed for any ODE solvers.
char SaveTag
A custom tag that can be used as a prefix to files for corresponding model identification.