32CPeriodicBoundaries::CPeriodicBoundaries(
int NumEdges,
int NumVertices)
34m_NumVertices(NumVertices)
44 pair<XYZ, XYZ> DomainAABB = Mesh.
GetAABB();
45 m_DomSize = DomainAABB.second - DomainAABB.first;
78 Output <<
"************************************" << endl;
79 Output <<
"*** PERIODIC BOUNDARY CONDITIONS ***" << endl;
80 Output <<
"************************************" << endl;
94 Output <<
"*NSet, NSet=" + SetName;
95 Output <<
", Unsorted" << endl;
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;
109 for (
int i = 0; i < 6; ++i )
111 Output <<
"*Node" << endl;
112 Output << iDummyNodeNum + i <<
", 0, 0, 0" << endl;
113 Output <<
"*NSet, NSet=ConstraintsDriver" << i << endl;
114 Output << iDummyNodeNum + i << endl;
122 ofstream Output(Filename.c_str(), ofstream::app);
157 Output <<
"***************************" << endl;
158 Output <<
"*** BOUNDARY CONDITIONS ***" << endl;
159 Output <<
"***************************" << endl;
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;
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;
174 Output <<
"*Equation\n2\n";
175 Output <<
"FaceA, 2, 1.0, FaceB, 2, -1.0" << endl;
177 Output <<
"*Equation\n2\n";
178 Output <<
"FaceA, 3, 1.0, FaceB, 3, -1.0" << endl;
180 Output <<
"*Equation\n3\n";
181 Output <<
"FaceC, 1, 1.0, FaceD, 1, -1.0, ConstraintsDriver3, 1, -" <<
m_DomSize.
y << endl;
183 Output <<
"*Equation\n3\n";
184 Output <<
"FaceC, 2, 1.0, FaceD, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
186 Output <<
"*Equation\n2\n";
187 Output <<
"FaceC, 3, 1.0, FaceD, 3, -1.0" << endl;
191 Output <<
"*Equation\n3\n";
192 Output <<
"FaceE, 1, 1.0, FaceF, 1, -1.0, ConstraintsDriver4, 1, -" <<
m_DomSize.
z << endl;
194 Output <<
"*Equation\n3\n";
195 Output <<
"FaceE, 2, 1.0, FaceF, 2, -1.0, ConstraintsDriver5, 1, -" <<
m_DomSize.
z << endl;
197 Output <<
"*Equation\n3\n";
198 Output <<
"FaceE, 3, 1.0, FaceF, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
201 Output <<
"*Equation\n3\n";
202 Output <<
"Edge2, 1, 1.0, Edge1, 1, -1.0, ConstraintsDriver0, 1, -" <<
m_DomSize.
x << endl;
204 Output <<
"*Equation\n2\n";
205 Output <<
"Edge2, 2, 1.0, Edge1, 2, -1.0" << endl;
207 Output <<
"*Equation\n2\n";
208 Output <<
"Edge2, 3, 1.0, Edge1, 3, -1.0" << endl;
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;
213 Output <<
"*Equation\n3\n";
214 Output <<
"Edge3, 2, 1.0, Edge1, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
216 Output <<
"*Equation\n2\n";
217 Output <<
"Edge3, 3, 1.0, Edge1, 3, -1.0" << endl;
219 Output <<
"*Equation\n3\n";
220 Output <<
"Edge4, 1, 1.0, Edge1, 1, -1.0, ConstraintsDriver3, 1, -" <<
m_DomSize.
y << endl;
222 Output <<
"*Equation\n3\n";
223 Output <<
"Edge4, 2, 1.0, Edge1, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
225 Output <<
"*Equation\n2\n";
226 Output <<
"Edge4, 3, 1.0, Edge1, 3, -1.0" << endl;
228 Output <<
"*Equation\n3\n";
229 Output <<
"Edge6, 1, 1.0, Edge5, 1, -1.0, ConstraintsDriver0, 1, -" <<
m_DomSize.
x << endl;
231 Output <<
"*Equation\n2\n";
232 Output <<
"Edge6, 2, 1.0, Edge5, 2, -1.0" << endl;
234 Output <<
"*Equation\n2\n";
235 Output <<
"Edge6, 3, 1.0, Edge5, 3, -1.0" << endl;
239 Output <<
"*Equation\n3\n";
240 Output <<
"Edge7, 1, 1.0, Edge8, 1, -1.0, ConstraintsDriver0, 1, -" <<
m_DomSize.
x << endl;
242 Output <<
"*Equation\n2\n";
243 Output <<
"Edge7, 2, 1.0, Edge8, 2, -1.0" << endl;
245 Output <<
"*Equation\n2\n";
246 Output <<
"Edge7, 3, 1.0, Edge8, 3, -1.0" << endl;
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;
254 Output <<
"*Equation\n3\n";
255 Output <<
"Edge7, 2, 1.0, Edge5, 2, -1.0, ConstraintsDriver5, 1, -" <<
m_DomSize.
z << endl;
257 Output <<
"*Equation\n3\n";
258 Output <<
"Edge7, 3, 1.0, Edge5, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
260 Output <<
"*Equation\n3\n";
261 Output <<
"Edge8, 1, 1.0, Edge5, 1, -1.0, ConstraintsDriver4, 1, -" <<
m_DomSize.
z << endl;
263 Output <<
"*Equation\n3\n";
264 Output <<
"Edge8, 2, 1.0, Edge5, 2, -1.0, ConstraintsDriver5, 1, -" <<
m_DomSize.
z << endl;
266 Output <<
"*Equation\n3\n";
267 Output <<
"Edge8, 3, 1.0, Edge5, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
270 Output <<
"*Equation\n3\n";
271 Output <<
"Edge10, 1, 1.0, Edge9, 1, -1.0, ConstraintsDriver3, 1, -" <<
m_DomSize.
y << endl;
273 Output <<
"*Equation\n3\n";
274 Output <<
"Edge10, 2, 1.0, Edge9, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
276 Output <<
"*Equation\n2\n";
277 Output <<
"Edge10, 3, 1.0, Edge9, 3, -1.0" << endl;
281 Output <<
"*Equation\n3\n";
282 Output <<
"Edge11, 1, 1.0, Edge12, 1, -1.0, ConstraintsDriver3, 1, -" <<
m_DomSize.
y << endl;
284 Output <<
"*Equation\n3\n";
285 Output <<
"Edge11, 2, 1.0, Edge12, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
287 Output <<
"*Equation\n2\n";
288 Output <<
"Edge11, 3, 1.0, Edge12, 3, -1.0" << endl;
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;
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;
299 Output <<
"*Equation\n3\n";
300 Output <<
"Edge11, 3, 1.0, Edge9, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
302 Output <<
"*Equation\n3\n";
303 Output <<
"Edge12, 1, 1.0, Edge9, 1, -1.0, ConstraintsDriver4, 1, -" <<
m_DomSize.
z << endl;
305 Output <<
"*Equation\n3\n";
306 Output <<
"Edge12, 2, 1.0, Edge9, 2, -1.0, ConstraintsDriver5, 1, -" <<
m_DomSize.
z << endl;
308 Output <<
"*Equation\n3\n";
309 Output <<
"Edge12, 3, 1.0, Edge9, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
312 Output <<
"*Equation\n3\n";
313 Output <<
"MasterNode2, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver0, 1, -" <<
m_DomSize.
x << endl;
315 Output <<
"*Equation\n2\n";
316 Output <<
"MasterNode2, 2, 1.0, MasterNode1, 2, -1.0" << endl;
318 Output <<
"*Equation\n2\n";
319 Output <<
"MasterNode2, 3, 1.0, MasterNode1, 3, -1.0" << endl;
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;
324 Output <<
"*Equation\n3\n";
325 Output <<
"MasterNode3, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
327 Output <<
"*Equation\n2\n";
328 Output <<
"MasterNode3, 3, 1.0, MasterNode1, 3, -1.0" << endl;
330 Output <<
"*Equation\n3\n";
331 Output <<
"MasterNode4, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver3, 1, -" <<
m_DomSize.
y << endl;
333 Output <<
"*Equation\n3\n";
334 Output <<
"MasterNode4, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
336 Output <<
"*Equation\n2\n";
337 Output <<
"MasterNode4, 3, 1.0, MasterNode1, 3, -1.0" << endl;
341 Output <<
"*Equation\n3\n";
342 Output <<
"MasterNode6, 1, 1.0, MasterNode5, 1, -1.0, ConstraintsDriver0, 1, -" <<
m_DomSize.
x << endl;
344 Output <<
"*Equation\n2\n";
345 Output <<
"MasterNode6, 2, 1.0, MasterNode5, 2, -1.0" << endl;
347 Output <<
"*Equation\n2\n";
348 Output <<
"MasterNode6, 3, 1.0, MasterNode5, 3, -1.0" << endl;
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;
354 Output <<
"*Equation\n3\n";
355 Output <<
"MasterNode7, 2, 1.0, MasterNode5, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
357 Output <<
"*Equation\n2\n";
358 Output <<
"MasterNode7, 3, 1.0, MasterNode5, 3, -1.0" << endl;
360 Output <<
"*Equation\n3\n";
361 Output <<
"MasterNode8, 1, 1.0, MasterNode5, 1, -1.0, ConstraintsDriver3, 1, -" <<
m_DomSize.
y << endl;
363 Output <<
"*Equation\n3\n";
364 Output <<
"MasterNode8, 2, 1.0, MasterNode5, 2, -1.0, ConstraintsDriver1, 1, -" <<
m_DomSize.
y << endl;
366 Output <<
"*Equation\n2\n";
367 Output <<
"MasterNode8, 3, 1.0, MasterNode5, 3, -1.0" << endl;
372 Output <<
"*Equation\n3\n";
373 Output <<
"MasterNode5, 1, 1.0, MasterNode1, 1, -1.0, ConstraintsDriver4, 1, -" <<
m_DomSize.
z << endl;
375 Output <<
"*Equation\n3\n";
376 Output <<
"MasterNode5, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver5, 1, -" <<
m_DomSize.
z << endl;
378 Output <<
"*Equation\n3\n";
379 Output <<
"MasterNode5, 3, 1.0, MasterNode1, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
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;
384 Output <<
"*Equation\n3\n";
385 Output <<
"MasterNode6, 2, 1.0, MasterNode1, 2, -1.0, ConstraintsDriver5, 1, -" <<
m_DomSize.
z << endl;
387 Output <<
"*Equation\n3\n";
388 Output <<
"MasterNode6, 3, 1.0, MasterNode1, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
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;
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;
397 Output <<
"*Equation\n3\n";
398 Output <<
"MasterNode7, 3, 1.0, MasterNode1, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
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;
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;
406 Output <<
"*Equation\n3\n";
407 Output <<
"MasterNode8, 3, 1.0, MasterNode1, 3, -1.0, ConstraintsDriver2, 1, -" <<
m_DomSize.
z << endl;
414 Output <<
"*******************" << endl;
415 Output <<
"*** CREATE STEP ***" << endl;
416 Output <<
"*******************" << endl;
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;
423 Output <<
"*Step, Name=Isothermal linear perturbation step, perturbation" << endl;
424 Output <<
"Elastic material property computation" << endl;
425 Output <<
"*Static" << endl;
427 Output <<
"***********************" << endl;
428 Output <<
"*** OUTPUT REQUESTS ***" << endl;
429 Output <<
"***********************" << endl;
430 Output <<
"*Output, field" << endl;
436 Output <<
"*Element Output, directions=YES" << endl <<
"S,E," << endl;
440 Output <<
"*Element Output, directions=YES" << endl <<
"S," << endl;
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 )
448 Output <<
"*** FIELD OUTPUT: Ouput Request Fz ***" << endl;
449 Output <<
"*Node Output, nset=ConstraintsDriver2" << endl <<
"U," << endl;
451 Output <<
"*** FIELD OUTPUT: Output Request Shear_xy ***" << endl;
452 Output <<
"*Node Output, nset=ConstraintsDriver3" << endl <<
"U," << endl;
453 if ( bOutputTransverse )
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;
463 Output <<
"******************" << endl;
464 Output <<
"*** LOAD CASES ***" << endl;
465 Output <<
"******************" << endl;
466 for (
int i = 0; i < 6; ++i )
468 if ( iBoundaryConditions !=
BENDING_BC && (bOutputTransverse || !i || i == 1 || i==3 ) )
488 Output <<
"*Step" << endl;
489 Output <<
"*Static" << endl;
492 Output <<
"*BOUNDARY" << endl;
493 for (
int j = 0; j < 6; j++)
496 Output <<
"ConstraintsDriver" << j <<
", 1, 1, 0" << endl;
503 Output <<
"*End step" << endl;
511 Output <<
"*End Step" << endl;
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;
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;
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 )
534 Output <<
"*** FIELD OUTPUT: Output Request Fz ***" << endl;
535 Output <<
"*Node Output, nset=ConstraintsDriver2" << endl <<
"U," << endl;
537 Output <<
"*End Step" << endl;
544 ofstream Output(Filename.c_str(), ofstream::app);
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;
Defines the nodes and elements of a surface or volume mesh.
pair< XYZ, XYZ > GetAABB(double dGrowDistance=0) const
Get an axis aligned bounding box for the mesh.
~CPeriodicBoundaries(void)
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 SetVertex(int Vertex)
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.
Namespace containing a series of customised math operations not found in the standard c++ library.
void WriteValues(std::ostream &Output, T &Values, int iMaxPerLine)
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.
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....