Configuration-based Multi-objective Bayesian Optimization on OpenFOAM cases with Ax-platform
Project description
Multi Objective Optimization on OpenFOAM cases
If you're using this piece of software, please care enough to cite it in your publications
Relying on ax-platform to experiment around 0-code parameter variation and multi-objective optimization of OpenFOAM cases.
Objectives and features
- Parameter values are fetched through a YAML/JSON configuration file. Absolutely no code should be needed, add parameters to the YAML file and they should be picked up automatically
- The no-code thing is taken to the extreme, through a YAML config file, you can (need-to):
- Specify the template case. This must be a "complete" (no placeholder), and runnable (as-is) OpenFOAM case.
- Specify how the case is ran. Locally, or on SLURM, and specifying the commands to run.
- Specify how/where parameters are substituted.
PyFoam
is used for this purpose for now. - Specify how your metrics are computed. These are just shell commands that output a single scalar
value to
STDOUT
.
How do I try this out?
Some examples, which range from simple and moderate levels of complexity, are provided as reference.
Strictly speaking, you don't need an OpenFOAM installation unless you are running a CFD case. You can always use your own code to evaluate the trials; but parameters must be passed through an OpenFOAM-like dictionary (See single-objective opt. example for inspiration.
# Install the package
pip install foambo
# Clone the repo to get the examples
git clone https://github.com/FoamScience/OpenFOAM-Multi-Objective-Optimization foamBO
cd foamBO/examples
Apptainer containers
If you'd like to try this out in Apptainer containers instead, It's recommended to
(Must have ansible
installed for this to work):
git clone https://github.com/FoamScience/openfoam-apptainer-packaging /tmp/of_tainers
git clone https://github.com/FoamScience/OpenFOAM-Multi-Objective-Optimization foamBO
cd foamBO
ansible-playbook /tmp/of_tainers/build.yaml --extra-vars="original_dir=$PWD" --extra-vars="@build/config.yaml"
# Get an apptainer container at containers/projects/foambo-<version>.sif
Each example has some description in its README:
- Single-Objective BO of a single-parameter function, ran locally
- Multi-Objective BO of a
pitzDaily
case, ran locally and on a SLURM Cluster - Multi-Objective BO of a
pitzDaily
case, ran on a SLURM cluster and providing "dependent parameters setup" variants.
Contribution is welcome!
By either filing issues or opening pull requests, you can contribute to the development of this project, which I would appreciate.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file foambo-0.1.2.tar.gz
.
File metadata
- Download URL: foambo-0.1.2.tar.gz
- Upload date:
- Size: 505.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20cdf34526da23c43865689a6c46afb757d4d7d7a7a5359e8b3b813dba4daa31 |
|
MD5 | 36944cd01408fbc4b7ba2040552f88d1 |
|
BLAKE2b-256 | fd9e99fd929844f49ea3def680ef81cfeedb9512d48c67dedfc1f7f19cefc94b |
File details
Details for the file foambo-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: foambo-0.1.2-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8475f1a17b77507bd5b0ee3940c618d2c6fa93a5ff0419a9c0b96b1c80addabe |
|
MD5 | 6b6eeba61f1303cd7874276e45064e0d |
|
BLAKE2b-256 | a52da6548a010da898d1cc01464ed5505a75226050249163299f421e2af773e5 |