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
DLTNonlinearCoreFun.m
Go to the documentation of this file.
1 namespace models{
2 namespace beam{
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 
20  :public dscomponents.ACoreFun {
39  private:
40 
41  Kx;
42 
43  currentx = "[]";
44 
45  dKx;
46 
47 
48  public:
49 
51  this = this@dscomponents.ACoreFun(system);
52 
53  free = this.System.Model.free;
54  K0 = this.System.K0(free,free);
55  this.fDim= size(K0,1);
56  this.xDim= size(K0,2);
57  JP = logical(K0);
58  this.JSparsityPattern= [JP 0*JP];
59  }
60 
61 
62  function fx = evaluateCoreFun(colvec<double> x,double t) {
63  this.updateB(x);
64  /* Funktion f auswerten */
65  fx = -this.Kx;
66  }
78  this.updateB(x);
79  /* Jacobi-Matrix ausgeben */
80  J = -this.dKx;
81  }
93  function pr = project(V,W) {
94  error(" not implemented ")
95  }
96 
97 
98  private:
99 
100  function updateB(colvec<double> x) {
101  m = this.System.Model;
102  /* Updates the x, J and R big versions (if needed) */
103  if isempty(this.currentx) || (norm(this.currentx - x) > 1e-8)
104 
105  /* Only pass the spatial part of x to the weak form! */
106  [Kx_full, dKx_full] = this.weak_form(x(1:length(m.free)));
107 
108  /* K(x) */
109  this.Kx= Kx_full(m.free);
110 
111  /* \partial K|\partial x
112  * dKx = [0 0; dK 0] */
113  this.dKx= dKx_full(m.free, m.free);
114  /* Augment to represent zero velocity dof dependency */
115  this.dKx= [this.dKx zeros(size(this.dKx))];
116 
117  this.currentx= x;
118  end
119  }
120 
121 
122  function [R , K ] = weak_form(u) {
123  m = this.System.Model;
124  data = m.data;
125  /* Full dimension */
126  fdim = 7*data.num_knots;
127 
128  /* Tangentiale Steifigkeitsmatrix aufstellen und schwache Form mit der aktuellen Verschiebung auswerten */
129  el = m.Elements;
130 
131  nel = length(el);
132  nK = zeros(nel,1); nR = nK;
133  for k=1:nel
134  nR(k) = length(el[k].getGlobalIndices);
135  end
136 
137  i = zeros(sum(nR.^2),1); j = i; K = i;
138  R = zeros(sum(nR),1); ir = R;
139 
140  u_full = zeros(fdim,1);
141  /* load dirichlet values */
142  u_full(m.dir_u) = m.u_dir;
143  /* set current values, only use x */
144  u_full(m.free) = u;
145  Roff = 0;
146  Koff = 0;
147  for k=1:length(el)
148  index_glob = el[k].getGlobalIndices;
149  [K_lok, R_lok] = el[k].getLocalTangentials(u_full(index_glob));
150 
151  /* Unklar welche alternative schneller ist; muss man in
152  * sp�teren tests mal profilen. Idealerweise m�ssen die i,j
153  * etc vektoren auch vorinitialisiert werden.. */
154  [li,lj] = meshgrid(index_glob);
155  pos = Koff + (1:nR(k)^2);
156  i(pos) = li(:);
157  j(pos) = lj(:);
158  K(pos) = K_lok(:);
159 
160  pos = Roff + (1:nR(k));
161  ir(pos) = index_glob;
162  R(pos) = R_lok;
163 
164  Roff = Roff + nR(k);
165  Koff = Koff + nR(k)^2;
166  end
167  /* Steifigkeitsmatrix für u und T */
168  K = sparse(i,j,K,fdim,fdim);
169  /* Residuumsvektor */
170  R = sparse(ir,ones(size(ir)),R,fdim,1);
171  }
180 };
181 }
182 }
183 
integer fDim
The current output dimension of the function.
Definition: ACoreFun.m:171
Model
The Model this System is attached to.
A boolean value.
Basic interface for all dynamical system's core functions Inherits the AProjectable interface...
Definition: ACoreFun.m:18
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
function fx = evaluateCoreFun(colvec< double > x,double t)
Daten nicht aktuell? (check inside)
V
The matrix of the biorthogonal pair .
Definition: AProjectable.m:61
colvec< double > mu
The current model parameter mu for evaluations. Will not be persisted as only valid for runtime durin...
Definition: ACoreFun.m:208
sparse< logical > JSparsityPattern
Sparsity pattern for the jacobian matrix.
Definition: ACoreFun.m:127
function J = getStateJacobian(colvec< double > x,double t,colvec< double > mu)
Daten nicht aktuell? (check inside)
W
The matrix of the biorthogonal pair .
Definition: AProjectable.m:72