diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3cfac40..97492d36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,9 +36,9 @@ jobs: python-version: ${{matrix.python-version}} - name: Install dependencies run: | - pip install black - pip install isort - pip install codespell + pip install --upgrade pip + pip install black isort codespell + - name: Formatting and sorting import run: | source .github/linters/formatting.sh @@ -63,8 +63,8 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install . - pip install pytest + pip install .[test,post] + - name: Test preprocess run: | pytest tests/preprocess @@ -94,7 +94,7 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install nrel-bird + pip install nrel-bird[post] pip install pytest - name: Test run: pytest . diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 2f8f8eed..60b4eef5 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install sphinx sphinx_rtd_theme + pip install sphinx sphinx-rtd-theme - name: Build documentation run: | diff --git a/README.md b/README.md index f931da90..768a93cf 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ conda create --name bird python=3.10 conda activate bird git clone https://github.com/NREL/BioReactorDesign.git cd BioReactorDesign -pip install -e . +pip install -e .[all] ``` ## Installation of python package for users @@ -25,6 +25,12 @@ pip install -e . ```bash conda create --name bird python=3.10 conda activate bird +pip install nrel-bird[post] +``` + +If you do not need the post processing tools, please replace the last line with + +```bash pip install nrel-bird ``` diff --git a/bird/calibration/__init__.py b/bird/calibration/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bird/meshing/__init__.py b/bird/meshing/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bird/meshing/stirred_tank_mesh_templates/base_tank/tank_par.yaml b/bird/meshing/stirred_tank_mesh_templates/base_tank/tank_par.yaml index 3afc6376..e58ccd8a 100644 --- a/bird/meshing/stirred_tank_mesh_templates/base_tank/tank_par.yaml +++ b/bird/meshing/stirred_tank_mesh_templates/base_tank/tank_par.yaml @@ -1,23 +1,23 @@ geometry: - Dt: 0.26 # Tank diameter [m] - Da: 0.0866667 # Impleller tip Diameter [m] - H: 0.39 # Height of the reactor [m] - nimpellers: 1 - C: [0.0866667] # height of the center of impellers [m] - W: 0.026 # impeller blade width [m] - L: 0.013 # impeller blade length (beyond the hub) [m] - Lin: 0.013 # impeller blade length (inside the hub) - J: 0.026 # Baffle width - Wh: 0.0026 # Hub height (Width) - polyrad: 0.00866667 # Stem radius (R_shaft) - Z0: 0.0 # bottom of reactor - nbaffles: 6 # number of baffles and impeller fins + Dt: 0.26 # Tank diameter [m] + Da: 0.0866667 # Impleller tip Diameter [m] + H: 0.39 # Height of the reactor [m] + nimpellers: 1 + C: [0.0866667] # height of the center of impellers [m] + W: 0.026 # impeller blade width [m] + L: 0.013 # impeller blade length (beyond the hub) [m] + Lin: 0.013 # impeller blade length (inside the hub) + J: 0.026 # Baffle width + Wh: 0.0026 # Hub height (Width) + polyrad: 0.00866667 # Stem radius (R_shaft) + Z0: 0.0 # bottom of reactor + nbaffles: 6 # number of baffles and impeller fins mesh: - nr: 120 # mesh points per unit radial length - nz: 240 # mesh points per unit axial length - Npoly: 4 # mesh points in the polygon at the axis - Na: 6 # mesh points in the azimuthal direction + nr: 120 # mesh points per unit radial length + nz: 240 # mesh points per unit axial length + Npoly: 4 # mesh points in the polygon at the axis + Na: 6 # mesh points in the azimuthal direction diff --git a/bird/postprocess/__init__.py b/bird/postprocess/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bird/preprocess/__init__.py b/bird/preprocess/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bird/requirements.txt b/bird/requirements.txt deleted file mode 100644 index 789a560b..00000000 --- a/bird/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -numpy -prettyPlot -ruamel_yaml -numpy-stl==2.17.0 -scipy -corner -jax -numpyro>=0.16.1 diff --git a/bird/utilities/__init__.py b/bird/utilities/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bird/version.py b/bird/version.py index 4b814da6..7d5a455e 100644 --- a/bird/version.py +++ b/bird/version.py @@ -1,3 +1,3 @@ """Bio reactor design version""" -__version__ = "0.0.15" +__version__ = "0.0.16" diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 11a9e8fe..31d78ec8 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -14,7 +14,7 @@ Installation of python package for developers conda activate bird git clone https://github.com/NREL/BioReactorDesign.git cd BioReactorDesign - pip install -e . + pip install -e .[all] .. _installation_users: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..f17881f1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,83 @@ +[build-system] +requires = ["setuptools >= 64", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "nrel-bird" +version = "0.0.16" +description = "Bio Reactor Design (BiRD): a toolbox to simulate and analyze different designs of bioreactors in OpenFOAM" +readme = {file = "README.md", content-type = "text/markdown"} +authors = [ + {name = "Malik Hassanaly", email = "malik.hassanaly@nrel.gov"}, + {name = "Federico Municchi", email = "federico.municchi@nrel.gov"}, + {name = "Hariswaran Sitaraman", email = "hariswaran.sitaraman@nrel.gov"}, + {name = "Mohammad Rahimi", email = "mohammad.rahimi@nrel.gov"}, +] +license = {text = "BSD-3-Clause"} +requires-python = ">= 3.9" +classifiers=[ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +dependencies = [ + "numpy", + "prettyPlot", + "ruamel_yaml", + "numpy-stl", + "scipy", +] + + +[project.optional-dependencies] +post = [ + "corner", + "jax", + "numpyro>=0.16.1" +] +format = [ + "black", + "isort", + "codespell" +] +docs = [ + "sphinx", + "sphinx_rtd_theme" +] +test = [ + "pytest" +] +all = [ + "corner", + "jax", + "numpyro>=0.16.1", + "black", + "isort", + "codespell", + "sphinx", + "sphinx_rtd_theme", + "pytest", +] + + +[project.urls] +homepage = "https://github.com/NREL/BioReactorDesign" +documentation = "https://nrel.github.io/BioReactorDesign/" +repository = "https://github.com/NREL/BioReactorDesign" + +[tool.setuptools] +packages = ["bird", "bird.meshing", "bird.preprocess", "bird.postprocess", "bird.calibration", "bird.utilities"] +include-package-data = true + +[tool.setuptools.package-data] +bird = [ + "*.json", + "*.yaml", + "*.csv", + "data_conditional_mean", +] + diff --git a/setup.py b/setup.py deleted file mode 100644 index 54b1b67b..00000000 --- a/setup.py +++ /dev/null @@ -1,52 +0,0 @@ -import os - -from setuptools import setup - -here = os.path.abspath(os.path.dirname(__file__)) - -with open(os.path.join(here, "bird", "requirements.txt")) as f: - install_requires = f.readlines() - -with open(os.path.join(here, "README.md"), encoding="utf-8") as f: - readme = f.read() - -with open(os.path.join(here, "bird", "version.py"), encoding="utf-8") as f: - version = f.read() -version = version.split("=")[-1].strip().strip('"').strip("'") - -setup( - name="nrel-bird", - version=version, - description="Bio Reactor Design (BiRD): a toolbox to simulate and analyze different designs of bioreactors in OpenFOAM", - long_description=readme, - long_description_content_type="text/markdown", - url="https://github.com/NREL/BioReactorDesign", - author="Malik Hassanaly", - license="BSD 3-Clause", - package_dir={"bird": "bird"}, - classifiers=[ - "Intended Audience :: Science/Research", - "License :: OSI Approved :: BSD License", - "Natural Language :: English", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - ], - package_data={ - "": [ - "*requirements.txt", - "*.json", - "*.yaml", - "*.csv", - "data_conditional_mean", - ] - }, - project_urls={ - "Documentation": "https://nrel.github.io/BioReactorDesign/", - "Repository": "https://github.com/NREL/BioReactorDesign", - }, - include_package_data=True, - python_requires=">=3.9", - install_requires=install_requires, -) diff --git a/tests/preprocess/test_stl_patch.py b/tests/preprocess/test_stl_patch.py index 6ed831cf..e9c5fafc 100644 --- a/tests/preprocess/test_stl_patch.py +++ b/tests/preprocess/test_stl_patch.py @@ -5,10 +5,10 @@ from bird import BIRD_PRE_PATCH_TEMP_DIR from bird.meshing._mesh_tools import parseJsonFile from bird.preprocess.stl_patch.stl_bc import write_boundaries -from bird.utilities.stl_plotting import plotSTL, pretty_labels +from bird.utilities.stl_plotting import plotSTL, plt, pretty_labels -def test_spider_sparger(): +def test_spider_sparger(verbose=False): input_dict = parseJsonFile( os.path.join(BIRD_PRE_PATCH_TEMP_DIR, "spider_spg/inlets_outlets.json") ) @@ -16,9 +16,11 @@ def test_spider_sparger(): # plot axes = plotSTL("inlets.stl") pretty_labels("x", "y", zlabel="z", fontsize=14, ax=axes) + if verbose: + plt.show() -def test_loop_reactor(): +def test_loop_reactor(verbose=False): input_dict = parseJsonFile( os.path.join( BIRD_PRE_PATCH_TEMP_DIR, "loop_reactor_expl/inlets_outlets.json" @@ -28,9 +30,14 @@ def test_loop_reactor(): # plot axes = plotSTL("inlets.stl") pretty_labels("x", "y", zlabel="z", fontsize=14, ax=axes) + # plot + axes = plotSTL("outlets.stl") + pretty_labels("x", "y", zlabel="z", fontsize=14, ax=axes) + if verbose: + plt.show() -def test_loop_reactor_branch(): +def test_loop_reactor_branch(verbose=False): input_dict = parseJsonFile( os.path.join( BIRD_PRE_PATCH_TEMP_DIR, "loop_reactor_branch/inlets_outlets.json" @@ -40,7 +47,14 @@ def test_loop_reactor_branch(): # plot axes = plotSTL("inlets.stl") pretty_labels("x", "y", zlabel="z", fontsize=14, ax=axes) + # plot + axes = plotSTL("outlets.stl") + pretty_labels("x", "y", zlabel="z", fontsize=14, ax=axes) + if verbose: + plt.show() if __name__ == "__main__": - test_spider_sparger() + test_spider_sparger(verbose=True) + test_loop_reactor(verbose=True) + test_loop_reactor_branch(verbose=True)