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 bipolar membrane unit model and costing #1500

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

johnson12742
Copy link

@johnson12742 johnson12742 commented Oct 2, 2024

Fixes/Resolves:

(replace this with the issue # fixed or resolved, if no issue exists then a brief statement of what this PR does)

Summary/Motivation:

Adding the bipolar membrane unit model capability

Changes proposed in this PR:

  • Bipolar Electrodialysis 0-D unit model with a test. Heavily borrows from Electrodialysis 0-D.
  • Documentation for the Bipolar Electrodialysis 0-D unit model
  • Costing package for Bipolar Electrodialysis unit model. This is a slightly modified version of the electrodialysis costing. With bipolar there is a negative cost component (value addition)

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@johnson12742 johnson12742 marked this pull request as ready for review October 3, 2024 00:59
@lbianchi-lbl lbianchi-lbl added the Priority:Normal Normal Priority Issue or PR label Oct 3, 2024
Figure 1. Schematic representation of a bipolar electrodialysis unit


One bipolar membrane along with the **Acidate** and **Basate** channels can thus be treated as a modelling unit that can
Copy link
Contributor

Choose a reason for hiding this comment

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

Are acidate and basate typical terminology for BPMD?

Copy link
Author

Choose a reason for hiding this comment

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

They are not. I needed a name for the acid & base channel.
I went off diluted/ concentrated channel which are called diluate/concentrate (in ED documentation). Extrapolating from this I chose acidate/basate.

If anybody has better suggestion I am happy to use it.

Copy link
Contributor

Choose a reason for hiding this comment

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

In theory they are an acid concentrate and base concentrate (increasing in concentration), where the brine is a brine diluate (deceasing in concentration) based on the donation of ions toward the objective of the system, correct?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, they do increase concentration. But I think there is a subtle difference. BPMED increase concentration via production of new acid/base (through water splitting) and not by just transporting ions across the membranes. I feel like that deserved a distinction in nomenclature. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd go with either acid and base or acidic and basic.

Copy link
Author

@johnson12742 johnson12742 Oct 10, 2024

Choose a reason for hiding this comment

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

@adam-a-a That's reasonable. I have changed the names to Acidic & Basic

Copy link
Contributor

@adam-a-a adam-a-a left a comment

Choose a reason for hiding this comment

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

Here are some initial comments until I finish my pass

@@ -6,6 +6,7 @@ Unit Models

anaerobic_digester
aeration_tank
Biploar_electrodialysis_0D
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Biploar_electrodialysis_0D
bipolar_electrodialysis_0D

@@ -0,0 +1,340 @@
Bipolar Electrodialysis (0D)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great! While we're here, you should also add an rst file to describe costing, e.g.,: https://watertap.readthedocs.io/en/latest/technical_reference/costing/detailed_unit_model_costing.html

Copy link
Author

Choose a reason for hiding this comment

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

That's a good idea. However, I made some changes to the unit model costing and would like some feedback (before committing it to the docs).
While doing analysis I realised that a big component (negative cost/value addition) of the bipolar costing might be best done on the flowsheet level. So, I have removed it (in the most recent version).

As it stands the BPMED costing is very similar to the ED costing. The difference being the variable name for number of membranes. (cell_pair_num vs cell_num). Is there a way to inherit the ED costing?

Also, just for future reference I plan to add the bpmed + ED unit model (a configuration that is commonly used and something that I have been using for analysis). This would require minor alteration to the costing. It would be nice to know the capabilities/limits of the inheritance. Since that would inform whether I need a costing just for bipolar membrane.
I am happy to elaborate more on this issue.

@@ -0,0 +1,340 @@
Bipolar Electrodialysis (0D)
============================
Copy link
Contributor

@adam-a-a adam-a-a Oct 10, 2024

Choose a reason for hiding this comment

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

Looks like you updated the terminology to acidic and basic channels. One other place where this should be updated is in the png diagram.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. Somehow I missed that.

Comment on lines 22 to 24
ion and water transport across the membrane along with water splitting. Modelled transfer mechanisms include
electrical migration, diffusion of ions, osmosis, electroosmosis, and water splitting. The following are the key
assumptions made:
Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds great. A question that comes to mind is -- what notable mechanisms does the model not account for at this time (but technically could be based on latest literature)? I suggest creating an issue to track any such mechanisms so that we chart a path for future enhancement, whether that be by you or another developer later on.

Copy link
Author

Choose a reason for hiding this comment

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

@adam-a-a This is a good question. I actually faced the other problem. It was challenging finding the appropriate steady state equations for bipolar membrane (there are many equations/features for dynamic bipolar modelling but that's a can of worms for another day).
Even now there are some features (like the boundary layer details) that have not been added to the unit model because I can't find appropriate equations.


* The **acidic** and **basic** side channels have identical geometry.
* For each channel, component fluxes are uniform in the bulk solutions (the 0-dimensional assumption) and are set as the average of inlet and outlet of each channel.
* Steady state: all variables are independent on time.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Steady state: all variables are independent on time.
* Steady state: all variables are independent of time.

Comment on lines 40 to 41
* **acidic** channel
* **basic** side channel
Copy link
Contributor

Choose a reason for hiding this comment

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

Is one called acidic and the other called basic or basic_side? I'd remove "side" if not used in the attribute name to avoid confusion.


"Time", ":math:`t`", "[t] ([0])\ :sup:`1`"
"Phase", ":math:`p`", "['Liq']"
"Component", ":math:`j`", "['H\ :sub:`2` \O', 'Na\ :sup:`+`', 'Cl\ :sup:`-`', 'H\ :sup:`+`', 'OH\ :sup:`-`']"
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not yet clear whether this unit works with MCAS, the NaCl prop package, both, and/or other property models. Can you elaborate?

Copy link
Author

Choose a reason for hiding this comment

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

How do I check this? I took what the ED folks have been using and ran with it. So, theoretically whatever is applicable for the prop packages in the ED unit model should be applicable here (with the caveat that users should also supply H_+ and OH_- ).

Comment on lines 86 to 87
to fully solve the model. The exact degrees of freedom depend on the mode of operation. For the simplest case where no water
splitting occurs and the bipolar membrane acts like a simple electrodialysis memrbane these are:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
to fully solve the model. The exact degrees of freedom depend on the mode of operation. For the simplest case where no water
splitting occurs and the bipolar membrane acts like a simple electrodialysis memrbane these are:
to fully solve the model. The exact degrees of freedom depend on the mode of operation. For the simplest case, where no water
splitting occurs and the bipolar membrane acts like a simple electrodialysis membrane, these are:

ion_dict = {
"solute_list": ["Na_+", "Cl_-", "H_+", "OH_-"],
"mw_data": {
"H2O": 18e-3,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"H2O": 18e-3,
"H2O": 18e-3,

Note, you no longer need to supply MW for water anymore.

},
}

This model, by default, uses H\ :sub:`2`\ O as the solvent of the feed solution.
Copy link
Contributor

Choose a reason for hiding this comment

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

I probably should wait until I get to the code, but what happens when the user omits H_+ and OH_- from the solute_list? Would the unit model raise the appropriate exception? If so, and I may have missed it, you should add a note here stating that H2 and OH must be provided.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, the user needs to supply H_+ and OH_- . I have now added a note saying that it must be added.

…rrect error in water flux. Updated unit model and test (changes are minor)
…rrect error in water flux. Updated unit model and test (changes are minor) v1.1
…rrect error in water flux. Updated unit model and test (changes are minor) v1.2
…rrect error in water flux. Updated unit model and test (changes are minor) v1.2

"Component mass balance", ":math:`N_{j, in}^{acidic \: or\: basic}-N_{j, out}^{acidic\: or\: basic}+J_j^{acidic\: or\: basic} bl=0`", ":math:`j \in \left['H_2 O', '{Na^+} ', '{Cl^-} '\right]`"
"mass transfer flux, basic, solute", ":math:`J_j^{C} = -t_j^{bpem}\frac{\xi i_{lim}}{ z_j F}`", ":math:`j \in \left['{Na_+} ', '{Cl^-} '\right]`"
"mass transfer flux, acidic, Water ions", ":math:`J_j^{C} = \frac{i - i_{lim}}{ z_j F}`", ":math:`j \in \left['{H^+} '\right]`"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would annotate "Water ions" or replace them with "proton" and "hydroxide".

:math:`mol\, m^{-3}` and are taken to be constants. :math:`f(E)` is the second Wien effect driven enhanacidicent of the
dissociation rate under applied electric field. It requires as input temperature and relative permittivity (:math:`\epsilon_r`).
To close the model :math:`\lambda = E_{crit} \epsilon_0 \epsilon_r / (F \sigma)`

Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend tabulating these equations along others for easier following. It could be even better to tabulate them side by side with the catalysis-modeled scenario. I also recommend referencing them more precisely, i.e., annotating which eq is from which literature.

Copy link
Author

Choose a reason for hiding this comment

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

@lbibl This is a very good suggestion. I have rewritten the doc file to tabulate the equations (and correct some errors).


Bipolar electrodialysis, an electrochemical separation technology, has primarily been used to generate acids and bases
from waste salts produced in water purification. By providing in-situ access to valuable raw materials bipolar membranes can
significantly reduce the total cost of the operation. This cell stack is shown in Figure 1 with **basic** and **acidic** channels, that produce base and acid
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence somewhat puzzles me without specifying what is the "raw material" and what operation.

.. csv-table:: **Table 2.** List of Degree of Freedom (DOF)
:header: "Description", "Symbol", "Variable Name", "Index", "Units", "DOF Number \ :sup:`1`"

"Temperature, inlet_acidic", ":math:`T^acidic`", "temperature", "None", ":math:`K`", 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check the rst formatting in the printout throughout. For instance, it should probably be T^{acidic}, etc.


"mass transfer flux, acidic/basic, Water ions", ":math:`J_j^{C} = J_{diss}`", ":math:`j \in \left['{H^+, OH^-} '\right]`"
"mass transfer flux, acidic H\ :sub:`2`\ O", ":math:`J_j^{C} = t_w^{bpem} \left(\frac{i}{F}\right)+\left(L^{bpem} \right)\left(p_{osm}^CEM-p_{osm}^AEM \right)\left(\frac{\rho_w}{M_w}\right) - J_{diss}`", ":math:`j \in \left['H_2 O'\right]`"
"mass transfer flux, basic, H\ :sub:`2`\ O", ":math:`J_j^{C} = -t_w^{bpem} \left(\frac{i}{F}\right)-\left(L^{bpem} \right)\left(p_{osm}^CEM-p_{osm}^AEM \right)\left(\frac{\rho_w}{M_w}\right) - J_{diss}`", ":math:`j \in \left['H_2 O'\right]`"
Copy link
Contributor

Choose a reason for hiding this comment

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

Check formatting throughout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Normal Normal Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants