Code Monkey home page Code Monkey logo

bioreactordesign's Introduction

Bio Reactor Design (BiRD) Toolbox bird-CI bird-pyversion bird-pypi

Installation for developers

conda create --name bird python=3.10
conda activate bird
git clone https://github.com/NREL/BioReactorDesign.git
cd BioReactorDesign
pip install -e .

Installation for users

conda create --name bird python=3.10
conda activate bird
pip install nrel-bird

OpenFOAM solvers

Place the attached models in OFsolvers into the same arborescence in your $FOAM_APP directory. These compile with openFOAM-9

We provide a new drag model Grace, a new interfacial composition model Higbie and various other models which magnitude can be controlled via an efficiency factor *_limited

Meshing

Generate Stir tank mesh

inp=bird/meshing/stir_tank_mesh_templates/base_tank/tank_par.yaml
out=bird/meshing/stir_tank_case_templates/base/system/blockMeshDict

python applications/write_stir_tank_mesh.py -i $inp -o $out

Generates a blockMeshDict

Then activate openFoam environment (tested with OpenFoam9) and mesh with

blockMesh -dict system/blockMeshDict
stitchMesh -perfect -overwrite inside_to_hub inside_to_hub_copy
stitchMesh -perfect -overwrite hub_to_rotor hub_to_rotor_copy
transformPoints "rotate=((0 0 1)(0 1 0))":

Mesh visualized in Paraview

Generate STL mesh

python applications/write_stl_mesh.py -v -cr 0.25 -na 12 -aw 0.1 -al 0.5

Generates

Manual

usage: write_stl_mesh.py [-h] [-cr] [-na] [-aw] [-al] [-v]

Generate Spider Sparger STL

optional arguments:
  -h, --help            show this help message and exit
  -cr , --centerRadius
                        Radius of the center distributor
  -na , --nArms         Number of spider arms
  -aw , --armsWidth     Width of spider arms
  -al , --armsLength    Length of spider arms
  -v, --verbose         plot on screen

Block cylindrical meshing

Generates blockMeshDict in system

root=`pwd`
caseFolder=bird/meshing/block_cyl_cases_templates/case
mesh_temp=bird/meshing/block_cyl_mesh_templates/sideSparger

python applications/write_block_cyl_mesh.py -i $mesh_temp/input.json -t $mesh_temp/topology.json -o $caseFolder/system

Then activate openFoam environment (tested with OpenFoam9) and mesh with

cd $caseFolder
blockMesh
transformPoints "scale=(0.001 0.001 0.001)"
transformPoints "rotate=((0 0 1) (0 1 0))"
cd $root

Will generate this

How to change the dimensions or mesh refinement

All dimensions and mesh are controlled by the input file input.json. The input file can also be in .yaml format. The parser will decide the file format based on its extension. See bird/meshing/block_cyl_mesh_templates/baseColumn/ for an example of .yaml

How to change the arrangement of concentric cylinders

The block topology is controlled by the topology.json Always work with a schematic. Here is the schematic for this case

The purple blocks are walls (not meshed) and the white blocks are fluid blocks (meshed). The symmetry axis is indicated as a dashed line

In the topology.json, the purple blocks are defined as

"Walls": {
                "Support": [
                            {"R": 0, "L": 3},
                            {"R": 1, "L": 3}
                           ],
                "Sparger": [
                            {"R": 0, "L": 2},
                            {"R": 1, "L": 2},
                            {"R": 2, "L": 2}
                           ]
        }

How to change boundaries

Boundaries are defined with three types, top, bottom and lateral

In the case of sparger walls shown below with the red lines

the boundary is defined in the topology.json as

"Boundary": {
                "wall_sparger":[
                           {"type": "bottom", "Rmin": 2, "Rmax": 2, "Lmin": 2, "Lmax": 3},
                           {"type": "top", "Rmin": 0, "Rmax": 0, "Lmin": 1, "Lmax": 2},
                           {"type": "top", "Rmin": 1, "Rmax": 1, "Lmin": 1, "Lmax": 2},
                           {"type": "top", "Rmin": 2, "Rmax": 2, "Lmin": 1, "Lmax": 2}
                         ],
...

In the case of sparger inlet shown below with the red line

the boundary is defined in the topology.json as

"Boundary": {
                "inlet": [
                           {"type": "lateral", "Rmin": 2, "Rmax": 3, "Lmin": 2, "Lmax": 2}
                         ],
...

Manual

usage: write_block_cyl_mesh.py [-h] -i  -t  -o

Block cylindrical meshing

options:
  -h, --help            show this help message and exit
  -i , --input_file     Input file for meshing and geometry parameters
  -t , --topo_file      Block description of the configuration
  -o , --output_folder 
                        Output folder for blockMeshDict

Postprocess

Perform early prediction

python applications/earlyPredicition.py -df bird/postProcess/data_early

Generates

Manual

usage: early_prediction.py [-h] -df  [-func]

Early prediction

options:
  -h, --help            show this help message and exit
  -df , --dataFolder    Data folder containing multiple QOI time histories
  -func , --functionalForm 
                        functional form used to perform extrapolation

Plot conditional means

python applications/compute_conditional_mean.py -f bird/postProcess/data_conditional_mean -avg 2

Generates (among others)

usage: compute_conditional_mean.py [-h] -f  [-vert] [-avg] [--fl FL [FL ...]] [-n  [...]]

Compute conditional means of OpenFOAM fields

options:
  -h, --help            show this help message and exit
  -f , --caseFolder     caseFolder to analyze
  -vert , --verticalDirection 
                        Index of vertical direction
  -avg , --windowAve    Window Average
  --fl FL [FL ...], --field_list FL [FL ...]
                        List of fields to plot
  -n  [ ...], --names  [ ...]
                        names of cases

Formatting Code style: black Imports: isort

Code formatting and import sorting are done automatically with black and isort.

Fix imports and format : pip install black isort; bash fixFormat.sh

Spelling is checked but not automatically fixed using codespell

References

Coming soon

SWR-24-35 "BiRD (BioReactorDesign)"

Acknowledgments

This work was authored by the National Renewable Energy Laboratory (NREL), operated by Alliance for Sustainable Energy, LLC, for the U.S. Department of Energy (DOE) under Contract No. DE-AC36-08GO28308. This work was supported by funding from DOE's Bioenergy Technologies Office (BETO) program. The research was performed using computational resources sponsored by the Department of Energy's Office of Energy Efficiency and Renewable Energy and located at the National Renewable Energy Laboratory. The views expressed in the article do not necessarily represent the views of the DOE or the U.S. Government. The U.S. Government retains and the publisher, by accepting the article for publication, acknowledges that the U.S. Government retains a nonexclusive, paid-up, irrevocable, worldwide license to publish or reproduce the published form of this work, or allow others to do so, for U.S. Government purposes.

bioreactordesign's People

Contributors

malihass avatar hsitaram avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.