This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added readme.txt Example files renamed Added overview pdf
- Loading branch information
Showing
10 changed files
with
235 additions
and
46 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
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 | ||
|
||
Usefull applications of Pycalculix: | ||
-Trade studies for plane stress, splane strain, or axisymmetric parts | ||
-Quick Kt analysis of 2D geometry | ||
-Leaning finite element analyis (FEA) and Python | ||
|
||
Notes: | ||
I build 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 work. I'd like to integrate gmsh in the future | ||
so mesh quality can be more controllable, and less error prone. | ||
|
||
License: | ||
See LICENSE.txt (GPL v2) | ||
|
||
Creator: | ||
Justin Black, justin.a.black[at-sine]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 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 | ||
blends/fillets with the part method: part.fillet_lines(L1, L2, arc_radius) | ||
The new filleet will be tangent to both adjacent lines. | ||
|
||
Loading: | ||
Force loading, constant pressure, linearly varying pressure, gravity, and rotational speed forces are implemented. | ||
Displacement constraints are also supported. | ||
Loads are stored on geometry primitives (points lines etc) and can be applied before or after meshing. | ||
|
||
Getting Started: | ||
Please read through the documented example files below: | ||
example1_dam.py | ||
example2_hole_in_plate.py | ||
example3_compr_rotor.py | ||
example4_hole_kt.py | ||
example5_times_dam.py | ||
|
||
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: | ||
Install the below required software. | ||
Then move pycalculix.py to the directory you want to work in. | ||
Any new models should be created in separate .py files. See the above example files in the 'Getting Started' section. | ||
|
||
Required Software: | ||
Calculix: | ||
Free and very full-featured preprocessor (cgx) and finite element analysis (FEA) solver (ccx) | ||
http://www.calculix.de/ | ||
Linux Version: http://www.dhondt.de/ | ||
Windows Version: http://www.bconverged.com/download.php#calculix | ||
Gmsh: | ||
Free and full featured mesher | ||
http://geuz.org/gmsh/#Download | ||
|
||
Anaconda: | ||
An installation package that includes Python and many often used 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 below separate installers. | ||
Url: | ||
http://continuum.io/downloads#py34 | ||
|
||
Python 3+: | ||
https://www.python.org/downloads/release/python-342/ | ||
Numpy: | ||
http://sourceforge.net/projects/numpy/files/NumPy/1.9.1/ | ||
Matplotlib: | ||
http://matplotlib.org/downloads.html | ||
|
||
Optional Software: | ||
Suggested IDE (program to edit and run python programs): | ||
Wing IDE: | ||
http://wingware.com/downloads/wingide-101 | ||
|
||
Future Goals: | ||
-Plotting | ||
Add element results plotting | ||
-Add compression supports | ||
-Make lists for lines and signed lines (need to write a signed lines class) | ||
-Add struct-thermal and thermal support | ||
-Auto-detect contact regions between parts | ||
-CAD import of brep and igs via gmsh | ||
-CAD export via gmsh (step, brep) | ||
-Add mp4 maker | ||
-Bolted joint example perhaps, nodal thickness on bolt and nut areas | ||
-Interactive selection? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
from pycalculix import FeaModel | ||
import math | ||
|
||
# We'll be modeling a masonry gravity dam, the Beetaloo dam in Australia | ||
# Problem constants | ||
proj_name = 'example1_dam' | ||
grav = 9.81 # m/s^2 | ||
dens_water = 1000 #kg/m^3 | ||
press_atm = 101325 # Pascals = N/m^2 = kg/(m-s^2) | ||
dam_ht_ft = 115 | ||
water_ht_ft = 109 | ||
length_dam_ft = 580 | ||
|
||
# derived dims | ||
water_ax = (water_ht_ft-22)/math.tan(math.radians(89)) + 12 | ||
top_ax = (dam_ht_ft-22)/math.tan(math.radians(89)) + 12 | ||
thickness = length_dam_ft*0.3048 # conversion to metric | ||
|
||
# derived dimensions, tan = o/a --> o/tan = a | ||
pts_ft_water = [[8,0],[22,12],[water_ht_ft,water_ax]] | ||
pts_ft_air = [[dam_ht_ft,top_ax], [dam_ht_ft, top_ax + 14]] | ||
water_ht_m = water_ht_ft*0.3048 | ||
|
||
# make model | ||
a = FeaModel(proj_name) | ||
a.set_units('m') # this sets dist units to meters, labels our consistent units | ||
|
||
# make part, coordinates are x, y = radial, axial | ||
b = a.PartMaker() | ||
b.goto(0.0,0.0) | ||
water_lines = [] | ||
air_lines = [] | ||
for [x,y] in pts_ft_water: | ||
[x,y] = [x*0.3048,y*0.3048] # conversion to metric | ||
[L1,p1,p2] = b.draw_line_to(x, y) | ||
water_lines.append(L1) | ||
for [x,y] in pts_ft_air: | ||
[x,y] = [x*0.3048,y*0.3048] # conversion to metric | ||
[L1,p1,p2] = b.draw_line_to(x, y) | ||
air_lines.append(L1) | ||
# make the two arcs | ||
pts_ft_arcs = [ [[22,73],[146,208]], [[14,98],[41,93]] ] | ||
for [[x,y],[xc,yc]] in pts_ft_arcs: | ||
[x,y] = [x*0.3048,y*0.3048] | ||
[xc,yc] = [xc*0.3048,yc*0.3048] | ||
[L1,p1,p2] = b.draw_arc(x,y,xc,yc) | ||
air_lines.append(L1) | ||
# make the last 3 lines after the arcs | ||
pts_ft_other = [ [2,110], [0, 110] ] | ||
for [x,y] in pts_ft_other: | ||
[x,y] = [x*0.3048,y*0.3048] # conversion to metric | ||
[L1,p1,p2] = b.draw_line_to(x, y) | ||
air_lines.append(L1) | ||
b.draw_line_to(0, 0) | ||
a.plot_geometry(proj_name+'_geom', b) # view the points, lines, and areas | ||
|
||
# set part material | ||
mat = a.MatlMaker('concrete') | ||
mat.set_mech_props(2300, 30000*(10**6), 0.2) | ||
a.set_matl(mat, b) | ||
|
||
# set the element type, line division, and mesh the database | ||
a.set_eshape('quad', 2) | ||
a.set_etype(b, 'plstrain', thickness) | ||
b.get_item('L8').set_ediv(2) | ||
a.mesh(0.5, 'gmsh') # mesh with 1.0 or less fineness, smaller is finer | ||
a.plot_elements(proj_name+'_elem') # plot the part elements | ||
|
||
# set loads and constraints | ||
a.set_load('press', air_lines, press_atm) | ||
a.set_fluid_press(water_lines, dens_water, grav, water_ht_m, press_atm) | ||
a.set_gravity(grav, b) | ||
a.set_constr('fix', b.bottom, 'x') | ||
a.set_constr('fix', b.bottom, 'y') | ||
a.plot_pressures(proj_name+'_press_1') | ||
a.plot_constraints(proj_name+'_constr') | ||
|
||
# make model and solve it | ||
mod = a.ModelMaker(b, 'struct') | ||
mod.solve() | ||
|
||
# query results and store them | ||
disp = False # turn off display plotting | ||
fields = 'Seqv,Sx,Sy,Sz,S1,S2,S3,ux,uy,utot' # store the fields to write | ||
fields = fields.split(',') | ||
|
||
for field in fields: | ||
fname = proj_name+'_'+field | ||
mod.rfile.nplot(field, fname, display=disp) | ||
smax = mod.rfile.get_nmax('Seqv') | ||
[fx, fy, fz] = mod.rfile.get_fsum(a.get_item('L9')) | ||
print('Seqv_max= %3.2f' % (smax)) | ||
print('Reaction forces (fx,fy,fz) = (%12.10f, %12.10f, %12.10f)' % (fx, fy, fz)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters