用 Python 实现简单的机翼周围 C 型计算网格

本文介绍了一篇使用Python完成的机翼周围C型计算网格的实现过程,涉及计算流体力学(CFD)的基础应用,并在代码中详细注释了关键步骤。该内容基于Sage数学软件,遵循CC-BY 3.0协议。
摘要由CSDN通过智能技术生成

这其实只是计算流体力学的一份作业,边做作业边学了一些关于 Sage 的新的东西,就发到博客上了。主要的内容都在代码注释里了,此处不再赘述。全部内容按照 CC-BY 3.0 协议发布。

# This program is a sage script, and NOT a standard python script, so you can only run it
# in sage, rather than just load the script into python interperater.

# f(x) is the shape function of the surface of the wing
f1(x) = 0.6 * (0.2969*sqrt(x) - 0.126*x - 0.3516*x^2 + 0.2843*x^3 - 0.1015*x^4)
f2(x) = 0
f = piecewise([[(0, 1), f1], [(1, 4), f2]])

# Description: generate points on which grid will be generated, and then
# 	map them to the upper plane of complex plane.
# Implementation: variable s is the real part of the point on which grid
# 	will be generated. w_i stores the mapped points of upper surface of
# 	the wing and the lower surface of the wing.
w1 = []; w2 = []
for j in range(100):
	s = (j/50)^1.4
	w1.append(sqrt(s+f(s).n()*I).n())
	w2.append(sqrt(s+f(s).n()*(-1)*I).n()*(-1))
  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值