问题概要
点数据的测量
软件
tcfd 18.10
具体问题
tcfd一般设置里的probe测量数据为各截面上的平均数据。详细结果可参阅计算结果生成的路径下“postprocessing”文件夹里各个子文件里的csv文件。
而如何使用tcfd测量某个特定点的数据呢?就需要使用python脚本了。
首先创建一个文本文档,在文档中键入下图中的字符(有实际意义的部分为带颜色的文字,后面附详细文字版):
前两行为声明语句:
setentry('system/controldict', 'functions/customprobes/functionobjectlibs', '( "libsampling.so" )')
setentry('system/controldict', 'functions/customprobes/type', 'probes')
往下为需要监控的参数声明:
setentry('system/controldict', 'functions/customprobes/fields:0', 'p') 监控量为静压p;
setentry('system/controldict', 'functions/customprobes/fields:1', 'ptot') 监控量为总压ptot;
setentry('system/controldict', 'functions/customprobes/fields:2', 'u') 监控量为速度场 u;
再往下为监测的具体坐标点,需要注意的是,这里的点给定的是三维坐标,单位只能给成米meter:
setentry('system/controldict', 'functions/customprobes/probelocations:0', '( -0.0137 -0.1631 0.0974 )')
setentry('system/controldict', 'functions/customprobes/probelocations:1', '( -0.0147 -0.1631 0.0974 )') 这里插入了(-0.0137,-0.1631,0.0974)、(-0.0147,-0.1631,0.0974)两个坐标点。
最后为结束语句:writefile('system/controldict')
将文档保存后,修改后缀名为.py。
将脚本导入tcfd:
点开tcfd设置条框里“scripting”右边的“ ”加号,在弹出的对话框中添加刚才生成的py文件即可,
点击图中的“execution point”下方小空白框,按需求添加脚本在程序运行时脚本运行的时间,如:after write、before meshing、after calculation等。然后按正常流程进行manager>write case>run all。在计算结果生成的路径下“postprocessing”文件夹里会生成“custom probe”文件夹,在这里可查看插入的数据点的参数。
附整个文本语句(#后语句为说明语句,不执行):
# print '@@@ this script defines probes (points) for which given quantities are tracked.'
# compulsory lines
setentry('system/controldict', 'functions/customprobes/functionobjectlibs', '( "libsampling.so" )')
setentry('system/controldict', 'functions/customprobes/type', 'probes')
# fields to be tracked
setentry('system/controldict', 'functions/customprobes/fields:0', 'p')
setentry('system/controldict', 'functions/customprobes/fields:1', 'ptot')
setentry('system/controldict', 'functions/customprobes/fields:2', 'u')
# position of tracked points, always in meters
setentry('system/controldict', 'functions/customprobes/probelocations:0', '( -0.0137 -0.1631 0.0974 )')
setentry('system/controldict', 'functions/customprobes/probelocations:1', '( -0.0147 -0.1631 0.0974 )')
# compulsory line
writefile('system/controldict')