Hello,
Wow! I am interested in this topic. I need practically the same.
I create a simple box in freecad. The .inp of this file is the following one:
DEFAULT .INP file
Code: Select all
** written by FreeCAD inp file writer for CalculiX,Abaqus meshes
** highest dimension mesh elements only.
** Nodes
*Node, NSET=Nall
1, 0, 0, 10
2, 0, 0, 0
3, 0, 30, 10
4, 0, 30, 0
5, 20, 0, 10
6, 20, 0, 0
7, 20, 30, 10
8, 20, 30, 0
9, 0, 0, 5
10, 0, 15, 10
11, 0, 30, 5
12, 0, 15, 0
13, 20, 0, 5
14, 20, 15, 10
15, 20, 30, 5
16, 20, 15, 0
17, 10, 0, 0
18, 10, 0, 10
19, 10, 30, 0
20, 10, 30, 10
21, 0, 15, 5
22, 0, 7.5, 2.5
23, 0, 7.5, 7.5
24, 0, 22.5, 7.5
25, 0, 22.5, 2.5
26, 20, 15, 5
27, 20, 7.5, 2.5
28, 20, 7.5, 7.5
29, 20, 22.5, 7.5
30, 20, 22.5, 2.5
31, 10, 0, 5
32, 5, 0, 2.5
33, 5, 0, 7.5
34, 15, 0, 7.5
35, 15, 0, 2.5
36, 10, 30, 5
37, 5, 30, 7.5
38, 5, 30, 2.5
39, 15, 30, 7.5
40, 15, 30, 2.5
41, 10, 15, 0
42, 5, 22.5, 0
43, 5, 7.5, 0
44, 15, 7.5, 0
45, 15, 22.5, 0
46, 10, 15, 10
47, 5, 22.5, 10
48, 5, 7.5, 10
49, 15, 7.5, 10
50, 15, 22.5, 10
51, 10, 7.5, 7.5
52, 10, 7.5, 2.5
53, 10, 22.5, 7.5
54, 10, 22.5, 2.5
55, 5, 15, 7.5
56, 5, 15, 2.5
57, 10, 15, 5
58, 5, 7.5, 5
59, 15, 15, 2.5
60, 15, 15, 7.5
61, 15, 7.5, 5
62, 5, 22.5, 5
63, 15, 22.5, 5
** Volume elements
*Element, TYPE=C3D10, ELSET=Evolumes
37, 46, 5, 1, 31, 49, 18, 48, 51, 34, 33
38, 6, 41, 2, 31, 44, 43, 17, 35, 52, 32
39, 46, 3, 7, 36, 47, 20, 50, 53, 37, 39
40, 41, 8, 4, 36, 45, 19, 42, 54, 40, 38
41, 41, 46, 21, 31, 57, 55, 56, 52, 51, 58
42, 26, 46, 41, 31, 60, 57, 59, 61, 51, 52
43, 41, 21, 46, 36, 56, 55, 57, 54, 62, 53
44, 26, 41, 46, 36, 59, 57, 60, 63, 54, 53
45, 46, 1, 21, 31, 48, 23, 55, 51, 33, 58
46, 6, 26, 41, 31, 27, 59, 44, 35, 61, 52
47, 41, 4, 21, 36, 42, 25, 56, 54, 38, 62
48, 26, 8, 41, 36, 30, 45, 59, 63, 40, 54
49, 26, 5, 46, 31, 28, 49, 60, 61, 34, 51
50, 41, 21, 2, 31, 56, 22, 43, 52, 58, 32
51, 26, 46, 7, 36, 60, 50, 29, 63, 53, 39
52, 46, 21, 3, 36, 55, 24, 47, 53, 62, 37
53, 3, 21, 4, 36, 24, 25, 11, 37, 62, 38
54, 6, 5, 26, 31, 13, 28, 27, 35, 34, 61
55, 1, 2, 21, 31, 9, 22, 23, 33, 32, 58
56, 26, 7, 8, 36, 29, 15, 30, 63, 39, 40
57, 3, 1, 21, 46, 10, 23, 24, 47, 48, 55
58, 46, 7, 5, 26, 50, 14, 49, 60, 29, 28
59, 26, 41, 8, 6, 59, 45, 30, 27, 44, 16
60, 21, 2, 4, 41, 22, 12, 25, 56, 43, 42
** Define element set Eall
*ELSET, ELSET=Eall
Evolumes
***********************************************************
** Element sets for materials and FEM element type (solid, shell, beam, fluid)
** written by write_element_sets_material_and_femelement_type function
*ELSET,ELSET=SolidMaterialSolid
Evolumes
***********************************************************
** Node sets for fixed constraint
** written by write_node_sets_constraints_fixed function
** FemConstraintFixed
*NSET,NSET=FemConstraintFixed
1,
2,
5,
6,
9,
13,
17,
18,
31,
32,
33,
34,
35,
***********************************************************
** Materials
** written by write_materials function
** Young's modulus unit is MPa = N/mm2
** Density's unit is t/mm^3
** FreeCAD material name: CalculiX-Steel
** Steel
*MATERIAL, NAME=SolidMaterial
*ELASTIC
210000, 0.300
*DENSITY
7.900e-09
***********************************************************
** Sections
** written by write_femelementsets function
*SOLID SECTION, ELSET=SolidMaterialSolid, MATERIAL=SolidMaterial
***********************************************************
** At least one step is needed to run an CalculiX analysis of FreeCAD
** written by write_step_begin function
*STEP
*FREQUENCY
3,0.0,100000.0
***********************************************************
** Fixed Constraints
** written by write_constraints_fixed function
** FemConstraintFixed
*BOUNDARY
FemConstraintFixed,1
FemConstraintFixed,2
FemConstraintFixed,3
***********************************************************
** Outputs --> frd file
** written by write_outputs_types function
*NODE FILE
U
*EL FILE
S, E
** outputs --> dat file
*NODE PRINT , NSET=Nall
U
*EL PRINT , ELSET=Eall
S
***********************************************************
** written by write_step_end function
*END STEP
***********************************************************
** CalculiX Input file
** written by write_footer function
** written by --> FreeCAD 0.17.13528 (Git)
** written on --> Sun Sep 23 12:50:46 2018
** file name --> SimpleBox.FCStd
** analysis name --> Analysis
**
**
**
** Units
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
**
I modify the .inp file in order to obtain exactly the same results:
MY .INP file
Code: Select all
** written by FreeCAD inp file writer for CalculiX,Abaqus meshes
** highest dimension mesh elements only.
** Nodes
*Node, NSET=Nall
1, 0, 0, 10
2, 0, 0, 0
3, 0, 30, 10
4, 0, 30, 0
5, 20, 0, 10
6, 20, 0, 0
7, 20, 30, 10
8, 20, 30, 0
9, 0, 0, 5
10, 0, 15, 10
11, 0, 30, 5
12, 0, 15, 0
13, 20, 0, 5
14, 20, 15, 10
15, 20, 30, 5
16, 20, 15, 0
17, 10, 0, 0
18, 10, 0, 10
19, 10, 30, 0
20, 10, 30, 10
21, 0, 15, 5
22, 0, 7.5, 2.5
23, 0, 7.5, 7.5
24, 0, 22.5, 7.5
25, 0, 22.5, 2.5
26, 20, 15, 5
27, 20, 7.5, 2.5
28, 20, 7.5, 7.5
29, 20, 22.5, 7.5
30, 20, 22.5, 2.5
31, 10, 0, 5
32, 5, 0, 2.5
33, 5, 0, 7.5
34, 15, 0, 7.5
35, 15, 0, 2.5
36, 10, 30, 5
37, 5, 30, 7.5
38, 5, 30, 2.5
39, 15, 30, 7.5
40, 15, 30, 2.5
41, 10, 15, 0
42, 5, 22.5, 0
43, 5, 7.5, 0
44, 15, 7.5, 0
45, 15, 22.5, 0
46, 10, 15, 10
47, 5, 22.5, 10
48, 5, 7.5, 10
49, 15, 7.5, 10
50, 15, 22.5, 10
51, 10, 7.5, 7.5
52, 10, 7.5, 2.5
53, 10, 22.5, 7.5
54, 10, 22.5, 2.5
55, 5, 15, 7.5
56, 5, 15, 2.5
57, 10, 15, 5
58, 5, 7.5, 5
59, 15, 15, 2.5
60, 15, 15, 7.5
61, 15, 7.5, 5
62, 5, 22.5, 5
63, 15, 22.5, 5
** Volume elements
*Element, TYPE=C3D10, ELSET=Evolumes
37, 46, 5, 1, 31, 49, 18, 48, 51, 34, 33
38, 6, 41, 2, 31, 44, 43, 17, 35, 52, 32
39, 46, 3, 7, 36, 47, 20, 50, 53, 37, 39
40, 41, 8, 4, 36, 45, 19, 42, 54, 40, 38
41, 41, 46, 21, 31, 57, 55, 56, 52, 51, 58
42, 26, 46, 41, 31, 60, 57, 59, 61, 51, 52
43, 41, 21, 46, 36, 56, 55, 57, 54, 62, 53
44, 26, 41, 46, 36, 59, 57, 60, 63, 54, 53
45, 46, 1, 21, 31, 48, 23, 55, 51, 33, 58
46, 6, 26, 41, 31, 27, 59, 44, 35, 61, 52
47, 41, 4, 21, 36, 42, 25, 56, 54, 38, 62
48, 26, 8, 41, 36, 30, 45, 59, 63, 40, 54
49, 26, 5, 46, 31, 28, 49, 60, 61, 34, 51
50, 41, 21, 2, 31, 56, 22, 43, 52, 58, 32
51, 26, 46, 7, 36, 60, 50, 29, 63, 53, 39
52, 46, 21, 3, 36, 55, 24, 47, 53, 62, 37
53, 3, 21, 4, 36, 24, 25, 11, 37, 62, 38
54, 6, 5, 26, 31, 13, 28, 27, 35, 34, 61
55, 1, 2, 21, 31, 9, 22, 23, 33, 32, 58
56, 26, 7, 8, 36, 29, 15, 30, 63, 39, 40
57, 3, 1, 21, 46, 10, 23, 24, 47, 48, 55
58, 46, 7, 5, 26, 50, 14, 49, 60, 29, 28
59, 26, 41, 8, 6, 59, 45, 30, 27, 44, 16
60, 21, 2, 4, 41, 22, 12, 25, 56, 43, 42
** Define element set Eall
*ELSET, ELSET=Eall
Evolumes
***********************************************************
** Element sets for materials and FEM element type (solid, shell, beam, fluid)
** written by write_element_sets_material_and_femelement_type function
*ELSET,ELSET=SolidMaterialSolid
37,
39,
40,
41,
42,
43,
44,
45,
47,
48,
49,
50,
51,
52,
53,
55,
56,
57,
58,
60,
*ELSET,ELSET=MaterialSelectedNodes
38,
46,
54,
59,
***********************************************************
** Node sets for fixed constraint
** written by write_node_sets_constraints_fixed function
** FemConstraintFixed
*NSET,NSET=FemConstraintFixed
1,
2,
5,
6,
9,
13,
17,
18,
31,
32,
33,
34,
35,
***********************************************************
** Materials
** written by write_materials function
** Young's modulus unit is MPa = N/mm2
** Density's unit is t/mm^3
** FreeCAD material name: CalculiX-Steel
** Steel
*MATERIAL, NAME=SolidMaterial
*ELASTIC
210000, 0.300
*DENSITY
7.900e-09
*MATERIAL, NAME=SolidMaterialSelectedNodes
*ELASTIC
210000, 0.300
*DENSITY
7.900e-09
***********************************************************
** Sections
** written by write_femelementsets function
*SOLID SECTION, ELSET=SolidMaterialSolid, MATERIAL=SolidMaterial
*SOLID SECTION, ELSET=MaterialSelectedNodes, MATERIAL=SolidMaterialSelectedNodes
***********************************************************
** At least one step is needed to run an CalculiX analysis of FreeCAD
** written by write_step_begin function
*STEP
*FREQUENCY
3,0.0,100000.0
***********************************************************
** Fixed Constraints
** written by write_constraints_fixed function
** FemConstraintFixed
*BOUNDARY
FemConstraintFixed,1
FemConstraintFixed,2
FemConstraintFixed,3
***********************************************************
** Outputs --> frd file
** written by write_outputs_types function
*NODE FILE
U
*EL FILE
S, E
** outputs --> dat file
*NODE PRINT , NSET=Nall
U
*EL PRINT , ELSET=Eall
S
***********************************************************
** written by write_step_end function
*END STEP
***********************************************************
** CalculiX Input file
** written by write_footer function
** written by --> FreeCAD 0.17.13528 (Git)
** written on --> Sun Sep 23 12:50:46 2018
** file name --> SimpleBox.FCStd
** analysis name --> Analysis
**
**
**
** Units
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
**
However, I dont know how to run Calculix using the .inp file and the information from the attached file: SimpleBox.FCStd
I know that in python API is something like this (special thanks to Bernd
https://www.freecadweb.org/wiki/FEM_Tutorial_Python):
Code: Select all
# --------------------------------------------------------------
### Run Analysis
# --------------------------------------------------------------
FemGui.setActiveAnalysis(FreeCAD.getDocument("SimpleBox").Analysis)
fea = ccxtools.FemToolsCcx()
fea.update_objects()
message = fea.check_prerequisites()
if not message:
fea.reset_all()
fea.run() # ccxtools.FemToolsCcx().run is equivalent
fea.load_results()
else:
FreeCAD.Console.PrintError("Houston, we have a problem! {}\n".format(message)) # in report view
I think that fea.run() is the command for calling calculix but I dont know which are the arguments required using user defined .inp file.
best regards,
Ekaitz.
BTW: This post is linked with the following two of my problems:
https://forum.freecadweb.org/viewtopic.php?f=18&t=31100
https://forum.freecadweb.org/viewtopic.php?f=18&t=31123