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

Features/chemical reaction #157

Closed
wants to merge 5 commits into from

Conversation

Golui
Copy link

@Golui Golui commented Jul 5, 2020

The aim here was to implement a chemical oxidation scheme for use in PySDM, based on the works of Dr. Anna Jaruga.

The code successfully implements a "dynamic" that manages the chemical reactions. The code is designed to be as modular as possible, with the intention of introducing other, different reaction types.

The main problem that the current implementation is facing (in the attached test) is the slow growth of the droplets, which causes them to be too concentrated for too long. This is a problem not only for numerical reasons, but also manifests due to the upper limit of how concentrated the droplets can be in order for the reaction to occur. Switching chemistry on and off can be seen on the graph as refractions in all curves.

The problem may be in the test setup. In particular, in the original work, Dr. Jaruga uses 1kg of dry air. PySDM does not seem to deal with such a mass; even with chemistry turned off, strange bends occur in the LWC curve and by extension, pH. What is more, with such mass, the droplets are never dilute enough to allow the chemistry to "start up". As such, the test currently uses 100kg of dry air.

At 100kg reasonable results can be abtained. However, they are still incompatible with what is presented in the work - the concentration of hydrogen ions coming from the starting compound is too high. This reveals a very low pH throughout the simulation. While in the work of Dr. Jaruga, the pH begins to increase strongly after about 200m (400s) and tends to a value of about 5, so in my simulations it is closer to 4, which means a 10-fold difference in concentration. Naturally, these results are not comparable due to the above difference in air mass. Ultimately, this suggests either a poor aerosol concentration, an incorrectly implemented pressure change (or lack thereof), or a problem with other microbiological parameters.

Another (possibly related) issue is the extremely fast consumption of all available sulfous dioxide, effectively preventing the chemical processes of interest from taking place.

This code was created as part of a course project for the course "Modelling of Atmospheric Clouds" at the Insitute of Mathematics and Computer Science, Jagiellonian University.

@slayoo slayoo self-requested a review July 5, 2020 17:57
@slayoo
Copy link
Member

slayoo commented Jul 5, 2020

Kudos! :)

@piotrbartman
Copy link
Collaborator

Nice!

@trontrytel
Copy link
Contributor

This is great! @Golui , @slayoo I can also take a look and see if I can help debugging this. I tried running your parcel model the other day but ran into some package issues. Did not have the time to figure out my way out of that.

From my experience the chemistry module is very attuned to the initial condition. This could be one problem.

Another issue could be that the chemical reactions in libcloudph++ are only done for selected droplets with wet radius significantly bigger than dry radius. This is to avoid problems in activation when dry radius (due to chemistry) is bigger than predicted wet radius in condensation. This is consistent with the fact that all of the chemistry formulation is only valid for diluted solutions. Here is the relevant code for this: https://github.com/igfuw/libcloudphxx/blob/0ebb8b1b2a5bc22f229ceecc587131d7259ae36b/src/impl/particles_impl_chem_react.ipp#L169-L203

This is all just me guessing based on the description provided in the PR. I will be able to help more when I can generate the LWP and pH plots.

@Golui
Copy link
Author

Golui commented Jul 7, 2020

Thank you for your insight @trontrytel!

It would indeed make sense that the problem lies in the setup of the system. Something that seems to be consistently happening in my case are droplets that are too concentrated. My pH plots are considerably steeper than the ones in your works.

Regarding the selection process, the way I handle this is how I believe it to be in libcloudph++. That is, I calculate the ionic strength of a droplet and I run chemistry on it iff it is below 0.02M (code here). Do note that in the actual code, my condition is the negation of what it is in libcloudph++. Please do let me know if I missed anything else.

@slayoo
Copy link
Member

slayoo commented Jul 7, 2020

Dzięki Aniu!

I'm pretty sure it is worth to start investigating with the air mass issue - IIUC, the mass of air should cancel out in all equations and should not have any impact on results in a parcel model, right?

@trontrytel
Copy link
Contributor

I'm pretty sure it is worth to start investigating with the air mass issue - IIUC, the mass of air should cancel out in all equations and should not have any impact on results in a parcel model, right?

Yes, you are right.

The two issues I mentioned were the ones that gave me the most problems. Anyhow, I'll come back here to help once I manage to run a PySDM simulation of my own.

@slayoo
Copy link
Member

slayoo commented Jul 7, 2020

The two issues I mentioned were the ones that gave me the most problems. Anyhow, I'll come back here to help once I manage to run a PySDM simulation of my own.

Aniu! Please note that there is a massive refactor of PySDM soon to be merged with #158.

@piotrbartman piotrbartman added this to the JOSS milestone Aug 5, 2020
@piotrbartman piotrbartman removed this from the JOSS milestone Sep 7, 2020
@slayoo slayoo closed this Jan 4, 2021
@slayoo slayoo reopened this Jan 4, 2021
@slayoo
Copy link
Member

slayoo commented Mar 9, 2021

closing as all the logic is now being worked on in #431
Kudos @Golui !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants