Solving Nernst-Planck Equations -Project Report-

Similar documents
Please bring the task to your first physics lesson and hand it to the teacher.

Math101, Sections 2 and 3, Spring 2008 Review Sheet for Exam #2:

Solving Quadratic & Higher Degree Equations

Section 4.6 Negative Exponents

Lesson 6-1: Relations and Functions

Math 111, Introduction to the Calculus, Fall 2011 Midterm I Practice Exam 1 Solutions

Descriptive Statistics (And a little bit on rounding and significant digits)

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Lines and Their Equations

T 1. The value function v(x) is the expected net gain when using the optimal stopping time starting at state x:

Solving Quadratic & Higher Degree Equations

C if U can. Algebra. Name

Solving Quadratic & Higher Degree Equations

DIFFERENTIAL EQUATIONS

Solve Systems of Equations Algebraically

5.5. The Substitution Rule

PHY 123 Lab 1 - Error and Uncertainty and the Simple Pendulum

Introduction to Algebra: The First Week

Solving with Absolute Value

Partial Fractions. June 27, In this section, we will learn to integrate another class of functions: the rational functions.

Chapter 1 Review of Equations and Inequalities

Answers for Calculus Review (Extrema and Concavity)

MATH 408N PRACTICE MIDTERM 1

Chapter 5 Simplifying Formulas and Solving Equations

Solution to Proof Questions from September 1st

of 8 28/11/ :25

How to Use Calculus Like a Physicist

Vectors Part 1: Two Dimensions

O.K. But what if the chicken didn t have access to a teleporter.

Lesson 21 Not So Dramatic Quadratics

Algebra & Trig Review

Experiment 1: The Same or Not The Same?

EQ: How do I convert between standard form and scientific notation?

Determinants in detail

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011

Math 5a Reading Assignments for Sections

A Level Maths summer preparation work

Lecture 5. 1 Review (Pairwise Independence and Derandomization)

STARTING WITH CONFIDENCE

Quadratic Equations Part I

MATH The Chain Rule Fall 2016 A vector function of a vector variable is a function F: R n R m. In practice, if x 1, x n is the input,

Polynomials; Add/Subtract

Infinite Limits. By Tuesday J. Johnson

CS103 Handout 22 Fall 2012 November 30, 2012 Problem Set 9

CHAPTER 7: TECHNIQUES OF INTEGRATION

Section 1.1. Chapter 1. Quadratics. Parabolas. Example. Example. ( ) = ax 2 + bx + c -2-1

base 2 4 The EXPONENT tells you how many times to write the base as a factor. Evaluate the following expressions in standard notation.

Lesson Plan by: Stephanie Miller

Algebra. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Business Statistics. Lecture 9: Simple Regression

One sided tests. An example of a two sided alternative is what we ve been using for our two sample tests:

Exploring Graphs of Polynomial Functions

One-to-one functions and onto functions

MITOCW watch?v=7q32wnm4dew

Math 31 Lesson Plan. Day 16: Review; Start Section 8. Elizabeth Gillaspy. October 18, Supplies needed: homework. Colored chalk. Quizzes!

Number Systems III MA1S1. Tristan McLoughlin. December 4, 2013

Where Is Newton Taking Us? And How Fast?

Study skills for mathematicians

MA 1128: Lecture 08 03/02/2018. Linear Equations from Graphs And Linear Inequalities

2, or x 5, 3 x 0, x 2

TA guide Physics 208 Spring 2008 Lab 3 (E-1): Electrostatics

CO6: Introduction to Computational Neuroscience

Getting Started with Communications Engineering

5.1 Simplifying Rational Expressions

Differential Equations

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Functions

18.085, PROBLEM SET 1 SOLUTIONS

Administrivia. Lab notebooks from Lab 0 are due at 2 PM in Hebb 42 at the start of Lab 1.

Mathematical induction

Partial Differential Equations Summary

Student Questionnaire (s) Main Survey

Generating Function Notes , Fall 2005, Prof. Peter Shor

Introduction. So, why did I even bother to write this?

Lesson Objectives: we will learn:

MATH 250 TOPIC 13 INTEGRATION. 13B. Constant, Sum, and Difference Rules

MITOCW ocw f99-lec30_300k

LECTURE 15: SIMPLE LINEAR REGRESSION I

CSE370 HW3 Solutions (Winter 2010)

Lesson 29: Newton's Law of Universal Gravitation

LAB 2 - ONE DIMENSIONAL MOTION

MI 4 Mathematical Induction Name. Mathematical Induction

AP Physics Ch 6 Day 4

ED 357/358 - FIELD EXPERIENCE - LD & EI LESSON DESIGN & DELIVERY LESSON PLAN #4

Vectors. A vector is usually denoted in bold, like vector a, or sometimes it is denoted a, or many other deviations exist in various text books.

2 Analogies between addition and multiplication

Big Bang, Black Holes, No Math

Edexcel AS and A Level Mathematics Year 1/AS - Pure Mathematics

Unit 1 Linear Models. Answer. Question. Model. Question. Answer. 3 Types of Models. Model: A simplified version of reality

Markov Chain Monte Carlo The Metropolis-Hastings Algorithm

Introduction - Motivation. Many phenomena (physical, chemical, biological, etc.) are model by differential equations. f f(x + h) f(x) (x) = lim

In this unit we will study exponents, mathematical operations on polynomials, and factoring.

Math Lab 8: Electric Fields Integrating Continuous Charge Distributions II Due noon Thu. Feb. 1 in class

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this.

The Derivative of a Function

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Quadratic Equations

Worksheet for Exploration 24.1: Flux and Gauss's Law

Sums of Squares (FNS 195-S) Fall 2014

Sequence convergence, the weak T-axioms, and first countability

General Technical Remarks on PDE s and Boundary Conditions Kurt Bryan MA 436

MATH 31B: BONUS PROBLEMS

EM Algorithm & High Dimensional Data

Transcription:

Solving Nernst-Planck Equations -Project Report- Leo Kim 23163058 Physics 210 05 December 2007 1

1 Introduction The first and ultimate goal of this project is solving Nernst-Planck equation numerically. I developed and expanded this topic from my old project topic, the simple diffusion equation. To be honest with you, as you already mentioned, it is very interesting but very ambitious. However, I did learn a lot from this project although I didn t accomplish what I intended to do in the first place. I used the various types of programs to do this project, including Maple, Mathematica, Excel, and many different kind of image tools. It is really hard to edit and produce the postscript files on the Window without any pro-programs such as Photoshop. Not only I learned and used various type of computer programs to fulfill the computational part of the course, but I also read different books to understand the actual physics behind it. This is the computational PHYSICS course, so I believe I actually need to understand the physics of my project. Moreover, I also believe that it is really important to do the physics topic which you feel interest about. For such a reason, this project gives me that bittersweet taste of the challenging but fun task. Basically, I did start from the scratch. The heart of my project is finite difference method which will solve the PDE numerically. I did sample examples for the certain wave and heat problems with finite difference method in Excel. Then I used Maple and Mathematica to write a code to solve PDE in such a way and plot them. For the last part, I actually tried to solve Nernst-Planck equation with Excel which turns out to be interesting. 2 Theory This section explains briefly about the Nernst-Planck equation, and finite difference method for PDE. Also, 2.1 Nernst-Planck equation Nernst-Planck equation can be thought as the advanced version of the simple diffusion equation because it describes the concentration change due to the properties of diffusion and effect of the electrostatics. And you can say it is more realistic as well because pretty much everything in our body has a net charge as an ion. Although, I did find the article which explains how to compute exact solution but even with that article[1] I did have some difficult time to understand the solution fully. As I already mention, PDE needs certain boundary conditions to be solved. I will choose closed system where no extra ions can be diffused in and out. Then I will use equation to find flux of anions and cations over long time and eventually they will be in equilibrium state. For this particular case, the Nernst-Planck equations[1] will be Φ a (x, t) = D a ( n a / x) (qd a n a /kt )( φ/ x), (1) Φ b (x, t) = D b ( n b / x) + (qd b n b /kt )( φ/ x), (2) 2

n a / t = Φ a / x, (3) n b / t = Φ b / x, (4) where n a is the number of cations per unit volume, Φ a is the flux of cations, n b is the number of anions per unit volume, Φ b is the flux of anions, φ is the electric potential, k is Boltzmann s constant, T is the absolute temperature, and D a and D b are the diffusion coefficients of the cations and the anions. q and -q are charge of cation and anion. However, this PDE is not simple to solve even though you use the computer program because it is non-linear PDE. But, you can apply the physical conditions, which is just described previously, you can get the linear PDE. 2 Φ/ x 2 = (4/ɛ)(n a n b ), (5) Equation (5) is the Poisson s equation which will take care of the potential term of the original Nernst-Planck equation. Then you need the boundary conditions. n a (0, t)/ x = 0, n b (0, t)/ x = 0, (6) n a (L, t)/ x = 0, n b (L, t)/ x = 0, (7) After sub-in the equation (5) to the original Nernst-Planck equation and applied equation (6) and (7) produce, n a / t = D a ( 2 n a / x 2 ) + (qd a n /kt )( 2 Φ/ x 2 ), (8) n b / t = D b ( 2 n b / x 2 ) + (qd b n /kt )( 2 Φ/ x 2 ), (9) where the n is the number of the ions in the equilibrium. However, you can neglect the effect of the potential terms due to the effect of the ionic screening[2]. Effect of the ionic screening introduces the co-ions around the charge which will make the electronic interaction be valid for within nano length so the potential terms have neglecting value. And finally, you get the equations in form, Equations to be solved by numerical method n a / t = D a ( 2 n a / x 2 ) αd a (n a n b ), (11) n b / t = D b ( 2 n b / x 2 ) + αd b (n a n b ),(12) where n a and n b are function of x and t. D a, D a, and α are constants. 2.2 The Finite Difference Method [3] Finite Difference Method is the main tool of my project. Its concept is quite simple but actual computation might take long and boring. There are two different ways to solve the heat or wave equation with this method. But, I will show only the heat equation since the simplified Nernst-planck equation indeed looks like the heat equation but Nernst-Planck equation has the extra coupled term. 3

First you have to choose the time and distance steps for the grid in which the the numerical solution of the certain equation will be found. Of course, you can decide the how big is the grid will be. And, yes if you can produce more grid, that will be better. It is same as you take more N for your normal numerical solution. Your discretization expression will find the value of the next layer of the grid then you can use that value to find the next upper layer value of the grid and so on. Now, this is time to do the discretization of the heat equation. The basic and general heat equations have first partial derivative respect to time and second partial derivative respect to the distance. Then discretization of each of term will be, u t (ih, jk) 1/k(u i,j+1 u ij ), (13) u xx (ih, jk) 1/h 2 (u i+1,j 2u ij + u i 1.j ), (14) where k is the time step and h is the distance step. And finally, you can produce the discretization of the heat equation, u i,j+1 = (1 2s)u ij + s(u i+1,j + u i 1,j ), (15) s = k/h 2, (16) Similarly, you can find the discretization of the wave equation, u i,j+1 = 2(1 s)u ij + s(u i+1,j + u i 1,j ) u i,j 1, (17) s = k 2 /h 2, (18) I work out sample wave equation for practice in Excel and you can find out them in the Result section. 3 Results and Discussion In this section, there will be results of work and discussion. 3.1 Practice: Numerical solution for wave function on Excel For this particular example, I used the Excel to find the numerical values. Excel provides the excellent grid for me so all I need to do is that determine and set the constants for the time and distance steps. Then I need to carefully type in the expression of the discretization of the wave equation. Wave function is given, 4

u tt = 4u xx, 0x30, 0t30, (19) u(0, t) = 0, (20) u(l, t) = 0, (21) u(x, 0) = p(x), (22) u t (x, 0) = 0, (23) where p(x) is Although my Nernst-Planck equation is similar to heat equation, I did the wave equation because if I plot the numerical solution then I know if that numerical solution is wrong or right by just looking at the graph. If my numerical solution for the wave is correct, it should be periodic function. But, I can t be sure that by just looking at the 1-D graph of the heat equation, the numerical solution of the heat equation is right or wrong. And, indeed, the graph of the numerical solution of wave looks promising. The size and resolution of the image are poor but you can see the full size version in my Excel Figure 1: Graph of the numerical solution of the wave function file(wave function.xls). You just need to change the worksheets by clicking which are located at the left corner of the excel documents. However, the shape of graph is drawn as expected. As you can see, every time the steps are added, the shape of the graph becomes more clear. Thus, I use the smaller time step so I can improve the numerical solution which is also done in the same excel file. 5

3.2 Practice:Wave equation solving code in Mathematica Originally, I was trying this job with the Maple but something terrible things happened. The Maple was too heavy for my computer so long time usage of the Maple crushed my system, exactly its own works. So I can t use any Maple data or code for this project even if there were some. I restart everything with the Mathematica and I think I did make working code. Actual code:[4],[5],[6]. FDgrid[n, m ]:=Module [ {i}, u = Table[0, {n}, {m}]; For [ i = 1, i n, i++, u [[i,1]] = f[i]; ] ; For [i = 2, i n 1, i++, u [[i,2]] = ( 1 r 2) ] ] f[i] + k g[i] + r2 2 (f[i + 1] + f[i 1]); ; ; This code will generate the grid. FDsolve[n, m ]:= Module[{i, j}, For[j = 3, j m, j++, For[i = 2, i n 1, i++, u u[[i,j]] = ( 2 2r 2) u [[i,j 1]] + r 2 ( ) u [[i+1,j 1]] + u [[i 1,j 1]] u [[i,j 2]] ; ] ; ] ; ] ; This code will actually solve the wave equation way I did in Excel. Now I will set up the wave equation for this particular example. a = 1.0; b = 1.0; c = 2.0; n = 11; m = 21; F [x ] = Sin[πx] + Sin[2πx]; G[x ] = 0.0; h = a n 1 ; k = b m 1 ; f[i ] = F [h(i 1)]; g[j ] = G[k(k 1)]; F[] and G[] are initial conditions and boundary conditions are zero. Now, let s solve the equation and plot it. r = ck h ; FDgrid[n, m]; FDsolve[n, m]; ListPlot3D[u, AxesLabel {"t(j)", "x(i)", "u"}]; Print["The numerical solution to the wave P.D.E."]; Print ["u tt (x,t)=4 u xx (x,t)"] ; 6

Print[" u(x,0) = f(x) = ", F [x]]; Print ["u t (0,x) = g(x) = ", G[x]] ; Print["c = ", c]; Print["h = ", h]; Print["k = ", k]; [ Print " ck h = ", ck ] h ; Figure 2: The numerical solution to the wave P.D.E. The numerical solution to the wave P.D.E. u tt (x,t)=4 u xx (x,t) u(x,0) = f(x) = Sin[πx] + Sin[2πx] u t (0,x) = g(x) = 0. c = 2. h = 0.1 k = 0.05 ck h = 1. Let s compare with the exact solution. The code below will plot the real wave function. In order to compare both graphs easily, I set up the grid of this graph as m and n. U[x, t ] = Sin[πx]Cos[2πt] + Sin[2πx]Cos[4πt]; SetOptions[Plot3D, PlotPoints {m, n}]; Plot3D[U[x, t], {t, 0, 1}, {x, 0, 1}, AxesLabel {"t(j)", "x(i)", "u"}]; Print["The analytic solution to the wave P.D.E."]; Print ["u tt (x,t)=4 u xx (x,t)"] ; Print[" u(x,0) = f(x) = ", F [x]]; Print ["u t (0,x) = g(x) = ", G[x]] ; Print[" u[x,t] = ", U[x, t]]; The analytic solution to the wave P.D.E. u tt (x,t)=4 u xx (x,t) u(x,0) = f(x) = Sin[πx] + Sin[2πx] 7

Figure 3: The analytic solution to the wave P.D.E. u t (0,x) = g(x) = 0. u[x,t] = Cos[2πt]Sin[πx] + Cos[4πt]Sin[2πx] u[x,t] = Cos[2πt]Sin[πx] + Cos[4πt]Sin[2πx] As you can see, both graphs are exactly same. Code works great. Now, let s make the table of numbers which is similar to the one in the Excel. 8

This code will generate the table. Print["The numerical solution to the wave P.D.E."]; Print ["u tt (x,t)=4 u xx (x,t)", "\n"] ; Print[NumberForm[TableForm[Transpose[Chop[u]]], 3]]; The numerical solution to the wave P.D.E. u tt (x,t)=4 u xx (x,t) 0 0.897 1.54 1.76 1.54 1. 0.363 0.142 0.363 0.279 0 0 0.769 1.33 1.54 1.38 0.951 0.429 0 0.21 0.182 0 0 0.432 0.769 0.948 0.951 0.809 0.588 0.361 0.182 0.0684 0 0 0 0.0516 0.182 0.377 0.588 0.741 0.769 0.639 0.363 0 0 0.38 0.588 0.519 0.182 0.309 0.769 1.02 0.951 0.571 0 0 0.588 0.951 0.951 0.588 0 0.588 0.951 0.951 0.588 0 0 0.571 0.951 1.02 0.769 0.309 0.182 0.519 0.588 0.38 0 0 0.363 0.639 0.769 0.741 0.588 0.377 0.182 0.0516 0 0 0 0.0684 0.182 0.361 0.588 0.809 0.951 0.948 0.769 0.432 0 0 0.182 0.21 0 0.429 0.951 1.38 1.54 1.33 0.769 0 0 0.279 0.363 0.142 0.363 1. 1.54 1.76 1.54 0.897 0 0 0.182 0.21 0 0.429 0.951 1.38 1.54 1.33 0.769 0 0 0.0684 0.182 0.361 0.588 0.809 0.951 0.948 0.769 0.432 0 0 0.363 0.639 0.769 0.741 0.588 0.377 0.182 0.0516 0 0 0 0.571 0.951 1.02 0.769 0.309 0.182 0.519 0.588 0.38 0 0 0.588 0.951 0.951 0.588 0 0.588 0.951 0.951 0.588 0 0 0.38 0.588 0.519 0.182 0.309 0.769 1.02 0.951 0.571 0 0 0 0.0516 0.182 0.377 0.588 0.741 0.769 0.639 0.363 0 0 0.432 0.769 0.948 0.951 0.809 0.588 0.361 0.182 0.0684 0 0 0.769 1.33 1.54 1.38 0.951 0.429 0 0.21 0.182 0 0 0.897 1.54 1.76 1.54 1. 0.363 0.142 0.363 0.279 0 3.3 Real1: Solving Nernst-Planck equation in the Excel1 Finally, we come to this far, my original goal to solve the Nernst-Planck equation. As I did for the wave-function, I hope that Nernst-Planck equation can be done in Excel so I can carry onto the Mathematica. For the simplicity sake, I will introduce easier notations and constant values: [1]. a = u ij, (24) b = u i,j+1, (25) c = u i+1,j, (26) d = u i 1,j), (27) s = D a k/h 2, (28) w = αd a k, (29) α = 4πq 2 n /ɛk b T, (30) 9

D a = 1.0 10 5 cm 2 sec 1, (31) D b = 0.5 10 5 cm 2 sec 1, (32) L = 1.0cm, (33) T = 298.18 K, (34) ɛ = 78.53, (35) q = 4.803 10 10, (36) n = 3.0 10 8 cm 3, (37) K b =Boltzmann constant, (38) and of course, s and w will have D b when they are dealing with n b. Everything is calculated in the Excel worksheet(nernst-planck equation.xls). Since equation(11) and (12) are coupled, their discretization is somewhat different with the heat or wave equation. For n a (in Excel, this is expressed as u family), discretization is b = (1 2s w)a + s(c + d) + wv i,j (v i,j is the u i,j of n b ), and for n b (in Excel, this is expressed as v family), discretization is b = (1 2s w)a + s(c + d) + wu i,j. As you can see both have extra ending term which is not their own function. Thus, I decide to use the cross reference in the Excel. Basically, I will make two work sheets which are one for n a or u and one for n b or v. Then I will construct the layers one by one but with each other s one-lower layer value. That is what the discretization equation says! In such a mechanism, I only build the one layer by time since both layers are building at same time. If you don t have the layers of another, you can t find the next value of your own. Figure 4: Graph of u 10

Figure 5: Graph of v However, look at these graphs. They are graph of worksheet u and v in the Excel file. They don t tell much about the concentration behavior. They just describe the initial distribution of the concentration which I create in the first place. Originally, I plan to give the Gaussian distribution for the initial state of concentration in the box(i said box, because it is the isolated system). Furthermore, the behavior of both u and v should be almost exactly proportional to the cos(πx/l), but they don t seem to follow the rule of the equation. However, they are inversed each other, that can be explained by the charge of the ion. u is supposed to describe the motion of the cations and v is supposed to destine the motion of the anions so it can be reasonable they may have inverse relationship. And due the difference of the diffusion constant,d their max value of u and min value of v don t perfectly cancel each others. That is a good feature of these graphs since their behaviors are expected as difference of D. This time, I use smaller distance step so I can get more accurate graphs. Now, the distance steps are about twice as much as compare to the first one. And all of the work is in the Uu and Vv worksheets in the Excel file. 11

Figure 6: Graph of u for uu worksheet Figure 7: Graph of v for vv worksheet 12

They are not also telling much about the motion of the concentration. However, at least they have better shape of the graph which will support the as the steps get smaller, you will get more accurate answers. That is the main concepts of all of the numerical methods so I believe, my approach and method to this certain problem is not that bad so far. Or my first assumption and set up and property of the equation can be very wrong because as you can see, the shape of the graph doesn t change over time, static state. So problem can be arise from that equation tells concentration to move but my given conditions and set up of the discretization tell concentration not to move. 3.4 Real2: Solving Nernst-Planck equation in the Excel2 I can t give up just like that, so I tried little bit different approach this time. There must be N total in the system and I set that N total = n a + n b = constant = 2n. And I am still using the more smaller space steps. These works are doen in the worksheet uuu and vvvv in the Excel file. Figure 8: Graph of u for uuu worksheet 13

Figure 9: Graph of v for vvv worksheet The results look very interesting. The graph of the v is totally in the negative side and its max value is 0 which suggests all the anions are attracted to the cation side. That can be possible since electrons are pretty much only movable and want to move somewhere if there is attraction. Moreover, the shapes of graphs are more like cos which is the expected behavior for the t=long time. However, this is not answer for sure and this can t satisfy me due to the face that this graph is also having no effect over time. Their shapes are almost same and don t change over the time. May be the point about the wrong relationship between the property of the equation and my condition are right or there are just simple problems which I can t find right now. But, one thing is for sure, this is wrong about the logic and theory which I build for this method and project. 4 Conclusion and Future plan FINALLY, time for the conclusion. This project was such a bittersweet chocolate for me. The equations are evil and no one really can help me. But, this is MY project and MY topic so I did what can I do for the best. Definitely this is not easy project for general. I didn t realize that type in the LaTex form is such a hard job. It feels really great if I did something which I think can t do that especially for writing the code for the Mathematica shows the lessons of the P210. I can do the programming without any previous experience because I have the documentations and GOOGLE! And it really feels sad and bad for the last part which I really want to solve. However, I think it is just a small step which I will take closer to the my goal like space and time steps are building each layers of the numerical solution. I will probably research about this related topic for my honors thesis for 4th year if I am still doing Biophysics in next year which is the my future plan. I will master the Nernst-Planck equation and let all the world know how EASY that equation should be. For that purpose, I won t make this project public. This is between you and me, Jess! Thank you to teach me such a great strength and knowledge! 14

References [1] S.B. Malvadkar, M.D. Kostin, Solutions of the Nernst-Planck Equations for Ionic Diffusion for Conditions near Equilibrium, The Journal of Chemical Physics, Oct. 1972, vol 57, is. 8, pp. 3263-3265. [2] Philip Nelson,Biological Physics, pp.265-272. [3] One of the my Math 316 notes on the finite difference method. [4] http://www.math.buffalo.edu/ pitman/courses/mth438/na/ node15.htmlsection000132000000000000000. [5] http://www.me.rochester.edu/courses/me223/webexamp/findiffexamp1nb.pdf. [6] http://www.math.su.se/ lambe/nsc/nsc.html. 15