slaon的个人博客分享 http://blog.sciencenet.cn/u/slaon

博文

Salome 构建 Sajben Diffuser的几何型线

已有 3536 次阅读 2016-7-31 22:43 |个人分类:salome|系统分类:科研笔记

Sajben Diffuser的型线控制方程如下图所示。

取自Benjamin的硕士论文:

Simulation and validation of compressible flow in nozzle geometries and validation of OpenFOAM for this application”。

他也是引用了Bogar的文章
Bogar, T. J., Sajben, M., & Kroutil, J. C. 1983. Characteristic Frequencies of Transonic Diffuser Flow Oscillations. AIAA Journal, 21(9), 1232–1240.



下面说一下怎么构建。

用TUI命令流,为什么不用GUI呢?

因为上面有公式!而且还有一点麻烦。GUI实现起来更麻烦。索性,用TUI吧。

一些介绍参考:在Salome中使用python命令流创建curve


下面贴一下.py代码

注意:curve有三种:polyline,Bezier和Interpolation,

第1种生成多段直线,第2种是贝塞尔曲线,第3种生成一条通过个点的曲线。


# #################################################################################
# Using SALOME
#  To creat the Sajben diffuser geometry, which can be found in Benjamin's master thesis,
#  i.e. "Simulation and validation of compressible flow in nozzle geometries and validation of OpenFOAM for this application",
#  which is located in Sec.4.2.1
#  Then it will be meshed in Salome, and is send to OpenFoam for a CFD simulation
# #################################################################################

import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
gg = salome.ImportComponentGUI("GEOM")

# ###################
# set variables
# ###################


a_c= 1.4114
a_d=1.5000
l_c= -2.598
l_d= 7.216
C1_c= 0.81
C1_d= 2.25
C2_c=1.0
C2_d=0.0
C3_c= 0.5
C3_d= 0.5
C4_c= 0.6
C4_d= 0.6
pie = 3.1415926


xi_c='C1_c*(t/l_c)*pow(1.0+C2_c*(t/l_c),C3_c)/pow(1.0-(t/l_c),C4_c)'
xi_d='C1_d*(t/l_d)*pow(1.0+C2_d*(t/l_d),C3_d)/pow(1.0-(t/l_d),C4_d)'
h_c='a_c*cosh('+xi_c+')/(a_c-1.0+cosh('+xi_c+'))'
h_d='a_d*cosh('+xi_d+')/(a_d-1.0+cosh('+xi_d+'))'

x_min=4.55
x_max=9.1

# ###################
# create several polylines using parametric definition of the basic points
# ###################


# 1st: The inlet bc of Sajben diffuser. It is a line.
t_min=0.0
t_max=1.4114
t_num=1
x_constant='-4.55'
param_polyline_1 = geompy.MakeCurveParametric(x_constant, "t", "0.", t_min, t_max, t_num, GEOM.Polyline, theNewMethod=True)

# 2nd: The constant section on the top wall with a downstream covergent section. It is a line.
t_min=-4.55
t_max=-2.597
t_num=1
h_constant='1.4114'
param_polyline_2 = geompy.MakeCurveParametric("t", h_constant, "0.", t_min, t_max, t_num, GEOM.Polyline, theNewMethod=True)


# 3Rd: The covergent section. It is a curve.
t_min=-2.597
t_max=0.0
t_num=300
param_polyline_c = geompy.MakeCurveParametric("t", h_c, "0.", t_min, t_max, t_num, GEOM.Interpolation, theNewMethod=True)

# 4th: The divergent section. It is a curve.
t_min=0.0
t_max=7.215
t_num=300
param_polyline_d = geompy.MakeCurveParametric("t", h_d, "0.", t_min, t_max, t_num, GEOM.Interpolation, theNewMethod=True)


# 5th: The constant section on the top wall downstream of the divergennt section. It is a line.
t_min=7.215
t_max=9.1
t_num=1
h_constant='1.5'
param_polyline_3 = geompy.MakeCurveParametric("t", h_constant, "0.", t_min, t_max, t_num, GEOM.Polyline, theNewMethod=True)

# 6th: The outlet bc of Sajben diffuser. It is a line.
t_min=0.0
t_max=1.5
t_num=1
x_constant='9.1'
param_polyline_4 = geompy.MakeCurveParametric(x_constant, "t", "0.", t_min, t_max, t_num, GEOM.Polyline, theNewMethod=True)

# 7th: The bottom wall of Sajben diffuser. It is a line.
t_min=-4.55
t_max=9.1
t_num=1
h_constant='0.'
param_polyline_5 = geompy.MakeCurveParametric("t", h_constant, "0.", t_min, t_max, t_num, GEOM.Polyline, theNewMethod=True)


# ###################
# add objects in the study
# ###################


id_param_polyline_1 = geompy.addToStudy(param_polyline_1, "Polyline Parametric Inlet ")
id_param_polyline_2 = geompy.addToStudy(param_polyline_2, "Polyline Parametric TopConstant 1")
id_param_polyline_c = geompy.addToStudy(param_polyline_c,  "Polyline Parametric Convergent")
id_param_polyline_d = geompy.addToStudy(param_polyline_d, "Polyline Parametric Divergent")
id_param_polyline_3 = geompy.addToStudy(param_polyline_3, "Polyline Parametric TopConstant 2")
id_param_polyline_4 = geompy.addToStudy(param_polyline_4, "Polyline Parametric Outlet")
id_param_polyline_5 = geompy.addToStudy(param_polyline_5, "Polyline Parametric Bottom")


# ###################
# display the objects
# ###################

gg.createAndDisplayGO(id_param_polyline_1)
gg.createAndDisplayGO(id_param_polyline_2)
gg.createAndDisplayGO(id_param_polyline_c)
gg.createAndDisplayGO(id_param_polyline_d)
gg.createAndDisplayGO(id_param_polyline_3)
gg.createAndDisplayGO(id_param_polyline_4)
gg.createAndDisplayGO(id_param_polyline_5)



具体怎么用呢?

打开Salome,

界面是这样的:


然后file->load script


运行完了以后,切换到SALOME模块,然后再返回值Geometry模块。这样是刷新一下。




刷新完之后,是这样的。






https://wap.sciencenet.cn/blog-531760-993759.html

上一篇:在Salome中使用python命令流创建curve
下一篇:Sajben Diffuser 流动计算
收藏 IP: 112.26.66.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (1 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-9 11:12

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部