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
DynLinTimoshenkoSystem.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 
40  public:
41 
42  K0;
54  public:
55 
57  this = this@models.BaseSecondOrderSystem(model);
58 
59  this.MaxTimestep= [];
60 
61  /* % Modellparameter
62  * d1 = 0.3 D�mpfungsfaktor vor Massenmatrix (Luftwiderstand) */
63  this.addParam(" d1 ",1," Range ",[0 2]);
64  /* d2 = .01 D�mpfungsfaktor vor Steifigkeitsmatrix (Materiald�mpfung) */
65  this.addParam(" d2 ",.05," Range ",[0 .1]);
66  /* Add the 3rd parameter, the local gravity factor */
67  this.addParam(" gravity constant ",9.81," Range ",[-20 20]);
68 
69  /* Input coordinate one is for constant force term b (previously in Ax+b in corefun)
70  * Fake constant gravity */
71  this.Inputs[1] = @(t)[1; 0; 0; -1];
72  this.Inputs[2] = @(t)[1; -1; 0; 0];
73  this.Inputs[3] = @(t)[1; 0; -1; 0];
74  /* More "advanced" gravity */
75  this.Inputs[4] = @(t)[1; sin(t); 0; 0];
76  this.Inputs[5] = @(t)[1; sin((t/10)*2*pi); cos((t/10)*2*pi); 0];
77  this.Inputs[6] = @(t)[1; 0; sin((t/10)*2*pi); cos((t/10)*2*pi)];
78 
80  }
81 
82 
84  m = this.Model;
85  data = m.data;
86 
87  /* % Assemblieren der Massenmatrix & Steifigkeitsmatrix f�r t=0
88  * Mass matrix (M is actually the full M (including dirichlet
89  * nodes), but is projected at the end of this method to the
90  * size of actual DoFs) */
91  e = m.Elements;
92  i = []; j = [];
93  M = []; K = [];
94  for k = 1:length(e)
95  M_lok = e[k].getLocalMassMatrix;
96  K_lok = e[k].getLocalStiffnessMatrix;
97  index_glob = e[k].getGlobalIndices;
98 
99  [li,lj] = meshgrid(index_glob);
100  i = [i; li(:)]; /* #ok<*AGROW> */
101 
102  j = [j; lj(:)];
103  M = [M; M_lok(:)];
104  K = [K; K_lok(:)];
105  end
106  nk = data.num_knots;
107 
108  /* % Mass matrix */
109  M = sparse(i,j,M,7*nk,7*nk);
110  /* Project M to effectively needed entries */
111  M = M(m.free,m.free);
112  this.M= dscomponents.ConstMassMatrix(M);
113  /* Create full K0 matrix */
114  this.K0= sparse(i,j,K,7*nk,7*nk);
115  K = this.K0(m.free,m.free);
116 
117  /* % Stiffness matrix */
118  if m.NonlinearModel
119  this.f= models.beam.DLTNonlinearCoreFun(this);
120  else
121  this.A= dscomponents.LinearCoreFun(-K);
122  end
123 
124  /* % Fill inner AffLinCoreFun with matrices
125  * Dämpfungsmodell 1: M a_t + (d1*M + d2*K) v_t + K u_t = f
126  * d1 = 0.3 Dämpfungsfaktor vor Massenmatrix (Luftwiderstand)
127  * d2 = .01 Dämpfungsfaktor vor Steifigkeitsmatrix (Materiald�mpfung) */
128  d = dscomponents.AffLinCoreFun(this);
129  d.addMatrix(" mu(1) ",M);
130  d.addMatrix(" mu(2) ",-K);
131  this.D= d;
132 
133  dim = length(m.free);
134  this.NumStateDofs= dim;
135  this.NumDerivativeDofs= dim;
136  this.updateDimensions;
137 
138  /* % Initial values */
139  this.x0= dscomponents.ConstInitialValue(zeros(dim,1));
140 
141  /* % Model input (gravity + const term)
142  * Affine-parametric matrix models const.
143  * B(t,\mu) = \mu_3*[0 F] + 1*[f_const 0 0 0], u(t) = [1 g(t)], g\in\R^3 */
144  B = dscomponents.AffLinInputConv;
145 
146  /* % 1*[f_const 0 0 0]
147  * Neumann forces (computed in Model.preprocess_data) */
148  f_const = m.f_neum;
149  f_const = f_const(m.free);
150  /* Dirichlet forces only for linear model */
151  if ~m.NonlinearModel
152  /* Reconstruct fake u vector which has entries only at
153  * dirichlet points. Used for computation of constant forces due
154  * to dirichlet values. */
155  u = zeros(7*nk,1);
156  u(m.dir_u) = m.u_dir;
157  f_dir = -this.K0*u;
158  f_const = f_const + f_dir(m.free);
159  end
160  Fconst = sparse(dim,4);
161  Fconst(:,1) = f_const;
162  B.addMatrix(" 1 ",Fconst);
163 
164  /* % \mu_3*[0 F] */
165  i = []; j = [];
166  F = [];
167  for k = 1:length(e)
168  F_lok = e[k].getLocalForceMatrix^t;
169  index_glob = e[k].getGlobalIndices;
170 
171  [li,lj] = meshgrid(index_glob,1:3);
172  i = [i; li(:)]; /* #ok<*AGROW> */
173 
174  j = [j; lj(:)];
175  F = [F; F_lok(:)];
176  end
177 
178  F = sparse(i,j,F,7*nk,3);
179  F = F(m.free,:);
180  /* F = [sparse(size(F,1),3); F];
181  * Add zero column to front */
182  F = [sparse(size(F,1),1) F];
183  B.addMatrix(" mu(3) ",F);
184  B.CoeffClass= " InputConvCoeffs ";
185 
186  this.B= B;
187 
188  /* % Output setup (dim = 3*space + 3*velo + 1*temp)
189  *xdim = (dim - (dim/7))/2; */
190  nf = length(m.free);
191  C = speye(nf);
192  /* Remove velocity entries
193  *C(repmat(logical([0 0 0 1 1 1]'),nf/6,1),:) = []; */
194  C = [C 0*C];
195  this.C= dscomponents.LinearOutputConv(C);
196  /* Export settings */
197  je = m.JKerMorExport;
198  je.DoFFields= 6;
199 
200  f = struct;
201  f(1).Type = " Displacement3D ";
202  f(1).Name = [];
203  f(2).Type = " RealValue ";
204  f(2).Name = " X-Velocity ";
205  f(3).Type = " RealValue ";
206  f(3).Name = " Y-Velocity ";
207  f(4).Type = " RealValue ";
208  f(4).Name = " Z-Velocity ";
209  je.LogicalFields= f;
210 
212  }
220  protected:
221 
222  function val = getDerivativeDirichletValues(double t) {
223  val = [];
224  }
225 
226 
227 };
228 }
229 }
230 
function updateSparsityPattern()
The state space vector (NumTotalDofs) is composed of x: Original state space of second order model...
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
dscomponents.AInputConv B
The input conversion.
Model
The Model this System is attached to.
function val = getDerivativeDirichletValues(double t)
Computes the derivative dirichlet values dependent on the current time.
K0
The stiffness matrix for t=0, used in the linear model and also in the nonlinear model to compute C...
LinearCoreFun(A)
No system reference needed for constant linear core fun.
Definition: LinearCoreFun.m:43
Base class for all KerMor second-order dynamical systems.
DynLinTimoshenkoSystem(models.BaseFullModel model)
dscomponents.LinearCoreFun D
The damping matrix of the second order system.
#define F(x, y, z)
Definition: CalcMD5.c:168
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
Inputs
The system's possible input functions. A cell array of function handles, each taking a time argument ...
dscomponents.LinearOutputConv C
The output conversion Defaults to an LinearOutputConv instance using a 1-matrix, which just forwards ...
dscomponents.ACoreFun f
The core f function from the dynamical system.
dscomponents.AMassMatrix M
The system's mass matrix.
u
The current input function as function handle, [] if none used.
double MaxTimestep
The maximum timestep allowed for any ODE solvers.
function ModelParam p = addParam(char name, default, varargin)
Adds a parameter with the given values to the parameter collection of the current dynamical system...
function buildElementDependentComponents()
Creates all beam element-dependent components like mass matrix and force conversion matrix...
dscomponents.LinearCoreFun A
Represents a linear or affine-linear component of the dynamical system.