From 0db5aa7ab06a801cd7be986775085429a103b999 Mon Sep 17 00:00:00 2001 From: Malik Date: Tue, 10 Mar 2026 07:41:26 -0600 Subject: [PATCH 1/4] add pixi regression test --- .github/workflows/ci.yml | 34 ++++++++++++ bird/version.py | 2 +- tutorial_cases/bubble_column_20L/run_pixi.sh | 57 ++++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100755 tutorial_cases/bubble_column_20L/run_pixi.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38c03595..5247c979 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -258,3 +258,37 @@ jobs: bash run.sh cd ../../ + Regression-Test-OF-pixi: + name: Regression-Test-OF-pixi (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ['ubuntu-22.04'] + defaults: + run: + shell: bash -l {0} + working-directory: ${{github.workspace}} + steps: + - uses: actions/checkout@v4 + - uses: gerlero/setup-openfoam@v1 + with: + openfoam-version: 9 + - name: Setup Pixi + uses: prefix-dev/setup-pixi@v0.9.4 + with: + pixi-version: v0.62.2 + cache: true + cache-write: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + - name: Compile solver + run: | + cd OFsolvers/birdmultiphaseEulerFoam + export WM_COMPILE_OPTION=Debug + ./Allwmake + cd ../../ + - name: Run bubble column tutorial + run: | + cd tutorial_cases/bubble_column_20L + bash run_pixi.sh + cd ../../ + diff --git a/bird/version.py b/bird/version.py index 4a789b30..a1dc9db8 100644 --- a/bird/version.py +++ b/bird/version.py @@ -1,3 +1,3 @@ """Bio reactor design version""" -__version__ = "0.0.53" +__version__ = "0.0.54" diff --git a/tutorial_cases/bubble_column_20L/run_pixi.sh b/tutorial_cases/bubble_column_20L/run_pixi.sh new file mode 100755 index 00000000..7794f5cb --- /dev/null +++ b/tutorial_cases/bubble_column_20L/run_pixi.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# Clean case +./Allclean + +set -e # Exit on any error +# Define what to do on error +trap 'echo "ERROR: Something failed! Running cleanup..."; ./Allclean' ERR + + +echo PRESTEP 1 +# Generate blockmeshDict +pixi run python ../../applications/write_block_cyl_mesh.py -i system/mesh.json -t system/topology.json -o system + +# Generate boundary stl +pixi run python ../../applications/write_stl_patch.py -i system/inlets_outlets.json + +# Generate species thermo properties +pixi run python ../../applications/write_species_thermo_prop.py -cf . + + +echo PRESTEP 2 +# Mesh gen +blockMesh -dict system/blockMeshDict +transformPoints "rotate=((0 0 1) (0 1 0))" +transformPoints "scale=(0.001 0.001 0.001)" + +# Inlet BC +surfaceToPatch -tol 1e-3 inlets.stl +export newmeshdir=$(foamListTimes -latestTime) +rm -rf constant/polyMesh/ +cp -r $newmeshdir/polyMesh ./constant +rm -rf $newmeshdir +cp constant/polyMesh/boundary /tmp +sed -i -e 's/inlets\.stl/inlet/g' /tmp/boundary +cat /tmp/boundary > constant/polyMesh/boundary + +# setup IC +cp -r 0.orig 0 +setFields + +# Scale +transformPoints "scale=(0.19145161188225573 0.19145161188225573 0.19145161188225573)" + +# Setup mass flow rate +# Get inlet area +postProcess -func 'patchIntegrate(patch="inlet", field="alpha.gas")' +postProcess -func writeCellVolumes +writeMeshObj + +echo PRESTEP 3 +pixi run python writeGlobalVars.py +cp constant/phaseProperties_pbe constant/phaseProperties + + +echo RUN +birdmultiphaseEulerFoam From 054cd9bacbd0f2deb73f3bfa28270d717e9c4771 Mon Sep 17 00:00:00 2001 From: Malik Date: Tue, 10 Mar 2026 09:55:21 -0600 Subject: [PATCH 2/4] add pixi doc --- docs/source/bubbleColumn.rst | 9 ++++++++- docs/source/quickstart.rst | 26 +++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/source/bubbleColumn.rst b/docs/source/bubbleColumn.rst index a6155877..f372fc5e 100644 --- a/docs/source/bubbleColumn.rst +++ b/docs/source/bubbleColumn.rst @@ -20,7 +20,14 @@ To simply run the entire tutorial, do: cd ${BCE_CASE} bash run.sh -This test is run as part of the continuous integration +If you use pixi, make sure to run ``pixi shell`` first or + +.. code-block:: console + + cd ${BCE_CASE} + bash run_pixi.sh + +These tests are run as part of the continuous integration Geometry ------------ diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 9316a180..ca740463 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -4,7 +4,7 @@ Quick start .. _installation_dev: -Installation of python package for developers +Installation of python package for developers (recommmended) ------------ @@ -18,6 +18,23 @@ Installation of python package for developers .. _installation_users: +Installation of python package for developers (with pixi) +------------ + +This requires installing pixi. If it is not available on your machine, follow `Pixi Installation `_ +Once installed, pixi does not require the conda environment creation and pip install gymnastics, and can be used as + +.. code-block:: console + + git clone https://github.com/NREL/BioReactorDesign.git + cd BioReactorDesign + pixi shell + +This will activate an environment for you (equivalent to ``pip install -e .``) +Alternatively to the ``pixi shell``, in any directory of BiRD, you can use ``pixi run python myscript.py`` instead of ``python myscript.py`` + +.. _installation_users: + Installation of python package for users ------------ @@ -64,3 +81,10 @@ Run an example cd tutorial_cases/bubble_column_20L bash run.sh +If you run with pixi + +.. code-block:: console + + cd tutorial_cases/bubble_column_20L + bash run_pixi.sh + From 236e1c5898688aa8ef6db0177b5d739e975832bc Mon Sep 17 00:00:00 2001 From: Malik Date: Tue, 10 Mar 2026 09:58:12 -0600 Subject: [PATCH 3/4] add pixi guidelines for test and contributing --- docs/source/contribute.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/source/contribute.rst b/docs/source/contribute.rst index 28c4c0f4..c039f55f 100644 --- a/docs/source/contribute.rst +++ b/docs/source/contribute.rst @@ -14,7 +14,15 @@ You can automatically enforce the formatting guidelines with pip install nox nox -s lint -- write + nox -s spell -- write +If you use pixi, you can run + +.. code-block:: console + + pixi shell + pixi lint-write + pixi spell-write Tests ------------ @@ -30,6 +38,15 @@ To run the unit tests cd ${BIRD_HOME}/../ pytest . +If you use pixi + +.. code-block:: console + + pixi shell + BIRD_HOME=`python -c "import bird; print(bird.BIRD_DIR)"` + cd ${BIRD_HOME}/../ + pixi test + To run the regression tests .. code-block:: console From e703ea663a361f10283d1253e9d23a510fd4d7c2 Mon Sep 17 00:00:00 2001 From: Malik Date: Tue, 10 Mar 2026 10:04:09 -0600 Subject: [PATCH 4/4] forgot the run + format --- docs/source/contribute.rst | 6 +++--- docs/source/quickstart.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/contribute.rst b/docs/source/contribute.rst index c039f55f..a11aba37 100644 --- a/docs/source/contribute.rst +++ b/docs/source/contribute.rst @@ -21,8 +21,8 @@ If you use pixi, you can run .. code-block:: console pixi shell - pixi lint-write - pixi spell-write + pixi run lint-write + pixi run spell-write Tests ------------ @@ -45,7 +45,7 @@ If you use pixi pixi shell BIRD_HOME=`python -c "import bird; print(bird.BIRD_DIR)"` cd ${BIRD_HOME}/../ - pixi test + pixi run test To run the regression tests diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index ca740463..e0aeff19 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -4,7 +4,7 @@ Quick start .. _installation_dev: -Installation of python package for developers (recommmended) +Installation of python package for developers (recommended) ------------