Skip to content

Commit

Permalink
FEM: Add comments to .inp file about functions
Browse files Browse the repository at this point in the history
Adding detailed information which function is responsible for
creating a proticular section of the .inp file should save
some guesswork. An example from the .inp file:

[..]
***********************************************************
** node sets for loads
** written by write_load_node_sets function
*NSET,NSET=FemConstraintForce
1,
3,
[..]

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
  • Loading branch information
PrzemoF authored and wwmayer committed May 1, 2015
1 parent beb6cec commit 605e8cd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Mod/Fem/ccxInpWriter.py
Expand Up @@ -2,6 +2,7 @@
import FreeCAD
import os
import time
import sys


class inp_writer:
Expand Down Expand Up @@ -37,6 +38,7 @@ def write_calculix_input_file(self):
def write_material_element_sets(self, f):
f.write('\n\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']
mat_obj_name = mat_obj.Name
Expand All @@ -54,6 +56,7 @@ def write_material_element_sets(self, f):
def write_fixed_node_sets(self, f):
f.write('\n\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']
print fix_obj.Name
Expand All @@ -77,6 +80,7 @@ def write_fixed_node_sets(self, f):
def write_load_node_sets(self, f):
f.write('\n\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']
print frc_obj.Name
Expand Down Expand Up @@ -114,6 +118,7 @@ def write_load_node_sets(self, f):
def write_materials(self, f):
f.write('\n\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')
for m in self.material_objects:
mat_obj = m['Object']
Expand All @@ -139,11 +144,13 @@ 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('** 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')

def write_constraints_fixed(self, f):
f.write('\n** 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
f.write('*BOUNDARY\n')
Expand All @@ -153,6 +160,7 @@ def write_constraints_fixed(self, f):

def write_constraints_force(self, f):
f.write('\n** loads\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:
Expand All @@ -171,6 +179,7 @@ def write_constraints_force(self, f):

def write_outputs_types(self, f):
f.write('\n** 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')
f.write('*EL FILE\n')
Expand All @@ -183,11 +192,13 @@ def write_outputs_types(self, f):
f.write('\n\n')

def write_step_end(self, f):
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('** written by {} function\n'.format(sys._getframe().f_code.co_name))
f.write('**\n')
f.write('** CalculiX Inputfile\n')
f.write('**\n')
Expand Down

0 comments on commit 605e8cd

Please sign in to comment.