diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54243aa..852dc07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: - '*.rst' - 'README*' - 'LICENSE' - - 'assets/*' + - 'docs/**' pull_request: branches: [main] @@ -17,7 +17,7 @@ on: - '*.rst' - 'README*' - 'LICENSE' - - 'assets/*' + - 'docs/**' jobs: Lint: diff --git a/README.md b/README.md index c7a4eaa..6d8301d 100644 --- a/README.md +++ b/README.md @@ -43,17 +43,17 @@ See the [nrel.github.io/BioReactorDesign](https://nrel.github.io/BioReactorDesig Software record [SWR 24-35](https://www.osti.gov/biblio/2319227) -To cite BioReactorDesign use these articles on [CO2 interphase mass transfer (open access)](https://arxiv.org/pdf/2404.19636) on [aerobic bioreactors](https://www.sciencedirect.com/science/article/pii/S0263876218304337) -and on [butanediol synthesis](https://www.sciencedirect.com/science/article/pii/S0263876223004689) -``` -@article{hassanaly2024inverse, - title={Bayesian calibration of bubble size dynamics applied to \ce{CO2} gas fermenters}, - author={Hassanaly, Malik and Parra-Alvarez, John M. and Rahimi, Mohammad J. and Sitaraman, Hariswaran}, - journal={Under Review}, - year={2024}, -} +To cite BiRD, please use these articles on [CO2 interphase mass transfer](https://doi.org/10.1016/j.cherd.2025.01.034) (open access [link](https://arxiv.org/pdf/2404.19636) ) on [aerobic bioreactors](https://doi.org/10.1016/j.cherd.2018.08.033) and on [butanediol synthesis](https://doi.org/10.1016/j.cherd.2023.07.031) +``` +@article{hassanaly2025inverse, + title={Bayesian calibration of bubble size dynamics applied to \ce{CO2} gas fermenters}, + author={Hassanaly, Malik and Parra-Alvarez, John M. and Rahimi, Mohammad J., Municchi, Federico and Sitaraman, Hariswaran}, + journal={Chemical Engineering Research and Design}, + year={2025}, + } + @article{rahimi2018computational, title={Computational fluid dynamics study of full-scale aerobic bioreactors: Evaluation of gas--liquid mass transfer, oxygen uptake, and dynamic oxygen distribution}, author={Rahimi, Mohammad J and Sitaraman, Hariswaran and Humbird, David and Stickel, Jonathan J}, diff --git a/applications/compute_kla_uq.py b/applications/compute_kla_uq.py new file mode 100644 index 0000000..6afec4f --- /dev/null +++ b/applications/compute_kla_uq.py @@ -0,0 +1,65 @@ +import argparse +import os + +from bird import BIRD_KLA_DATA_DIR +from bird.postprocess.kla_utils import compute_kla, print_res_dict + +parser = argparse.ArgumentParser(description="KLA calculation with UQ") +parser.add_argument( + "-i", + "--data_file", + type=str, + metavar="", + required=False, + help="data_file", + default=os.path.join(BIRD_KLA_DATA_DIR, "volume_avg.dat"), +) +parser.add_argument( + "-ti", + "--time_index", + type=int, + metavar="", + required=False, + help="column index for time", + default=0, +) +parser.add_argument( + "-ci", + "--conc_index", + type=int, + metavar="", + required=False, + help="column index for concentration", + default=1, +) +parser.add_argument( + "-no_db", + "--no_data_bootstrap", + action="store_true", + help="Do not do data bootstrapping", +) +parser.add_argument( + "-mc", + "--max_chop", + type=int, + metavar="", + required=False, + help="maximum number of early data to remove", + default=None, +) + +args, unknown = parser.parse_known_args() + +if args.no_data_bootstrap: + bootstrap = False +else: + bootstrap = True + +res_dict = compute_kla( + filename=args.data_file, + time_ind=args.time_index, + conc_ind=args.conc_index, + bootstrap=bootstrap, + max_chop=args.max_chop, +) +print_res_dict(res_dict) diff --git a/docs/source/postprocess.rst b/docs/source/postprocess.rst index 2dc49f8..d565694 100644 --- a/docs/source/postprocess.rst +++ b/docs/source/postprocess.rst @@ -51,5 +51,45 @@ Generates (among others) +Compute kLa with uncertainty estimates +------------ + +Based on the time-history of the concentration of a species, one can calculate kLa by fitting the function + +.. math:: + + (C^* - C_0) (1-\exp(-kLa (t-t_0)) + C_0 + +where :math:`C^*` is the equilibrium concentration (to be fitted), :math:`C_0` is the initial concentration, :math:`t` is time, :math:`t_0` is the initial time after which concentration is recorded + +Accurate estimates can be obtained if sufficient data is acquired. Otherwise, it may be useful to derive uncertainty estimates about :math:`C^*` and :math:`kLa` (the parameters fitted) + +This can be achieved with a Bayesian calibration procedure. The calibration is conducted by removing transient data, and by doing a data bootstrapping. The number of data to remove in the transient phase is automatically determined by examining how accurate is the fit. + + +.. code-block:: console + + python applications/compute_kla_uq.py -i bird/postprocess/data_kla/volume_avg.dat -ti 0 -ci 1 -mc 10 + +Generates + +.. code-block:: console + + Chopping index = 0 + Chopping index = 1 + Chopping index = 2 + Chopping index = 3 + Chopping index = 4 + Doing data bootstrapping + scenario 0 + scenario 1 + scenario 2 + scenario 3 + For bird/postprocess/data_kla/volume_avg.dat with time index: 0, concentration index: 1 + kla = 0.09005 +/- 0.0006387 + cstar = 0.3107 +/- 0.0006122 + Without data bootstrap + kla = 0.09014 +/- 0.0005957 + cstar = 0.3105 +/- 0.0005472 diff --git a/docs/source/references.rst b/docs/source/references.rst index 88ce3b5..5b32588 100644 --- a/docs/source/references.rst +++ b/docs/source/references.rst @@ -3,16 +3,16 @@ References Software record `SWR 24-35 `_ -To cite BiRD, please use these articles on `CO2 interphase mass transfer (open access) `_ on `aerobic bioreactors `_ and on `butanediol synthesis `_ +To cite BiRD, please use these articles on `CO2 interphase mass transfer `_ (open access `link `_ ) on `aerobic bioreactors `_ and on `butanediol synthesis `_ .. code-block:: console - @article{hassanaly2024inverse, + @article{hassanaly2025inverse, title={Bayesian calibration of bubble size dynamics applied to \ce{CO2} gas fermenters}, - author={Hassanaly, Malik and Parra-Alvarez, John M. and Rahimi, Mohammad J. and Sitaraman, Hariswaran}, - journal={Under Review}, - year={2024}, + author={Hassanaly, Malik and Parra-Alvarez, John M. and Rahimi, Mohammad J., Municchi, Federico and Sitaraman, Hariswaran}, + journal={Chemical Engineering Research and Design}, + year={2025}, }