Training and models

A solved case becomes a grid, then weights, then a fast prediction. Training reads the mesh and the time-directory fields. It does not read the viewer files.

Pipeline

1SolveMass run
2ArtifactNative zip
3StageCartesian grid
4Trainweights/
5Predictsurrogate engine

Job artifact

Each job ships a native case zip. One field file looks like this.

results/openfoam_native.zip
├── constant/polyMesh/
│   ├── points
│   ├── faces
│   ├── owner
│   └── neighbour
├── 0.1/
│   ├── p          (or p_rgh)
│   ├── U
│   └── alpha.water
├── 0.2/
│   └── …
└── …
/* OpenFOAM time-dir field (p) — cell values */
dimensions      [0 2 -2 0 0 0 0];
internalField   nonuniform List<scalar>
4
(
1.02e5
1.01e5
9.98e4
9.95e4
);

Stage resamples onto a grid

Cell centres become a regular lattice. The model needs that grid.

Unstructured cells

Cartesian lattice

A staged sample

One sample is one run at one time: inputs plus field planes on the grid.

Logical sample

{
  "inputs": {
    "damHeight": 0.35,
    "Uinlet": 0.12
  },
  "simulation_time": 0.2,
  "run_index": 7,
  "grid": { "nx": 48, "ny": 32, "nz": 1 },
  "fields": {
    "p": [[1.02e5, 1.01e5, /* … nx */], /* … ny rows */],
    "U": [[[0.1,0,0], [0.12,0,0], /* … */], /* … */],
    "alpha.water": [[1, 1, 0, 0, /* … */], /* … */]
  },
  "bbox": { "min": [0, 0, 0], "max": [0.6, 0.4, 0.1] }
}

On disk

{
  "inputs": { "damHeight": 0.35, "Uinlet": 0.12 },
  "simulation_time": 0.2,
  "run_index": 7,
  "grid": { "nx": 48, "ny": 32, "nz": 1 },
  "storage": "npy",
  "fields_file": "run_7_t0.2.npy",
  "channels": ["p", "U_x", "U_y", "U_z", "alpha.water"],
  "coords_file": "coords.npy"
}

Same time, different input

Two input values at the same time produce different field maps. The picture is illustrative.

{ damHeight: 0.35 }
field at t=0.1
{ damHeight: 0.42 }
predicted field at t=0.1
{
  "engine": "surrogate",
  "model_id": "model_dam_fno_1",
  "inputs": { "damHeight": 0.42, "Uinlet": 0.10 },
  "simulation_time": 0.2
}

Train tensors

Samples pack into inputs and field channels, stored under the model id.

train.npz
  x: (N, n_inputs)
  y: (N, C, H, W)

models/{id}/staging/bundle.zip
models/{id}/weights/bundle.zip
{
  "x_keys": ["damHeight", "Uinlet", "simulation_time"],
  "y_channels": ["p", "U_x", "U_y", "U_z", "alpha.water"],
  "grid": { "ny": 32, "nx": 48 },
  "n_train": 80,
  "n_test": 20
}

Checklist

1Register

Pick the template, input parameters, output fields, and which runs train or test.

2Mass run

Sweep the inputs. Keep the native case zip, not a viewer-only export.

3Stage

A worker with the staging capability writes models/{id}/staging/.

4Train

A worker with the training capability writes models/{id}/weights/.

5Test

An optional hold-out checks the error.

6Predict

A surrogate run uses the trained model. The viewer still reads fields.

Related screens in this console: Models and Architecture. Mass runs and predictions stay in Forge.