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
preprocess_data.m
Go to the documentation of this file.
2 namespace models{
3 namespace beam{
4 
5 
6 /* (Autoinserted by mtoc++)
7  * This source code has been filtered by the mtoc++ executable,
8  * which generates code that can be processed by the doxygen documentation tool.
9  *
10  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
11  * Except for the comments, the function bodies of your M-file functions are untouched.
12  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
13  * attached source files that are highly readable by humans.
14  *
15  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
16  * the correct locations in the source code browser.
17  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
18  */
19 
20 function models.beam.DynLinTimoshenkoModel.preprocess_data() {
21 
22 
23 used_knots_KR = [];
24 used_knots_RO = [];
25 used_knots_FH = [];
26 
27 /* Falls nicht alle Knoten verwendet werden */
28 if (size(this.KR_raw, 1))
29  used_knots_KR = unique(this.KR_raw(:,2:3));
30 end
31 if (size(this.RO_raw, 1))
32  used_knots_RO = unique(this.RO_raw(:,2:3));
33 end
34 if (size(this.FH_raw, 1))
35  used_knots_FH = unique(this.FH_raw(:,2:3));
36 end
37 used_knots = union(used_knots_RO, used_knots_KR);
38 used_knots = union(used_knots, used_knots_FH);
39 
40 /* Neue Nummerierung der Punkte aufstellen (Position in zB globalen
41  * Verschiebungsvektor) */
42 knot_index = zeros(1,size(this.Points,1));
43 for index = 1:length(used_knots)
44  knot = used_knots(index);
45  knot_index(knot) = index;
46 end
47 
48 num_knots = length(used_knots);
49 num_elem_RO = size(this.RO_raw, 1);
50 num_elem_KR = size(this.KR_raw, 1);
51 num_elem_FH = size(this.FH_raw, 1);
52 
53 this.data= struct(" num_knots ", num_knots, " knot_index ", knot_index,...
54  " num_elem_RO ", num_elem_RO, " num_elem_KR ", num_elem_KR, " num_elem_FH ", num_elem_FH);
55 
56 if (size(this.Supports, 1) > 0)
57  this.data.dirichlet= this.Supports(:, 1);
58  this.data.dir_data= this.Supports(:, 2:15);
59 else
60  this.data.dirichlet= [];
61  this.data.dir_data= [];
62 end
63 
64 if (size(this.Loads,1) > 0)
65  this.data.neumann= this.Loads(:,1);
66  this.data.neu_data= this.Loads(:, 2:8);
67 else
68  this.data.neumann= [];
69  this.data.neu_data= [];
70 end
71 
72 /* % Verarbeitung der Randbedingungen (Dirichlet & Neumann)
73  * Neumann randbedingungen
74  * @todo mit obiger zuweisung zusammenlegen? wo wirds noch gebraucht?
75  * (direkt Loads benutzen) */
76 this.f_neum= sparse(7 * num_knots, 1);
77 for i = 1:length(this.data.neumann)
78  if (this.data.knot_index(this.data.neumann(i)) == 0)
79  continue;
80  end
81  index_start = 7*this.data.knot_index(this.data.neumann(i))-6;
82  this.f_neum(index_start : index_start+6) = this.f_neum(index_start : index_start+6) + this.data.neu_data(i, :)^t;
83 end
84 
85 /* Dirichlet Randbedingungen */
86 nodes = 1:7*num_knots;
87 /* Indices of temperature DoFs */
88 nodes_T = 7 * (1:num_knots);
89 /* Indices of u (space and velocity, 3 each) */
90 nodes_u = setdiff(nodes, nodes_T);
91 
92 /* Aufbau des vollen Dirichlet-Vektors
93  * Vektor mit Indizes der Freiheitsgrade von u aufbauen */
94 u = zeros(7 * num_knots, 1);
95 free = 1:7*num_knots;
96 
97 /* Balken */
98 for i = 1:length(this.data.dirichlet)
99  /* Lokale Liste der Komponenten dieses Knotens, die Dirichlet sind */
100  dir_knoten_lok = (1:7) .* this.data.dir_data(i,8:14);
101  dir_knoten_lok = setdiff(dir_knoten_lok, 0);
102 
103  /* Wenn der Knoten in der Struktur nicht verwendet wird, auslassen */
104  if (this.data.knot_index(this.data.dirichlet(i)) == 0)
105  continue;
106  end
107 
108  /* Globale Liste der Komponenten dieses Knotens, die Dirichlet sind */
109  dir_knoten = 7*this.data.knot_index(this.data.dirichlet(i))-6 : 7*this.data.knot_index(this.data.dirichlet(i));
110  dir_knoten = dir_knoten .* this.data.dir_data(i,8:14);
111  dir_knoten = setdiff(dir_knoten, 0);
112 
113  /* Dirichlet-Werte in Lösungsvektor eintragen und Liste der Freiheitsgrade verkleinern */
114  u(dir_knoten) = this.data.dir_data(i, dir_knoten_lok)^t;
115  free = setdiff(free, dir_knoten);
116 end
117 
118 /* % Vektor der Freiheitsgrade aufteilen in Freiheitsgrade für Balken und Temperatur
119  * Vektor für Balken (Temperatureinträge entfernen) */
120 free_u = setdiff(free, nodes_T);
121 if this.withHeat
122  /* "free" contains all DoFs, both u and T, just extract the T DoFs here */
123  free_T = setdiff(free, free_u);
124 else
125  /* Only consider u DoFs */
126  free = free_u;
127 end
128 this.free= free;
129 
130 this.dir_u= setdiff(nodes_u, free_u);
131 if this.withHeat
132  this.dir_T= setdiff(nodes_T, free_T);
133 end
134 /* Store dirichlet values */
135 this.u_dir= u(this.dir_u); /* (eigentlich aus data.dir_data direkt zuweisbar?) */
136 
137 
138 /* % Erstellen der Strukturelemente */
139 this.Elements= cell(1,num_elem_RO+num_elem_KR+num_elem_FH);
140 /* Verarbeitung der geraden Rohrleitungen RO_raw */
141 gesamtlaenge = 0;
142 cnt = 1;
143 for i = 1:num_elem_RO
144  /* constructor arguments: model instance, material, pointsindices */
145  sb = models.beam.StraightBeam(this, this.Materials(this.RO_raw(i,1)), this.RO_raw(i,2:3));
146  gesamtlaenge = gesamtlaenge + sb.Length;
147  this.Elements[cnt] = sb;
148  cnt = cnt+1;
149 end
150 /* Verarbeitung der krummen Rohrleitungen KR_raw
151  * KR <Mat> <P1> <P2> <PCenter> */
152 for i = 1:num_elem_KR
153  cb = models.beam.CurvedBeam(this, this.Materials(this.KR_raw(i,1)), this.KR_raw(i,2:4));
154  gesamtlaenge = gesamtlaenge + cb.Length;
155  this.Elements[cnt] = cb;
156  cnt = cnt+1;
157 end
158 /* Verarbeitung der Stäbe FH_raw
159  * FH <Mat> <P1> <P2> */
160 for i = 1:num_elem_FH
161  this.Elements[cnt] = models.beam.Truss(this, this.Materials(this.FH_raw(i,1)), this.FH_raw(i,2:3));
162  cnt = cnt+1;
163 end
164 
165 /* % Anteil der jeweiligen Elementen an der Gesamtsystemlänge speichern
166  * Speichern, an wievielen Stellen das Element ausgewertet werden soll, wenn auf das Gesamtsystem M auswertungen kommen sollen
167  * Gilt nur für RO und KR elemente */
168 M = 75;
169 for i = 1:num_elem_RO+num_elem_KR
170  this.Elements[i].split = round(M * this.Elements[i].Length / gesamtlaenge);
171 end
172 
173 fprintf(" Gesamtlänge: %f\n ",gesamtlaenge);
174 }
175 
176 };
177 };
A MatLab cell array or matrix.
A MatLab struct.