phipict.io.domain_io
Saving and loading of multi-block domains to/from .json + .npz files.
A domain is stored as a pair of files next to each other, <name>.json (the
structure: blocks, boundaries and settings) and <name>.npz (the tensors,
referenced by index from the JSON). Both functions take the path of the pair
without the extension, as a pathlib.Path:
save_domain(domain, Path("runs/case/domain")) # domain.json + domain.npz
domain = load_domain(Path("runs/case/domain"), dtype=torch.float64)
Saving is atomic per file and the two files carry a shared id, so a save that was interrupted (e.g. a killed job checkpointing) is detected on load instead of silently mixing an old structure with new tensors.
Module Attributes
|
Version of the file layout written by |
Functions
|
Convert a boundary index to its face string. |
|
Convert a boundary condition name to its type. |
|
Convert a boundary condition type to its name. |
|
Convert a saved tensor's dtype to its name. |
|
Load a domain saved with |
|
Save a domain to |