From 021c25a78f845a71b84b75754e39b953fde8c668 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Thu, 23 Apr 2020 12:42:50 +0200 Subject: [PATCH] FEM: ccx input writer, splitted, improve node sets for fixed constraint --- src/Mod/Fem/femsolver/calculix/writer.py | 28 +++-- .../data/ccx/canti_ccx_faceload_hexa20.inp | 2 +- .../ccx/constraint_contact_shell_shell.inp | 2 +- .../ccx/constraint_contact_solid_solid.inp | 2 +- .../Fem/femtest/data/ccx/constraint_tie.inp | 2 +- src/Mod/Fem/femtest/data/ccx/cube_static.inp | 2 +- src/Mod/Fem/femtest/data/ccx/mat_multiple.inp | 2 +- .../Fem/femtest/data/ccx/mat_nonlinear.inp | 2 +- .../Fem/femtest/data/ccx/spine_thermomech.inp | 2 +- .../femtest/data/ccx/thermomech_bimetall.inp | 2 +- ~diff | 104 ++++++++++++++++++ 11 files changed, 130 insertions(+), 20 deletions(-) create mode 100644 ~diff diff --git a/src/Mod/Fem/femsolver/calculix/writer.py b/src/Mod/Fem/femsolver/calculix/writer.py index 9e996aba0f..c7335b03af 100644 --- a/src/Mod/Fem/femsolver/calculix/writer.py +++ b/src/Mod/Fem/femsolver/calculix/writer.py @@ -195,14 +195,7 @@ class FemInputWriterCcx(writerbase.FemInputWriter): self.write_element_sets_material_and_femelement_type(inpfileMain) # node sets and surface sets - if self.fixed_objects: - inpfileMain.write("\n***********************************************************\n") - inpfileMain.write("** Node sets for constraints\n") - inpfileNodes = open(self.include + "_Node_sets.inp", "w") - if self.fixed_objects: - inpfileMain.write("** written by write_node_sets_constraints_fixed\n") - self.write_node_sets_constraints_fixed(inpfileNodes) - + self.write_node_sets_constraints_fixed(inpfileMain, True) self.write_node_sets_constraints_displacement(inpfileMain, True) self.write_node_sets_constraints_planerotation(inpfileMain, True) self.write_surfaces_constraints_contact(inpfileMain, True) @@ -382,7 +375,7 @@ class FemInputWriterCcx(writerbase.FemInputWriter): for elid in ccx_elset["ccx_elset"]: f.write(str(elid) + ",\n") - def write_node_sets_constraints_fixed(self, f): + def write_node_sets_constraints_fixed(self, f, splitted=None): if not self.fixed_objects: return # write for all analysis types @@ -390,10 +383,23 @@ class FemInputWriterCcx(writerbase.FemInputWriter): # get nodes self.get_constraints_fixed_nodes() - # write nodes to file + write_name = "constraints_fixed_node_sets" f.write("\n***********************************************************\n") - f.write("** Node sets for fixed constraint\n") + f.write("** {}\n".format(write_name.replace("_", " "))) f.write("** written by {} function\n".format(sys._getframe().f_code.co_name)) + + if splitted is True: + file_name_splitt = self.mesh_name + "_" + write_name + ".inp" + f.write("** {}\n".format(write_name.replace("_", " "))) + f.write("*INCLUDE,INPUT={}\n".format(file_name_splitt)) + inpfile_splitt = open(join(self.dir_name, file_name_splitt), "w") + self.write_node_sets_nodes_constraints_fixed(inpfile_splitt) + inpfile_splitt.close() + else: + self.write_node_sets_nodes_constraints_fixed(f) + + def write_node_sets_nodes_constraints_fixed(self, f): + # write nodes to file for femobj in self.fixed_objects: # femobj --> dict, FreeCAD document object is femobj["Object"] fix_obj = femobj["Object"] diff --git a/src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp b/src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp index bbc16785e6..f99a670b09 100644 --- a/src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp +++ b/src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp @@ -346,7 +346,7 @@ Evolumes Evolumes *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** ConstraintFixed *NSET,NSET=ConstraintFixed diff --git a/src/Mod/Fem/femtest/data/ccx/constraint_contact_shell_shell.inp b/src/Mod/Fem/femtest/data/ccx/constraint_contact_shell_shell.inp index dbb87f47a3..8370b8867c 100644 --- a/src/Mod/Fem/femtest/data/ccx/constraint_contact_shell_shell.inp +++ b/src/Mod/Fem/femtest/data/ccx/constraint_contact_shell_shell.inp @@ -22999,7 +22999,7 @@ Efaces Efaces *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** ConstraintFixed *NSET,NSET=ConstraintFixed diff --git a/src/Mod/Fem/femtest/data/ccx/constraint_contact_solid_solid.inp b/src/Mod/Fem/femtest/data/ccx/constraint_contact_solid_solid.inp index a39c957bff..57d3aa4ca5 100644 --- a/src/Mod/Fem/femtest/data/ccx/constraint_contact_solid_solid.inp +++ b/src/Mod/Fem/femtest/data/ccx/constraint_contact_solid_solid.inp @@ -4320,7 +4320,7 @@ Evolumes Evolumes *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** ConstraintFixed *NSET,NSET=ConstraintFixed diff --git a/src/Mod/Fem/femtest/data/ccx/constraint_tie.inp b/src/Mod/Fem/femtest/data/ccx/constraint_tie.inp index 59680afff3..8e1d25f6d7 100644 --- a/src/Mod/Fem/femtest/data/ccx/constraint_tie.inp +++ b/src/Mod/Fem/femtest/data/ccx/constraint_tie.inp @@ -18535,7 +18535,7 @@ Evolumes Evolumes *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** ConstraintFixed *NSET,NSET=ConstraintFixed diff --git a/src/Mod/Fem/femtest/data/ccx/cube_static.inp b/src/Mod/Fem/femtest/data/ccx/cube_static.inp index c66fed8eab..83960fa30f 100644 --- a/src/Mod/Fem/femtest/data/ccx/cube_static.inp +++ b/src/Mod/Fem/femtest/data/ccx/cube_static.inp @@ -430,7 +430,7 @@ Evolumes Evolumes *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** FemConstraintFixed *NSET,NSET=FemConstraintFixed diff --git a/src/Mod/Fem/femtest/data/ccx/mat_multiple.inp b/src/Mod/Fem/femtest/data/ccx/mat_multiple.inp index 8bdc2c489f..aa87ef3771 100644 --- a/src/Mod/Fem/femtest/data/ccx/mat_multiple.inp +++ b/src/Mod/Fem/femtest/data/ccx/mat_multiple.inp @@ -1166,7 +1166,7 @@ Evolumes 148, *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** ConstraintFixed *NSET,NSET=ConstraintFixed diff --git a/src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp b/src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp index a0a36a3cf9..349f0b98c5 100644 --- a/src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp +++ b/src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp @@ -19779,7 +19779,7 @@ Evolumes Evolumes *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** ConstraintFixed *NSET,NSET=ConstraintFixed diff --git a/src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp b/src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp index 50433fd547..563d07ba29 100644 --- a/src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp +++ b/src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp @@ -78,7 +78,7 @@ Evolumes Evolumes *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** FemConstraintFixed *NSET,NSET=FemConstraintFixed diff --git a/src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp b/src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp index 52a7f7d442..5497230335 100644 --- a/src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp +++ b/src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp @@ -6114,7 +6114,7 @@ Evolumes 2930, *********************************************************** -** Node sets for fixed constraint +** constraints fixed node sets ** written by write_node_sets_constraints_fixed function ** ConstraintFixed *NSET,NSET=ConstraintFixed diff --git a/~diff b/~diff new file mode 100644 index 0000000000..fe4dd2beb7 --- /dev/null +++ b/~diff @@ -0,0 +1,104 @@ +diff --git a/src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp b/src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp +index bbc16785e6..f99a670b09 100644 +--- a/src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp ++++ b/src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp +@@ -346,7 +346,7 @@ Evolumes + Evolumes +  + *********************************************************** +-** Node sets for fixed constraint ++** constraints fixed node sets + ** written by write_node_sets_constraints_fixed function + ** ConstraintFixed + *NSET,NSET=ConstraintFixed +diff --git a/src/Mod/Fem/femtest/data/ccx/constraint_contact_shell_shell.inp b/src/Mod/Fem/femtest/data/ccx/constraint_contact_shell_shell.inp +index cb2763d1b3..d4bc2c111e 100644 +--- a/src/Mod/Fem/femtest/data/ccx/constraint_contact_shell_shell.inp ++++ b/src/Mod/Fem/femtest/data/ccx/constraint_contact_shell_shell.inp +@@ -22999,7 +22999,7 @@ Efaces + Efaces +  + *********************************************************** +-** Node sets for fixed constraint ++** constraints fixed node sets + ** written by write_node_sets_constraints_fixed function + ** ConstraintFixed + *NSET,NSET=ConstraintFixed +diff --git a/src/Mod/Fem/femtest/data/ccx/constraint_contact_solid_solid.inp b/src/Mod/Fem/femtest/data/ccx/constraint_contact_solid_solid.inp +index 718c6ab8b1..26d50fcacc 100644 +--- a/src/Mod/Fem/femtest/data/ccx/constraint_contact_solid_solid.inp ++++ b/src/Mod/Fem/femtest/data/ccx/constraint_contact_solid_solid.inp +@@ -4320,7 +4320,7 @@ Evolumes + Evolumes +  + *********************************************************** +-** Node sets for fixed constraint ++** constraints fixed node sets + ** written by write_node_sets_constraints_fixed function + ** ConstraintFixed + *NSET,NSET=ConstraintFixed +diff --git a/src/Mod/Fem/femtest/data/ccx/constraint_tie.inp b/src/Mod/Fem/femtest/data/ccx/constraint_tie.inp +index 8ee42ed0b9..9f9360f387 100644 +--- a/src/Mod/Fem/femtest/data/ccx/constraint_tie.inp ++++ b/src/Mod/Fem/femtest/data/ccx/constraint_tie.inp +@@ -18535,7 +18535,7 @@ Evolumes + Evolumes +  + *********************************************************** +-** Node sets for fixed constraint ++** constraints fixed node sets + ** written by write_node_sets_constraints_fixed function + ** ConstraintFixed + *NSET,NSET=ConstraintFixed +diff --git a/src/Mod/Fem/femtest/data/ccx/mat_multiple.inp b/src/Mod/Fem/femtest/data/ccx/mat_multiple.inp +index 8bdc2c489f..aa87ef3771 100644 +--- a/src/Mod/Fem/femtest/data/ccx/mat_multiple.inp ++++ b/src/Mod/Fem/femtest/data/ccx/mat_multiple.inp +@@ -1166,7 +1166,7 @@ Evolumes + 148, +  + *********************************************************** +-** Node sets for fixed constraint ++** constraints fixed node sets + ** written by write_node_sets_constraints_fixed function + ** ConstraintFixed + *NSET,NSET=ConstraintFixed +diff --git a/src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp b/src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp +index a0a36a3cf9..349f0b98c5 100644 +--- a/src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp ++++ b/src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp +@@ -19779,7 +19779,7 @@ Evolumes + Evolumes +  + *********************************************************** +-** Node sets for fixed constraint ++** constraints fixed node sets + ** written by write_node_sets_constraints_fixed function + ** ConstraintFixed + *NSET,NSET=ConstraintFixed +diff --git a/src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp b/src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp +index 210cadd779..2f5113e35b 100644 +--- a/src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp ++++ b/src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp +@@ -78,7 +78,7 @@ Evolumes + Evolumes +  + *********************************************************** +-** Node sets for fixed constraint ++** constraints fixed node sets + ** written by write_node_sets_constraints_fixed function + ** FemConstraintFixed + *NSET,NSET=FemConstraintFixed +diff --git a/src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp b/src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp +index b98472ac71..eb2d2d2bca 100644 +--- a/src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp ++++ b/src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp +@@ -6114,7 +6114,7 @@ Evolumes + 2930, +  + *********************************************************** +-** Node sets for fixed constraint ++** constraints fixed node sets + ** written by write_node_sets_constraints_fixed function + ** ConstraintFixed + *NSET,NSET=ConstraintFixed