Using FreeCAD 0.16, I wrote a Python script that built a simple model, meshed it, solved it with CalculiX and displayed the results. However, as I made the model more complex, I began having trouble with huge meshes. Following the guidance from this forum, I switched to v0.17 and GMSH. I am able to get as far as solving with CalculiX, but the following error appears when trying to display the results:
FEM: Result node numbers are not equal to FEM Mesh NodeCount.
Upon inspection, I can see the result object is populated. Here is the script I am using:
Code: Select all
import sys
import ObjectsFem
from Part import makeSphere as Sphere
d = App.newDocument("SphereFEA")
g = FreeCADGui.ActiveDocument
d.addObject('Part::Feature', 'Chamber').Shape = Sphere(100).cut(Sphere(90))
m = ObjectsFem.makeAnalysis('MechanicalAnalysis')
ChamberMesh = ObjectsFem.makeMeshGmsh('ChamberMesh')
d.ChamberMesh.Part = d.Chamber
d.ChamberMesh.CharacteristicLengthMax = 10
d.ChamberMesh.CharacteristicLengthMin = 1
d.ChamberMesh.FemMesh
d.ChamberMesh.ElementDimension = '3D'
m.Member += [ChamberMesh]
d.addObject("Fem::ConstraintFixed","FemConstraintFixed")
d.FemConstraintFixed.Scale = 1
d.FemConstraintFixed.References = [(d.Chamber,"Vertex1")]
m.Member += [d.FemConstraintFixed]
d.addObject("Fem::ConstraintPressure","FemConstraintPressure")
d.FemConstraintPressure.Pressure = 10.0
d.FemConstraintPressure.Reversed = False
d.FemConstraintPressure.References = [(d.Chamber,"Face2"),]
m.Member += [d.FemConstraintPressure]
Metal1 = ObjectsFem.makeMaterialSolid('SolidMaterial')
mat = Metal1.Material
mat['Name'] = "Steel-Generic"
mat['YoungsModulus'] = "210000 MPa"
mat['PoissonRatio'] = "0.30"
mat['Density'] = "7900 kg/m^3"
Metal1.Material = mat
m.Member += [Metal1]
Solver = ObjectsFem.makeSolverCalculix('CalculiX')
m.Member += [Solver]
d.recompute()
g.ActiveView.fitAll()
- * Generate the mesh
* Run Calculix
Cheers,
Doug
PS Thank you to all the developers for making this powerful tool!
_________________________________________________________________________________________________________________________
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10640 (Git)
Build type: Release
Branch: master
Hash: 2365dd6f8b424ecf01c16b70b3217ccc53098070
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0