|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
scripts/grid.gen is the standalone structured-grid utility used by the grid.mode: grid_gen workflow and legacy grid conversion paths. This page documents what it can generate or convert directly, how its config files work, and how picurv wraps it.
Use grid.gen when you want:
.picgrid geometry instead of C-side programmatic_c geometry,.info) and visualization output (.vts).This is distinct from:
grid.mode: programmatic_c: geometry is generated inside the C runtime,grid.mode: file: an existing .picgrid file is staged and used directly.General form:
Examples from the current script interface:
grid.gen accepts both:
--config) for reusable defaults,CLI values override config-file values.
Common options (all grid types):
--config <file>--output <picgrid_path>--vts <vtk_path>--stats-file <info_path>--origin X Y Z--show-stats / --no-show-stats--write-vtk / --no-write-vtkGlobal stretching controls:
--stretch-i, --stretch-j, --stretch-k--first-cell-i-start, --first-cell-i-end--first-cell-j-start, --first-cell-j-end--first-cell-k-start, --first-cell-k-endGrid-type-specific options:
cpipe: --ncells-i, --ncells-j, --ncells-k, --side-lengths, --rc-factor, --straight-factor, --bend-angle, --orientationpipe: --ncells-phi, --ncells-r, --ncells-path, --diameter, --pinhole-factor, --rc-factor, --straight-factor, --bend-angle, --orientationwarp: --ncells-i, --ncells-j, --ncells-k, --bounds-x, --bounds-y, --bounds-z, --amp-A, --amp-B, --amp-Clegacy1d: --input, --axis-columns, --strict-trailing / --allow-trailingNotes for CFD users:
ncells-* are cell counts at input.cells + 1) after conversion.tests/test_cli_smoke.py.Current subcommands:
cpipe: bent pipe with a rectangular cross-sectionpipe: bent pipe with a circular cross-section (O-grid style)warp: generic warped Cartesian blocklegacy1d: legacy 1D-axis payload converter (headerless block + dims + x/y/z axis lists -> canonical PICGRID)These map to different geometric parameter sets inside grid.gen.
Reusable config files live naturally in config/grids/, but can also live beside a study for reproducibility snapshots.
Current shared example:
config/grids/coarse_square_tube_curved.cfgThe config file is INI-style:
[cpipe], [pipe], [warp])Typical contents include:
Depending on settings, grid.gen can emit:
.picgrid: solver-ingestible structured grid file.info: grid quality/statistics summary.vts: visualization helper for ParaViewgrid.gen also prints mesh-quality information to the console when enabled, including normalized warpage checks.
picurv wraps the generator through:
Current contract notes:
grid.generator.config_file is required today.picurv does not generate a temporary grid.cfg for grid.gen.grid.gen input dimensions (ncells_*, --ncells-*) are cell counts.grid.gen converts those to node counts before writing the .picgrid header.Behavior in picurv:
scripts/grid.gen,grid.run artifact for C-side ingestion.This means grid_gen remains a Python-side preprocessing workflow even though the final solver still receives a normalized file grid.
For grid.mode: file, picurv can call grid.gen legacy1d before normal grid staging:
Execution sequence:
grid.gen legacy1d --input <source_file> --output <run>/config/grid.converted.picgridgrid.run-grid_file <run>/config/grid.run to the C runtimeUse programmatic_c when:
Use file when:
.picgrid,Use grid_gen when:
.info/.vts outputs alongside the mesh.This page describes Grid Generator Guide: scripts/grid.gen within the PICurv workflow. For CFD users, the most reliable reading strategy is to map the page content to a concrete run decision: what is configured, what runtime stage it influences, and which diagnostics should confirm expected behavior.
Treat this page as both a conceptual reference and a runbook. If you are debugging, pair the method/procedure described here with monitor output, generated runtime artifacts under runs/<run_id>/config, and the associated solver/post logs so numerical intent and implementation behavior stay aligned.