[OpenPNM] Part 5——Examples of Algorithm —— Predicting absolute permeability

发布于 2023-04-04  293 次阅读


Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------

该示例解释了立方网络上的绝对渗透率计算。

注意,在计算从PoreSpy中提取的网络的渗透率时,分配相位、算法和计算渗透率的步骤与本教程类似。

import numpy as np
import openpnm as op
op.visualization.set_mpl_style()
np.random.seed(10)
%matplotlib inline
np.set_printoptions(precision=5)

在spyder里运行上面的代码,%matplotlib inline这一行会报错,直接注释掉就行,原因可以参考:https://zhuanlan.zhihu.com/p/34948525

创建一个随机的立方体网络模型

pn = op.network.Cubic(shape=[15, 15, 15], spacing=1e-6)
pn.add_model_collection(op.models.collections.geometry.spheres_and_cylinders)#添加随机的几何参数
pn.regenerate_models()#重新生成网络模型

创建相对象

phase = op.phase.Phase(network=pn)
phase['pore.viscosity']=1.0#定义粘度
phase.add_model_collection(op.models.collections.physics.basic)#添加物理模型
phase.regenerate_models()
'''
[17:44:16] WARNING  throat.entry_pressure was not run since the  _models.py:480
                    following property is missing:                             
                    'throat.surface_tension'                                   
           WARNING  throat.diffusive_conductance was not run     _models.py:480
                    since the following property is missing:                   
                    'throat.diffusivity'          
'''

设置stokes流动

为了计算x方向的渗透率,在网络的左侧和右侧应用恒定压力边界条件。当然,也可以遵循类似的过程来查找 y 和 z 方向的渗透率。

inlet = pn.pores('left')#添加‘进口’标签
outlet = pn.pores('right')#添加‘出口’标签
flow = op.algorithms.StokesFlow(network=pn, phase=phase)#应用StokesFlow算法
flow.set_value_BC(pores=inlet, values=1)#设置进口压力值
flow.set_value_BC(pores=outlet, values=0)#设置出口压力值
flow.run()#运行模型
phase.update(flow.soln)#updates the `phase` with the new computed values of `pore.pressure` from solving the Stokes flow transport algorithm.
ax = op.visualization.plot_connections(pn)
ax = op.visualization.plot_coordinates(pn, ax=ax, color_by=phase['pore.pressure'])

计算渗透率

使用达西定律计算绝对渗透率:

K_{abs}=Q \mu L/A \Delta P

Q为流率

A为样品在流动方向上的截面积

\mu为流体粘度

L为样品在流动方向上的长度

\Delta P为压力差

# NBVAL_IGNORE_OUTPUT
Q = flow.rate(pores=inlet, mode='group')[0]
A = op.topotools.get_domain_area(pn, inlets=inlet, outlets=outlet)
L = op.topotools.get_domain_length(pn, inlets=inlet, outlets=outlet)
# K = Q * L * mu / (A * Delta_P) # mu and Delta_P were assumed to be 1.
K = Q * L / A
print(f'The value of K is: {K/0.98e-12*1000:.2f} mD')
'''
[18:27:36] WARNING  Attempting to estimate inlet area...will be low                              _topotools.py:1033
           WARNING  Attempting to estimate domain length...could be low if boundary pores were   _topotools.py:1077
                    not added                                                                                      
The value of K is: 0.07 mD
'''

1)在“topotools”中寻找区域的方法是基于Scipy的“ConvexHull”,创建一个包括入口的凸壳来近似入口面积。
' get_domain_area '和' get_domain_length '在提取网络的面积和长度时都是用的近似。在没有边界孔隙的提取网络中,由于进/出口孔隙不一定位于几乎平坦的平面上,估计值可能会偏低。

2)在这个例子中,我们假设网络具有球形孔和圆柱形喉道。在“geometry”集合中定义了不同的孔隙和喉咙几何形状。每个几何集合都包含孔隙尺度模型size factors,这些模型是计算管道水力导度和应用传输算法所必需的。size factors模型也可以使用' add_model '方法分配给网络,并从' op.models.geometry. hydroic_size_factors '中选择。

届ける言葉を今は育ててる
最后更新于 2023-04-20