Skip to content

swip10/ZienkiFlowNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ZienkiFlowNet

Graph neural network predicting incompressible 2D Stokes/Navier–Stokes solutions (vx, vy, p) and the inlet flow rate Q from geometry only, trained on CFD reference solutions produced by the Zienki finite-element solver.

Layout

ZienkiFlowNet/
β”œβ”€β”€ GCNN/                 ← Python package
β”‚   β”œβ”€β”€ dataset.py
β”‚   β”œβ”€β”€ model.py
β”‚   β”œβ”€β”€ train.py
β”‚   β”œβ”€β”€ infer.py
β”‚   β”œβ”€β”€ evaluate.py
β”‚   β”œβ”€β”€ utils.py
β”‚   └── README.md
└── README.md

../cfd_database/          ← reference dataset (sibling, not tracked here)
└── cases/
    └── case_XXXX/
        β”œβ”€β”€ params.json
        β”œβ”€β”€ result.vtu
        └── result.post.json

The dataset directory is expected as a sibling of ZienkiFlowNet/. It can be overridden with --cases on the CLI.

Quickstart

PYBIN=/path/to/venv/bin/python
$PYBIN -m GCNN.dataset --build                # build cached PyG dataset
$PYBIN -m GCNN.train   --epochs 300           # train
$PYBIN -m GCNN.evaluate                       # evaluate on validation split
$PYBIN -m GCNN.infer   --case ../cfd_database/cases/case_0000

Architecture (current best, v5)

  • Encoder: per-node features (8 geom + 4 obs + 2 wall normal) + 16-dim Laplacian-eigenvector positional encoding (MLP_pos, MLP_spec heads).
  • Processor: 8 Γ— MeshGraphNet blocks + 8 Γ— CellBlock (FE-native TRI3 message-passing using P1 basis gradients), interleaved with global-token cross-attention and per-graph multi-head boundary cross-attention every two layers.
  • Decoder: per-node (vx_n, vy_n, p_n) + global head for Q.
  • Hard BC projection in scaled space: walls u=0, inlet p=1, outlet p=0.

Training regime

JEPA-style auto-supervision: a fraction of nodes carry the ground-truth field as input (context), the rest are masked (targets). The mask ratio anneals on a cosine schedule from 0.30 β†’ 1.00 over the training run, so the final epochs match the inference setting (pure geometry).

Losses: node MSE on targets + BC residual + global Q + scaled divergence on cells.

About

surrogate GCNN for numerical simulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages