PKR Core
Feature Deep Dive 4 min read

Three structures, generated, measured, and imaged without leaving HTTP

No browser, no local solver, no files moved by hand: one script talks to the PKR Core API over HTTP and comes back with three microstructures, their effective properties, cross section images, and a sweep chart. Everything below is what that run actually returned.

  • Build Structures
  • Analyze Properties
  • Automate Workflows
Cross section of a particle-packed structure returned by the API, filler particles in one colour against pore space.

What you can do

The web app is one client of the PKR Core API, not a privileged one. Anything the workspace does — generate a structure, analyze it, cut a cross section, sweep a parameter — is an HTTP call you can make yourself. That matters if you want PKR Core inside a notebook, a nightly job, or an agent loop rather than a tab.

  • GET /api/v1/examples returns ready-made recipes, so nothing has to be hard-coded in the caller.
  • GET /api/v1/materials returns the material constants, including thermal conductivity.
  • POST /api/v1/generate builds the structure and, with storeStructure, keeps it server-side under an id.
  • The analyses, the metrics, and the image export all accept that id instead of a fresh copy of the voxels.

One structure, uploaded once

A 64³ grid is 262,144 voxels. Re-sending that array with every analysis is what pushes a request body past the size limit, and it gets worse fast — 160³ is over four million. So the run registers each structure once with storeStructure: true and passes the returned structureId to everything downstream. The request bodies after the first are a few hundred bytes.

curl -X POST https://api.pakericore.app/api/v1/generate \
  -H "authorization: Bearer $PAKURI_TOKEN" \
  -H "content-type: application/json" \
  -d '{"recipe": {...}, "storeStructure": true}'
# -> { "structureId": "...", "structureSummary": {...}, "elapsedMs": 349 }

The three recipes come from GET /api/v1/examples with two edits: the grid is set to 64³ and the packings are raised to 45 % solid at 15 % particle overlap. The example recipes sit at 12 %, where the solid phase does not span the box and every effective property comes back as zero — a correct answer to an uninteresting question.

What came back

Eighteen calls, 10.3 seconds of wall clock for the whole thing. Conductivity is the reduced graph-network solver with a 30 W/m·K solid (Ceramic / alumina, from the materials endpoint); permeability is the pore-network solver.

StructureGenerateSolid fractionConductivity (W/m·K)Permeability (µm²)
Particle packing349 ms0.45019.210.258
Fiber packing673 ms0.45021.460.236
Foam-like226 ms0.36521.407.43

The foam is the odd one out in both columns, and for the same reason: its solid is one continuous phase rather than a pile of touching spheres, and its pore space is open. It carries slightly more heat than the packings despite being 8 points less dense, and it passes fluid roughly thirty times more easily.

Cross section at z=32 of the particle-packed structure: rounded solid particles filling most of the frame with pore space between them.
Particle packing, z = 32. POST /api/v1/export-image-stack with colorMode: "material" returns the slices as PNGs inside a ZIP — the server draws them, not the client.
Cross section at z=32 of the fiber-packed structure, showing fiber cross sections cut at many angles.
Fiber packing at the same slice. Fibers cut obliquely read as elongated blobs.
Cross section at z=32 of the foam-like structure, showing rounded open cells in a connected solid.
Foam-like: one connected solid phase around open cells, which is what the transport numbers reflect.

A sweep, and its chart, from one request

POST /api/v1/parametric-study takes a base recipe plus a list of overrides and runs the batch server-side. Asking for trendChart adds a standalone SVG to the response, so the caller gets a plot without a charting library. Five volume fractions from 15 % to 55 %, all five plotted, none skipped.

Scatter plot of porosity against volume fraction for five cases, falling from about 0.85 at 15 percent to about 0.45 at 55 percent.
The trend chart exactly as the API returned it. Points only — the plot deliberately never draws a fitted or interpolated line through them.

Where it stopped

The same run at 96³ is where the edges show. Generation stays quick — 1.0 s for the particle packing, 2.8 s for the fibers — and the pore-network permeability still answers, but the reduced conductivity solver has a ceiling on graph size and declines the larger structure. A reduced-order method buys its speed by working on a smaller object than the grid, and that object has a size beyond which the reduction stops paying for itself.

These numbers are what the reduced solvers returned, not ground truth. How far they can be trusted is a separate question, answered separately: the companion run checks the same API against cases whose answers are known in closed form.

Try it in PKR Core.

Open PKR Core