PFC x vedo Post-processing Skill
Use this skill to turn PFC/DEM data into reproducible vedo visualizations: particles, contacts/force chains, cracks, vector fields, slices, and time-series animations.
Scope and Routing
Handle the visualization layer directly:
- Export or load particle/contact/crack/field data.
- Build vedo scenes with reproducible camera, colors, labels, scalar bars, resolution, and output paths.
- Produce publication-quality screenshots, MP4/GIF animations, and reusable Python scripts.
Route these parts elsewhere or ask for upstream details:
- Physical definitions such as Love-Weber stress, fabric tensor, crack classification criteria, or c/phi parameter extraction belong to the user's PFC modeling workflow, not this visualization skill.
- PFC
itasca object API details can differ by PFC version; verify method names before relying on them.
- AE/moment-tensor beachball interpretation is a separate AE post-processing topic; only render the exported locations/tensors here if already provided.
Default Workflow
- Identify the data path.
- If the user is inside PFC with
itasca, export a compact snapshot per step.
- If files already exist, inspect
.npz, .csv, .vtp, or folder naming before writing render code.
- Confirm or infer the schema.
- Typical arrays:
pos, rad, disp, vel, grp, c_p1, c_p2, c_fn, c_bonded, cr_pos, cr_nrm, cr_size, cr_type.
- For 2D models, promote coordinates to 3D by setting
z=0.
- Start lightweight.
- Sample large models (
[::N]), use low sphere resolution, or render points while tuning the camera and color scale.
- Switch to full-resolution spheres/tubes only after the view is stable.
- Make rendering reproducible.
- Write camera, color maps, scalar ranges, resolution, force sign convention, and output names into a config file or constants block.
- Use fixed global
vmin/vmax for animations so colors do not flicker frame to frame.
- Export useful outputs.
- Save scripts next to outputs, usually
balls_disp.png, force_chain.png, cracks.png, slice.png, and pfc_loading.mp4.
- Prefer
offscreen=True for batch rendering and automation.
Data Conventions
Use the schema in references/export-schema.md when creating or reading snapshots. If the user's files differ, adapt the loader and document the mapping in the script header.
Important checks:
- Units: PFC and vedo both use Cartesian coordinates; preserve SI units unless the user requests scaling.
- Force sign: confirm whether positive normal force means compression or tension for the user's PFC version/export.
- Normals: normalize crack normals before orienting discs.
- Empty arrays: contact/crack arrays may be empty early in a simulation; handle them without crashing.
Visualization Recipes
Read references/vedo-recipes.md when writing code for:
- Particles colored by displacement, velocity, stress, or group.
- Force chains as line/tube objects with width proportional to contact force.
- Cracks as oriented discs colored by tensile/shear class.
- Displacement/velocity vectors as arrows.
- Cut-away or thin-slice shear-band views.
Read references/animation.md when making time-series videos.
Publication Style
Use references/colormaps.md for default color choices:
- Sequential magnitudes:
viridis by default; jet only when the user wants high visual contrast.
- Diverging signed values:
coolwarm or RdBu, centered at zero.
- Classes/groups:
Set2 or explicit named colors.
Always include the scientific meaning of colors in scalar bars, legends, titles, filenames, or captions. Make compression/tension and tensile/shear conventions explicit because those are common sources of misinterpretation.
Common Pitfalls
- Too many particles: sample first, lower
Spheres(..., res=8-12), use Points, or render offscreen.
- Force-chain colors reversed: verify the contact normal force sign before labeling red/blue.
- Displacement invisible: arrow/deformation vectors usually need a scale factor.
- Animation flicker: fix camera and global scalar range.
- Crack discs point the wrong way: normalize normals and test one obvious crack before batch rendering.
- 2D data fails in vedo: promote
(x, y) to (x, y, 0) and render with viewup='z'.
First Response Pattern
When the user asks for PFC + vedo post-processing, ask only for missing essentials:
- Data source: running PFC/
itasca session or exported files?
- Target views: particles, force chains, cracks, vectors, slices, animation?
- PFC version and force sign convention if contacts are involved.
- Desired output folder, image resolution, and whether offscreen rendering is needed.
If the repository already contains scripts or snapshots, inspect them first and adapt existing style instead of starting from scratch.
Required Inputs
Ask for these if missing:
- exported particle/contact/crack/field files and their schema;
- target visualization type: particles, displacement, vectors, slices, force chains, cracks, or animation;
- coordinate units, scalar fields, and color/size mapping rules;
- required output formats such as PNG, SVG, PDF, MP4, or source CSV;
- whether outputs must match a paper style or project style guide.
Local Contents
references/animation.md: animation workflow and camera conventions.
references/colormaps.md: color mapping and semantic palette rules.
references/export-schema.md: expected export-file schemas.
references/vedo-recipes.md: reusable vedo plotting recipes.
1---2name: pfc-vedo-postprocess3description: Post-process and visualize ITASCA PFC/PFC2D/PFC3D DEM results with vedo. Use this skill whenever the user mentions PFC/DEM post-processing, particle rendering, force chains, crack visualization, displacement or velocity fields, shear-band slices, exported .npz/.vtp/.csv PFC data, or making publication-quality DEM figures and animations with vedo.4---56# PFC x vedo Post-processing Skill78Use this skill to turn PFC/DEM data into reproducible vedo visualizations: particles, contacts/force chains, cracks, vector fields, slices, and time-series animations.910## Scope and Routing1112Handle the visualization layer directly:13- Export or load particle/contact/crack/field data.14- Build vedo scenes with reproducible camera, colors, labels, scalar bars, resolution, and output paths.15- Produce publication-quality screenshots, MP4/GIF animations, and reusable Python scripts.1617Route these parts elsewhere or ask for upstream details:18- Physical definitions such as Love-Weber stress, fabric tensor, crack classification criteria, or c/phi parameter extraction belong to the user's PFC modeling workflow, not this visualization skill.19- PFC `itasca` object API details can differ by PFC version; verify method names before relying on them.20- AE/moment-tensor beachball interpretation is a separate AE post-processing topic; only render the exported locations/tensors here if already provided.2122## Default Workflow23241. Identify the data path.25 - If the user is inside PFC with `itasca`, export a compact snapshot per step.26 - If files already exist, inspect `.npz`, `.csv`, `.vtp`, or folder naming before writing render code.272. Confirm or infer the schema.28 - Typical arrays: `pos`, `rad`, `disp`, `vel`, `grp`, `c_p1`, `c_p2`, `c_fn`, `c_bonded`, `cr_pos`, `cr_nrm`, `cr_size`, `cr_type`.29 - For 2D models, promote coordinates to 3D by setting `z=0`.303. Start lightweight.31 - Sample large models (`[::N]`), use low sphere resolution, or render points while tuning the camera and color scale.32 - Switch to full-resolution spheres/tubes only after the view is stable.334. Make rendering reproducible.34 - Write camera, color maps, scalar ranges, resolution, force sign convention, and output names into a config file or constants block.35 - Use fixed global `vmin/vmax` for animations so colors do not flicker frame to frame.365. Export useful outputs.37 - Save scripts next to outputs, usually `balls_disp.png`, `force_chain.png`, `cracks.png`, `slice.png`, and `pfc_loading.mp4`.38 - Prefer `offscreen=True` for batch rendering and automation.3940## Data Conventions4142Use the schema in `references/export-schema.md` when creating or reading snapshots. If the user's files differ, adapt the loader and document the mapping in the script header.4344Important checks:45- Units: PFC and vedo both use Cartesian coordinates; preserve SI units unless the user requests scaling.46- Force sign: confirm whether positive normal force means compression or tension for the user's PFC version/export.47- Normals: normalize crack normals before orienting discs.48- Empty arrays: contact/crack arrays may be empty early in a simulation; handle them without crashing.4950## Visualization Recipes5152Read `references/vedo-recipes.md` when writing code for:53- Particles colored by displacement, velocity, stress, or group.54- Force chains as line/tube objects with width proportional to contact force.55- Cracks as oriented discs colored by tensile/shear class.56- Displacement/velocity vectors as arrows.57- Cut-away or thin-slice shear-band views.5859Read `references/animation.md` when making time-series videos.6061## Publication Style6263Use `references/colormaps.md` for default color choices:64- Sequential magnitudes: `viridis` by default; `jet` only when the user wants high visual contrast.65- Diverging signed values: `coolwarm` or `RdBu`, centered at zero.66- Classes/groups: `Set2` or explicit named colors.6768Always include the scientific meaning of colors in scalar bars, legends, titles, filenames, or captions. Make compression/tension and tensile/shear conventions explicit because those are common sources of misinterpretation.6970## Common Pitfalls7172- Too many particles: sample first, lower `Spheres(..., res=8-12)`, use `Points`, or render offscreen.73- Force-chain colors reversed: verify the contact normal force sign before labeling red/blue.74- Displacement invisible: arrow/deformation vectors usually need a scale factor.75- Animation flicker: fix camera and global scalar range.76- Crack discs point the wrong way: normalize normals and test one obvious crack before batch rendering.77- 2D data fails in vedo: promote `(x, y)` to `(x, y, 0)` and render with `viewup='z'`.7879## First Response Pattern8081When the user asks for PFC + vedo post-processing, ask only for missing essentials:82- Data source: running PFC/`itasca` session or exported files?83- Target views: particles, force chains, cracks, vectors, slices, animation?84- PFC version and force sign convention if contacts are involved.85- Desired output folder, image resolution, and whether offscreen rendering is needed.8687If the repository already contains scripts or snapshots, inspect them first and adapt existing style instead of starting from scratch.8889## Required Inputs9091Ask for these if missing:9293- exported particle/contact/crack/field files and their schema;94- target visualization type: particles, displacement, vectors, slices, force chains, cracks, or animation;95- coordinate units, scalar fields, and color/size mapping rules;96- required output formats such as PNG, SVG, PDF, MP4, or source CSV;97- whether outputs must match a paper style or project style guide.9899## Local Contents100101- `references/animation.md`: animation workflow and camera conventions.102- `references/colormaps.md`: color mapping and semantic palette rules.103- `references/export-schema.md`: expected export-file schemas.104- `references/vedo-recipes.md`: reusable vedo plotting recipes.105