upxo.pxtal.fm_steel_3d.steps.steps_base_grain_structure module
Base Grain Structure – Part B of the FM Steel 3D walkthrough.
Two independent generation methods, both terminating in the same build_base step: Voronoi (a single nearest-seed tessellation, instant) and Monte Carlo (a Potts-model grain-growth simulation – one candidate grain structure per saved temporal slice, pick one afterward).
- upxo.pxtal.fm_steel_3d.steps.steps_base_grain_structure.generate_voronoi_lfi(nx, ny, nz, n_seeds, seed)[source]
Nearest-seed-argmin Voronoi tessellation – aperiodic, random seed placement only (periodic/regular seed layouts are not wired up anywhere in the pipeline today).
- Returns:
np.ndarray, shape (nx, ny, nz), dtype int32
- Return type:
1-indexed grain-ID field.
- upxo.pxtal.fm_steel_3d.steps.steps_base_grain_structure.run_mc_simulation(nx=50, ny=50, nz=50, q_states=10, mcsteps=100, save_interval=5, mcalg='300b', consider_boltzmann=True, boltzmann_temp_factor=0.01, print_interval=10, rng_seed=0, verbose=True)[source]
Runs a 3D Potts-model Monte Carlo grain-growth simulation.
nx/ny/nz are voxel counts (not physical dimensions); xmax/ymax/zmax are derived as n - 1 with unit increment (the MCGSConfig construction).
- Returns:
pxt (the mcgs_v2 simulation object. pxt.m lists saved temporal-slice)
indices; pxt.gs[t].s is the raw state array (shape (nz, ny, nx),
z-first) for slice t.
- upxo.pxtal.fm_steel_3d.steps.steps_base_grain_structure.extract_mc_tslice_lfi(pxt, tslice_key, connectivity=6, randomize_ids=True)[source]
Connected-component-labels one saved MC temporal slice into a grain-ID field, transposed into the (nx, ny, nz) axis order the rest of the pipeline expects (the raw MC state array is z-first).
- upxo.pxtal.fm_steel_3d.steps.steps_base_grain_structure.compute_morphology_stats(lfi)[source]
Full-structure morphology metrics (volume, surface area, neighbour counts, junction lines/points per grain), as used for the 3D grain structure morphology plots.
- Returns:
dict (geom_metrics_3d.all_metrics(lfi)’s own return value)
(keys include ‘vol’, ‘surf’, ‘jl’, ‘jp’, ‘nb_ids’).
- upxo.pxtal.fm_steel_3d.steps.steps_base_grain_structure.build_base(lfi, physical_dimensions, voxel_size, units='microns', connectivity=6, min_grain_nvoxels=-1, random_seed=None, verbosity=0)[source]
Terminal step shared by BOTH generation methods: wraps a raw grain-ID field into the pipeline’s foundation object.
- Return type: