TexGen
BendingPeriodicBoundaries.cpp
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2021 Mikhail Matveev
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"
23
24
25using namespace TexGen;
26using namespace std;
27
28CBendingPeriodicBoundaries::CBendingPeriodicBoundaries(void)
29{
30}
31
33{
34}
35
36void CBendingPeriodicBoundaries::OutputEquations( ostream& Output, int iBoundaryConditions )
37{
38 Output << "*********************************" << endl;
39 Output << "*** BOUNDARY CONDITIONS ***" << endl;
40 Output << "*** Requires MPC.f subroutine ***" << endl;
41 Output << "*********************************" << endl;
42
43 Output << "*MPC, User, Mode=DOF " << endl;
44 Output << "1, FaceA, FaceB, ConstraintsDriver0, ConstraintsDriver3" << endl;
45
46 Output << "*MPC, User, Mode=DOF" << endl;
47 Output << "2, FaceA, FaceB, ConstraintsDriver5" << endl;
48
49 Output << "*MPC, User, Mode=DOF" << endl;
50 Output << "3, FaceA, FaceB, ConstraintsDriver3, ConstraintsDriver5" << endl;
51
52 Output << "**" << endl;
53 Output << "*MPC, User, Mode=DOF" << endl;
54 Output << "4, FaceC, FaceD, ConstraintsDriver2, ConstraintsDriver5" << endl;
55
56 Output << "*MPC, User, Mode=DOF" << endl;
57 Output << "5, FaceC, FaceD, ConstraintsDriver1, ConstraintsDriver4" << endl;
58
59 Output << "*MPC, User, Mode=DOF" << endl;
60 Output << "6, FaceC, FaceD, ConstraintsDriver4, ConstraintsDriver5" << endl;
61
62 Output << "**" << endl;
63 Output << "** Edges in x-direction" << endl;
64 Output << "**" << endl;
65 Output << "*MPC,USER,MODE=dof" << endl;
66 Output << "1, Edge2, Edge1, ConstraintsDriver0, ConstraintsDriver3" << endl;
67
68 Output << "*MPC, User, Mode=DOF" << endl;
69 Output << "2, Edge2, Edge1, ConstraintsDriver5" << endl;
70
71 Output << "*MPC, User, Mode=DOF" << endl;
72 Output << "3, Edge2, Edge1, ConstraintsDriver3, ConstraintsDriver5" << endl;
73
74 Output << "*MPC,USER,MODE=dof" << endl;
75 Output << "1, Edge6, Edge5, ConstraintsDriver0, ConstraintsDriver3" << endl;
76
77 Output << "*MPC, User, Mode=DOF" << endl;
78 Output << "2, Edge6, Edge5, ConstraintsDriver5" << endl;
79
80 Output << "*MPC, User, Mode=DOF" << endl;
81 Output << "3, Edge6, Edge5, ConstraintsDriver3, ConstraintsDriver5" << endl;
82
83 Output << "*MPC,USER,MODE=dof" << endl;
84 Output << "1, Edge7, Edge8, ConstraintsDriver0, ConstraintsDriver3" << endl;
85
86 Output << "*MPC, User, Mode=DOF" << endl;
87 Output << "2, Edge7, Edge8, ConstraintsDriver5" << endl;
88
89 Output << "*MPC, User, Mode=DOF" << endl;
90 Output << "3, Edge7, Edge8, ConstraintsDriver3, ConstraintsDriver5" << endl;
91
92 Output << "**" << endl;
93 Output << "** Masternodes in x-direction" << endl;
94 Output << "**" << endl;
95 Output << "*MPC,USER,MODE=dof" << endl;
96 Output << "1, MasterNode2, MasterNode1, ConstraintsDriver0, ConstraintsDriver3" << endl;
97
98 Output << "*MPC, User, Mode=DOF" << endl;
99 Output << "2, MasterNode2, MasterNode1, ConstraintsDriver5" << endl;
100
101 Output << "*MPC, User, Mode=DOF" << endl;
102 Output << "3, MasterNode2, MasterNode1, ConstraintsDriver3, ConstraintsDriver5" << endl;
103
104 Output << "*MPC,USER,MODE=dof" << endl;
105 Output << "1, MasterNode6, MasterNode5, ConstraintsDriver0, ConstraintsDriver3" << endl;
106
107 Output << "*MPC, User, Mode=DOF" << endl;
108 Output << "2, MasterNode6, MasterNode5, ConstraintsDriver5" << endl;
109
110 Output << "*MPC, User, Mode=DOF" << endl;
111 Output << "3, MasterNode6, MasterNode5, ConstraintsDriver3, ConstraintsDriver5" << endl;
112 Output << "**" << endl;
113 Output << "** Edges in y-direction" << endl;
114 Output << "**" << endl;
115 Output << "*MPC, User, Mode=DOF" << endl;
116 Output << "4, Edge10, Edge9, ConstraintsDriver2, ConstraintsDriver5" << endl;
117
118 Output << "*MPC, User, Mode=DOF" << endl;
119 Output << "5, Edge10, Edge9, ConstraintsDriver1, ConstraintsDriver4" << endl;
120
121 Output << "*MPC, User, Mode=DOF" << endl;
122 Output << "6, Edge10, Edge9, ConstraintsDriver4, ConstraintsDriver5" << endl;
123
124 Output << "*MPC, User, Mode=DOF" << endl;
125 Output << "4, Edge12, Edge11, ConstraintsDriver2, ConstraintsDriver5" << endl;
126
127 Output << "*MPC, User, Mode=DOF" << endl;
128 Output << "5, Edge12, Edge11, ConstraintsDriver1, ConstraintsDriver4" << endl;
129
130 Output << "*MPC, User, Mode=DOF" << endl;
131 Output << "6, Edge12, Edge11, ConstraintsDriver4, ConstraintsDriver5" << endl;
132
133 Output << "*MPC, User, Mode=DOF" << endl;
134 Output << "4, Edge4, Edge1, ConstraintsDriver2, ConstraintsDriver5" << endl;
135
136 Output << "*MPC, User, Mode=DOF" << endl;
137 Output << "5, Edge4, Edge1, ConstraintsDriver1, ConstraintsDriver4" << endl;
138
139 Output << "*MPC, User, Mode=DOF" << endl;
140 Output << "6, Edge4, Edge1, ConstraintsDriver4, ConstraintsDriver5" << endl;
141
142 Output << "*MPC, User, Mode=DOF" << endl;
143 Output << "4, MasterNode4, MasterNode1, ConstraintsDriver2, ConstraintsDriver5" << endl;
144
145 Output << "*MPC, User, Mode=DOF" << endl;
146 Output << "5, MasterNode4, MasterNode1, ConstraintsDriver1, ConstraintsDriver4" << endl;
147
148 Output << "*MPC, User, Mode=DOF" << endl;
149 Output << "6, MasterNode4, MasterNode1, ConstraintsDriver4, ConstraintsDriver5" << endl;
150
151 Output << "*MPC, User, Mode=DOF" << endl;
152 Output << "4, MasterNode8, MasterNode5, ConstraintsDriver2, ConstraintsDriver5" << endl;
153
154 Output << "*MPC, User, Mode=DOF" << endl;
155 Output << "5, MasterNode8, MasterNode5, ConstraintsDriver1, ConstraintsDriver4" << endl;
156
157 Output << "*MPC, User, Mode=DOF" << endl;
158 Output << "6, MasterNode8, MasterNode5, ConstraintsDriver4, ConstraintsDriver5" << endl;
159
160 Output << "**" << endl;
161 Output << "** Diagonal edges" << endl;
162 Output << "**" << endl;
163 Output << "*MPC, User, Mode=DOF" << endl;
164 Output << "7, Edge3, Edge1, ConstraintsDriver0, ConstraintsDriver3, ConstraintsDriver2, ConstraintsDriver5" << endl;
165
166 Output << "*MPC, User, Mode=DOF" << endl;
167 Output << "8, Edge3, Edge1, ConstraintsDriver5, ConstraintsDriver1, ConstraintsDriver4" << endl;
168
169 Output << "*MPC, User, Mode=DOF" << endl;
170 Output << "9, Edge3, Edge1, ConstraintsDriver3, ConstraintsDriver4, ConstraintsDriver5" << endl;
171
172 Output << "*MPC, User, Mode=DOF" << endl;
173 Output << "7, Edge3, Edge1, ConstraintsDriver0, ConstraintsDriver3, ConstraintsDriver2, ConstraintsDriver5" << endl;
174
175 Output << "*MPC, User, Mode=DOF" << endl;
176 Output << "8, Edge3, Edge1, ConstraintsDriver5, ConstraintsDriver1, ConstraintsDriver4" << endl;
177
178 Output << "*MPC, User, Mode=DOF" << endl;
179 Output << "9, Edge3, Edge1, ConstraintsDriver3, ConstraintsDriver4, ConstraintsDriver5" << endl;
180
181 Output << "*MPC, User, Mode=DOF" << endl;
182 Output << "7, MasterNode3, MasterNode1, ConstraintsDriver0, ConstraintsDriver3, ConstraintsDriver2, ConstraintsDriver5" << endl;
183
184 Output << "*MPC, User, Mode=DOF" << endl;
185 Output << "8, MasterNode3, MasterNode1, ConstraintsDriver5, ConstraintsDriver1, ConstraintsDriver4" << endl;
186
187 Output << "*MPC, User, Mode=DOF" << endl;
188 Output << "9, MasterNode3, MasterNode1, ConstraintsDriver3, ConstraintsDriver4, ConstraintsDriver5" << endl;
189
190 Output << "*MPC, User, Mode=DOF" << endl;
191 Output << "7, MasterNode7, MasterNode5, ConstraintsDriver0, ConstraintsDriver3, ConstraintsDriver2, ConstraintsDriver5" << endl;
192
193 Output << "*MPC, User, Mode=DOF" << endl;
194 Output << "8, MasterNode7, MasterNode5, ConstraintsDriver5, ConstraintsDriver1, ConstraintsDriver4" << endl;
195
196 Output << "*MPC, User, Mode=DOF" << endl;
197 Output << "9, MasterNode7, MasterNode5, ConstraintsDriver3, ConstraintsDriver4, ConstraintsDriver5" << endl;
198
199 Output << "*Parameter" << endl;
200 Output << "my_force=" << 1.0 / (m_DomSize.x * m_DomSize.y) << endl;
201
202}
203
204void CBendingPeriodicBoundaries::OutputStep( ostream& Output, int iBoundaryConditions )
205{
206 Output << "*******************" << endl;
207 Output << "*** CREATE STEP ***" << endl;
208 Output << "*******************" << endl;
209 Output << endl;
210 Output << "*Step, Name=In-plane and out-of-plane loading, perturbation" << endl;
211 Output << "Elastic material property computation" << endl;
212 Output << "*Static" << endl;
213 Output << "******************" << endl;
214 Output << "*** LOAD CASES ***" << endl;
215 Output << "******************" << endl;
216
217 for (int i = 0; i < 6; i++)
218 {
219 Output << "*Load case, Name=Load" << i << endl;
220 Output << "*BOUNDARY" << endl;
221 for (int j = 0; j < 6; j++)
222 {
223 if ( i != j )
224 Output << "ConstraintsDriver" << j << ", 1, 1, 0" << endl;
225 else
226 Output << "ConstraintsDriver" << j << ", 1, 1, <my_force>" << endl;
227 }
228 }
229 Output << endl;
230
231 Output << "*End Step" << endl;
232 Output << endl;
233}
void OutputEquations(ostream &Output, int iBoundaryConditions)
Set up the domain size parameters used in the equations.
void OutputStep(ostream &Output, int iBoundaryConditions)
Namespace containing a series of customised math operations not found in the standard c++ library.
double x
Definition: mymath.h:57
double y
Definition: mymath.h:57