Skip to content

Commit 7038d82

Browse files
authored
notebook as presented (#53)
1 parent 5eb1573 commit 7038d82

1 file changed

Lines changed: 59 additions & 21 deletions

File tree

notebooks/pluto-icmpbp-solvertest.jl

Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ md"""
4242
This code implements the model described in
4343
[Müller, R., Fuhrmann, J., & Landstorfer, M. (2020). Modeling polycrystalline electrode-electrolyte interfaces: The differential capacitance. Journal of The Electrochemical Society, 2020, 167(10), 106512](https://iopscience.iop.org/article/10.1149/1945-7111/ab9cca/meta) with surface charge boundary conditions in a symmetric cell and ion conservation constraint.
4444
45-
For the later, see e.g. H. Sugyioka, "Ion-Conserving Modified Poisson–Boltzmann Theory Considering a Steric Effect in an Electrolyte", Journal of the Physical Society of Japan, 2016, Vol. 85, No. 12, DOI [10.7566/JPSJ.85.124006](https://doi.org/10.7566/JPSJ.85.124006)
45+
For the later, see e.g. H. Sugioka, "Ion-Conserving Modified Poisson–Boltzmann Theory Considering a Steric Effect in an Electrolyte", Journal of the Physical Society of Japan, 2016, Vol. 85, No. 12, DOI [10.7566/JPSJ.85.124006](https://doi.org/10.7566/JPSJ.85.124006)
4646
4747
4848
"""
4949

5050
# ╔═╡ aa9cfb26-ad55-4f37-804a-b33b706e9427
5151
md"""
52-
### Poisson equation
53-
52+
## Poisson equation
53+
Domain: ``\Omega=(0,L)``
5454
```math
5555
-∇⋅(1+χ)ε_0∇φ = q(φ,p)
5656
```
@@ -70,6 +70,11 @@ y_α(φ,p)=y_α^E\exp\left(\frac{-z_αe}{k_BT}(φ- φ^E)-\frac{v_α}{k_BT}(p-p^E
7070
"""
7171

7272

73+
# ╔═╡ 4d571068-133f-4b1a-86f6-3225439652eb
74+
md"""
75+
## Parameters
76+
"""
77+
7378
# ╔═╡ 1facab2a-6ebf-492f-978f-2ace26b3bc4f
7479
md"""
7580
Here, for ``\alpha=1\dots N``, ``z_α`` are the charge numbers, and ``v_α=v_α^u + κ_α v_0`` are the effective molecular volumes, with solvation numbers ``κ_α`` and unsolvated molecular volumes ``v_α^u``.
@@ -92,19 +97,19 @@ y_α^E&=\frac{n_α^E}{n^E}
9297

9398
# ╔═╡ e89e4da3-a2e4-41a3-99d9-327a9b862d28
9499
md"""
95-
### Surface with given value of `q`
100+
## Surface with given charge `q`
96101
```math
97102
\begin{aligned}
98103
(1+χ)\varepsilon_0\nabla \phi|_{z=0} &= q\\
99-
(1+χ)\varepsilon_0\nabla \phi|_{z=L} &= -q
104+
-(1+χ)\varepsilon_0\nabla \phi|_{z=L} &= -q
100105
\end{aligned}
101106
```
102107
103108
"""
104109

105110
# ╔═╡ 63d99173-c779-4e72-b96f-15b27aec55cf
106111
md"""
107-
### Pressure equation
112+
## Pressure equation
108113
Pressure is calculated according to [J. Fuhrmann, “Comparison and numerical treatment of generalised Nernst–Planck models,” Computer Physics Communications, vol. 196, pp. 166–178, 2015.](https://dx.doi.org/10.1016/j.cpc.2015.06.004).
109114
110115
Starting with the momentum balance in mechanical equilibrium
@@ -118,23 +123,47 @@ by taking the divergence on both sides of the equation, one derives the pressure
118123
(\nabla p + q\nabla \varphi)\cdot \vec n &=0 & \text{on}\; \partial\Omega\\
119124
\end{aligned}
120125
```
121-
In order to obtain uniquness, the pressure in the center of the domain is set to zero:
126+
In order to obtain uniqueness, the pressure in the center of the domain is set to zero:
122127
```math
123128
p|_{x=\frac{L}2}=0
124129
```
125130
"""
126131

127132
# ╔═╡ bab7b779-339d-4702-a88a-e6cbf5a72cd0
128133
md"""
129-
### Ion conservation
134+
## Ion conservation
130135
131136
Ion conservation is expressed by the constraint
132137
```math
133-
\frac1{|\Omega|}\int\limits_\Omega n_α d\omega = n_α^{avg}\quad (α=1\dots N)
138+
\frac1{|\Omega|}\int\limits_\Omega n_α d\omega = n_α^{avg}\quad (α=1\dots N).
134139
```
135140
In order to implement this condition, the constraints (for ``α=1\dots N-1``) are added to the system, and the bulk molarities ``n_α^E`` are made variables with the electroneutrality constraint ``\sum\limits_{\alpha=1}^N z_α n_α^E =0`` .
136141
"""
137142

143+
# ╔═╡ 16a79117-e89b-4478-a571-8c011b5784c1
144+
md"""
145+
## Simulation result
146+
"""
147+
148+
# ╔═╡ 7caea4c4-9783-403c-931c-681f86166a25
149+
md"""
150+
## Next steps
151+
"""
152+
153+
# ╔═╡ 65c0b7fa-de4f-454e-ac63-2723d5acc26c
154+
md"""
155+
- Finalize pyiron integration
156+
- Discuss comparison with molecular simulation results
157+
- Add dielectric decrement model
158+
- Discuss additional molecular interactio terms
159+
- Write paper
160+
"""
161+
162+
# ╔═╡ 760e5861-7a6f-41bb-8aec-5e7466c6ec9f
163+
md"""
164+
## Simulation setup and run
165+
"""
166+
138167
# ╔═╡ f4facb34-1f4a-432d-8a1e-30299e542bcd
139168
begin
140169
const nm = ufac"nm"
@@ -149,6 +178,11 @@ end
149178
# ╔═╡ ae11bded-9f67-4004-8786-ed54e1ccb932
150179
surfcharge(n) = n * ph"e" / ufac"nm^2"
151180

181+
# ╔═╡ f75f1d3a-47e5-475b-97b1-bb275a510783
182+
md"""
183+
### Helper functions
184+
"""
185+
152186
# ╔═╡ dc05f31c-a28e-4470-8916-72dda567b149
153187
myround(x) = round(x, sigdigits = 4)
154188

@@ -297,12 +331,6 @@ function plotsol(
297331
end
298332

299333

300-
# ╔═╡ b062320f-644a-40d0-a7ba-6dcf0f9ee9bc
301-
surfcharge(n1_e)
302-
303-
# ╔═╡ ab92ab0a-0e2a-49a7-98d6-c8069efe85ff
304-
M1_avg * mol / dm^3 * N_A * ph"e" * L
305-
306334
# ╔═╡ eacdd772-1869-406a-b601-64cdd6453ec1
307335
begin
308336
data1 = ICMPBData(
@@ -320,32 +348,42 @@ sys1 = ICMPBSystem(grid, data1);
320348
inival1 = unknowns(sys1, data1);
321349

322350
# ╔═╡ d2df6ed0-e6f5-4677-b790-bfc40de7fd6a
323-
sol1 = solve(sys1; inival = inival1, damp_initial = 0.1, verbose = "n")
351+
sol1 = solve(sys1; inival = inival1, damp_initial = 0.1, verbose = "n", log=true)
352+
353+
# ╔═╡ 5f153fe4-4476-401e-8674-b6902213c19e
354+
md"""
355+
Newton steps: $(length(history(sol1)))
356+
"""
324357

325358
# ╔═╡ c7a08779-53f3-4fab-8bd4-3dffe6135c3b
326359
plotsol(sol1, sys1; Mscale)
327360

328361
# ╔═╡ Cell order:
329-
# ╟─ef660f6f-9de3-4896-a65e-13c60df5de1e
330362
# ╠═60941eaa-1aea-11eb-1277-97b991548781
363+
# ╟─ef660f6f-9de3-4896-a65e-13c60df5de1e
331364
# ╟─920b7d84-56c6-4958-aed9-fc67ba0c43f6
332365
# ╟─aa9cfb26-ad55-4f37-804a-b33b706e9427
366+
# ╟─4d571068-133f-4b1a-86f6-3225439652eb
333367
# ╟─1facab2a-6ebf-492f-978f-2ace26b3bc4f
334368
# ╟─275536e9-394d-4686-b37c-ef10a623b400
335369
# ╟─e89e4da3-a2e4-41a3-99d9-327a9b862d28
336370
# ╟─63d99173-c779-4e72-b96f-15b27aec55cf
337371
# ╟─bab7b779-339d-4702-a88a-e6cbf5a72cd0
372+
# ╟─16a79117-e89b-4478-a571-8c011b5784c1
373+
# ╟─5f153fe4-4476-401e-8674-b6902213c19e
374+
# ╟─c7a08779-53f3-4fab-8bd4-3dffe6135c3b
375+
# ╟─7caea4c4-9783-403c-931c-681f86166a25
376+
# ╟─65c0b7fa-de4f-454e-ac63-2723d5acc26c
377+
# ╟─760e5861-7a6f-41bb-8aec-5e7466c6ec9f
338378
# ╠═f4facb34-1f4a-432d-8a1e-30299e542bcd
379+
# ╠═2ef6b8d7-e5f3-4700-8a40-8feffab3569f
339380
# ╠═a629e8a1-b1d7-42d8-8c17-43475785218e
340381
# ╠═ae11bded-9f67-4004-8786-ed54e1ccb932
341-
# ╠═b062320f-644a-40d0-a7ba-6dcf0f9ee9bc
342-
# ╠═ab92ab0a-0e2a-49a7-98d6-c8069efe85ff
343-
# ╟─2ef6b8d7-e5f3-4700-8a40-8feffab3569f
344-
# ╠═c7a08779-53f3-4fab-8bd4-3dffe6135c3b
345382
# ╠═eacdd772-1869-406a-b601-64cdd6453ec1
346383
# ╠═8433319f-2f78-494c-9b2e-a5390cf93b00
347384
# ╠═70910bd5-b8ca-4021-9b40-233b50ea5601
348385
# ╠═d2df6ed0-e6f5-4677-b790-bfc40de7fd6a
386+
# ╟─f75f1d3a-47e5-475b-97b1-bb275a510783
349387
# ╠═dc05f31c-a28e-4470-8916-72dda567b149
350388
# ╠═f579cf2d-9511-48a8-bf11-7400ef76ee3d
351389
# ╠═000e87b5-cd1b-4b23-99be-6b7006502312

0 commit comments

Comments
 (0)