diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index eb91c9a15..37c8df3eb 100755 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -73,6 +73,8 @@ SET(FemScripts_SRCS ccxInpWriter.py TestFem.py FemTools.py + mesh_points.csv + mesh_volumes.csv MechanicalAnalysis.ui MechanicalAnalysis.py MechanicalMaterial.ui diff --git a/src/Mod/Fem/TestFem.py b/src/Mod/Fem/TestFem.py index 1b0d95802..77723c3cf 100644 --- a/src/Mod/Fem/TestFem.py +++ b/src/Mod/Fem/TestFem.py @@ -25,9 +25,23 @@ #***************************************************************************/ import Fem +import FemTools import FreeCAD +import MechanicalAnalysis +import csv +import hashlib import unittest +# md5sum of src/Mod/Fem/test_file.inp +# All changes in ccxInpWriter resulting in changes of the .inp file should +# be reflected in src/Mod/Fem/test_file.inp and the m5d_standard variable +# should be updated +md5_standard = "4de49f1f9ef63e56f180bb42f7b55ccf" +mesh_name = 'Mesh' +working_dir = '/tmp/FEM/' +mesh_points_file = 'Mod/Fem/mesh_points.csv' +mesh_volumes_file = 'Mod/Fem/mesh_volumes.csv' + class FemTest(unittest.TestCase): @@ -39,66 +53,96 @@ class FemTest(unittest.TestCase): finally: FreeCAD.setActiveDocument("FemTest") self.active_doc = FreeCAD.ActiveDocument - self.create_box() - - def test_new_analysis(self): - FreeCAD.Console.PrintMessage('\nChecking FEM new analysis...\n') - import MechanicalAnalysis - analysis = MechanicalAnalysis.makeMechanicalAnalysis('MechanicalAnalysis') - self.failUnless(analysis, "FemTest of new analysis failed") - - def test_new_mesh(self): - FreeCAD.Console.PrintMessage('\nChecking FEM new mesh...\n') - mesh = Fem.FemMesh() - - mesh.addNode(0, 1, 0) - mesh.addNode(0, 0, 1) - mesh.addNode(1, 0, 0) - mesh.addNode(0, 0, 0) - mesh.addNode(0, 0.5, 0.5) - mesh.addNode(0.5, 0.03, .5) - mesh.addNode(0.5, 0.5, 0.03) - mesh.addNode(0, 0.5, 0) - mesh.addNode(0.03, 0, 0.5) - mesh.addNode(0.5, 0, 0) - - mesh.addVolume([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) - self.failUnless(mesh, "FemTest of new mesh failed") - - def create_box(self): self.box = self.active_doc.addObject("Part::Box", "Box") + self.active_doc.recompute() + + def create_new_analysis(self): + self.analysis = MechanicalAnalysis.makeMechanicalAnalysis('MechanicalAnalysis') + self.active_doc.recompute() + + def create_new_mesh(self): + self.mesh_object = self.active_doc.addObject('Fem::FemMeshObject', mesh_name) + self.mesh = Fem.FemMesh() + with open(mesh_points_file, 'r') as points_file: + reader = csv.reader(points_file) + for p in reader: + self.mesh.addNode(float(p[0]), float(p[1]), float(p[2]), int(p[3])) + + with open(mesh_volumes_file, 'r') as volumes_file: + reader = csv.reader(volumes_file) + for _v in reader: + v = [int(x) for x in _v] + self.mesh.addVolume([v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9]]) + + self.mesh_object.FemMesh = self.mesh + self.active_doc.recompute() + + def create_new_material(self): + self.new_material_object = self.active_doc.addObject("App::MaterialObjectPython", 'MechanicalMaterial') + mat = self.new_material_object.Material + mat['Name'] = "Test Material" + mat['YoungsModulus'] = "20000 MPa" + mat['PoissonRatio'] = "0.36" + self.new_material_object.Material = mat def create_fixed_constraint(self): self.fixed_constraint = self.active_doc.addObject("Fem::ConstraintFixed", "FemConstraintFixed") self.fixed_constraint.References = [(self.box, "Face1")] - def test_new_fixed_constraint(self): - FreeCAD.Console.PrintMessage('\nChecking FEM new fixed constraint...\n') - self.create_fixed_constraint() - self.failUnless(self.fixed_constraint, "FemTest of new fixed constraint failed") - def create_force_constraint(self): self.force_constraint = self.active_doc.addObject("Fem::ConstraintForce", "FemConstraintForce") - self.force_constraint.References = [(self.box, "Face1")] + self.force_constraint.References = [(self.box, "Face3")] self.force_constraint.Force = 10.000000 self.force_constraint.Direction = (self.box, ["Edge12"]) self.force_constraint.Reversed = True - def test_new_force_constraint(self): - FreeCAD.Console.PrintMessage('\nChecking FEM new force constraint...\n') - self.create_force_constraint() - self.failUnless(self.force_constraint, "FemTest of new force constraint failed") - def create_pressure_constraint(self): self.pressure_constraint = self.active_doc.addObject("Fem::ConstraintPressure", "FemConstraintPressure") - self.pressure_constraint.References = [(self.box, "Face1")] + self.pressure_constraint.References = [(self.box, "Face4")] self.pressure_constraint.Pressure = 10.000000 self.pressure_constraint.Reversed = True - def test_new_pressure_constraint(self): + def test_new_analysis(self): + FreeCAD.Console.PrintMessage('\nChecking FEM new analysis...\n') + self.create_new_analysis() + self.assertTrue(self.analysis, "FemTest of new analysis failed") + + FreeCAD.Console.PrintMessage('\nChecking FEM new mesh...\n') + self.create_new_mesh() + self.assertTrue(self.mesh, "FemTest of new mesh failed") + self.analysis.Member = self.analysis.Member + [self.mesh_object] + + FreeCAD.Console.PrintMessage('\nChecking FEM new material...\n') + self.create_new_material() + self.assertTrue(self.new_material_object, "FemTest of new material failed") + self.analysis.Member = self.analysis.Member + [self.new_material_object] + + FreeCAD.Console.PrintMessage('\nChecking FEM new fixed constraint...\n') + self.create_fixed_constraint() + self.assertTrue(self.fixed_constraint, "FemTest of new fixed constraint failed") + self.analysis.Member = self.analysis.Member + [self.fixed_constraint] + + FreeCAD.Console.PrintMessage('\nChecking FEM new force constraint...\n') + self.create_force_constraint() + self.assertTrue(self.force_constraint, "FemTest of new force constraint failed") + self.analysis.Member = self.analysis.Member + [self.force_constraint] + FreeCAD.Console.PrintMessage('\nChecking FEM new pressure constraint...\n') self.create_pressure_constraint() - self.failUnless(self.pressure_constraint, "FemTest of new pressure constraint failed") + self.assertTrue(self.pressure_constraint, "FemTest of new pressure constraint failed") + self.analysis.Member = self.analysis.Member + [self.pressure_constraint] + + fea = FemTools.FemTools(self.analysis) + FreeCAD.Console.PrintMessage('\nChecking FEM inp file prerequisites...\n') + error = fea.check_prerequisites() + self.assertFalse(error, "FemTools check_prerequisites returned error message: {}".format(error)) + + FreeCAD.Console.PrintMessage('\nChecking FEM inp file write...\n') + fea.setup_working_dir(working_dir) + error = fea.write_inp_file() + md5_test = hashlib.md5(open(working_dir + mesh_name + '.inp', 'rb').read()).hexdigest() + self.assertEqual(md5_standard, md5_test, "FemTools write_inp_file failed. md5 \ + sums don't match. md5 for the test file is ()".format(md5_test)) def tearDown(self): FreeCAD.closeDocument("FemTest") diff --git a/src/Mod/Fem/mesh_points.csv b/src/Mod/Fem/mesh_points.csv new file mode 100644 index 000000000..56363b848 --- /dev/null +++ b/src/Mod/Fem/mesh_points.csv @@ -0,0 +1,267 @@ +0, 0, 0, 1 +0, 0, 10, 2 +0, 10, 0, 3 +0, 10, 10, 4 +10, 0, 0, 5 +10, 0, 10, 6 +10, 10, 0, 7 +10, 10, 10, 8 +0, 0, 5, 9 +0, 0, 2.5, 10 +0, 0, 7.5, 11 +0, 5, 0, 12 +0, 2.5, 0, 13 +0, 7.5, 0, 14 +0, 10, 5, 15 +0, 10, 2.5, 16 +0, 10, 7.5, 17 +0, 5, 10, 18 +0, 2.5, 10, 19 +0, 7.5, 10, 20 +10, 0, 5, 21 +10, 0, 2.5, 22 +10, 0, 7.5, 23 +10, 5, 0, 24 +10, 2.5, 0, 25 +10, 7.5, 0, 26 +10, 10, 5, 27 +10, 10, 2.5, 28 +10, 10, 7.5, 29 +10, 5, 10, 30 +10, 2.5, 10, 31 +10, 7.5, 10, 32 +5, 0, 0, 33 +2.5, 0, 0, 34 +7.5, 0, 0, 35 +5, 0, 10, 36 +2.5, 0, 10, 37 +7.5, 0, 10, 38 +5, 10, 0, 39 +2.5, 10, 0, 40 +7.5, 10, 0, 41 +5, 10, 10, 42 +2.5, 10, 10, 43 +7.5, 10, 10, 44 +0, 5, 5, 45 +0, 2.5, 2.5, 46 +0, 2.5, 7.5, 47 +0, 7.5, 2.5, 48 +0, 7.5, 7.5, 49 +0, 1.25, 3.75, 50 +0, 1.25, 1.25, 51 +0, 1.25, 6.25, 52 +0, 2.5, 5, 53 +0, 1.25, 8.75, 54 +0, 6.25, 1.25, 55 +0, 3.75, 1.25, 56 +0, 5, 2.5, 57 +0, 8.75, 1.25, 58 +0, 7.5, 5, 59 +0, 6.25, 3.75, 60 +0, 6.25, 6.25, 61 +0, 8.75, 3.75, 62 +0, 8.75, 6.25, 63 +0, 3.75, 3.75, 64 +0, 5, 7.5, 65 +0, 3.75, 6.25, 66 +0, 6.25, 8.75, 67 +0, 3.75, 8.75, 68 +0, 8.75, 8.75, 69 +10, 5, 5, 70 +10, 2.5, 2.5, 71 +10, 2.5, 7.5, 72 +10, 7.5, 7.5, 73 +10, 7.5, 2.5, 74 +10, 6.25, 3.75, 75 +10, 7.5, 5, 76 +10, 6.25, 6.25, 77 +10, 8.75, 3.75, 78 +10, 8.75, 6.25, 79 +10, 3.75, 1.25, 80 +10, 6.25, 1.25, 81 +10, 5, 2.5, 82 +10, 3.75, 3.75, 83 +10, 8.75, 1.25, 84 +10, 5, 7.5, 85 +10, 6.25, 8.75, 86 +10, 3.75, 8.75, 87 +10, 3.75, 6.25, 88 +10, 2.5, 5, 89 +10, 1.25, 6.25, 90 +10, 1.25, 3.75, 91 +10, 1.25, 8.75, 92 +10, 8.75, 8.75, 93 +10, 1.25, 1.25, 94 +5, 0, 5, 95 +7.5, 0, 2.5, 96 +7.5, 0, 7.5, 97 +2.5, 0, 2.5, 98 +2.5, 0, 7.5, 99 +1.25, 0, 1.25, 100 +1.25, 0, 3.75, 101 +1.25, 0, 6.25, 102 +2.5, 0, 5, 103 +1.25, 0, 8.75, 104 +6.25, 0, 8.75, 105 +8.75, 0, 8.75, 106 +3.75, 0, 8.75, 107 +5, 0, 7.5, 108 +8.75, 0, 6.25, 109 +6.25, 0, 3.75, 110 +7.5, 0, 5, 111 +6.25, 0, 6.25, 112 +8.75, 0, 3.75, 113 +3.75, 0, 6.25, 114 +3.75, 0, 1.25, 115 +8.75, 0, 1.25, 116 +6.25, 0, 1.25, 117 +3.75, 0, 3.75, 118 +5, 0, 2.5, 119 +5, 10, 5, 120 +2.5, 10, 2.5, 121 +7.5, 10, 2.5, 122 +7.5, 10, 7.5, 123 +2.5, 10, 7.5, 124 +3.75, 10, 8.75, 125 +6.25, 10, 8.75, 126 +5, 10, 7.5, 127 +1.25, 10, 8.75, 128 +8.75, 10, 8.75, 129 +6.25, 10, 6.25, 130 +3.75, 10, 6.25, 131 +1.25, 10, 6.25, 132 +2.5, 10, 5, 133 +3.75, 10, 3.75, 134 +1.25, 10, 3.75, 135 +6.25, 10, 1.25, 136 +8.75, 10, 1.25, 137 +3.75, 10, 1.25, 138 +5, 10, 2.5, 139 +1.25, 10, 1.25, 140 +8.75, 10, 3.75, 141 +7.5, 10, 5, 142 +6.25, 10, 3.75, 143 +8.75, 10, 6.25, 144 +5, 5, 0, 145 +2.5, 7.5, 0, 146 +7.5, 7.5, 0, 147 +2.5, 2.5, 0, 148 +7.5, 2.5, 0, 149 +1.25, 3.75, 0, 150 +1.25, 1.25, 0, 151 +1.25, 6.25, 0, 152 +2.5, 5, 0, 153 +1.25, 8.75, 0, 154 +6.25, 6.25, 0, 155 +7.5, 5, 0, 156 +6.25, 3.75, 0, 157 +3.75, 6.25, 0, 158 +5, 7.5, 0, 159 +8.75, 8.75, 0, 160 +6.25, 8.75, 0, 161 +3.75, 8.75, 0, 162 +8.75, 6.25, 0, 163 +8.75, 3.75, 0, 164 +5, 2.5, 0, 165 +3.75, 3.75, 0, 166 +3.75, 1.25, 0, 167 +6.25, 1.25, 0, 168 +8.75, 1.25, 0, 169 +5, 5, 10, 170 +2.5, 7.5, 10, 171 +7.5, 7.5, 10, 172 +2.5, 2.5, 10, 173 +7.5, 2.5, 10, 174 +3.75, 1.25, 10, 175 +6.25, 1.25, 10, 176 +5, 2.5, 10, 177 +6.25, 3.75, 10, 178 +3.75, 3.75, 10, 179 +8.75, 1.25, 10, 180 +7.5, 5, 10, 181 +6.25, 6.25, 10, 182 +8.75, 3.75, 10, 183 +8.75, 6.25, 10, 184 +6.25, 8.75, 10, 185 +3.75, 8.75, 10, 186 +5, 7.5, 10, 187 +8.75, 8.75, 10, 188 +1.25, 8.75, 10, 189 +1.25, 1.25, 10, 190 +2.5, 5, 10, 191 +3.75, 6.25, 10, 192 +1.25, 6.25, 10, 193 +1.25, 3.75, 10, 194 +5, 5, 5, 195 +5, 1.25, 8.75, 196 +7.5, 1.25, 8.75, 197 +6.25, 1.25, 7.5, 198 +8.75, 8.75, 7.5, 199 +7.5, 8.75, 6.25, 200 +8.75, 8.75, 5, 201 +7.5, 8.75, 3.75, 202 +8.75, 8.75, 2.5, 203 +2.5, 8.75, 1.25, 204 +5, 8.75, 1.25, 205 +3.75, 7.5, 1.25, 206 +1.25, 1.25, 2.5, 207 +2.5, 1.25, 3.75, 208 +1.25, 1.25, 5, 209 +7.5, 8.75, 8.75, 210 +5, 8.75, 8.75, 211 +6.25, 8.75, 7.5, 212 +8.75, 1.25, 7.5, 213 +7.5, 1.25, 6.25, 214 +8.75, 1.25, 5, 215 +2.5, 1.25, 1.25, 216 +3.75, 1.25, 2.5, 217 +5, 1.25, 1.25, 218 +6.25, 2.5, 1.25, 219 +7.5, 1.25, 1.25, 220 +2.5, 1.25, 8.75, 221 +2.5, 8.75, 8.75, 222 +1.25, 5, 1.25, 223 +1.25, 2.5, 1.25, 224 +7.5, 8.75, 1.25, 225 +8.75, 1.25, 2.5, 226 +1.25, 1.25, 7.5, 227 +1.25, 7.5, 1.25, 228 +1.25, 2.5, 8.75, 229 +3.75, 3.75, 7.5, 230 +2.5, 3.75, 6.25, 231 +3.75, 2.5, 6.25, 232 +1.25, 8.75, 7.5, 233 +1.25, 7.5, 8.75, 234 +2.5, 6.25, 6.25, 235 +3.75, 6.25, 7.5, 236 +3.75, 7.5, 6.25, 237 +1.25, 8.75, 2.5, 238 +8.75, 7.5, 8.75, 239 +8.75, 2.5, 8.75, 240 +8.75, 7.5, 1.25, 241 +8.75, 2.5, 1.25, 242 +3.75, 3.75, 2.5, 243 +6.25, 2.5, 3.75, 244 +5, 2.5, 5, 245 +5, 5, 2.5, 246 +7.5, 3.75, 3.75, 247 +7.5, 6.25, 3.75, 248 +7.5, 5, 5, 249 +2.5, 3.75, 3.75, 250 +6.25, 3.75, 7.5, 251 +5, 5, 7.5, 252 +6.25, 6.25, 7.5, 253 +5, 7.5, 5, 254 +7.5, 6.25, 6.25, 255 +7.5, 3.75, 6.25, 256 +3.75, 7.5, 3.75, 257 +2.5, 5, 5, 258 +2.5, 6.25, 1.25, 259 +2.5, 6.25, 3.75, 260 +7.5, 3.75, 1.25, 261 +6.25, 8.75, 2.5, 262 +8.75, 5, 1.25, 263 +2.5, 7.5, 5, 264 +7.5, 5, 7.5, 265 +2.5, 5, 7.5, 266 +6.25, 6.25, 2.5, 267 diff --git a/src/Mod/Fem/mesh_volumes.csv b/src/Mod/Fem/mesh_volumes.csv new file mode 100644 index 000000000..dabda81a5 --- /dev/null +++ b/src/Mod/Fem/mesh_volumes.csv @@ -0,0 +1,118 @@ +174, 97, 99, 95, 197, 108, 196, 198, 112, 114 +120, 123, 73, 74, 130, 199, 200, 202, 201, 76 +122, 123, 120, 74, 142, 130, 143, 203, 201, 202 +147, 121, 146, 145, 205, 204, 159, 155, 206, 158 +95, 98, 99, 46, 118, 103, 114, 208, 207, 209 +172, 124, 123, 120, 211, 127, 210, 212, 131, 130 +95, 72, 97, 96, 214, 213, 112, 110, 215, 111 +95, 98, 148, 96, 118, 216, 217, 110, 119, 218 +149, 145, 148, 96, 157, 166, 165, 220, 219, 218 +36, 99, 173, 174, 107, 221, 175, 176, 196, 177 +149, 148, 33, 96, 165, 167, 168, 220, 218, 117 +36, 97, 99, 174, 105, 108, 107, 176, 197, 196 +42, 172, 171, 124, 185, 187, 186, 125, 211, 222 +46, 98, 99, 9, 207, 103, 209, 50, 101, 102 +42, 124, 123, 172, 125, 127, 126, 185, 211, 210 +12, 48, 46, 148, 55, 57, 56, 150, 223, 224 +147, 146, 121, 39, 159, 204, 205, 161, 162, 138 +39, 122, 121, 147, 136, 139, 138, 161, 225, 205 +27, 123, 122, 74, 144, 142, 141, 78, 201, 203 +27, 73, 123, 74, 79, 199, 144, 78, 76, 201 +96, 72, 21, 71, 215, 90, 113, 226, 89, 91 +9, 46, 47, 99, 50, 53, 52, 102, 209, 227 +48, 146, 148, 12, 228, 153, 223, 55, 152, 150 +21, 97, 72, 96, 109, 213, 90, 113, 111, 215 +33, 148, 98, 96, 167, 216, 115, 117, 218, 119 +47, 173, 99, 195, 229, 221, 227, 231, 230, 232 +171, 49, 124, 195, 234, 233, 222, 236, 235, 237 +4, 124, 49, 15, 128, 233, 69, 17, 132, 63 +1, 46, 148, 12, 51, 224, 151, 13, 56, 150 +146, 12, 48, 3, 152, 55, 228, 154, 14, 58 +18, 47, 173, 2, 68, 229, 194, 19, 54, 190 +3, 48, 121, 15, 58, 238, 140, 16, 62, 135 +2, 47, 99, 9, 54, 227, 104, 11, 52, 102 +39, 122, 147, 7, 136, 225, 161, 41, 137, 160 +2, 99, 173, 36, 104, 221, 190, 37, 107, 175 +171, 4, 49, 18, 189, 69, 234, 193, 20, 67 +96, 21, 5, 71, 113, 22, 116, 226, 91, 94 +1, 98, 46, 9, 100, 207, 51, 10, 101, 50 +174, 36, 97, 6, 176, 105, 197, 180, 38, 106 +171, 124, 4, 42, 222, 128, 189, 186, 125, 43 +5, 149, 33, 96, 169, 168, 35, 116, 220, 117 +72, 6, 97, 21, 92, 106, 213, 90, 23, 109 +30, 8, 73, 172, 32, 93, 86, 184, 188, 239 +72, 174, 6, 30, 240, 180, 92, 87, 183, 31 +123, 8, 42, 172, 129, 44, 126, 210, 188, 185 +123, 8, 73, 27, 129, 93, 199, 144, 29, 79 +74, 147, 7, 24, 241, 160, 84, 81, 163, 26 +1, 148, 98, 33, 151, 216, 100, 34, 167, 115 +3, 121, 146, 39, 140, 204, 154, 40, 138, 162 +7, 27, 122, 74, 28, 141, 137, 84, 78, 203 +5, 24, 149, 71, 25, 164, 169, 94, 80, 242 +121, 146, 48, 3, 204, 228, 238, 140, 154, 58 +4, 49, 124, 171, 69, 233, 128, 189, 234, 222 +47, 99, 173, 2, 227, 221, 229, 54, 104, 190 +7, 122, 147, 74, 137, 225, 160, 84, 203, 241 +6, 97, 174, 72, 106, 197, 180, 92, 213, 240 +123, 73, 8, 172, 199, 93, 129, 210, 239, 188 +96, 5, 149, 71, 116, 169, 220, 226, 94, 242 +148, 98, 46, 1, 216, 207, 224, 151, 100, 51 +96, 195, 148, 95, 244, 243, 218, 110, 245, 217 +148, 195, 96, 145, 243, 244, 218, 166, 246, 219 +74, 195, 71, 70, 248, 247, 82, 75, 249, 83 +46, 195, 99, 95, 250, 232, 209, 208, 245, 114 +174, 195, 173, 170, 251, 230, 177, 178, 252, 179 +172, 195, 124, 120, 253, 237, 211, 212, 254, 131 +74, 195, 73, 120, 248, 255, 76, 202, 254, 200 +73, 195, 74, 70, 255, 248, 76, 77, 249, 75 +72, 71, 195, 70, 89, 247, 256, 88, 83, 249 +46, 148, 95, 98, 224, 217, 208, 207, 216, 118 +95, 148, 46, 195, 217, 224, 208, 245, 243, 250 +121, 124, 195, 120, 133, 237, 257, 134, 131, 254 +47, 49, 195, 45, 65, 235, 231, 66, 61, 258 +46, 47, 195, 45, 53, 231, 250, 64, 66, 258 +47, 46, 195, 99, 53, 250, 231, 227, 209, 232 +48, 121, 145, 146, 238, 206, 259, 228, 204, 158 +145, 121, 48, 195, 206, 238, 259, 246, 257, 260 +148, 48, 145, 146, 223, 259, 166, 153, 228, 158 +145, 48, 148, 195, 259, 223, 166, 246, 260, 243 +48, 195, 46, 148, 260, 250, 57, 223, 243, 224 +46, 195, 48, 45, 250, 260, 57, 64, 258, 60 +49, 48, 195, 45, 59, 260, 235, 61, 60, 258 +73, 120, 172, 123, 200, 212, 239, 199, 130, 210 +172, 120, 73, 195, 212, 200, 239, 253, 254, 255 +172, 195, 174, 170, 253, 251, 181, 182, 252, 178 +171, 173, 195, 170, 191, 230, 236, 192, 179, 252 +172, 195, 171, 124, 253, 236, 187, 211, 237, 222 +171, 195, 172, 170, 236, 253, 187, 192, 252, 182 +174, 195, 99, 173, 251, 232, 196, 177, 230, 221 +99, 195, 174, 95, 232, 251, 196, 114, 245, 198 +96, 145, 71, 149, 219, 261, 226, 220, 157, 242 +71, 145, 96, 195, 261, 219, 226, 247, 246, 244 +72, 195, 96, 95, 256, 244, 215, 214, 245, 110 +96, 195, 72, 71, 244, 256, 215, 226, 247, 89 +72, 195, 73, 70, 256, 255, 85, 88, 249, 77 +174, 95, 72, 97, 198, 214, 240, 197, 112, 213 +72, 95, 174, 195, 214, 198, 240, 256, 245, 251 +147, 120, 74, 122, 262, 202, 241, 225, 143, 203 +121, 120, 147, 122, 134, 262, 205, 139, 143, 225 +147, 71, 145, 149, 263, 261, 155, 156, 242, 157 +24, 147, 71, 74, 163, 263, 80, 81, 241, 82 +147, 24, 71, 149, 163, 80, 263, 156, 164, 242 +195, 49, 15, 48, 235, 63, 264, 260, 59, 62 +49, 195, 15, 124, 235, 264, 63, 233, 237, 132 +195, 15, 121, 48, 264, 135, 257, 260, 62, 238 +15, 195, 121, 124, 264, 257, 135, 132, 237, 133 +195, 172, 30, 73, 253, 184, 265, 255, 239, 86 +30, 172, 195, 174, 184, 253, 265, 183, 181, 251 +72, 195, 30, 73, 256, 265, 87, 85, 255, 86 +30, 195, 72, 174, 265, 256, 87, 183, 251, 240 +195, 18, 47, 173, 266, 68, 231, 230, 194, 229 +47, 18, 195, 49, 68, 266, 231, 65, 67, 235 +195, 171, 18, 173, 236, 193, 266, 230, 191, 194 +18, 171, 195, 49, 193, 236, 266, 67, 234, 235 +195, 147, 71, 145, 267, 263, 247, 246, 155, 261 +147, 195, 71, 74, 267, 247, 263, 241, 248, 82 +147, 120, 195, 74, 262, 254, 267, 241, 202, 248 +147, 121, 195, 120, 205, 257, 267, 262, 134, 254 +121, 147, 195, 145, 205, 267, 257, 206, 155, 246 diff --git a/src/Mod/Fem/test_file.inp b/src/Mod/Fem/test_file.inp new file mode 100644 index 000000000..6ee687d24 --- /dev/null +++ b/src/Mod/Fem/test_file.inp @@ -0,0 +1,530 @@ +*Node, NSET=Nall +1, 0, 0, 0 +2, 0, 0, 10 +3, 0, 10, 0 +4, 0, 10, 10 +5, 10, 0, 0 +6, 10, 0, 10 +7, 10, 10, 0 +8, 10, 10, 10 +9, 0, 0, 5 +10, 0, 0, 2.5 +11, 0, 0, 7.5 +12, 0, 5, 0 +13, 0, 2.5, 0 +14, 0, 7.5, 0 +15, 0, 10, 5 +16, 0, 10, 2.5 +17, 0, 10, 7.5 +18, 0, 5, 10 +19, 0, 2.5, 10 +20, 0, 7.5, 10 +21, 10, 0, 5 +22, 10, 0, 2.5 +23, 10, 0, 7.5 +24, 10, 5, 0 +25, 10, 2.5, 0 +26, 10, 7.5, 0 +27, 10, 10, 5 +28, 10, 10, 2.5 +29, 10, 10, 7.5 +30, 10, 5, 10 +31, 10, 2.5, 10 +32, 10, 7.5, 10 +33, 5, 0, 0 +34, 2.5, 0, 0 +35, 7.5, 0, 0 +36, 5, 0, 10 +37, 2.5, 0, 10 +38, 7.5, 0, 10 +39, 5, 10, 0 +40, 2.5, 10, 0 +41, 7.5, 10, 0 +42, 5, 10, 10 +43, 2.5, 10, 10 +44, 7.5, 10, 10 +45, 0, 5, 5 +46, 0, 2.5, 2.5 +47, 0, 2.5, 7.5 +48, 0, 7.5, 2.5 +49, 0, 7.5, 7.5 +50, 0, 1.25, 3.75 +51, 0, 1.25, 1.25 +52, 0, 1.25, 6.25 +53, 0, 2.5, 5 +54, 0, 1.25, 8.75 +55, 0, 6.25, 1.25 +56, 0, 3.75, 1.25 +57, 0, 5, 2.5 +58, 0, 8.75, 1.25 +59, 0, 7.5, 5 +60, 0, 6.25, 3.75 +61, 0, 6.25, 6.25 +62, 0, 8.75, 3.75 +63, 0, 8.75, 6.25 +64, 0, 3.75, 3.75 +65, 0, 5, 7.5 +66, 0, 3.75, 6.25 +67, 0, 6.25, 8.75 +68, 0, 3.75, 8.75 +69, 0, 8.75, 8.75 +70, 10, 5, 5 +71, 10, 2.5, 2.5 +72, 10, 2.5, 7.5 +73, 10, 7.5, 7.5 +74, 10, 7.5, 2.5 +75, 10, 6.25, 3.75 +76, 10, 7.5, 5 +77, 10, 6.25, 6.25 +78, 10, 8.75, 3.75 +79, 10, 8.75, 6.25 +80, 10, 3.75, 1.25 +81, 10, 6.25, 1.25 +82, 10, 5, 2.5 +83, 10, 3.75, 3.75 +84, 10, 8.75, 1.25 +85, 10, 5, 7.5 +86, 10, 6.25, 8.75 +87, 10, 3.75, 8.75 +88, 10, 3.75, 6.25 +89, 10, 2.5, 5 +90, 10, 1.25, 6.25 +91, 10, 1.25, 3.75 +92, 10, 1.25, 8.75 +93, 10, 8.75, 8.75 +94, 10, 1.25, 1.25 +95, 5, 0, 5 +96, 7.5, 0, 2.5 +97, 7.5, 0, 7.5 +98, 2.5, 0, 2.5 +99, 2.5, 0, 7.5 +100, 1.25, 0, 1.25 +101, 1.25, 0, 3.75 +102, 1.25, 0, 6.25 +103, 2.5, 0, 5 +104, 1.25, 0, 8.75 +105, 6.25, 0, 8.75 +106, 8.75, 0, 8.75 +107, 3.75, 0, 8.75 +108, 5, 0, 7.5 +109, 8.75, 0, 6.25 +110, 6.25, 0, 3.75 +111, 7.5, 0, 5 +112, 6.25, 0, 6.25 +113, 8.75, 0, 3.75 +114, 3.75, 0, 6.25 +115, 3.75, 0, 1.25 +116, 8.75, 0, 1.25 +117, 6.25, 0, 1.25 +118, 3.75, 0, 3.75 +119, 5, 0, 2.5 +120, 5, 10, 5 +121, 2.5, 10, 2.5 +122, 7.5, 10, 2.5 +123, 7.5, 10, 7.5 +124, 2.5, 10, 7.5 +125, 3.75, 10, 8.75 +126, 6.25, 10, 8.75 +127, 5, 10, 7.5 +128, 1.25, 10, 8.75 +129, 8.75, 10, 8.75 +130, 6.25, 10, 6.25 +131, 3.75, 10, 6.25 +132, 1.25, 10, 6.25 +133, 2.5, 10, 5 +134, 3.75, 10, 3.75 +135, 1.25, 10, 3.75 +136, 6.25, 10, 1.25 +137, 8.75, 10, 1.25 +138, 3.75, 10, 1.25 +139, 5, 10, 2.5 +140, 1.25, 10, 1.25 +141, 8.75, 10, 3.75 +142, 7.5, 10, 5 +143, 6.25, 10, 3.75 +144, 8.75, 10, 6.25 +145, 5, 5, 0 +146, 2.5, 7.5, 0 +147, 7.5, 7.5, 0 +148, 2.5, 2.5, 0 +149, 7.5, 2.5, 0 +150, 1.25, 3.75, 0 +151, 1.25, 1.25, 0 +152, 1.25, 6.25, 0 +153, 2.5, 5, 0 +154, 1.25, 8.75, 0 +155, 6.25, 6.25, 0 +156, 7.5, 5, 0 +157, 6.25, 3.75, 0 +158, 3.75, 6.25, 0 +159, 5, 7.5, 0 +160, 8.75, 8.75, 0 +161, 6.25, 8.75, 0 +162, 3.75, 8.75, 0 +163, 8.75, 6.25, 0 +164, 8.75, 3.75, 0 +165, 5, 2.5, 0 +166, 3.75, 3.75, 0 +167, 3.75, 1.25, 0 +168, 6.25, 1.25, 0 +169, 8.75, 1.25, 0 +170, 5, 5, 10 +171, 2.5, 7.5, 10 +172, 7.5, 7.5, 10 +173, 2.5, 2.5, 10 +174, 7.5, 2.5, 10 +175, 3.75, 1.25, 10 +176, 6.25, 1.25, 10 +177, 5, 2.5, 10 +178, 6.25, 3.75, 10 +179, 3.75, 3.75, 10 +180, 8.75, 1.25, 10 +181, 7.5, 5, 10 +182, 6.25, 6.25, 10 +183, 8.75, 3.75, 10 +184, 8.75, 6.25, 10 +185, 6.25, 8.75, 10 +186, 3.75, 8.75, 10 +187, 5, 7.5, 10 +188, 8.75, 8.75, 10 +189, 1.25, 8.75, 10 +190, 1.25, 1.25, 10 +191, 2.5, 5, 10 +192, 3.75, 6.25, 10 +193, 1.25, 6.25, 10 +194, 1.25, 3.75, 10 +195, 5, 5, 5 +196, 5, 1.25, 8.75 +197, 7.5, 1.25, 8.75 +198, 6.25, 1.25, 7.5 +199, 8.75, 8.75, 7.5 +200, 7.5, 8.75, 6.25 +201, 8.75, 8.75, 5 +202, 7.5, 8.75, 3.75 +203, 8.75, 8.75, 2.5 +204, 2.5, 8.75, 1.25 +205, 5, 8.75, 1.25 +206, 3.75, 7.5, 1.25 +207, 1.25, 1.25, 2.5 +208, 2.5, 1.25, 3.75 +209, 1.25, 1.25, 5 +210, 7.5, 8.75, 8.75 +211, 5, 8.75, 8.75 +212, 6.25, 8.75, 7.5 +213, 8.75, 1.25, 7.5 +214, 7.5, 1.25, 6.25 +215, 8.75, 1.25, 5 +216, 2.5, 1.25, 1.25 +217, 3.75, 1.25, 2.5 +218, 5, 1.25, 1.25 +219, 6.25, 2.5, 1.25 +220, 7.5, 1.25, 1.25 +221, 2.5, 1.25, 8.75 +222, 2.5, 8.75, 8.75 +223, 1.25, 5, 1.25 +224, 1.25, 2.5, 1.25 +225, 7.5, 8.75, 1.25 +226, 8.75, 1.25, 2.5 +227, 1.25, 1.25, 7.5 +228, 1.25, 7.5, 1.25 +229, 1.25, 2.5, 8.75 +230, 3.75, 3.75, 7.5 +231, 2.5, 3.75, 6.25 +232, 3.75, 2.5, 6.25 +233, 1.25, 8.75, 7.5 +234, 1.25, 7.5, 8.75 +235, 2.5, 6.25, 6.25 +236, 3.75, 6.25, 7.5 +237, 3.75, 7.5, 6.25 +238, 1.25, 8.75, 2.5 +239, 8.75, 7.5, 8.75 +240, 8.75, 2.5, 8.75 +241, 8.75, 7.5, 1.25 +242, 8.75, 2.5, 1.25 +243, 3.75, 3.75, 2.5 +244, 6.25, 2.5, 3.75 +245, 5, 2.5, 5 +246, 5, 5, 2.5 +247, 7.5, 3.75, 3.75 +248, 7.5, 6.25, 3.75 +249, 7.5, 5, 5 +250, 2.5, 3.75, 3.75 +251, 6.25, 3.75, 7.5 +252, 5, 5, 7.5 +253, 6.25, 6.25, 7.5 +254, 5, 7.5, 5 +255, 7.5, 6.25, 6.25 +256, 7.5, 3.75, 6.25 +257, 3.75, 7.5, 3.75 +258, 2.5, 5, 5 +259, 2.5, 6.25, 1.25 +260, 2.5, 6.25, 3.75 +261, 7.5, 3.75, 1.25 +262, 6.25, 8.75, 2.5 +263, 8.75, 5, 1.25 +264, 2.5, 7.5, 5 +265, 7.5, 5, 7.5 +266, 2.5, 5, 7.5 +267, 6.25, 6.25, 2.5 +*Element, TYPE=C3D10, ELSET=Eall +1, 97, 174, 99, 95, 197, 196, 108, 112, 198, 114, +2, 123, 120, 73, 74, 130, 200, 199, 201, 202, 76, +3, 123, 122, 120, 74, 142, 143, 130, 201, 203, 202, +4, 121, 147, 146, 145, 205, 159, 204, 206, 155, 158, +5, 98, 95, 99, 46, 118, 114, 103, 207, 208, 209, +6, 124, 172, 123, 120, 211, 210, 127, 131, 212, 130, +7, 72, 95, 97, 96, 214, 112, 213, 215, 110, 111, +8, 98, 95, 148, 96, 118, 217, 216, 119, 110, 218, +9, 145, 149, 148, 96, 157, 165, 166, 219, 220, 218, +10, 99, 36, 173, 174, 107, 175, 221, 196, 176, 177, +11, 148, 149, 33, 96, 165, 168, 167, 218, 220, 117, +12, 97, 36, 99, 174, 105, 107, 108, 197, 176, 196, +13, 172, 42, 171, 124, 185, 186, 187, 211, 125, 222, +14, 98, 46, 99, 9, 207, 209, 103, 101, 50, 102, +15, 124, 42, 123, 172, 125, 126, 127, 211, 185, 210, +16, 48, 12, 46, 148, 55, 56, 57, 223, 150, 224, +17, 146, 147, 121, 39, 159, 205, 204, 162, 161, 138, +18, 122, 39, 121, 147, 136, 138, 139, 225, 161, 205, +19, 123, 27, 122, 74, 144, 141, 142, 201, 78, 203, +20, 73, 27, 123, 74, 79, 144, 199, 76, 78, 201, +21, 72, 96, 21, 71, 215, 113, 90, 89, 226, 91, +22, 46, 9, 47, 99, 50, 52, 53, 209, 102, 227, +23, 146, 48, 148, 12, 228, 223, 153, 152, 55, 150, +24, 97, 21, 72, 96, 109, 90, 213, 111, 113, 215, +25, 148, 33, 98, 96, 167, 115, 216, 218, 117, 119, +26, 173, 47, 99, 195, 229, 227, 221, 230, 231, 232, +27, 49, 171, 124, 195, 234, 222, 233, 235, 236, 237, +28, 124, 4, 49, 15, 128, 69, 233, 132, 17, 63, +29, 46, 1, 148, 12, 51, 151, 224, 56, 13, 150, +30, 12, 146, 48, 3, 152, 228, 55, 14, 154, 58, +31, 47, 18, 173, 2, 68, 194, 229, 54, 19, 190, +32, 48, 3, 121, 15, 58, 140, 238, 62, 16, 135, +33, 47, 2, 99, 9, 54, 104, 227, 52, 11, 102, +34, 122, 39, 147, 7, 136, 161, 225, 137, 41, 160, +35, 99, 2, 173, 36, 104, 190, 221, 107, 37, 175, +36, 4, 171, 49, 18, 189, 234, 69, 20, 193, 67, +37, 21, 96, 5, 71, 113, 116, 22, 91, 226, 94, +38, 98, 1, 46, 9, 100, 51, 207, 101, 10, 50, +39, 36, 174, 97, 6, 176, 197, 105, 38, 180, 106, +40, 124, 171, 4, 42, 222, 189, 128, 125, 186, 43, +41, 149, 5, 33, 96, 169, 35, 168, 220, 116, 117, +42, 6, 72, 97, 21, 92, 213, 106, 23, 90, 109, +43, 8, 30, 73, 172, 32, 86, 93, 188, 184, 239, +44, 174, 72, 6, 30, 240, 92, 180, 183, 87, 31, +45, 8, 123, 42, 172, 129, 126, 44, 188, 210, 185, +46, 8, 123, 73, 27, 129, 199, 93, 29, 144, 79, +47, 147, 74, 7, 24, 241, 84, 160, 163, 81, 26, +48, 148, 1, 98, 33, 151, 100, 216, 167, 34, 115, +49, 121, 3, 146, 39, 140, 154, 204, 138, 40, 162, +50, 27, 7, 122, 74, 28, 137, 141, 78, 84, 203, +51, 24, 5, 149, 71, 25, 169, 164, 80, 94, 242, +52, 146, 121, 48, 3, 204, 238, 228, 154, 140, 58, +53, 49, 4, 124, 171, 69, 128, 233, 234, 189, 222, +54, 99, 47, 173, 2, 227, 229, 221, 104, 54, 190, +55, 122, 7, 147, 74, 137, 160, 225, 203, 84, 241, +56, 97, 6, 174, 72, 106, 180, 197, 213, 92, 240, +57, 73, 123, 8, 172, 199, 129, 93, 239, 210, 188, +58, 5, 96, 149, 71, 116, 220, 169, 94, 226, 242, +59, 98, 148, 46, 1, 216, 224, 207, 100, 151, 51, +60, 195, 96, 148, 95, 244, 218, 243, 245, 110, 217, +61, 195, 148, 96, 145, 243, 218, 244, 246, 166, 219, +62, 195, 74, 71, 70, 248, 82, 247, 249, 75, 83, +63, 195, 46, 99, 95, 250, 209, 232, 245, 208, 114, +64, 195, 174, 173, 170, 251, 177, 230, 252, 178, 179, +65, 195, 172, 124, 120, 253, 211, 237, 254, 212, 131, +66, 195, 74, 73, 120, 248, 76, 255, 254, 202, 200, +67, 195, 73, 74, 70, 255, 76, 248, 249, 77, 75, +68, 71, 72, 195, 70, 89, 256, 247, 83, 88, 249, +69, 148, 46, 95, 98, 224, 208, 217, 216, 207, 118, +70, 148, 95, 46, 195, 217, 208, 224, 243, 245, 250, +71, 124, 121, 195, 120, 133, 257, 237, 131, 134, 254, +72, 49, 47, 195, 45, 65, 231, 235, 61, 66, 258, +73, 47, 46, 195, 45, 53, 250, 231, 66, 64, 258, +74, 46, 47, 195, 99, 53, 231, 250, 209, 227, 232, +75, 121, 48, 145, 146, 238, 259, 206, 204, 228, 158, +76, 121, 145, 48, 195, 206, 259, 238, 257, 246, 260, +77, 48, 148, 145, 146, 223, 166, 259, 228, 153, 158, +78, 48, 145, 148, 195, 259, 166, 223, 260, 246, 243, +79, 195, 48, 46, 148, 260, 57, 250, 243, 223, 224, +80, 195, 46, 48, 45, 250, 57, 260, 258, 64, 60, +81, 48, 49, 195, 45, 59, 235, 260, 60, 61, 258, +82, 120, 73, 172, 123, 200, 239, 212, 130, 199, 210, +83, 120, 172, 73, 195, 212, 239, 200, 254, 253, 255, +84, 195, 172, 174, 170, 253, 181, 251, 252, 182, 178, +85, 173, 171, 195, 170, 191, 236, 230, 179, 192, 252, +86, 195, 172, 171, 124, 253, 187, 236, 237, 211, 222, +87, 195, 171, 172, 170, 236, 187, 253, 252, 192, 182, +88, 195, 174, 99, 173, 251, 196, 232, 230, 177, 221, +89, 195, 99, 174, 95, 232, 196, 251, 245, 114, 198, +90, 145, 96, 71, 149, 219, 226, 261, 157, 220, 242, +91, 145, 71, 96, 195, 261, 226, 219, 246, 247, 244, +92, 195, 72, 96, 95, 256, 215, 244, 245, 214, 110, +93, 195, 96, 72, 71, 244, 215, 256, 247, 226, 89, +94, 195, 72, 73, 70, 256, 85, 255, 249, 88, 77, +95, 95, 174, 72, 97, 198, 240, 214, 112, 197, 213, +96, 95, 72, 174, 195, 214, 240, 198, 245, 256, 251, +97, 120, 147, 74, 122, 262, 241, 202, 143, 225, 203, +98, 120, 121, 147, 122, 134, 205, 262, 143, 139, 225, +99, 71, 147, 145, 149, 263, 155, 261, 242, 156, 157, +100, 147, 24, 71, 74, 163, 80, 263, 241, 81, 82, +101, 24, 147, 71, 149, 163, 263, 80, 164, 156, 242, +102, 49, 195, 15, 48, 235, 264, 63, 59, 260, 62, +103, 195, 49, 15, 124, 235, 63, 264, 237, 233, 132, +104, 15, 195, 121, 48, 264, 257, 135, 62, 260, 238, +105, 195, 15, 121, 124, 264, 135, 257, 237, 132, 133, +106, 172, 195, 30, 73, 253, 265, 184, 239, 255, 86, +107, 172, 30, 195, 174, 184, 265, 253, 181, 183, 251, +108, 195, 72, 30, 73, 256, 87, 265, 255, 85, 86, +109, 195, 30, 72, 174, 265, 87, 256, 251, 183, 240, +110, 18, 195, 47, 173, 266, 231, 68, 194, 230, 229, +111, 18, 47, 195, 49, 68, 231, 266, 67, 65, 235, +112, 171, 195, 18, 173, 236, 266, 193, 191, 230, 194, +113, 171, 18, 195, 49, 193, 266, 236, 234, 67, 235, +114, 147, 195, 71, 145, 267, 247, 263, 155, 246, 261, +115, 195, 147, 71, 74, 267, 263, 247, 248, 241, 82, +116, 120, 147, 195, 74, 262, 267, 254, 202, 241, 248, +117, 121, 147, 195, 120, 205, 267, 257, 134, 262, 254, +118, 147, 121, 195, 145, 205, 257, 267, 155, 206, 246, + + + +*********************************************************** +** Element sets for materials +** written by write_material_element_sets function +*ELSET,ELSET=MechanicalMaterial +Eall + +*********************************************************** +** Node set for fixed constraint +** written by write_fixed_node_sets function +*NSET,NSET=FemConstraintFixed +1, +2, +3, +4, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18, +19, +20, +45, +46, +47, +48, +49, +50, +51, +52, +53, +54, +55, +56, +57, +58, +59, +60, +61, +62, +63, +64, +65, +66, +67, +68, +69, + +*********************************************************** +** Node sets for loads +** written by write_load_node_sets function +*NSET,NSET=FemConstraintForce + +*********************************************************** +** Materials +** written by write_materials function +** Young's modulus unit is MPa = N/mm2 +*MATERIAL, NAME=Test Material +*ELASTIC +20000 , 0.360 +*SOLID SECTION, ELSET=MechanicalMaterial, MATERIAL=Test Material + +*********************************************************** +** One step is needed to calculate the mechanical analysis of FreeCAD +** loads are applied quasi-static, means without involving the time dimension +** written by write_step_begin function +*STEP +*STATIC + +*********************************************************** +** Constaints +** written by write_constraints_fixed function +*BOUNDARY +FemConstraintFixed,1 +FemConstraintFixed,2 +FemConstraintFixed,3 + + +*********************************************************** +** Node loads +** written by write_constraints_force function +** FemConstraintForce +*CLOAD +** node loads on element face: Box.Face3 + + + +*********************************************************** +** Element + CalculiX face + load in [MPa] +** written by write_face_load function +*DLOAD +** Load on face Face4 +3,P1,-10.0 +6,P4,-10.0 +15,P1,-10.0 +18,P1,-10.0 +19,P1,-10.0 +28,P2,-10.0 +32,P3,-10.0 +34,P2,-10.0 +40,P4,-10.0 +45,P1,-10.0 +46,P2,-10.0 +49,P2,-10.0 +50,P1,-10.0 +71,P2,-10.0 +98,P2,-10.0 +105,P3,-10.0 + +*********************************************************** +** 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 +** +** Units +** +** Geometry (mesh data) --> mm +** Materials (Young's modulus) --> N/mm2 = MPa +** Loads (nodal loads) --> N +**