Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update post process doc #91

Merged
merged 4 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '*.rst'
- 'README*'
- 'LICENSE'
- 'assets/*'
- 'docs/**'

pull_request:
branches: [main]
Expand All @@ -17,7 +17,7 @@ on:
- '*.rst'
- 'README*'
- 'LICENSE'
- 'assets/*'
- 'docs/**'

jobs:
Lint:
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
65 changes: 65 additions & 0 deletions applications/compute_kla_uq.py
Original file line number Diff line number Diff line change
@@ -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)
40 changes: 40 additions & 0 deletions docs/source/postprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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


10 changes: 5 additions & 5 deletions docs/source/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ References

Software record `SWR 24-35 <https://www.osti.gov/biblio/2319227>`_

To cite BiRD, please 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>`_
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>`_


.. 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},
}


Expand Down