TexGen
PeriodicBoundaries.cpp
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2010 Louise Brown
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18=============================================================================*/
19
20#include "PrecompiledHeaders.h"
21#include "TexGen.h"
22#include "PeriodicBoundaries.h"
23#include "Materials.h"
24
25#define NUM_FACES 6
26#define NUM_EDGES 12
27#define NUM_VERTICES 8
28
29using namespace TexGen;
30using namespace std;
31
32CPeriodicBoundaries::CPeriodicBoundaries(int NumEdges, int NumVertices)
33:m_NumEdges(NumEdges),
34m_NumVertices(NumVertices)
35{
36}
37
39{
40}
41
43{
44 pair<XYZ, XYZ> DomainAABB = Mesh.GetAABB();
45 m_DomSize = DomainAABB.second - DomainAABB.first;
46}
47
48// Faces with constant x
49void CPeriodicBoundaries::SetFaceA( vector<int>& A1, vector<int>& A2 )
50{
51 m_FaceA = make_pair( A1, A2 );
52}
53
54// Faces with consant y
55void CPeriodicBoundaries::SetFaceB( vector<int>& B1, vector<int>& B2 )
56{
57 m_FaceB = make_pair( B1, B2 );
58}
59
60// Faces with constant z
61void CPeriodicBoundaries::SetFaceC( vector<int>& C1, vector<int>& C2 )
62{
63 m_FaceC = make_pair( C1, C2 );
64}
65
67{
68 m_Vertices.push_back( Vertex );
69}
70
71void CPeriodicBoundaries::SetEdges( vector<int>& Edge )
72{
73 m_Edges.push_back( Edge );
74}
75
76void CPeriodicBoundaries::CreatePeriodicBoundaries( ostream& Output, int iDummyNodeNum, CTextile& Textile, int iBoundaryConditions, bool bMatrixOnly )
77{
78 Output << "************************************" << endl;
79 Output << "*** PERIODIC BOUNDARY CONDITIONS ***" << endl;
80 Output << "************************************" << endl;
81
82 OutputDummyNodeSets( Output, iDummyNodeNum );
83 OutputFaceSets( Output );
84 OutputEdgeSets( Output );
85 OutputVertexSets( Output );
86
87 OutputEquations( Output, iBoundaryConditions );
88
89 OutputStep( Output, iBoundaryConditions );
90}
91
92void CPeriodicBoundaries::OutputSets( ostream& Output, vector<int>& Set, string SetName)
93{
94 Output << "*NSet, NSet=" + SetName;
95 Output << ", Unsorted" << endl;
96 WriteValues( Output, Set, 16 );
97}
98
99void CPeriodicBoundaries::OutputDummyNodeSets( ostream& Output, int iDummyNodeNum )
100{
101 // Dummy nodes/sets: x = 0, y = 1, z = 2, xy = 3, xz = 4, yz = 5
102 Output << "*** ConstraintsDriver0 = e_x" << endl;
103 Output << "*** ConstraintsDriver1 = e_y" << endl;
104 Output << "*** ConstraintsDriver2 = e_z" << endl;
105 Output << "*** ConstraintsDriver3 = e_xy" << endl;
106 Output << "*** ConstraintsDriver4 = e_xz" << endl;
107 Output << "*** ConstraintsDriver5 = e_yz" << endl;
108
109 for ( int i = 0; i < 6; ++i )
110 {
111 Output << "*Node" << endl;
112 Output << iDummyNodeNum + i << ", 0, 0, 0" << endl;
113 Output << "*NSet, NSet=ConstraintsDriver" << i << endl;
114 Output << iDummyNodeNum + i << endl;
115 }
116}
117
118void CPeriodicBoundaries::OutputDummyNodeSets( string Filename, int iDummyNodeNum )
119{
120 AddExtensionIfMissing(Filename, ".inp");
121
122 ofstream Output(Filename.c_str(), ofstream::app);
123 OutputDummyNodeSets( Output, iDummyNodeNum );
124}
125
127{
128 OutputSets( Output, m_FaceA.first, "FaceA" );
129 OutputSets( Output, m_FaceA.second, "FaceB" );
130 OutputSets( Output, m_FaceB.first, "FaceC" );
131 OutputSets( Output, m_FaceB.second, "FaceD" );
132 OutputSets( Output, m_FaceC.first, "FaceE" );
133 OutputSets( Output, m_FaceC.second, "FaceF" );
134}
135
137{
138 for ( int i = 0; i < m_NumEdges; ++i )
139 {
140 OutputSets( Output, m_Edges[i], "Edge" + stringify(i+1) );
141 }
142}
143
145{
146 vector<int> Vertex;
147 Vertex.push_back(0);
148 for ( int i = 0; i < m_NumVertices; ++i )
149 {
150 Vertex[0] = m_Vertices[i];
151 OutputSets( Output, Vertex, "MasterNode" + stringify(i+1) );
152 }
153}
154
155void CPeriodicBoundaries::OutputEquations( ostream& Output, int iBoundaryConditions )
156{
157 Output << "***************************" << endl;
158 Output << "*** BOUNDARY CONDITIONS ***" << endl;
159 Output << "***************************" << endl;
160
161 Output << "*** Name: Translation stop Vertex 1 Type: Displacement/Rotation" << endl;
162 Output << "*Boundary" << endl;
163 Output << "MasterNode1, 1, 1" << endl;
164 Output << "MasterNode1, 2, 2" << endl;
165 Output << "MasterNode1, 3, 3" << endl;
166 Output << endl;
167
168 Output << "*****************" << endl;
169 Output << "*** EQUATIONS ***" << endl;
170 Output << "*****************" << endl;
171 Output << "*Equation\n3\n";
172 Output << "FaceA, 1, 1.0, FaceB, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << endl;
173
174 Output << "*Equation\n2\n";
175 Output << "FaceA, 2, 1.0, FaceB, 2, -1.0" << endl;
176
177 Output << "*Equation\n2\n";
178 Output << "FaceA, 3, 1.0, FaceB, 3, -1.0" << endl;
179
180 Output << "*Equation\n3\n";
181 Output << "FaceC, 1, 1.0, FaceD, 1, -1.0, ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
182
183 Output << "*Equation\n3\n";
184 Output << "FaceC, 2, 1.0, FaceD, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
185
186 Output << "*Equation\n2\n";
187 Output << "FaceC, 3, 1.0, FaceD, 3, -1.0" << endl;
188
189 if ( iBoundaryConditions == MATERIAL_CONTINUUM )
190 {
191 Output << "*Equation\n3\n";
192 Output << "FaceE, 1, 1.0, FaceF, 1, -1.0, ConstraintsDriver4, 1, -" << m_DomSize.z << endl;
193
194 Output << "*Equation\n3\n";
195 Output << "FaceE, 2, 1.0, FaceF, 2, -1.0, ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
196
197 Output << "*Equation\n3\n";
198 Output << "FaceE, 3, 1.0, FaceF, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
199 }
200
201 Output << "*Equation\n3\n";
202 Output << "Edge2, 1, 1.0, Edge1, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << endl;
203
204 Output << "*Equation\n2\n";
205 Output << "Edge2, 2, 1.0, Edge1, 2, -1.0" << endl;
206
207 Output << "*Equation\n2\n";
208 Output << "Edge2, 3, 1.0, Edge1, 3, -1.0" << endl;
209
210 Output << "*Equation\n4\n";
211 Output << "Edge3, 1, 1.0, Edge1, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << ", ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
212
213 Output << "*Equation\n3\n";
214 Output << "Edge3, 2, 1.0, Edge1, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
215
216 Output << "*Equation\n2\n";
217 Output << "Edge3, 3, 1.0, Edge1, 3, -1.0" << endl;
218
219 Output << "*Equation\n3\n";
220 Output << "Edge4, 1, 1.0, Edge1, 1, -1.0, ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
221
222 Output << "*Equation\n3\n";
223 Output << "Edge4, 2, 1.0, Edge1, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
224
225 Output << "*Equation\n2\n";
226 Output << "Edge4, 3, 1.0, Edge1, 3, -1.0" << endl;
227
228 Output << "*Equation\n3\n";
229 Output << "Edge6, 1, 1.0, Edge5, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << endl;
230
231 Output << "*Equation\n2\n";
232 Output << "Edge6, 2, 1.0, Edge5, 2, -1.0" << endl;
233
234 Output << "*Equation\n2\n";
235 Output << "Edge6, 3, 1.0, Edge5, 3, -1.0" << endl;
236
237 if ( iBoundaryConditions == SINGLE_LAYER_RVE )
238 {
239 Output << "*Equation\n3\n";
240 Output << "Edge7, 1, 1.0, Edge8, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << endl;
241
242 Output << "*Equation\n2\n";
243 Output << "Edge7, 2, 1.0, Edge8, 2, -1.0" << endl;
244
245 Output << "*Equation\n2\n";
246 Output << "Edge7, 3, 1.0, Edge8, 3, -1.0" << endl;
247
248 }
249 else
250 {
251 Output << "*Equation\n4\n";
252 Output << "Edge7, 1, 1.0, Edge5, 1, -1.0, ConstraintsDriver4, 1, -" << m_DomSize.z << ", ConstraintsDriver0, 1, -" << m_DomSize.x << endl;
253
254 Output << "*Equation\n3\n";
255 Output << "Edge7, 2, 1.0, Edge5, 2, -1.0, ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
256
257 Output << "*Equation\n3\n";
258 Output << "Edge7, 3, 1.0, Edge5, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
259
260 Output << "*Equation\n3\n";
261 Output << "Edge8, 1, 1.0, Edge5, 1, -1.0, ConstraintsDriver4, 1, -" << m_DomSize.z << endl;
262
263 Output << "*Equation\n3\n";
264 Output << "Edge8, 2, 1.0, Edge5, 2, -1.0, ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
265
266 Output << "*Equation\n3\n";
267 Output << "Edge8, 3, 1.0, Edge5, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
268 }
269
270 Output << "*Equation\n3\n";
271 Output << "Edge10, 1, 1.0, Edge9, 1, -1.0, ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
272
273 Output << "*Equation\n3\n";
274 Output << "Edge10, 2, 1.0, Edge9, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
275
276 Output << "*Equation\n2\n";
277 Output << "Edge10, 3, 1.0, Edge9, 3, -1.0" << endl;
278
279 if ( iBoundaryConditions == SINGLE_LAYER_RVE )
280 {
281 Output << "*Equation\n3\n";
282 Output << "Edge11, 1, 1.0, Edge12, 1, -1.0, ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
283
284 Output << "*Equation\n3\n";
285 Output << "Edge11, 2, 1.0, Edge12, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
286
287 Output << "*Equation\n2\n";
288 Output << "Edge11, 3, 1.0, Edge12, 3, -1.0" << endl;
289
290 }
291 else
292 {
293 Output << "*Equation\n4\n";
294 Output << "Edge11, 1, 1.0, Edge9, 1, -1.0, ConstraintsDriver3, 1, -" << m_DomSize.y << ", ConstraintsDriver4, 1, -" << m_DomSize.z << endl;
295
296 Output << "*Equation\n4\n";
297 Output << "Edge11, 2, 1.0, Edge9, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << ", ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
298
299 Output << "*Equation\n3\n";
300 Output << "Edge11, 3, 1.0, Edge9, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
301
302 Output << "*Equation\n3\n";
303 Output << "Edge12, 1, 1.0, Edge9, 1, -1.0, ConstraintsDriver4, 1, -" << m_DomSize.z << endl;
304
305 Output << "*Equation\n3\n";
306 Output << "Edge12, 2, 1.0, Edge9, 2, -1.0, ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
307
308 Output << "*Equation\n3\n";
309 Output << "Edge12, 3, 1.0, Edge9, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
310 }
311
312 Output << "*Equation\n3\n";
313 Output << "MasterNode2, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << endl;
314
315 Output << "*Equation\n2\n";
316 Output << "MasterNode2, 2, 1.0, MasterNode1, 2, -1.0" << endl;
317
318 Output << "*Equation\n2\n";
319 Output << "MasterNode2, 3, 1.0, MasterNode1, 3, -1.0" << endl;
320
321 Output << "*Equation\n4\n";
322 Output << "MasterNode3, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << ", ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
323
324 Output << "*Equation\n3\n";
325 Output << "MasterNode3, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
326
327 Output << "*Equation\n2\n";
328 Output << "MasterNode3, 3, 1.0, MasterNode1, 3, -1.0" << endl;
329
330 Output << "*Equation\n3\n";
331 Output << "MasterNode4, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
332
333 Output << "*Equation\n3\n";
334 Output << "MasterNode4, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
335
336 Output << "*Equation\n2\n";
337 Output << "MasterNode4, 3, 1.0, MasterNode1, 3, -1.0" << endl;
338
339 if ( iBoundaryConditions == SINGLE_LAYER_RVE )
340 {
341 Output << "*Equation\n3\n";
342 Output << "MasterNode6, 1, 1.0, MasterNode5, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << endl;
343
344 Output << "*Equation\n2\n";
345 Output << "MasterNode6, 2, 1.0, MasterNode5, 2, -1.0" << endl;
346
347 Output << "*Equation\n2\n";
348 Output << "MasterNode6, 3, 1.0, MasterNode5, 3, -1.0" << endl;
349
350 Output << "*Equation\n4\n";
351 Output << "MasterNode7, 1, 1.0, MasterNode5, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << "," << endl;
352 Output << "ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
353
354 Output << "*Equation\n3\n";
355 Output << "MasterNode7, 2, 1.0, MasterNode5, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
356
357 Output << "*Equation\n2\n";
358 Output << "MasterNode7, 3, 1.0, MasterNode5, 3, -1.0" << endl;
359
360 Output << "*Equation\n3\n";
361 Output << "MasterNode8, 1, 1.0, MasterNode5, 1, -1.0, ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
362
363 Output << "*Equation\n3\n";
364 Output << "MasterNode8, 2, 1.0, MasterNode5, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << endl;
365
366 Output << "*Equation\n2\n";
367 Output << "MasterNode8, 3, 1.0, MasterNode5, 3, -1.0" << endl;
368
369 }
370 else
371 {
372 Output << "*Equation\n3\n";
373 Output << "MasterNode5, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver4, 1, -" << m_DomSize.z << endl;
374
375 Output << "*Equation\n3\n";
376 Output << "MasterNode5, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
377
378 Output << "*Equation\n3\n";
379 Output << "MasterNode5, 3, 1.0, MasterNode1, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
380
381 Output << "*Equation\n4\n";
382 Output << "MasterNode6, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver4, 1, -" << m_DomSize.z << ", ConstraintsDriver0, 1, -" << m_DomSize.x << endl;
383
384 Output << "*Equation\n3\n";
385 Output << "MasterNode6, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
386
387 Output << "*Equation\n3\n";
388 Output << "MasterNode6, 3, 1.0, MasterNode1, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
389
390 Output << "*Equation\n5\n";
391 Output << "MasterNode7, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver0, 1, -" << m_DomSize.x << ", ConstraintsDriver4, 1, -" << m_DomSize.z << "," << endl;
392 Output << "ConstraintsDriver3, 1, -" << m_DomSize.y << endl;
393
394 Output << "*Equation\n4\n";
395 Output << "MasterNode7, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << ", ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
396
397 Output << "*Equation\n3\n";
398 Output << "MasterNode7, 3, 1.0, MasterNode1, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
399
400 Output << "*Equation\n4\n";
401 Output << "MasterNode8, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver3, 1, -" << m_DomSize.y << ", ConstraintsDriver4, 1, -" << m_DomSize.z << endl;
402
403 Output << "*Equation\n4\n";
404 Output << "MasterNode8, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver1, 1, -" << m_DomSize.y << ", ConstraintsDriver5, 1, -" << m_DomSize.z << endl;
405
406 Output << "*Equation\n3\n";
407 Output << "MasterNode8, 3, 1.0, MasterNode1, 3, -1.0, ConstraintsDriver2, 1, -" << m_DomSize.z << endl;
408 }
409
410}
411
412void CPeriodicBoundaries::OutputStep( ostream& Output, int iBoundaryConditions )
413{
414 Output << "*******************" << endl;
415 Output << "*** CREATE STEP ***" << endl;
416 Output << "*******************" << endl;
417
418 Output << "*** PREDEFINED FIELDS ***" << endl;
419 Output << "*** Name: Initial temperature 0ºC all cells Type: Temperature ***" << endl;
420 Output << "*Initial Conditions, type=TEMPERATURE" << endl;
421 Output << "AllNodes, 0." << endl;
422 Output << endl;
423 Output << "*Step, Name=Isothermal linear perturbation step, perturbation" << endl;
424 Output << "Elastic material property computation" << endl;
425 Output << "*Static" << endl;
426 Output << endl;
427 Output << "***********************" << endl;
428 Output << "*** OUTPUT REQUESTS ***" << endl;
429 Output << "***********************" << endl;
430 Output << "*Output, field" << endl;
431
432 bool bOutputTransverse = iBoundaryConditions == MATERIAL_CONTINUUM || iBoundaryConditions == SHEARED_BC || iBoundaryConditions == ROTATED_BC;
433
434 if ( iBoundaryConditions == SINGLE_LAYER_RVE || iBoundaryConditions == STAGGERED_BC )
435 {
436 Output << "*Element Output, directions=YES" << endl << "S,E," << endl;
437 }
438 else
439 {
440 Output << "*Element Output, directions=YES" << endl << "S," << endl;
441 }
442 Output << "*** FIELD OUTPUT: Output Request Fx ***" << endl;
443 Output << "*Node Output, nset=ConstraintsDriver0" << endl << "U," << endl;
444 Output << "*** FIELD OUTPUT: Output Request Fy ***" << endl;
445 Output << "*Node Output, nset=ConstraintsDriver1" << endl << "U," << endl;
446 if ( bOutputTransverse )
447 {
448 Output << "*** FIELD OUTPUT: Ouput Request Fz ***" << endl;
449 Output << "*Node Output, nset=ConstraintsDriver2" << endl << "U," << endl;
450 }
451 Output << "*** FIELD OUTPUT: Output Request Shear_xy ***" << endl;
452 Output << "*Node Output, nset=ConstraintsDriver3" << endl << "U," << endl;
453 if ( bOutputTransverse )
454 {
455 Output << "*** FIELD OUTPUT: Output Request Shear_zx ***" << endl;
456 Output << "*Node Output, nset=ConstraintsDriver4" << endl << "U," << endl;
457 Output << "*** FIELD OUTPUT: Output Request Shear_yz ***" << endl;
458 Output << "*Node Output, nset=ConstraintsDriver5" << endl << "U," << endl;
459 }
460
461 Output << endl;
462
463 Output << "******************" << endl;
464 Output << "*** LOAD CASES ***" << endl;
465 Output << "******************" << endl;
466 for ( int i = 0; i < 6; ++i )
467 {
468 if ( iBoundaryConditions != BENDING_BC && (bOutputTransverse || !i || i == 1 || i==3 ) )
469 OutputLoadCase( Output, i );
470
471 if ( iBoundaryConditions == BENDING_BC )
472 {
473 /*
474 Output << "*Load case, Name=Load" << i << endl;
475 Output << "*BOUNDARY" << endl;
476 for (int j = 0; j < 6; j++)
477 {
478 if ( i != j )
479 Output << "ConstraintsDriver" << j << ", 1, 1, 0" << endl;
480 else
481 Output << "ConstraintsDriver" << j << ", 1, 1, " << 1.0 / (m_DomSize.x * m_DomSize.y) << endl;
482 }
483 Output << "*End load case" << endl;
484 Output << endl;
485 */
486 if ( i )
487 {
488 Output << "*Step" << endl;
489 Output << "*Static" << endl;
490 }
491
492 Output << "*BOUNDARY" << endl;
493 for (int j = 0; j < 6; j++)
494 {
495 if ( i != j )
496 Output << "ConstraintsDriver" << j << ", 1, 1, 0" << endl;
497 else
498 Output << "ConstraintsDriver" << j << ", 1, 1, " << 1.0 / (m_DomSize.x * m_DomSize.y) << endl;
499 }
500
501 if ( i != 5 )
502 {
503 Output << "*End step" << endl;
504 }
505 Output << endl;
506 }
507 }
508
509 Output << endl;
510
511 Output << "*End Step" << endl;
512 Output << endl;
513
514 Output << "*** STEP: Thermomechanical step ***" << endl;
515 Output << "*Step, name=Thermomechanical step, perturbation" << endl;
516 Output << "Coefficient of Thermal Expansion computation" << endl;
517 Output << "*Static" << endl;
518
519 Output << "*** PREDEFINED FIELDS ***" << endl;
520 Output << "*** Name: Temperature steady 1ºC all cells Type: Temperature ***" << endl;
521 Output << "*Temperature" << endl;
522 Output << "AllNodes, 1." << endl; // Make sure no blank line after this line or analysis fails
523 Output << "***********************" << endl;
524 Output << "*** OUTPUT REQUESTS ***" << endl;
525 Output << "***********************" << endl;
526 Output << "*Output, field" << endl;
527 Output << "*Element Output, directions=YES" << endl << "S," << endl;
528 Output << "*** FIELD OUTPUT: Output Request Fx ***" << endl;
529 Output << "*Node Output, nset=ConstraintsDriver0" << endl << "U," << endl;
530 Output << "*** FIELD OUTPUT: Output Request Fy ***" << endl;
531 Output << "*Node Output, nset=ConstraintsDriver1" << endl << "U," << endl;
532 if ( bOutputTransverse )
533 {
534 Output << "*** FIELD OUTPUT: Output Request Fz ***" << endl;
535 Output << "*Node Output, nset=ConstraintsDriver2" << endl << "U," << endl;
536 }
537 Output << "*End Step" << endl;
538}
539
540void CPeriodicBoundaries::OutputStep( string Filename, int iBoundaryConditions )
541{
542 AddExtensionIfMissing(Filename, ".inp");
543
544 ofstream Output(Filename.c_str(), ofstream::app);
545 OutputStep( Output, iBoundaryConditions );
546}
547
548void CPeriodicBoundaries::OutputLoadCase(std::ostream &Output, int iCase )
549{
550 double dLoadPerVol = m_DomSize.x * m_DomSize.y * m_DomSize.z;
551 Output << "*Load Case, name=Load" << iCase << endl;
552 Output << "*Boundary, op=NEW" << endl;
553 Output << "MasterNode1, 1, 1" << endl;
554 Output << "MasterNode1, 2, 2" << endl;
555 Output << "MasterNode1, 3, 3" << endl;
556 Output << "*Cload" << endl;
557 Output << "ConstraintsDriver" << iCase << ", 1, " << dLoadPerVol << endl;
558 Output << "*End Load Case" << endl;
559 Output << endl;
560}
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
pair< XYZ, XYZ > GetAABB(double dGrowDistance=0) const
Get an axis aligned bounding box for the mesh.
Definition: Mesh.cpp:340
void OutputLoadCase(ostream &Output, int iCase)
Output 6 load cases.
pair< vector< int >, vector< int > > m_FaceA
Pairs of node sets for opposite faces.
pair< vector< int >, vector< int > > m_FaceB
void SetFaceB(vector< int > &B1, vector< int > &B2)
vector< vector< int > > m_Edges
Array of vectors containing nodes for edge sets.
void CreatePeriodicBoundaries(ostream &Output, int iDummyNodeNum, CTextile &Textile, int iBoundarConditions, bool bMatrixOnly)
pair< vector< int >, vector< int > > m_FaceC
virtual void OutputFaceSets(ostream &Output)
Output 6 face node sets.
void SetEdges(vector< int > &Edge)
void OutputSets(ostream &Output, vector< int > &Set, string SetName)
Output an unsorted node set.
virtual void SetDomainSize(const CMesh &Mesh)
vector< int > m_Vertices
Array of corner nodes.
void OutputDummyNodeSets(string Filename, int iDummyNodeNum)
Output 6 dummy nodes: x = 0, y = 1, z = 2, xy = 3, xz = 4, yz = 5.
void SetFaceA(vector< int > &A1, vector< int > &A2)
void OutputEdgeSets(ostream &Output)
Output 12 edge node sets.
virtual void OutputEquations(ostream &Output, int iBoundarConditions)
Output equations for boundary conditions.
void OutputVertexSets(ostream &Output)
Output 8 corner node sets.
void OutputStep(string Filename, int iBoundaryConditions)
Output a step including field outputs.
void SetFaceC(vector< int > &C1, vector< int > &C2)
Represents a textile cell containing yarns.
Definition: Textile.h:39
Namespace containing a series of customised math operations not found in the standard c++ library.
void WriteValues(std::ostream &Output, T &Values, int iMaxPerLine)
Definition: Misc.h:274
std::string stringify(const T &x, int iPrecision=12, bool bScientific=true)
Function to convert a value (e.g. int, double, etc...) to a string.
Definition: Misc.h:50
void AddExtensionIfMissing(std::string &Filename, std::string Extension)
Adds an extension to the filename if it is missing otherwise do nothing (e.g. picture -> picture....
Definition: Misc.cpp:116
@ SINGLE_LAYER_RVE
Definition: Misc.h:265
@ BENDING_BC
Definition: Misc.h:269
@ MATERIAL_CONTINUUM
Definition: Misc.h:264
@ SHEARED_BC
Definition: Misc.h:267
@ STAGGERED_BC
Definition: Misc.h:266
@ ROTATED_BC
Definition: Misc.h:268
double z
Definition: mymath.h:57
double x
Definition: mymath.h:57
double y
Definition: mymath.h:57