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

Added titration method to solve for concentrations of a system of chemical species which produce a target pH #10

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

Conversation

dantruitt
Copy link

@dantruitt dantruitt commented Jun 12, 2023

This PR adds the following features:

  • conc_solve method takes a target pH value, and will search for concentrations of constituent species in a system which will attain the desired pH value. This implementation is much faster computationally speaking than running minimize on a function which in turn calls the .pHsolve method with its own minimization function.
  • cond_solve method approximates the conductivity of a system given some cubic regressions modelling how those species contribute to the conductivity of a solution. This may be slightly outside of the scope of what the pHcalc library really seeks to do, but for our application bundling this feature in with the pH calcs presents a lot of improvements.
  • conc_solve_cond takes a target conductivity value, and suggests molar concentrations of constituent species which will achieve that target conductivity (in mS / cm)
  • conc_solve_complete takes both target conductivity and pH, and will solve for a system of chemical species yielding those pH and conductivity values.

I tried to follow the style of the existing library, but may have deviated in some places. Please let me know if there are any stylistic notes that I should change. If the additional functionality relating to conductivity is not of interest to you, the pH buffer solution component is stable in the third commit of my branch, and everything relating to conductivity was added in the fourth commit.

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.

1 participant