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

Crystallization reaction module #112

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

sleweke
Copy link
Contributor

@sleweke sleweke commented Mar 29, 2022

Adds a reaction module for crystallization. The population balance is discretized using finite volumes. The "advection"-like growth is implemented by simple upwind fluxes. The integral is approximated by the midpoint quadrature rule.

  • Arbitrary crystal size bins
  • Growth
  • Growth dispersion
  • Analytic Jacobians
  • Validation / testing
  • Documentation
    • Crystallization
    • HighResKoren
  • Add unit tests
    • Create a python script that generates the low resolution reference solutions and should be stored here
    • Numerical reference test for crystallization in a DPFR
    • Numerical reference test for crystallization in a CSTR
    • Open issue to add tests of HighResKoren in another PR (Add tests for Koren reconstruction scheme #237)
    • Rebase onto master once Add CMake flags for compiler sanitizers and max AD directions #290 is merged and then increase number of AD directions for test build
    • Python script that creates EOC tests for crystallization in a CSTR and DPFR (basically the ones from the first paper, two settings there (one CSTR and one DPFR) should be enough)
  • Cleanup history to separate HighResKoren and Crystallization features
  • Rebase / resolving conflicts
  • include Sam as co-author in the corresponding squashed commits (in commit description add "Co-authored by: Samuel Leweke [email protected]")
  • was comment Crystallization reaction module #112 (comment) addressed ?

@sleweke
Copy link
Contributor Author

sleweke commented Oct 14, 2022

I've moved the computation of the WENO coefficients from the residualLiquidImpl() to outside the class. As the coefficients only depend on the _binSizes, we can compute them once at configuration time and store them.
This should have multiple advantages:

  • Required stack size decreases
  • Computation time decreases due to caching the values instead of recomputing them

Of course, I have not tested the changes. Sorry! You may want to make sure that I didn't break anything.

Another thing that caught my eye: Flux through left and right face are computed separately. But don't we have

flux right face of cell i == flux left face of cell i+1

So the idea is to use the flux value from the previous cell's right face as the flux through the current cell's left face. Then update the variable to the flux through the current cell's right face. This would again save a lot of computations.

@schmoelder

This comment was marked as outdated.

@WFlynnZ

This comment was marked as outdated.

src/libcadet/AutoDiff.hpp Outdated Show resolved Hide resolved
src/libcadet/HighResKoren.hpp Show resolved Hide resolved
src/libcadet/Weno.hpp Show resolved Hide resolved
@schmoelder

This comment was marked as outdated.

@schmoelder

This comment was marked as outdated.

@WFlynnZ

This comment was marked as outdated.

@schmoelder

This comment was marked as outdated.

schmoelder

This comment was marked as outdated.

@WFlynnZ WFlynnZ force-pushed the feature/crystallization branch 2 times, most recently from d097538 to ac250c7 Compare February 16, 2024 15:22
@WFlynnZ WFlynnZ force-pushed the feature/crystallization branch 3 times, most recently from 9adaa9b to 1b1e733 Compare February 28, 2024 06:38
@schmoelder
Copy link
Contributor

Hey @WFlynnZ we're currently cleaning up our project management pipeline and were wondering if you could update us on the current status of the crystallization module. What's missing and when can we expect this to be finished?

Hope all is well!

@WFlynnZ
Copy link
Collaborator

WFlynnZ commented Jul 8, 2024

I think last time @jbreue16 and I checked we are pretty much all set (for part I, part II will be in a different PR) for residual and jacobian tests for all terms implemented (I need to double check the HR Koren tests). @jbreue16 mentioned he has another idea on how we compare the test result with no analytical solutions and clean up the code to wrap things up? @jbreue16 Are we still on top of that?

jbreue16 pushed a commit that referenced this pull request Jul 9, 2024
Crystallization/Precipitation modelled by a population balance model is
implemented as a reaction module and thus made available in every unit
operation that supports reactions, specifically in a CSTR and a DPFR
(i.e. LRM without solid).

Co-authored-by: Samuel Leweke <[email protected]>
Copy link

github-actions bot commented Jul 9, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@jbreue16
Copy link
Contributor

jbreue16 commented Jul 9, 2024

Ive rebased the branch, resolved some conflicts and squahsed the commits into two. I've created a backup branch with the old commits here

@WFlynnZ can you make sure that the crystallization code still works by simply running one or two of your simulations.
@WFlynnZ you also need to sign the contributors license agreement as described above by the github bot.

I'll go through the documentation and tests to see if I can update/fix some things, some of which were already mentioned in the above conversation. Flynn and I will meet next week, discuss final changes and hopefully and finally merge the branch into master.

test/Crystallization.cpp Outdated Show resolved Hide resolved
@WFlynnZ
Copy link
Collaborator

WFlynnZ commented Jul 25, 2024

  • The CADET maintainers know my real name.

At least one of the following two applies:

  • The CADET maintainers know my current employer.

  • I am not making this contribution on behalf of my current employer.

@WFlynnZ
Copy link
Collaborator

WFlynnZ commented Jul 25, 2024

I have read the CLA Document and I hereby sign the CLA.

@WFlynnZ
Copy link
Collaborator

WFlynnZ commented Jul 27, 2024

Ive rebased the branch, resolved some conflicts and squahsed the commits into two. I've created a backup branch with the old commits here

@WFlynnZ can you make sure that the crystallization code still works by simply running one or two of your simulations.

I checked one simulation, it still works

@WFlynnZ you also need to sign the contributors license agreement as described above by the github bot.

Signed

@schmoelder schmoelder added this to the v5.0.0 "CADET-Core" milestone Aug 20, 2024
@schmoelder
Copy link
Contributor

It would be great if we could finalize this PR s.t. we can include it in v5.0.0 of CADET.

What's currently blocking the merge?

jbreue16 pushed a commit that referenced this pull request Sep 9, 2024
Crystallization/Precipitation modelled by a population balance model is
implemented as a reaction module and thus made available in every unit
operation that supports reactions, specifically in a CSTR and a DPFR
(i.e. LRM without solid).

Co-authored-by: Samuel Leweke <[email protected]>
jbreue16 pushed a commit that referenced this pull request Sep 9, 2024
Crystallization/Precipitation modelled by a population balance model is
implemented as a reaction module and thus made available in every unit
operation that supports reactions, specifically in a CSTR and a DPFR
(i.e. LRM without solid).

Co-authored-by: Samuel Leweke <[email protected]>
@jbreue16 jbreue16 mentioned this pull request Sep 9, 2024
jbreue16 pushed a commit that referenced this pull request Sep 10, 2024
Crystallization/Precipitation modelled by a population balance model is
implemented as a reaction module and thus made available in every unit
operation that supports reactions, specifically in a CSTR and a DPFR
(i.e. LRM without solid).

Co-authored-by: Samuel Leweke <[email protected]>
jbreue16 pushed a commit that referenced this pull request Sep 17, 2024
Crystallization/Precipitation modelled by a population balance model is
implemented as a reaction module and thus made available in every unit
operation that supports reactions, specifically in a CSTR and a DPFR
(i.e. LRM without solid).

Co-authored-by: Samuel Leweke <[email protected]>
Copy link
Contributor

@jbreue16 jbreue16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code can be merged after we have decided on the AD directions

WFlynnZ and others added 9 commits October 4, 2024 15:19
Crystallization/Precipitation modelled by a population balance model is
implemented as a reaction module and thus made available in every unit
operation that supports reactions, specifically in a CSTR and a DPFR
(i.e. LRM without solid).

Co-authored-by: Samuel Leweke <[email protected]>
Needed in Crystallization DPFR test, where Jacobian entries become
numerically challenging (ca. 1E24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants