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
BurgersF_NoA.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 
39  public:
40 
41  Ax;
42 
43 
44  public:
45 
46  BurgersF_NoA(sys) {
47  this = this@dscomponents.ACompEvalCoreFun(sys);
48  this.CustomProjection= false;
49  this.TimeDependent= false;
50  }
51 
52 
53  function fx = evaluateCoreFun(colvec<double> x,unused1,unused2) {
54  fx = - x.*(this.Ax*x);
55  }
56 
57 
58  function J = getStateJacobian(colvec<double> x,unused1,unused2) {
59  hlp = bsxfun(@times,this.Ax,x);
60  J = -hlp - spdiags(this.Ax*x,0,size(x,1),size(x,1));
61  }
62 
63 
64  function newDim() {
65  m = this.System.Model;
66  n = m.Dimension;
67  dx = (m.Omega(2) - m.Omega(1))/(n+1);
68  e = ones(n,1);
69  d1 = e/(2*dx);
70  this.Ax= spdiags([-d1 0*d1 d1], -1:1, n, n);
71  this.JSparsityPattern= spdiags([e e e], -1:1, n, n);
72  this.xDim= n;
73  this.fDim= n;
74  }
75 
76 
77 
78  function copy = clone() {
79  copy = clone@dscomponents.ACompEvalCoreFun(this, models.burgers.BurgersF_NoA(this.System));
80  copy.Ax= this.Ax;
81  }
82 
83 
84  protected:
85 
86  function fxj = evaluateComponents(rowvec<integer> pts,rowvec<integer> ends,rowvec<integer> argidx,rowvec<integer> self,matrix<double> X,unused1,unused2) {
87  fxj = zeros(length(pts),size(X,2));
88  for idx=1:length(pts)
89  pt = pts(idx);
90  if idx == 1
91  st = 0;
92  else
93  st = ends(idx-1);
94  end
95  /* Select the elements of x that are effectively used in f */
96  xidx = (st+1):ends(idx);
97  x = X(xidx,:);
98  fxj(idx,:) = - x(self(xidx),:) .* (this.Ax(pt,argidx(xidx))*x);
99  end
100  }
125  fxj = this.evaluateComponents(varargin[:]);
126  }
127 
128 
129 };
130 }
131 }
132 
integer fDim
The current output dimension of the function.
Definition: ACoreFun.m:171
CustomProjection
Set this property if the projection process is customized by overriding the default project method...
Definition: ACoreFun.m:108
logical TimeDependent
Flag that indicates if the ACoreFun is (truly) time-dependent.
Definition: ACoreFun.m:84
Model
The Model this System is attached to.
function copy = clone()
Definition: BurgersF_NoA.m:78
function fxj = evaluateComponents(rowvec< integer > pts,rowvec< integer > ends,rowvec< integer > argidx,rowvec< integer > self,matrix< double > X, unused1, unused2)
Evaluates the burgers nonlinearity pointwise.
Definition: BurgersF_NoA.m:86
A variable number of input arguments.
integer xDim
The current state space dimension of the function's argument .
Definition: ACoreFun.m:151
models.BaseFirstOrderSystem System
The system associated with the current ACoreFun.
Definition: ACoreFun.m:193
#define X(i, j)
function fx = evaluateCoreFun(colvec< double > x, unused1, unused2)
Definition: BurgersF_NoA.m:53
sparse< logical > JSparsityPattern
Sparsity pattern for the jacobian matrix.
Definition: ACoreFun.m:127
function fxj = evaluateComponentsMulti(varargin)
Definition: BurgersF_NoA.m:124
ACompEvalCoreFun: A normal CoreFun which supports single-component evaluation.
function J = getStateJacobian(colvec< double > x, unused1, unused2)
Definition: BurgersF_NoA.m:58