pumapy.materialproperties¶
pumapy.materialproperties.conductivity¶
-
pumapy.materialproperties.conductivity.
compute_electrical_conductivity
(workspace, cond_map, direction, side_bc='p', prescribed_bc=None, tolerance=0.0001, maxiter=10000, solver_type='bicgstab', display_iter=True, print_matrices=(0, 0, 0, 0, 0))[source]¶ Compute the electrical conductivity
- Parameters
workspace (Workspace) – domain
cond_map (IsotropicConductivityMap or AnisotropicConductivityMap) – local constituents electrical conductivities
direction (string) – direction for solve (‘x’,’y’, or ‘z’)
side_bc (string, optional) – side boundary conditions can be symmetric (‘s’), periodic (‘p’) or dirichlet (‘d’)
prescribed_bc (ConductivityBC, optional) – 3D array holding dirichlet BC
tolerance (float, optional) – tolerance for iterative solver
maxiter (int, optional) – maximum Iterations for solver
solver_type (string, optional) – solver type, options: ‘bicgstab’, ‘cg’, ‘gmres’, ‘direct’
display_iter (bool, optional) – display iterations and residual
print_matrices (tuple(5 bools), optional) – corresponding to E, A, b, T, q decimal places. If 0, they are not printed
- Returns
electrical conductivity, potential field, flux
- Return type
tuple(tuple(float, float, float), ndarray, ndarray)
- Example
>>> import pumapy as puma >>> ws_fiberform = puma.import_3Dtiff(puma.path_to_example_file("200_fiberform.tif"), 1.3e-6) >>> ws_fiberform.matrix = ws_fiberform.matrix[50:150, 50:150, 50:150] >>> cond_map = puma.IsotropicConductivityMap() >>> cond_map.add_material((0, 89), 0.0257) >>> cond_map.add_material((90, 255), 12) >>> k_eff_x, P_x, q_x = puma.compute_electrical_conductivity(ws_fiberform, cond_map, 'x', 's', tolerance=1e-2, solver_type='cg') >>> print("Effective electrical conductivity tensor:") >>> print(k_eff_x)
-
pumapy.materialproperties.conductivity.
compute_thermal_conductivity
(workspace, cond_map, direction, side_bc='s', prescribed_bc=None, tolerance=0.0001, maxiter=10000, solver_type='bicgstab', display_iter=True, print_matrices=(0, 0, 0, 0, 0))[source]¶ Compute the thermal conductivity
- Parameters
workspace (Workspace) – domain
cond_map (IsotropicConductivityMap or AnisotropicConductivityMap) – local constituents themal conductivities
direction (string) – direction for solve (‘x’,’y’, or ‘z’)
side_bc (string, optional) – side boundary conditions can be symmetric (‘s’), periodic (‘p’) or dirichlet (‘d’)
prescribed_bc (ConductivityBC, optional) – 3D array holding dirichlet BC.
tolerance (float, optional) – tolerance for iterative solver
maxiter (int, optional) – maximum Iterations for solver
solver_type (string, optional) – solver type, options: ‘bicgstab’, ‘cg’, ‘gmres’, ‘direct’
display_iter (bool, optional) – display iterations and residual
print_matrices (tuple(5 bools), optional) – corresponding to b, E, A, T, q decimal places. If 0, they are not printed
- Returns
thermal conductivity, temperature field, flux
- Return type
tuple(tuple(float, float, float), ndarray, ndarray)
- Example
>>> import pumapy as puma >>> ws_fiberform = puma.import_3Dtiff(puma.path_to_example_file("200_fiberform.tif"), 1.3e-6) >>> ws_fiberform.matrix = ws_fiberform.matrix[50:150, 50:150, 50:150] >>> cond_map = puma.IsotropicConductivityMap() >>> cond_map.add_material((0, 89), 0.0257) >>> cond_map.add_material((90, 255), 12) >>> k_eff_x, T_x, q_x = puma.compute_thermal_conductivity(ws_fiberform, cond_map, 'x', 's', tolerance=1e-2, solver_type='cg') >>> print("Effective thermal conductivity tensor:") >>> print(k_eff_x)
pumapy.materialproperties.elasticity¶
-
pumapy.materialproperties.elasticity.
compute_elasticity
(workspace, elast_map, direction, side_bc='p', prescribed_bc=None, tolerance=0.0001, maxiter=10000, solver_type='bicgstab', display_iter=True, print_matrices=(0, 0, 0, 0, 0))[source]¶ Compute the thermal conductivity (N.B. 0 material ID in workspace refers to air unless otherwise specified)
- Parameters
workspace (Workspace) – domain
elast_map (ElasticityMap) – local elasticity of the constituents
direction (string) – direction for solve (‘x’,’y’, ‘z’, ‘yz’, ‘xz’, ‘xy’)
side_bc (string, optional) – side boundary conditions can be symmetric (‘s’), periodic (‘p’), dirichlet (‘d’) or free (‘f’)
prescribed_bc (ElasticityBC, optional) – 3D array holding dirichlet BC
tolerance – tolerance for iterative solver
maxiter (int, optional) – maximum Iterations for solver
solver_type (string, optional) – solver type, options: ‘bicgstab’, ‘cg’, ‘gmres’, ‘direct’
display_iter (bool, optional) – display iterations and residual
print_matrices (tuple(5 ints), optional) – corresponding to b, E, A, u, s decimal places. If 0, they are not printed
- Type
tolerance: float, optional
- Returns
elasticity, displacement field, direct stresses, shear stresses
- Return type
tuple(tuple(6 floats), ndarray, ndarray, ndarray)
- Example
>>> import pumapy as puma >>> export_name = 'halfmat' >>> X = 20 >>> Y = 20 >>> Z = 20 >>> ws = puma.Workspace.from_shape_value((X, Y, Z), 1) >>> ws[int(X / 2):] = 2 >>> elast_map = puma.ElasticityMap() >>> elast_map.add_isotropic_material((1, 1), 200, 0.3) >>> elast_map.add_isotropic_material((2, 2), 400, 0.1) >>> C, u, s, t = puma.compute_elasticity(ws, elast_map, direction='x', side_bc='f', solver_type="direct") >>> print(C)
-
pumapy.materialproperties.elasticity.
compute_stress_analysis
(workspace, elast_map, prescribed_bc=None, side_bc='p', tolerance=0.0001, maxiter=10000, solver_type='bicgstab', display_iter=True, print_matrices=(0, 0, 0, 0, 0))[source]¶ Compute the thermal conductivity (N.B. 0 material ID in workspace refers to air unless otherwise specified)
- Parameters
workspace (Workspace) – domain
elast_map (ElasticityMap) – local elasticity of the constituents
prescribed_bc (ElasticityBC, optional) – 3D array holding dirichlet BC
side_bc (string, optional) – side boundary conditions can be symmetric (‘s’), periodic (‘p’), dirichlet (‘d’) or free (‘f’)
tolerance (float, optional) – tolerance for iterative solver
maxiter (int, optional) – maximum Iterations for solver
solver_type (string, optional) – solver type, options: ‘bicgstab’, ‘cg’, ‘gmres’, ‘direct’
display_iter (bool, optional) – display iterations and residual
print_matrices (tuple(5 ints), optional) – corresponding to b, E, A, u, s decimal places. If 0, they are not printed
- Returns
displacement field, direct stresses, shear stresses ‘yz’, ‘xz’, ‘xy’
- Return type
tuple(ndarray, ndarray, ndarray)
pumapy.materialproperties.mean_intercept_length¶
-
pumapy.materialproperties.mean_intercept_length.
compute_mean_intercept_length
(workspace, void_cutoff)[source]¶ Computation of the mean intercept length
- Parameters
workspace (Workspace) – domain
void_cutoff (tuple(int, int)) – specify the void or gaseous phase of the domain
- Returns
mean intercept length in x,y,z
- Return type
tuple(float, float, float)
pumapy.materialproperties.orientation¶
-
class
pumapy.materialproperties.orientation.
OrientationST
(ws, sigma, rho, cutoff, edt)[source]¶ Bases:
object
-
pumapy.materialproperties.orientation.
compute_angular_differences
(matrix, orientation1, orientation2, cutoff)[source]¶ Compute angular difference between two orientation ndarrays
- Parameters
matrix (ndarray) – domain matrix
orientation1 (ndarray) – orientation as (x, y, z, 3)
orientation2 (ndarray) – orientation as (x, y, z, 3)
cutoff (tuple(int, int)) – to binarize domain
- Returns
angle_errors in degrees, mean, std
- Return type
tuple(ndarray, float, float)
-
pumapy.materialproperties.orientation.
compute_orientation_st
(ws, sigma, rho, cutoff, edt=False)[source]¶ Compute orientation of the material by the structure tensor algorithm
- Parameters
ws (Workspace) – domain
sigma (float) – kernel size parameter for Gaussian derivatives (should be smaller than rho)
rho (float) – kernel size parameter for Gaussian filter (should be bigger than sigma)
cutoff (tuple(int, int)) – which grayscales to consider
edt (bool) – indicating if we need to apply Euclidean Distance Transform before computing ST
- Returns
True if successful, False otherwise.
- Return type
bool
pumapy.materialproperties.permeability¶
-
pumapy.materialproperties.permeability.
compute_permeability
(workspace, solid_cutoff, tol=1e-08, maxiter=10000, solver_type='minres', display_iter=True)[source]¶ Compute the permeability using first order Q1-Q1 Finite Element solver and periodic BC on the sides
- Parameters
workspace (Workspace) – domain
solid_cutoff (tuple(int, int)) – specify the solid phase
tol (float, optional) – tolerance for iterative solver
maxiter (int, optional) – maximum Iterations for solver
solver_type (string, optional) – solver type, options: ‘minres’ (default), ‘direct’, ‘cg’, ‘bicgstab’
- Returns
permeability, velocity field
- Return type
tuple(ndarray, ndarray)
pumapy.materialproperties.radiation¶
-
class
pumapy.materialproperties.radiation.
Radiation
(workspace, cutoff, sources_number, degree_accuracy, void_phase, boundary_behavior, bin_density, rayexport_filepathname, export_plot)[source]¶ Bases:
object
-
pumapy.materialproperties.radiation.
compute_extinction_coefficients
(ws, rays_distances, sources_number, degree_accuracy, bin_density=10000, export_pathname=None)[source]¶
-
pumapy.materialproperties.radiation.
compute_radiation
(workspace, solid_cutoff, sources_number, degree_accuracy, void_phase=0, boundary_behavior=1, bin_density=10000, exportparticles_filepathname='', export_pathname=None)[source]¶ Compute the radiative thermal conductivity through ray tracing (N.B. 0 material ID in workspace refers to gas phases unless otherwise specified)
- Parameters
workspace (Workspace) – domain
solid_cutoff (tuple(int, int)) – specify the solid phase
sources_number (int) – number of light sources spread randomly in the void space (i.e. 0)
degree_accuracy (int) – angle difference between rays emitted in degrees (has to be an exact divider of 180°)
void_phase (int, optional) – ID of the void phase, defaulted as 0
boundary_behavior (int, optional) – how to treat particles exiting the domain: 0=kill, 1=periodic (default)
bin_density (int, optional) – number of bins used to create histogram of ray distances
exportparticles_filepathname (string, optional) – path and name of the particle files exported as VTK points
export_pathname (str, optional) – path to save curve plot of ray distance distribution
- Returns
extinction coefficient (beta), its standard deviation and of ray distances
- Return type
tuple(float, float, ndarray)
pumapy.materialproperties.surfacearea¶
-
class
pumapy.materialproperties.surfacearea.
SurfaceArea
(workspace, cutoff, flag_gaussian)[source]¶ Bases:
object
-
pumapy.materialproperties.surfacearea.
compute_surface_area
(workspace, cutoff, flag_gaussian=False)[source]¶ Computation of the surface area based on isosurface
- Parameters
workspace (Workspace) – domain
cutoff (tuple(int, int)) – specify the solid phase
flag_gaussian (bool, optional) – apply Gaussian filter before generating surface
- Returns
area, specific_area
- Return type
tuple(float, float)
pumapy.materialproperties.tortuosity¶
-
pumapy.materialproperties.tortuosity.
compute_continuum_tortuosity
(workspace, cutoff, direction, side_bc='p', prescribed_bc=None, tolerance=0.0001, maxiter=10000, solver_type='cg', display_iter=True)[source]¶ Compute the tortuosity modelling the local conductivity as isotropic
- Parameters
workspace (Workspace) – domain
cutoff (tuple(int, int)) – to binarize domain
direction (string) – direction for solve (‘x’,’y’, or ‘z’)
side_bc (string) – side boundary conditions (string) can be symmetric (‘s’), periodic (‘p’) or dirichlet (‘d’)
prescribed_bc (ConductivityBC) – 3D array holding dirichlet BC
tolerance (float) – tolerance for iterative solver
maxiter (int) – maximum Iterations for solver
solver_type (string) – solver type, options: ‘cg’, ‘bicgstab’, ‘direct’
display_iter (bool) – display iterations and residual
- Returns
tortuosity, diffusivity, porosity, concentration field
- Return type
tuple(tuple(float, float, float), float, float, ndarrya)