栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

用tecplot进行批量绘制流线图和涡量图的python脚本

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

用tecplot进行批量绘制流线图和涡量图的python脚本

较于昨天的批量画流线图的脚本,我又添加了涡量图的画法

'''
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']

# 测试case
# lst_Da = ['6']
# lst_Re = ['140']

# 画流线图
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),华为捞我( ・´ω`・ )

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/313728.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号