Run Calculix without GUI and read results
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Run Calculix without GUI and read results
Hi everybody!
I developped a python script who execute, with a existing INP_file, inverse method to optimise some parameters and run Abaqus and read results without GUI. For this, I launch Abaqus with os.system("abq6131 job="+inputFileName). It works very well, and I would like to do same with calculix.
I know (I think) how transform my INP_file for Abaqus to INP_file for Calculix, but I don't know how can I run calculix without GUI and read results automatically.
1) Do you know how can I do that ?
2) With FreeCAD python sripting or directly with Calculix ?
3) With os.system("ccx job="+inputFileName) ?
Thanks a lot!
PS : I precise that my problem is complex, 3D hyperelastic with 2D and 3D elements (200 000).
I developped a python script who execute, with a existing INP_file, inverse method to optimise some parameters and run Abaqus and read results without GUI. For this, I launch Abaqus with os.system("abq6131 job="+inputFileName). It works very well, and I would like to do same with calculix.
I know (I think) how transform my INP_file for Abaqus to INP_file for Calculix, but I don't know how can I run calculix without GUI and read results automatically.
1) Do you know how can I do that ?
2) With FreeCAD python sripting or directly with Calculix ?
3) With os.system("ccx job="+inputFileName) ?
Thanks a lot!
PS : I precise that my problem is complex, 3D hyperelastic with 2D and 3D elements (200 000).
Re: Run Calculix without GUI and read results
I don't understand what do you mean :
And I don't understand bernd's quote.
Which python scripts?So i would recommand just check the python scrips we are using...
And I don't understand bernd's quote.
Re: Run Calculix without GUI and read results
It is not a quote for you it is a quote for bend to trigger his attention
FreeCAD have a FEM workbench what is for a big part is written in python. my recomandation is download the newest version of FreeCAD 0.17.xxxxx and check FreeCAD/mod/FEM/...
FreeCAD have a FEM workbench what is for a big part is written in python. my recomandation is download the newest version of FreeCAD 0.17.xxxxx and check FreeCAD/mod/FEM/...
Re: Run Calculix without GUI and read results
Oh, ok, that's a good idea!
Currently I'm reading FreeCAD/mod/FEM/PyObjects! But that is very difficult to read and understand their scripts like that!
I don't find where is the "run calculix" or "ccx.exe"...
Do you know if calculix can understand an INP_file generate by Abaqus? INP_file generate by FreeCAD is slightly differents, but may be CalculiX can read my file without changes.
Furthermore, I'm not sur that Calculix can solve my problem with 2D/3D elements + hyperelastic materials. But I would like to try without use FreeCAD GUI.
Currently I'm reading FreeCAD/mod/FEM/PyObjects! But that is very difficult to read and understand their scripts like that!
I don't find where is the "run calculix" or "ccx.exe"...
Do you know if calculix can understand an INP_file generate by Abaqus? INP_file generate by FreeCAD is slightly differents, but may be CalculiX can read my file without changes.
Furthermore, I'm not sur that Calculix can solve my problem with 2D/3D elements + hyperelastic materials. But I would like to try without use FreeCAD GUI.
Re: Run Calculix without GUI and read results
it is what I would have been posted too.Jee-Bee wrote: ↑Mon Jul 17, 2017 6:12 pm check
https://github.com/FreeCAD/FreeCAD/blob ... oolsCcx.py
https://github.com/FreeCAD/FreeCAD/blob ... cx.py#L196
https://github.com/FreeCAD/FreeCAD/blob ... cx.py#L267
-
- Posts: 108
- Joined: Wed Sep 12, 2018 1:31 pm
[Help] Run Calculix without GUI and read results
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
I modify the .inp file in order to obtain exactly the same results:
MY .INP file
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):
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
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
**
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
**
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
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
- Attachments
-
- SimpleBox.FCStd
- (9.31 KiB) Downloaded 66 times
Re: Run Calculix without GUI and read results
no because with fea.run() you can not run a spcific inp file