In these days, a finite element model consists of several INCLUDE files either relative or absolute. When collaborating with other people, it is very difficult to remember sending the included files and also if we do remember, it is cumbersome if not difficult to find them and zip them as one file. I recently encountered this problem and wrote a simple utility in PYTHON to make this a little easier. Once you download this file, you simply invoke this using “pack_dyna main_input_file.k” and it handles all the rest of packing to give you one BZIP2 file to send to your contacts. In some cases, you may want to ignore absolutely references files (/some/path/to/a/include/file.k). To enable this, you can set the variable RELATIVE_FILES_ONLY to 1 which will cause the program to include only relatively included files (path/to/a/relative/file.k).
I must credit Dr. Brian Wainscott who was kind to guide me into using Python.
Download Link: pack_dyna.py
# Utility to pack files for a LS-DYNA run
# Author: Suri Bala
if len(sys.argv) == 1:
print "Usage %s main_file.k" % sys.argv
print " File %s does not exist" % MAIN_FILE
print " Exiting ...."
JOB_NAME = MAIN_FILE.split(".").pop(0)
def process_file (NAME):
for line in file:
if len(nline)>0 and nline=="*" and nline[0:4]=="*inc" or nline[0:4]=="*INC":
if RELATIVE_FILES_ONLY and line!="/":
for f in FILES:
os.system("tar -cf "+JOB_NAME+".tar "+FILE_NAME)