Skip to content

Commit

Permalink
FEM: ccx input writer, splitted, improve node sets for fixed constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Apr 24, 2020
1 parent cacf620 commit 021c25a
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 20 deletions.
28 changes: 17 additions & 11 deletions src/Mod/Fem/femsolver/calculix/writer.py
Expand Up @@ -195,14 +195,7 @@ def write_calculix_splitted_input_file(self):
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)
Expand Down Expand Up @@ -382,18 +375,31 @@ def write_element_sets_material_and_femelement_type(self, f):
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

# 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"]
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femtest/data/ccx/canti_ccx_faceload_hexa20.inp
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femtest/data/ccx/constraint_tie.inp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femtest/data/ccx/cube_static.inp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femtest/data/ccx/mat_multiple.inp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femtest/data/ccx/mat_nonlinear.inp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femtest/data/ccx/thermomech_bimetall.inp
Expand Up @@ -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
Expand Down
104 changes: 104 additions & 0 deletions ~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

3 comments on commit 021c25a

@vocx-fc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@berndhahnebach hey, I think a ~diff file was accidentally uploaded to the repository. I think it shouldn't be there.

@yorikvanhavre
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so too :) Ok to remove, @berndhahnebach ?

@donovaly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR that does this: #3434

Please sign in to comment.