forked from spacether/pycalculix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
298 lines (256 loc) · 11.3 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
Description:
pycalculix is a Python 3 library to automate and build finite element analysis (FEA) models in Calculix.
Meshing uses Calculix or GMSH.
Website: http://justinablack.com/pycalculix/
Source Code: https://github.com/spacether/pycalculix
Documentation: http://spacether.github.io/pycalculix/pycalculix.html
Usefull applications of Pycalculix:
-Trade studies for plane stress, plane strain, or axisymmetric parts
-Quick Kt analysis of 2D geometry
-Learning finite element analyis (FEA) and Python
Folder layout:
The folders of this project are laid out to allow me to distribute it on pypi.
Pypi link: https://pypi.python.org/pypi/pycalculix
Note: the main body of pycalculix code is in pycalculix/feamodel.py module
Notes, Cutting Areas:
I built a chunker in python which tries to cut big areas (> 5 sides) which
cgx can't mesh into smaller areas (<= 5 sides) which are meshable in cgx.
The chunker may not always be able to cut areas correctly.
License:
See LICENSE.txt (GPL v2)
Creator:
Justin Black, justin.a.black[at-sign]gmail[dot]com
Initial Release: December 2014
Elements Supported:
Axisymmetric, plane stress, and plane strain elements are supported.
First and second order triangles and quadrilaterals are supported.
First order elments only have corner nodes
Second order elements have corner and midside nodes
Second order elements produce more accurate results
Setting element divisions on lines is supported
Geometry Building:
One can build separate parts made of points, lines, arcs, and areas.
Straight lines and arcs are currently supported.
One can draw a part made of straight lines, then smooth out corners by adding
arcs with the part method: part.fillet_lines(L1, L2, arc_radius)
The new arc will be tangent to both adjacent lines.
Loading:
Force loading
Constant pressure
Linearly varying pressure (water pressure)
Gravity
Rotational speed forces
Displacement constraints
Loads are stored on geometry primitives (points lines, areas) and can be
applied before or after meshing.
Getting Started:
1) To run a pycalcuix file you have to have pycalulix installed,
see Installation below
2) The you can then write your own pycalculix programs or run one of the example
files in the eamples folder on github:
https://github.com/spacether/pycalculix/tree/master/examples
3) To run a file:
WINDOWS:
Graphical user interface:
Double click the file: if the .py extension is associated correctly you can
double click it to run the .py program
Console:
1) cd into the directory with your .py file in it
2) type:
python the_program.py
where the_program.py is the name of the file that you are running
This assumes that python3 is your active python installation
LINUX:
Console:
1) cd into the directory with your .py file in it
2) type:
python3 the_program.py
where the_program.py is the name of the file that you are running
Files Produced:
Meshing and solving are done in the background using cgx or gmsh for meshing,
and Calculix ccx for solving.
Files Used:
*.fbd (Calculix cgx gemetry file)
*.inp (Calculix solver input file, or mesh definition)
*.geo (Gmsh geometry file)
*.msh (Gmsh native mesh file)
*.frd (Calculix ccx nodal results file, values are at nodes and were created
by interpolating element integration point results back to the nodes)
*.dat (Calculix ccx element results file, includes integration point results)
Installation:
pycalculix requires the below software:
Python3+
Numpy (S1,S2,S3 calculation)
Matplotlib (plotting)
Calculix (solving)
Gmsh (meshing)
EASIEST INSTALLATION:
WINDOWS:
1) Install Anaconda* python 3.4:
http://continuum.io/downloads#py34
This includes required libraries like numpy and matplotlib.
Note:
64-bit:
This is an easier option for 64 bit systems because the binaries of the
other libraries are harder to find.
32-bit:
*Rather than installing anaconda you can just install python 3+ from the
python site:
https://www.python.org/downloads/release/python-343/
When you install pycalculix in the next step below, the required libraries
will autoinstall on your system.
2) In a console window, type:
pip install pycalculix
Note: This installs the calculix and gmsh programs in sub-folders in the python
pycalculix folder.
Running these included binaries from pycalculix only works for windows.
3) You are done! See 'Getting Started'
LINUX
(assumes Ubuntu 14.04)
1) Install required prerequsisites. In the console enter:
sudo apt-get install python3-pip python3-matplotlib gmsh
Note: this installs
pip (a python library downloader) for python 3
python3 matplotlib (the required matplotlib library needed for plotting)
gmsh (software needed to mesh you FEA models)
2) Install both calculix ccx and calculix cgx for your architecture (32 or 64 bit)
Ubuntu 14.04.1 (Trusty)
--------
32-bit:
--------
ccx: https://code.launchpad.net/~cae-team/+archive/ubuntu/ppa/+build/7043228/+files/calculix-ccx_2.7-0%7E1%2B6%7Eubuntu14.04.1_i386.deb
cgx: https://code.launchpad.net/~cae-team/+archive/ubuntu/ppa/+build/7043230/+files/calculix-cgx_2.7-0%7E1%2B3%7Eubuntu14.10.1_i386.deb
--------
64-bit:
--------
ccx: https://code.launchpad.net/~cae-team/+archive/ubuntu/ppa/+build/7043227/+files/calculix-ccx_2.7-0%7E1%2B6%7Eubuntu14.04.1_amd64.deb
cgx: https://code.launchpad.net/~cae-team/+archive/ubuntu/ppa/+build/7043229/+files/calculix-cgx_2.7-0%7E1%2B3%7Eubuntu14.10.1_amd64.deb
3) In the console window type:
pip3 install pycalculix
4) You are done! See 'Getting Started'
Separate Installs:
Install Python 3+: https://www.python.org/downloads/release/python-342/
Install numpy: http://sourceforge.net/projects/numpy/files/NumPy/1.9.1/
Install matplotlib: http://matplotlib.org/downloads.html
Install Calculix: http://www.calculix.de/
Linux Version: http://www.dhondt.de/
Windows Version: http://www.bconverged.com/download.php#calculix
Install Gmsh: http://geuz.org/gmsh/#Download
pip install pycalculix
Then pass locations to ccx, cgx, and gmsh per the example on the
pycaculix site: http://justinablack.com/pycalculix/
Anaconda:
An installation package that includes Python and many python libraries
Anaconda includes the below Python3+, Numpy, and Matplotlib.
If you are a Python beginner, I suggest downloading and installing it
rather than the separate installers.
Url:
http://continuum.io/downloads#py34
Optional Software:
Suggested IDE (program to edit and run python programs):
Wing IDE:
http://wingware.com/downloads/wingide-101
Version Updates:
0.9.3
ADDED: Import CAD geometry from dxf file
See pycalculix.CadImporter
ADDED: Element results plotting added
Element results plotting: pycalculix.Problem.rfile.eplot()
Nodal results plotting: pycalculix.Problem.rfile.nplot()
Number Formatting:
Strain results now use scientific formatting
Others use nearest 10**3 suffixes
Max and min values now listed above the colorbar
ADDED: method to draw an arc by swept angle in degrees
part.draw_arc_angle(degrees_ccw, center_x, center_y)
ADDED: min_val and max_val can now be passed to eplot and nplot
This lets the user set the results range that they want to see:
min_val <= colored results <= max_val
Values under and over are greyed out, darker under, lighter over
ADDED: internal holes in parts
One can make circular holes, or draw complicated holes.
See example 7
ADDED: Added set_ediv method to FeaModel class.
This method sets the number of elements on a line.
line.set_ediv still works.
ADDED: Robust selection object: feamodel.view
This object is feamodel.view Most important methods are:
view.select_all, view.select, view.allsel_under
All plotting now uses the current selection set
SYNTAX: updated how parts, materials, problems are made
Make part:
pycalculix.FeaModel.make_part or pycalculix.Part
Make material:
pycalculix.FeaModel.make_matl or pycalculix.Material
Make problem (previously called model):
pycalculix.FeaModel.make_problem or pycalculix.Problem
Make Results File:
pycalculix.Problem.rfile or pycalculix.ResultsFile(problem)
FIX: Plotting fix, closing triangles in the correct direction in matplotlib
DOC: All code separated into modules for clarity.
DOC: Docstrings added to all classes + methods + functions
PLOTTING: Closed areas are now filled in yellow when plotting geometry.
PLOTTING: Signed line names are shown and internal to the area.
BACKEND: Implimented signed line and signed arc class.
Pressures can now be applied on these signed lines.
Many methods and variables made private to clean up name space.
TODO:
Add tutorial videos
Update pdf
Improve Pylint Scores:
feamodel 9.28
geometry 9.02
results_file 9.75
part 9.64
selector 9.89
mesh 9.66
loads 9.80
cadimporter 9.71
problem 9.82
base_classes 9.51
components 10.0
material 10.0
environment 9.39
connectors 9.57
Future Goals:
-CAD import of: brep, step, iges
can make geo files with gmsh:
gmsh freecad_part.iges -o out_iges.geo -0
gmsh freecad_part.brep -o out_brep.geo -0
gmsh freecad_part.step -o out_step.geo -0
Importing the geo file:
Do points need explicit numbers? no, store them in a dict
points[geo_str] = point
Need to convert spline to arcs if it's a circle or arc >= 180
Will need to delete some points + make center point
-Ability to make a new field (% yield etc)
-Double check effective strain calculation:
http://orange.engr.ucdavis.edu/Documentation12.0/120/ans_thry.pdf
pg 23 + 24
https://support.tnodiana.com/manuals/d944/Analys/node405.html
https://books.google.com/books?id=70vvzjngyQEC&pg=PA21&lpg=PA21&dq=equivalent+strain+principal+strain&source=bl&ots=bPj4dHfddy&sig=X6MAdyeq34X9uNQRZ1poKXHZK9c&hl=en&sa=X&ei=lr2_VL_lM4q4ggS7loHICw&ved=0CFwQ6AEwCQ#v=onepage&q=equivalent%20strain%20principal%20strain&f=false
-Is my element stress calculation correct? Should it be an average, or a centroid val?
http://mostreal.sk/html/elem_55/chapter2/ES2-2.htm
http://orange.engr.ucdavis.edu/Documentation12.0/120/ans_thry.pdf#page=536&zoom=auto,32.4,582.228
-Add area chunker around arcs
-Add part offset function to offset a line and close an area
-Add contact between parts
-Add compression supports
model.make_compr_support('L5', 10)
make new part with new line loop, not closed, new line
set ndivs on both lines (only needed if before meshing)
make connector object
pre mesh: make gap elements after meshing
post mesh: clone the existing nodes with new node numbers, make gap eles
-Reaction force fix?
-Coupling nodes under points and lines ("gluing")
This would allow 'correct' stresses for knock up at discontinuities
-Add struct-thermal and thermal support
-Order faces under slines to be sequential so they can be output later
-Order nodes under slines to be sequential so they can be output later
-Add mp4 maker
-Bolted joint example perhaps, nodal thickness on bolt and nut areas
-Interactive selection?
-Face plotting?
-Aluminum can model?
-https://www.youtube.com/watch?v=hUhisi2FBuw