FEM: inp file formatting/typos
Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
parent
48efcc449b
commit
6ab70bece6
|
@ -37,8 +37,8 @@ class inp_writer:
|
|||
return self.base_name
|
||||
|
||||
def write_material_element_sets(self, f):
|
||||
f.write('\n\n***********************************************************\n')
|
||||
f.write('** element sets for materials\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Element sets for materials\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
for m in self.material_objects:
|
||||
mat_obj = m['Object']
|
||||
|
@ -52,11 +52,10 @@ class inp_writer:
|
|||
else:
|
||||
if mat_obj_name == 'MechanicalMaterial':
|
||||
f.write('Eall\n')
|
||||
f.write('\n\n')
|
||||
|
||||
def write_fixed_node_sets(self, f):
|
||||
f.write('\n\n***********************************************************\n')
|
||||
f.write('** node set for fixed constraint\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Node set for fixed constraint\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
for fobj in self.fixed_objects:
|
||||
fix_obj = fobj['Object']
|
||||
|
@ -76,11 +75,10 @@ class inp_writer:
|
|||
n = self.mesh_object.FemMesh.getNodesByVertex(fo)
|
||||
for i in n:
|
||||
f.write(str(i) + ',\n')
|
||||
f.write('\n\n')
|
||||
|
||||
def write_load_node_sets(self, f):
|
||||
f.write('\n\n***********************************************************\n')
|
||||
f.write('** node sets for loads\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Node sets for loads\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
for fobj in self.force_objects:
|
||||
frc_obj = fobj['Object']
|
||||
|
@ -101,7 +99,7 @@ class inp_writer:
|
|||
NbrForceNodes = NbrForceNodes + 1 # NodeSum of mesh-nodes of ALL reference shapes from force_object
|
||||
# calculate node load
|
||||
if NbrForceNodes == 0:
|
||||
print ' Warning --> no FEM-Mesh-node to apply the load to was found?'
|
||||
print 'No Line Loads or Point Loads in the model'
|
||||
else:
|
||||
fobj['NodeLoad'] = (frc_obj.Force) / NbrForceNodes
|
||||
# FIXME this method is incorrect, but we don't have anything else right now
|
||||
|
@ -111,13 +109,12 @@ class inp_writer:
|
|||
f.write('** ' + str(frc_obj.Force) + ' N / ' + str(NbrForceNodes) + ' Nodes = ' + str(fobj['NodeLoad']) + ' N on each node\n')
|
||||
if frc_obj.Force == 0:
|
||||
print ' Warning --> Force = 0'
|
||||
f.write('\n\n')
|
||||
|
||||
def write_materials(self, f):
|
||||
f.write('\n\n***********************************************************\n')
|
||||
f.write('** materials\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Materials\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
f.write('** youngs modulus unit is MPa = N/mm2\n')
|
||||
f.write('** Young\'s modulus unit is MPa = N/mm2\n')
|
||||
for m in self.material_objects:
|
||||
mat_obj = m['Object']
|
||||
# get material properties
|
||||
|
@ -133,21 +130,22 @@ class inp_writer:
|
|||
f.write('{0:.3f}\n'.format(PR))
|
||||
# write element properties
|
||||
if len(self.material_objects) == 1:
|
||||
f.write('*SOLID SECTION, ELSET=' + mat_obj_name + ', MATERIAL=' + mat_name + '\n\n')
|
||||
f.write('*SOLID SECTION, ELSET=' + mat_obj_name + ', MATERIAL=' + mat_name + '\n')
|
||||
else:
|
||||
if mat_obj_name == 'MechanicalMaterial':
|
||||
f.write('*SOLID SECTION, ELSET=' + mat_obj_name + ', MATERIAL=' + mat_name + '\n\n')
|
||||
f.write('*SOLID SECTION, ELSET=' + mat_obj_name + ', MATERIAL=' + mat_name + '\n')
|
||||
|
||||
def write_step_begin(self, f):
|
||||
f.write('\n\n\n\n***********************************************************\n')
|
||||
f.write('** one step is needed to calculate the mechanical analysis of FreeCAD\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** One step is needed to calculate the mechanical analysis of FreeCAD\n')
|
||||
f.write('** loads are applied quasi-static, means without involving the time dimension\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
f.write('*STEP\n')
|
||||
f.write('*STATIC\n\n')
|
||||
f.write('*STATIC\n')
|
||||
|
||||
def write_constraints_fixed(self, f):
|
||||
f.write('\n** constaints\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Constaints\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
for fixed_object in self.fixed_objects:
|
||||
fix_obj_name = fixed_object['Object'].Name
|
||||
|
@ -157,9 +155,9 @@ class inp_writer:
|
|||
f.write(fix_obj_name + ',3\n\n')
|
||||
|
||||
def write_constraints_force(self, f):
|
||||
f.write('\n** loads\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Node loads, see load node sets for how the value is calculated!\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
f.write('** node loads, see load node sets for how the value is calculated!\n')
|
||||
for fobj in self.force_objects:
|
||||
if 'NodeLoad' in fobj:
|
||||
frc_obj = fobj['Object']
|
||||
|
@ -176,8 +174,8 @@ class inp_writer:
|
|||
f.write(frc_obj_name + ',3,' + v3 + '\n\n')
|
||||
|
||||
def write_face_load(self, f):
|
||||
f.write('***********************************************************\n')
|
||||
f.write('** element + CalculiX face + load in [MPa]\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Element + CalculiX face + load in [MPa]\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
for fobj in self.force_objects:
|
||||
frc_obj = fobj['Object']
|
||||
|
@ -191,7 +189,8 @@ class inp_writer:
|
|||
f.write("{},P{},{}\n".format(i[0], i[1], frc_obj.Force))
|
||||
|
||||
def write_outputs_types(self, f):
|
||||
f.write('\n** outputs --> frd file\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Outputs --> frd file\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
f.write('*NODE FILE\n')
|
||||
f.write('U\n')
|
||||
|
@ -202,19 +201,18 @@ class inp_writer:
|
|||
f.write('U \n')
|
||||
f.write('*EL PRINT , ELSET=Eall \n')
|
||||
f.write('S \n')
|
||||
f.write('\n\n')
|
||||
|
||||
def write_step_end(self, f):
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
f.write('*END STEP \n')
|
||||
|
||||
def write_footer(self, f):
|
||||
FcVersionInfo = FreeCAD.Version()
|
||||
f.write('\n\n\n\n***********************************************************\n')
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** CalculiX Input file\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
f.write('**\n')
|
||||
f.write('** CalculiX Inputfile\n')
|
||||
f.write('**\n')
|
||||
f.write('** written by --> FreeCAD ' + FcVersionInfo[0] + '.' + FcVersionInfo[1] + '.' + FcVersionInfo[2] + '\n')
|
||||
f.write('** written on --> ' + time.ctime() + '\n')
|
||||
f.write('** file name --> ' + os.path.basename(FreeCAD.ActiveDocument.FileName) + '\n')
|
||||
|
@ -227,4 +225,3 @@ class inp_writer:
|
|||
f.write("** Materials (Young's modulus) --> N/mm2 = MPa\n")
|
||||
f.write('** Loads (nodal loads) --> N\n')
|
||||
f.write('**\n')
|
||||
f.write('**\n')
|
||||
|
|
Loading…
Reference in New Issue
Block a user