Kernel dies after the .run #2683
-
Dear Team, good day. Many thanks for your previous response, it helped me to advance a little bit further, but i stuck again. Could you help me? My goal is to calculate the absolute permeability of the 3D Micro-CT image of sandstone, which i upload from the .TIF file (i attached this file in the .zip archive). The image has a size of 400x400x400 voxels, what seems to be not very large. I use the following code, and after .run my Jupyter Notebook kernel dies after 1 second. Dear Team, could you tell me if i am doing anything wrong here? Also, maybe you have some recommendations how i can make this process better? Maybe i should add or optimize anything for better/faster results? Here the code and the file in zip archive go With respect, Evgeny import torch
import openpnm as op
import porespy as ps
import numpy as np
import skimage.io as skio
import matplotlib.pyplot as plt
# import 3D bimary image (0 and 255 values) into the tensor and normalize it to 0 and 1 values
Image_3D = torch.tensor(skio.imread('berea.tif', plugin="tifffile")).unsqueeze(0).float()/255
voxel_size = 5.345e-6 # 5.345 micro meters
# Transfer 0 and 1 into the PoreSpy convention where 0 = grains and 1 = pores. Check with porosity function
# if everything is correct. Transfer the torch tensor into numpy array
Image_3D = 1 - Image_3D
print('Image_3D porosity', ps.metrics.porosity(Image_3D))
Image_3D = Image_3D[0].numpy()
# Extract the network with the PoreSpy and assign boundaries
snow_output = ps.networks.snow2(Image_3D, voxel_size=voxel_size)
snow_output = ps.networks.label_boundaries(snow_output.network, labels=[['left', 'right'], ['front', 'back'], ['top', 'bottom']])
# Put the extracted network into the OpenPNM
pn = op.io.network_from_porespy(snow_output)
# Determine the parameters of the network
pn['pore.diameter'] = pn['pore.equivalent_diameter']
pn['throat.diameter'] = pn['throat.inscribed_diameter']
pn.add_model_collection(op.models.collections.geometry.pyramids_and_cuboids)
pn.add_model(propname='throat.length', model=op.models.geometry.throat_length.cubes_and_cuboids)
pn.add_model(propname='throat.lens_volume', model=op.models.geometry.throat_volume.lens)
pn.add_model(propname='throat.total_volume', model=op.models.geometry.throat_volume.cuboid)
pn.add_model(propname='throat.volume', model=op.models.misc.difference, props=['throat.total_volume', 'throat.lens_volume'])
# Check the network for isolated and disconnected pores. Delete (trim) these pores
h = op.utils.check_network_health(pn)
op.topotools.trim(network=pn, pores=h['isolated_pores'])
h = op.utils.check_network_health(pn)
op.topotools.trim(network=pn, pores=h['disconnected_pores'])
# Determine the properties of the water and determine conductance
water = op.phase.Water(network=pn)
pn.add_model(propname='throat.hydraulic_size_factors', model=op.models.geometry.hydraulic_size_factors.pyramids_and_cuboids)
water.add_model(propname='throat.hydraulic_conductance',model=op.models.physics.hydraulic_conductance.hagen_poiseuille)
# Determine the Stocks Flow and boundary conditions
flow = op.algorithms.StokesFlow(network=pn, phase=water)
Pin, Pout = (101_325, 0)
flow.set_value_BC(pores=pn.pores('left'), values=Pin)
flow.set_value_BC(pores=pn.pores('right'), values=Pout)
# Check that before .run everything seems to work fine
print('Till this point no errors')
# Run the simulaiton
flow.run() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 13 replies
-
Can you clarify how far the script gets before crashing? Break it into separate cells and see which is the problem? |
Beta Was this translation helpful? Give feedback.
Can you clarify how far the script gets before crashing? Break it into separate cells and see which is the problem?