You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks to the solution you provided, I was able to successfully create the pore network model. However, I am facing difficulties in calculating the absolute permeability, as I keep getting a result of 0 mD. Could you kindly provide guidance on whether I might have missed something in the process?
I used a 300x300x300 Ventheimer sandstone binary image as the input data, setting the top as the inlet and the bottom as the outlet. I applied boundary conditions of 0 on the sides to allow flow from top to bottom, and I assigned nitrogen as the fluid.
The final result was 0 mD, as if no fluid was flowing. However, the pore network contains 1917 pores and 3632 throats, so it doesn't seem possible that fluid wouldn’t flow. I am unsure what I might be missing. I have followed the process in the attached PDF for reference.
Thank you, Professor.
(this is my code)
import openpnm as op
import numpy as np
net = op.network.Cubic(shape=shape, spacing=spacing, name='adjusted_network')
print(f"해상도 (m/pixel): {voxel_size}")
resolution = 5.81e-05
name = 'bentheimer'
import os
from skimage import io
folder_path = r"C:/Users/user/Desktop/lab/포어 네트워크 모델/bentheimer_binary_image_cut_300_tif_invert"
image_files = [f for f in os.listdir(folder_path) if f.endswith('.tif')]
if len(image_files) == 0:
print("폴더에 tif 이미지 파일이 없습니다.")
else:
# 첫 번째 이미지 파일 경로 설정
image_path = os.path.join(folder_path, image_files[0])
im = io.imread(image_path)
print(f"불러온 이미지 파일: {image_files[0]}")
print(f"이미지 크기: {im.shape}")
import porespy as ps
import openpnm as op
import imageio.v2 as imageio
import os
import scipy.ndimage as spim
import numpy as np
folder_path = r"C:/Users/user/Desktop/lab/포어 네트워크 모델/bentheimer_binary_image_cut_300_tif_invert"
file_names = [f for f in os.listdir(folder_path) if f.endswith('.tif')]
if len(file_names) == 0:
print("폴더에 tif 이미지 파일이 없습니다.")
else:
# 첫 번째 이미지 파일 경로 설정 및 읽기
binary_image_path = os.path.join(folder_path, file_names[0])
binary_image = imageio.imread(binary_image_path)
labeled_image, num_features = spim.label(binary_image)
print(f"라벨링된 영역의 수: {num_features}")
snow_partitioned = ps.filters.snow_partitioning(labeled_image)
regions = snow_partitioned.regions
resolution = 5.81e-05
net = ps.networks.regions_to_network(regions, voxel_size=resolution)
pn = op.io.network_from_porespy(net)
print("포어 네트워크 모델이 성공적으로 생성되었습니다.")
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Respected Professor,
Thanks to the solution you provided, I was able to successfully create the pore network model. However, I am facing difficulties in calculating the absolute permeability, as I keep getting a result of 0 mD. Could you kindly provide guidance on whether I might have missed something in the process?
I used a 300x300x300 Ventheimer sandstone binary image as the input data, setting the top as the inlet and the bottom as the outlet. I applied boundary conditions of 0 on the sides to allow flow from top to bottom, and I assigned nitrogen as the fluid.
The final result was 0 mD, as if no fluid was flowing. However, the pore network contains 1917 pores and 3632 throats, so it doesn't seem possible that fluid wouldn’t flow. I am unsure what I might be missing. I have followed the process in the attached PDF for reference.
Thank you, Professor.
(this is my code)
import openpnm as op
import numpy as np
voxel_size = 0.0581e-3
shape = (300, 300, 300)
spacing = (voxel_size, voxel_size, voxel_size)
net = op.network.Cubic(shape=shape, spacing=spacing, name='adjusted_network')
print(f"해상도 (m/pixel): {voxel_size}")
resolution = 5.81e-05
name = 'bentheimer'
import os
from skimage import io
folder_path = r"C:/Users/user/Desktop/lab/포어 네트워크 모델/bentheimer_binary_image_cut_300_tif_invert"
image_files = [f for f in os.listdir(folder_path) if f.endswith('.tif')]
if len(image_files) == 0:
print("폴더에 tif 이미지 파일이 없습니다.")
else:
# 첫 번째 이미지 파일 경로 설정
image_path = os.path.join(folder_path, image_files[0])
import porespy as ps
import openpnm as op
import imageio.v2 as imageio
import os
import scipy.ndimage as spim
import numpy as np
folder_path = r"C:/Users/user/Desktop/lab/포어 네트워크 모델/bentheimer_binary_image_cut_300_tif_invert"
file_names = [f for f in os.listdir(folder_path) if f.endswith('.tif')]
if len(file_names) == 0:
print("폴더에 tif 이미지 파일이 없습니다.")
else:
# 첫 번째 이미지 파일 경로 설정 및 읽기
binary_image_path = os.path.join(folder_path, file_names[0])
binary_image = imageio.imread(binary_image_path)
import openpnm as op
pn.add_model_collection(op.models.collections.geometry.spheres_and_cylinders)
pn.regenerate_models()
phase = op.phase.Phase(network=pn)
phase['pore.viscosity'] = 0.00001787
phase['pore.density'] = 1.165
phase.add_model_collection(op.models.collections.physics.basic)
phase.regenerate_models()
import openpnm as op
import numpy as np
coords = pn['pore.coords']
inlet = coords[:, 1] >= np.percentile(coords[:, 1], 99)
pn.set_label('top', pores=np.where(inlet)[0])
outlet = coords[:, 1] <= np.percentile(coords[:, 1], 1)
pn.set_label('bottom', pores=np.where(outlet)[0])
pore_mask = np.ones(pn.Np, dtype=bool)
clustering = op.topotools.find_clusters(network=pn, mask=pore_mask)
pore_clusters = clustering.pore_labels
print(f"pore_clusters: {pore_clusters}")
if not isinstance(pore_clusters, np.ndarray):
raise ValueError(f"pore_clusters는 배열이 아닙니다. 현재 타입: {type(pore_clusters)}")
elif pore_clusters.ndim != 1:
raise ValueError("pore_clusters 배열이 1차원이 아닙니다.")
largest_cluster = np.argmax(np.bincount(pore_clusters))
connected_pores = np.where(pore_clusters == largest_cluster)[0]
op.topotools.trim(network=pn, pores=np.where(pore_clusters != largest_cluster)[0])
flow = op.algorithms.StokesFlow(network=pn, phase=phase)
flow.set_value_BC(pores=pn.pores('top'), values=1)
flow.set_value_BC(pores=pn.pores('bottom'), values=0)
flow.run()
phase.update(flow.soln)
import numpy as np
import openpnm as op
flow = op.algorithms.StokesFlow(network=pn, phase=phase)
flow.set_value_BC(pores=pn.pores('top'), values=1)
flow.set_value_BC(pores=pn.pores('bottom'), values=0)
coords = pn['pore.coords']
left_pores = np.where(coords[:, 0] <= np.percentile(coords[:, 0], 5))[0]
right_pores = np.where(coords[:, 0] >= np.percentile(coords[:, 0], 95))[0]
flow.set_rate_BC(pores=left_pores, rates=0)
flow.set_rate_BC(pores=right_pores, rates=0)
flow.run()
phase.update(flow.soln)
import numpy as np
import openpnm as op
coords = pn['pore.coords']
inlet = coords[:, 1] >= np.percentile(coords[:, 1], 99)
outlet = coords[:, 1] <= np.percentile(coords[:, 1], 1)
pn.set_label('top', pores=np.where(inlet)[0])
pn.set_label('bottom', pores=np.where(outlet)[0])
Q = flow.rate(pores=pn.pores('top'), mode='group')[0]
A = (300 * 300) * resolution**2
L = 300 * resolution
Delta_P = 1
mu = 0.00001787
K = Q * L * mu / (A * Delta_P)
print(f'The value of K is: {K/0.98e-12*1000:.2f} mD')
Berea-Copy.pdf
bentheimer_binary_image_cut_300_tif_invert.zip
Beta Was this translation helpful? Give feedback.
All reactions