| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
import FreeCAD |
| 25 |
from FreeCAD import Rotation |
| 26 |
from FreeCAD import Vector |
| 27 |
|
| 28 |
import ObjectsFem |
| 29 |
|
| 30 |
from . import manager |
| 31 |
from .manager import get_meshname |
| 32 |
from .manager import init_doc |
| 33 |
from .meshes import generate_mesh |
| 34 |
|
| 35 |
|
| 36 |
def get_information(): |
| 37 |
return { |
| 38 |
"name": "Rotating Disc Cyclic Symmetry Centrif", |
| 39 |
"meshtype": "solid", |
| 40 |
"meshelement": "Tet10", |
| 41 |
"constraints": ["tie", "centrif", "displacement"], |
| 42 |
"solvers": ["ccxtools"], |
| 43 |
"material": "solid", |
| 44 |
"equations": ["mechanical"], |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
def get_explanation(header=""): |
| 49 |
return ( |
| 50 |
header |
| 51 |
+ """ |
| 52 |
|
| 53 |
To run the example from Python console use: |
| 54 |
from femexamples.ccx_disc_cyclic_symm_centrif import setup |
| 55 |
setup() |
| 56 |
|
| 57 |
Analytical solution - max von Mises stress 109.78 MPa = 1.0987e8 Pa |
| 58 |
|
| 59 |
""" |
| 60 |
) |
| 61 |
|
| 62 |
|
| 63 |
def setup(doc=None, solvertype="ccxtools"): |
| 64 |
|
| 65 |
|
| 66 |
if doc is None: |
| 67 |
doc = init_doc() |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
manager.add_explanation_obj(doc, get_explanation(manager.get_header(get_information()))) |
| 72 |
|
| 73 |
|
| 74 |
cylinder1 = doc.addObject("Part::Cylinder", "Cylinder1") |
| 75 |
cylinder1.Placement = FreeCAD.Placement(Vector(0, 0, 0), Rotation(Vector(0, 0, 1), 0)) |
| 76 |
cylinder1.Radius = "400 mm" |
| 77 |
cylinder1.Height = "50 mm" |
| 78 |
cylinder1.Angle = "45 deg" |
| 79 |
|
| 80 |
|
| 81 |
cylinder2 = doc.addObject("Part::Cylinder", "Cylinder2") |
| 82 |
cylinder2.Placement = FreeCAD.Placement(Vector(0, 0, 0), Rotation(Vector(0, 0, 1), 0)) |
| 83 |
cylinder2.Radius = "200 mm" |
| 84 |
cylinder2.Height = "50 mm" |
| 85 |
cylinder2.Angle = "45 deg" |
| 86 |
|
| 87 |
geom_obj = doc.addObject("Part::Cut", "Cut") |
| 88 |
geom_obj.Base = cylinder1 |
| 89 |
geom_obj.Tool = cylinder2 |
| 90 |
doc.recompute() |
| 91 |
|
| 92 |
if FreeCAD.GuiUp: |
| 93 |
geom_obj.ViewObject.Document.activeView().viewAxonometric() |
| 94 |
geom_obj.ViewObject.Document.activeView().fitAll() |
| 95 |
|
| 96 |
|
| 97 |
axis = doc.addObject("Part::Line", "Axis") |
| 98 |
axis.Placement = FreeCAD.Placement(Vector(0, 0, 0), Rotation(Vector(0, 0, 1), 0)) |
| 99 |
axis.X1 = "0.00 mm" |
| 100 |
axis.Y1 = "0.00 mm" |
| 101 |
axis.Z1 = "0.00 mm" |
| 102 |
axis.X2 = "0.00 mm" |
| 103 |
axis.Y2 = "0.00 mm" |
| 104 |
axis.Z2 = "50.00 mm" |
| 105 |
doc.recompute() |
| 106 |
if FreeCAD.GuiUp: |
| 107 |
axis.ViewObject.LineWidth = 5.0 |
| 108 |
axis.ViewObject.LineColor = (1.0, 0.0, 0.0) |
| 109 |
|
| 110 |
|
| 111 |
analysis = ObjectsFem.makeAnalysis(doc, "Analysis") |
| 112 |
if FreeCAD.GuiUp: |
| 113 |
import FemGui |
| 114 |
|
| 115 |
FemGui.setActiveAnalysis(analysis) |
| 116 |
|
| 117 |
|
| 118 |
if solvertype == "ccxtools": |
| 119 |
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools") |
| 120 |
solver_obj.AnalysisType = "static" |
| 121 |
analysis.addObject(solver_obj) |
| 122 |
else: |
| 123 |
FreeCAD.Console.PrintWarning( |
| 124 |
"Unknown or unsupported solver type: {}. " |
| 125 |
"No solver object was created.\n".format(solvertype) |
| 126 |
) |
| 127 |
|
| 128 |
|
| 129 |
material_obj = ObjectsFem.makeMaterialSolid(doc, "Steel") |
| 130 |
mat = material_obj.Material |
| 131 |
mat["Name"] = "Calculix-Steel" |
| 132 |
mat["YoungsModulus"] = "210000 MPa" |
| 133 |
mat["PoissonRatio"] = "0.30" |
| 134 |
mat["Density"] = "8000 kg/m^3" |
| 135 |
material_obj.Material = mat |
| 136 |
material_obj.References = [(geom_obj, "Solid1")] |
| 137 |
analysis.addObject(material_obj) |
| 138 |
|
| 139 |
|
| 140 |
con_tie = ObjectsFem.makeConstraintTie(doc, "ConstraintTie") |
| 141 |
con_tie.References = [ |
| 142 |
(geom_obj, "Face2"), |
| 143 |
(geom_obj, "Face3"), |
| 144 |
] |
| 145 |
con_tie.Tolerance = 0.2 |
| 146 |
con_tie.CyclicSymmetry = True |
| 147 |
con_tie.Sectors = 8 |
| 148 |
con_tie.ConnectedSectors = 1 |
| 149 |
analysis.addObject(con_tie) |
| 150 |
|
| 151 |
|
| 152 |
con_centrif = ObjectsFem.makeConstraintCentrif(doc, "ConstraintCentrif") |
| 153 |
con_centrif.References = [(geom_obj, "Solid1")] |
| 154 |
con_centrif.RotationFrequency = "50 Hz" |
| 155 |
con_centrif.RotationAxis = [(axis, "Edge1")] |
| 156 |
analysis.addObject(con_centrif) |
| 157 |
|
| 158 |
|
| 159 |
con_disp = ObjectsFem.makeConstraintDisplacement(doc, "ConstraintDisplacement") |
| 160 |
con_disp.References = [(geom_obj, ("Vertex8"))] |
| 161 |
analysis.addObject(con_disp) |
| 162 |
con_disp.zFree = False |
| 163 |
con_disp.zDisplacement = "0.00 mm" |
| 164 |
|
| 165 |
|
| 166 |
femmesh_obj = analysis.addObject(ObjectsFem.makeMeshGmsh(doc, get_meshname()))[0] |
| 167 |
femmesh_obj.Shape = geom_obj |
| 168 |
femmesh_obj.ElementOrder = "2nd" |
| 169 |
femmesh_obj.CharacteristicLengthMax = "10 mm" |
| 170 |
femmesh_obj.ViewObject.Visibility = False |
| 171 |
|
| 172 |
|
| 173 |
generate_mesh.mesh_from_mesher(femmesh_obj, "gmsh") |
| 174 |
|
| 175 |
doc.recompute() |
| 176 |
return doc |
| 177 |
|