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
RiemannBurgers.m
Go to the documentation of this file.
1 namespace models{
2 namespace rbmatlab{
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 
28  public:
29 
30  RiemannBurgers(xnum,ynum,T) {
31  this = this@models.rbmatlab.RBMatlabModel;
32 
33  /* Setup rbmatlab param struct */
34  params = struct;
35  if nargin < 3
36  T = .5;
37  if nargin < 2
38  if nargin < 1
39  xnum = 100;
40  end
41  ynum = 20;
42  end
43  end
44  params.xnumintervals= xnum;
45  params.ynumintervals= ynum;
46 
47  /* Get rbmatlab model */
48  m = riemann_burgers_model(params);
49  m.newton_regularisation= 0;
50  m.T= T;
51  m.nt= 100;
52  /* for a detailed simulation we do not need the affine parameter
53  * decomposition */
54  m.decomp_mode= 0;
55  this.RBMModel= m;
56 
57  this.RBMDataCont= models.rbmatlab.RBMDataContainer(gen_model_data(m));
58 
59  /* this.ComputeParallel = false; */
60 
61  /* Times */
62  this.T= m.T;
63  this.dt= m.T / m.nt;
64 
65  /* System setup */
66  this.System= models.rbmatlab.RiemBurgSys_Fun(this);
67 
68  /* Solver */
69  this.ODESolver= solvers.ExplEuler(this.dt);
70 
71  /* Sampling */
72  this.Sampler= sampling.GridSampler;
73 
74  aa = approx.algorithms.Componentwise;
75  aa.ComputeParallel= false;
76  a = approx.KernelApprox(this.System);
77  a.Algorithm= aa;
78  a.Kernel= kernels.GaussKernel(60);
79  a.TimeKernel= kernels.GaussKernel(10*m.T/m.nt);
80  a.ParamKernel= kernels.NoKernel;
81  this.Approx= a;
82  this.preApproximationTrainingCallback= @this.preApproxCallback;
83  this.postApproximationTrainingCallback= @this.postApproxCallback;
84 
85  /* Space reduction; choose only first row for subspace as the
86  * problem repeats in y-direction. */
87  V = repmat(eye(params.xnumintervals),...
88  params.ynumintervals,1)*sqrt(1/params.ynumintervals);
89  this.SpaceReducer= spacereduction.ManualReduction(V,V);
90  }
98  function plot(double t,matrix<double> y) {
99  sd.U= y;
100  ppar.no_lines= 1;
101  plot_sim_data(this.RBMModel, this.RBMDataCont.RBMData, sd, ppar);
102  }
103 
104 
105 
106  private:
107 
108  function preApproxCallback() {
109  xnum = this.RBMModel.xnumintervals;
110  /* this.Data.ApproxTrainData = this.Data.ApproxTrainData(1:xnum+3,:); */
111  this.Data.ApproxTrainData.fxi= this.Data.ApproxTrainData.fxi(1:xnum,:);
112  }
113 
114 
115  function postApproxCallback() {
116  ynum = this.RBMModel.ynumintervals;
117  this.Data.ApproxTrainData.fxi= repmat(this.Data.ApproxTrainData.fxi,ynum,1);
118  this.Approx.Ma= repmat(this.Approx.Ma,ynum,1);
119  this.Approx.off= repmat(this.Approx.off,ynum,1);
120  }
121 
122 
123 
124 };
125 }
126 }
127 
128 
129 
data.FileMatrix fxi
The evaluations of , stored row-wise in a data.FileMatrix.
RiemannBurgers(xnum, ynum, T)
Call superconstructor.
double dt
The desired time-stepsize for simulations.
Definition: BaseModel.m:291
sampling.BaseSampler Sampler
The sampling strategy the Model uses.
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
Definition: BaseModel.m:102
function_handle postApproximationTrainingCallback
Advanced property. Must be a function handle taking the current model instance.
RIEMANNBURGERS Summary of this class goes here Detailed explanation goes here.
RBMatlabModel: Base class for all rbmatlab models in KerMor.
Definition: RBMatlabModel.m:19
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
models.rbmatlab.RBMDataContainer RBMDataCont
The RBMDataContainer for the model_data struct.
Definition: RBMatlabModel.m:52
data.ModelData Data
The full model's data container. Defaults to an empty container.
spacereduction.BaseSpaceReducer SpaceReducer
The reduction algorithm for subspaces.
function_handle preApproximationTrainingCallback
Advanced property. Must be a function handle taking the current model instance.
RBMModel
The adopted RB matlab model.
Definition: RBMatlabModel.m:42
function plot(double t,matrix< double > y)
data.ApproxTrainData ApproxTrainData
Training data for the core function approximation.
Definition: ModelData.m:110