较于昨天的批量画流线图的脚本,我又添加了涡量图的画法
'''
Volume product streamline and vorticity pictures
=======================================
Template file is '6_100.lay','vorticity.lay'
the volume product files is 'Da_Re_streamline.lay's
and 'Da_Re_vorticity.lay's.
Before running, you should prepare '6_100.lay', 'vorticity.lay'
and empty 'Da_Re_streamline.lay' and 'Da_Re_vorticity.lay' files
---------------------------------------
Auther:
ZHOU Lin
Time:
October 11, 2021 20:24:28
Email:
11930579@mail.sustech.edu.cn
Address:
Department of Mechanics and Aerospace Engineering,
Southern University of Science and Technology,
Shenzhen 518055, China
=========================================
Copyright ? 1997- ZHOU Lin. All rights reserved.
'''
lst_Da = ['2', '3', '4', '5', '6']
lst_Re = ['100', '110', '120', '130', '140', '150', '160']
for Da in lst_Da:
for Re in lst_Re:
filename = Da + '_' + Re + '_streamline.lay'
with open('6_100.lay') as template:
information = template.readlines(0)
line1 = information[1]
line1364 = information[1364]
line1365 = information[1365]
line1 = line1.replace('6_100', Da + '_' + Re)
line1364 = line1364.replace('100', Re)
line1365 = line1365.replace('6', Da)
information[1] = line1
information[1364] = line1364
information[1365] = line1365
with open(filename, 'w') as product:
s = " ".join(map(str, information))
product.write(s)
product.close()
template.close()
print(Da + '_' + Re)
for Da in lst_Da:
for Re in lst_Re:
filename = Da + '_' + Re + '_vorticity.lay'
with open('vorticity.lay') as template:
information = template.readlines(0)
line1 = information[1]
line982 = information[982]
line1 = line1.replace('t= 17000.0000s', Da + '_' + Re)
line982 = line982.replace('100', Re)
line982 = line982.replace('2', Da)
information[1] = line1
information[982] = line982
with open(filename, 'w') as product:
s = " ".join(map(str, information))
product.write(s)
product.close()
template.close()
print(Da + '_' + Re)
许愿帖:大疆捞我(o°ω°o),华为捞我( ・′ω`・ )
|