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/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/contribute.rst b/docs/source/contribute.rst index 28c4c0f4..a11aba37 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 run lint-write + pixi run 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 run test + To run the regression tests .. code-block:: console diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 9316a180..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 +Installation of python package for developers (recommended) ------------ @@ -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 + 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