Metadata-Version: 2.4
Name: foamnordic
Version: 1.0.6
Summary: Declarative orchestration for native OpenFOAM closure workloads
Keywords: OpenFOAM,CFD,HPC,machine learning,scientific computing
Author-Email: Hanseul Kang <hanseul.kang@aalto.fi>
License-Expression: GPL-3.0-only
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: C++
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Project-URL: Homepage, https://github.com/PentagonToy/FoamNordic
Project-URL: Documentation, https://github.com/PentagonToy/FoamNordic#readme
Project-URL: Issues, https://github.com/PentagonToy/FoamNordic/issues
Project-URL: Source, https://github.com/PentagonToy/FoamNordic
Project-URL: Changelog, https://github.com/PentagonToy/FoamNordic/blob/main/CHANGELOG.md
Requires-Python: <3.13,>=3.11
Requires-Dist: cmake>=3.20
Requires-Dist: cloudpickle<4,>=3
Requires-Dist: equinox<0.14,>=0.13.1
Requires-Dist: foamlib<2,>=1.7
Requires-Dist: jax<1,>=0.7
Requires-Dist: joblib<2,>=1.4
Requires-Dist: numpy<3,>=1.26
Requires-Dist: onnx<2,>=1.17
Requires-Dist: onsaemiro>=1.0.5
Requires-Dist: pyyaml<7,>=6
Requires-Dist: scikit-learn<2,>=1.4
Requires-Dist: scikit-learn-intelex<2027,>=2025.8; platform_system == "Linux" and platform_machine == "x86_64"
Description-Content-Type: text/markdown

# FoamNordic

FoamNordic is a native C++ and Python framework for ordinary OpenFOAM and machine-learning field programs, including equation-level closures. It keeps atomic field exchange, packing, scaling, and lifecycle in the native runtime while exposing a compact declarative API for cases, placement, launch, observations, and results.

> **Note:** The FoamNordic GitHub repository is temporarily private while the software is used in ongoing research and a related publication. The repository will be made public after the research is presented. PyPI distributions remain available in the meantime.

FoamNordic is active research software. Release notes and upgrade guidance are maintained in the [changelog](https://github.com/PentagonToy/FoamNordic/blob/main/CHANGELOG.md).

## Install

```console
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install foamnordic

# Load or enter the desired OpenFOAM environment once, then:
foamnordic build

foamnordic --version
foamnordic --help
foamnordic dir
foamnordic doctor
```

The same installation includes ONNX packaging, compiled and Joblib/scikit-learn models, and JAX/Equinox resident models. No backend-specific extra is required.

Binary wheels carry the native Python control runtime and compact OpenFOAM source build kit. `foamnordic build` compiles it for the currently loaded ABI; each case later selects that runtime from its declared `of_cmd` and `shell`. The build also prepares the native ONNX ModelHost and verified ONNX Runtime 1.28.0. Offline systems can point `FOAMNORDIC_ONNX_RUNTIME_ROOT` at an unpacked 1.28.0 distribution.

## First case

```python
from pathlib import Path
import foamnordic as fno

case = fno.OpenFOAM.Case(
    name="cavity",
    case_dir=Path("cases/cavity"),
    run_dir="output/cavity",
    of_cmd="module load openfoam/2512",  # macOS OpenFOAM.app: "openfoam"
    shell="bash",
)

# Use an existing cavity case with a blockMeshDict and initial fields.
case.initialize(ranks=1, mesh="blockMesh", validate_mesh=True)
print(case.fields.keys())

run = fno.Longship(case=case).launch()
run.summary()

result = run.stop()
post = result.postprocess
statistics = post.statistics(["U", "p"], time_idx=-1, verbose=True)
```

Paths may be strings, `pathlib.Path`, or text `PathLike` objects. FoamNordic uses `0/` when available and otherwise copies `0.orig/` to `0/` inside the isolated run without changing the source case.

## Platforms

- Linux `x86_64`
- Linux `aarch64`
- macOS Apple Silicon (`arm64`)

Native macOS development uses [OpenFOAM.app](https://github.com/gerlero/openfoam-app). It provides current OpenFOAM releases as Apple Silicon applications and Homebrew packages.

## Learn more

- [Project repository](https://github.com/PentagonToy/FoamNordic)
- [Installation and build guide](https://github.com/PentagonToy/FoamNordic#install)
- [Python run-control API](https://github.com/PentagonToy/FoamNordic/blob/main/docs/api/run-control-api.md)
- [Postprocess API](https://github.com/PentagonToy/FoamNordic/blob/main/docs/api/postprocess-api.md)
- [Native architecture](https://github.com/PentagonToy/FoamNordic/tree/main/docs/architecture)
- [License](https://github.com/PentagonToy/FoamNordic/blob/main/LICENSE)
