Skip to content

Conversation

@ronald-jaepel
Copy link
Contributor

@ronald-jaepel ronald-jaepel commented Jul 9, 2024

For models that include pH effects two use-cases can be interesting:

  1. Simulate the proton concentration (H+) as a component
  2. Simulate the pH (-log10(H+)) as a component

Option 1 is thermodynamically correct, but could lead to numerical precision problems if a pH of 10-14 is to be simulated as the concentration of H+ would be as low as 1e-14.
Option 2 leads to incorrect mixing results (a 1:1 mixture of pH 1 and pH 9 is not pH 5 but ~ pH 1.3) but is numerically easier and can still be useful if experiments with a constant pH are simulated.

As the CADET philosophy so far has been to give the user the choice, the suggestion is to add a switch parameter that decides if the model uses proton concentration or pH.

This PR is a starting point for that addition.

ToDos:

  • Decide on a good parameter name.
    • My suggestion is ###_USE_PROTON_CONCENTRATION or ###_CALCULATE_PH_FROM_PROTON_CONCENTRATION for the toggle and ###_INCLUDE_PH_COMPONENT for an optional flag for the models that can be used with or without pH dependence entirely. This is only a first attempt and open to change.
  • Extend the documentation
    • GIEX
    • Colloidal
    • Unified HIC (if merged before this is merged)
  • Extend the flux implementations
    • GIEX
    • Colloidal
    • Unified HIC (if merged before this is merged)
  • Extend the jacobian
    • GIEX
    • Colloidal
    • Unified HIC (if merged before this is merged)

…tration

Add the ###_USE_PROTON_CONCENTRATION flag, which if True sets component 1 to proton concentration and if False sets component 1 to pH (= -log10(proton concentration)).

For the colloidal binding, which can be used with or without pH effects entirely:
Rename the COL_USE_PH flag to COL_INCLUDE_PH, which if True treats component 1 as either pH or proton concentration and if False treats component 1 as a regular component.
@ronald-jaepel ronald-jaepel force-pushed the feature/pH_or_proton_concentration_switch branch from 0d44fd1 to 17b3179 Compare July 9, 2024 20:09
@ronald-jaepel ronald-jaepel self-assigned this Jul 9, 2024
@sleweke-bayer
Copy link
Contributor

The first option could benefit from component-specific solver tolerances (to be implemented...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants