def write_load_file(loadfilename, load_nodeID_amp, direction=-3,
header_comment="$Generated by GaussExc.py\n"):
"""write load file
:param loadfilename:
:param load_nodeID_amp: list of int node ID, float amp
:param direction: default = -3 (orientation (1, 2, 3) and sign)
:param header_comment:
"""
from numpy import sign, abs
d = abs(direction)
dsign = sign(direction)
lfile = open(loadfilename, 'w')
lfile.write(header_comment)
lfile.write("*LOAD_NODE_POINT\n")
[lfile.write("%i,%i,1,%.4f\n" % (i, d, dsign * j))
for i, j in load_nodeID_amp]
lfile.write("*END\n")
lfile.close()
return 0
评论列表
文章目录