转自:微信公众号 cfd之道
用来自记!!!!!
转载链接:https://mp.weixin.qq.com/s/nhDoHNsTwenXZNBYkDVoVg
在液体喷雾过程中,常利用Rosin-Rammler方法来描述液滴粒径分布。
本文内容来自Fluent UserGuide 25.3.14。
Rosin-Rammler方法利用以下方式描述粒径与质量分数之间的函数关系:
齐总\bar{d}为平均粒径(Mean Diameter),n为尺寸分布指数(Spread Parameter)。
通过将粒径分布数据拟合到Rosin-Rammler方程中,可以很容易地定义粒度分布。在这种方法中,完整的粒径范围被划分为一组离散的粒度范围。例如,假设粒径数据服从以下分布:
粒径范围(微米) | 质量分数 |
---|---|
0~70 | 0.05 |
70~100 | 0.1 |
100~120 | 0.35 |
120~150 | 0.3 |
150~180 | 0.15 |
180~200 | 0.05 |
首先需要处理表中的数据,以累积质量分数的形式显示:
粒径(微米) | 超过粒径的质量分数 |
---|---|
70 | 0.95 |
100 | 0.85 |
120 | 0.50 |
150 | 0.20 |
180 | 0.05 |
200 | 0 |
将表显示成散点图,如下图所示。
利用Rosin-rammler函数拟合上面的数据。这种非线性估计极为麻烦,曲线拟合常常失败。可以采用python对上表中的数据进行拟合。
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 6 09:40:40 2022
@author: qq:3123575367
"""
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import numpy as np
plt.rcParams['font.sans-serif'] = ['SimHei']
x = np.array([0.5,1,1.5,2,2.5,3,3.5,5])
y = np.array([0.9199,0.78676399,0.604136,0.428175,0.28827,0.18841,0.12165,0])
# 防止对0取对数,故去掉最后一个元素
xx = x[:-1]
yp = y[:-1]
# xx = np.array([5.155,7.937,10.283,20.512,31.581,40.915,62.996])
# yp = np.array([0.9649,0.88433,0.84253,0.70762,0.53222,0.30409,0.02898])
yy= np.log(yp)
'''
指定的公式,两边取对数然后拟合
'''
def func(x,a,b):
return -np.power(x/a,b)
popt, pcov = curve_fit(func, xx, yy)#函数拟合,popt返回参数,pcov返回协方差
print("平均粒径:",popt[0],"\n分布指数 n:",popt[1])
print("拟合方差:",pcov)
# 绘制图形
xx = np.linspace(x[0],x[-1],num=50)
yvals=np.exp(func(xx,popt[0],popt[1]))
plot1=plt.plot(x, y, 'o',c='r',label='初始数据')
plot2=plt.plot(xx, yvals, 'b',linewidth=2,label='$fit: Y_d = e^{-(\\frac{d}{%5.5f})^{%5.5f}}$' % tuple(popt))
plt.xlabel('直径(μm)')
plt.ylabel('累计分布')
plt.legend(loc=1)
#控制图例的形状大小:fontsize控制图例字体大小,markerscale控制scatters形状大小,scatterpoints控制scatters的数量
plt.legend(fontsize=14, markerscale=1., scatterpoints=1)
plt.show()
plt.savefig('fix.jpg', dpi=300) #指定分辨率保存
拟合结果如图所示:
可看到拟合的系数a=134.247,b=3.7794。这里为了防止对0取对数而丢失了一个点的信息。
Fluent中采用另外一种估算方案。
先估算平均粒径。当粒径为平均粒径时,此时质量分数:
此时线性插值得到平均粒径:
可得到平均粒径d=133.2μm。
有了平均粒径,即可代入公式:
将表中的粒径d代入公式中,求解得到多个n,再计算其平均值即可得到分布指数。
粒径 | 质量分数 | n |
---|---|---|
70 | 0.95 | 4.682585 |
100 | 0.85 | 6.5445 |
120 | 0.5 | 3.845475 |
150 | 0.2 | 3.722698 |
180 | 0.05 | 3.53755 |
200 | 0 | |
平均值 | 4.466562 |
可得到平均分布指数n=4.466562.
|
| | 平均值 | 4.466562 |
可得到平均分布指数n=4.466562.
[外链图片转存中…(img-SGpXEVvs-1601943704493)]
看图形拟合得还不错。当然如果想要硬生生的拟合,也并不是不可以,不过搞起来麻烦一点罢了,不管从哪个角度来讲,非线性拟合的复杂程度总是要大于代数计算。