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)

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)

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)

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

compute()[source]
error_check()[source]
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) – with kernel size parameter for Gaussian derivatives (should be smaller than rho)

  • rho (float) – with 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, direction, solid_cutoff, side_bc='fs', first_order=True, inf_sup=0.2, pressure_driven=True, rel_tol=1e-08, abs_tol=1e-06, maxiter=10000, solver_type='bicgstab', prec_type=None, display_iter=16, export_path=None)[source]

Compute the permeability

Parameters
  • workspace (Workspace) – domain

  • direction (string) – direction for solve (‘x’,’y’, or ‘z’)

  • solid_cutoff (tuple(int, int)) – specify the solid phase

  • side_bc (string, optional) – side boundary conditions can be free slip (‘fs’), no slip (‘ns’) or periodic (‘p’)

  • first_order (bool, optional) – specify whether to use Stab. 1st order method or Taylor-Hood method

  • inf_sup (float, optional) – inf-sup parameter used in case first_order=True to stabilize the Q1-Q1 method

  • pressure_driven (bool, optional) – whether the permeability is to be computed using a pressure driven-flow or body force

  • rel_tol (float, optional) – relative tolerance for iterative solver

  • abs_tol (float, optional) – absolute tolerance for iterative solver

  • maxiter (int, optional) – maximum Iterations for solver

  • solver_type (string, optional) – solver type, options: ‘bicgstab’, ‘minres’, ‘gmres’, ‘direct’

  • prec_type (string, optional) – preconditioner type, options: ‘amg’, ‘sor’, ‘ilu’, ‘icc’ or None

  • display_iter (int, optional) – FEniCS progress print: 16 for what’s happening (broadly), 13 for what’s happening (in detail), 20 for information of general interest, 0 for printing off

  • export_path (string, optional) – export path for intermediary steps (mesh_facets, p, v). If None (default), no export

Returns

permeability, pressure field, velocity field

Return type

tuple(ndarray, 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

compute()[source]
error_check()[source]
generate_sources()[source]
log_input()[source]
log_output()[source]
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

compute()[source]
log_input()[source]
log_output()[source]
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)

pumapy.materialproperties.volumefraction

class pumapy.materialproperties.volumefraction.VolumeFraction(workspace, cutoff)[source]

Bases: object

compute()[source]
error_check()[source]
log_input()[source]
log_output()[source]
pumapy.materialproperties.volumefraction.compute_volume_fraction(workspace, cutoff)[source]

Compute the volume fraction

Parameters
  • workspace (Workspace) – domain

  • cutoff (tuple(int, int)) – to binarize domain

Returns

volume fraction

Return type

float