pymm.core.pymm module

Main script for pymm

class pymm.core.pymm.PymmConfig(length: float, width: float, thickness: float, grainMeaning: int, threshold: float, rescale: float, grainsSize: int, borderTol: float, grainsTol: float, lineWidth: float, channelWidth: float, meshSize: float, viscosity: float, diffusion: float, inletLocation: str, inletValue: float, tracerTime: float, tracerWrite: float, pressureConv: float, velocityConv: float, iterationsMax: int, tracerStep: float)

Bases: object

Central configuration object for pymm from TOML inputs

borderTol: float
channelWidth: float
diffusion: float
grainMeaning: int
grainsSize: int
grainsTol: float
inletLocation: str
inletValue: float
iterationsMax: int
length: float
lineWidth: float
meshSize: float
pressureConv: float
rescale: float
thickness: float
threshold: float
tracerStep: float
tracerTime: float
tracerWrite: float
velocityConv: float
viscosity: float
width: float
pymm.core.pymm._assign_boundary(point: ndarray[tuple[Any, ...], dtype[float64]], start_index: int, number_of_segments: int, reference_value: float, coordinate_index: int, target: list[int], wall: list[int]) int

Assign the boundary tags

pymm.core.pymm.boundary_tags_left_top(point: ndarray[tuple[Any, ...], dtype[float64]], pl: ndarray[tuple[Any, ...], dtype[float64]], pt: ndarray[tuple[Any, ...], dtype[float64]], bl: float, bt: float, wall: list[int]) tuple[list[int], list[int], int]

Assign the boundary left-top tags

pymm.core.pymm.boundary_tags_right_bottom(point: ndarray[tuple[Any, ...], dtype[float64]], start_index: int, pr: ndarray[tuple[Any, ...], dtype[float64]], pb: ndarray[tuple[Any, ...], dtype[float64]], bb: float, br: float, wall: list[int]) tuple[list[int], list[int]]

Assign the boundary right-bottom tags

pymm.core.pymm.copy_and_replace(src: Path, dst: Path, replacements: dict[str, Any]) None

Function to edit the OpenFOAM files

pymm.core.pymm.extract_borders(boundary: ndarray[tuple[Any, ...], dtype[float64]]) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], float, float, float, float]

Function to extract the borders of the image

pymm.core.pymm.main() None

Python for microsystems

pymm.core.pymm.make_figures(cfg: PymmConfig, fol: Path, im: ndarray[tuple[Any, ...], dtype[bool]], border: ndarray[tuple[Any, ...], dtype[bool]], cn_grains: list[ndarray[tuple[Any, ...], dtype[float64]]], cn_border: list[ndarray[tuple[Any, ...], dtype[float64]]]) ndarray[tuple[Any, ...], dtype[float64]]

Function to make figures with the extract grains and contours

pymm.core.pymm.pad_with(vector: ndarray[tuple[Any, ...], dtype[float64]], pad_width: tuple[int, int], _iaxis: int, kwargs: dict) None

Function to add extra border to later extract the image boundaries see https://numpy.org/doc/stable/reference/generated/numpy.pad.html

pymm.core.pymm.process_image(cfg: PymmConfig, fol: Path, mode: str, in_image: str) tuple[int, int, list[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]]

Function to process the input image

pymm.core.pymm.run_stokes(cfg: PymmConfig, fol: Path, pat: Path) None

Function to write the openFOAM files to run the Navier-Stokes flow simulations

pymm.core.pymm.run_tracer(cfg: PymmConfig, fol: Path, pat: Path) None

Function to write the openFOAM files to run the Tracer flow simulations

pymm.core.pymm.write_geo(cfg: PymmConfig, fol: Path, pat: Path, mode: str, gmsh: str, imH: int, imL: int, cn_grains: list[ndarray[tuple[Any, ...], dtype[float64]]], pl: ndarray[tuple[Any, ...], dtype[float64]], pt: ndarray[tuple[Any, ...], dtype[float64]], pr: ndarray[tuple[Any, ...], dtype[float64]], pb: ndarray[tuple[Any, ...], dtype[float64]], bdnL: list[int], bdnT: list[int], bdnR: list[int], bdnB: list[int], wall: list[int]) None

Function to write the Gmsh .geo file