{"id":946,"date":"2020-03-17T15:56:24","date_gmt":"2020-03-17T19:56:24","guid":{"rendered":"http:\/\/www.joshuagallaway.com\/?p=946"},"modified":"2020-03-27T21:46:56","modified_gmt":"2020-03-28T01:46:56","slug":"modeling-porous-electrodes-part-3-newmans-band-method","status":"publish","type":"post","link":"http:\/\/www.joshuagallaway.com\/?p=946","title":{"rendered":"Modeling porous electrodes: Part 3 (Newman&#8217;s BAND method)"},"content":{"rendered":"\n<p>I previously made <a href=\"http:\/\/www.joshuagallaway.com\/?p=215\">a post about the basic formulation of porous electrode theory<\/a> (part 1), and <a href=\"http:\/\/www.joshuagallaway.com\/?p=322\">a post about how the choice of kinetic expression<\/a> determines what the result will look like (part 2). The purpose of this post is to explain how to solve these basic problems using the <a href=\"http:\/\/www.cchem.berkeley.edu\/jsngrp\/fortran.html\">BAND<\/a> formulation found in John Newman&#8217;s textbook <em>Electrochemical Systems<\/em> (<a href=\"https:\/\/www.amazon.com\/Electrochemical-Systems-3rd-John-Newman\/dp\/0471477567\">Newman and Thomas-Alyea in the Third Edition<\/a>). I also provide Python code so you can get the solution yourself and modify it for your own teaching and learning needs.<\/p>\n\n\n\n<p>As a model problem we&#8217;ll use the boundary value problem of Tafel kinetics in a concentration-independent porous electrode in Cartesian coordinates. The reason to choose this one is because Newman and Tobias provide the analytical solution in their 1962 paper &#8220;<a href=\"https:\/\/iopscience.iop.org\/article\/10.1149\/1.2425269\">Theoretical Analysis of Current Distribution in Porous Electrodes<\/a>.&#8221; You can also find this solution in Fuller and Harb&#8217;s <a href=\"https:\/\/www.amazon.com\/Electrochemical-Engineering-Thomas-F-Fuller\/dp\/111900425X\"><em>Electrochemical Engineering<\/em><\/a>, in the problems at the end of Chapter 5. The reason to choose a problem with an analytical solution is so you can check your work to know if it&#8217;s right! We lay out the problem below, which is the same as that in Newman and Tobias (1962) except one sign convention. This is four equations with four unknowns (i<sub>1<\/sub>, i<sub>2<\/sub>, \u03a6<sub>1<\/sub>, \u03a6<sub>2<\/sub>):<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"501\" src=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Newman-and-Tobias-Tafel-1-1024x501.png\" alt=\"\" class=\"wp-image-980\" srcset=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Newman-and-Tobias-Tafel-1-1024x501.png 1024w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Newman-and-Tobias-Tafel-1-300x147.png 300w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Newman-and-Tobias-Tafel-1-768x376.png 768w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Newman-and-Tobias-Tafel-1-500x245.png 500w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Newman-and-Tobias-Tafel-1.png 1414w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you read the electrochemical engineering literature, solving problems such as this with <em>Newman&#8217;s BAND method<\/em> often comes up, and you might wonder what that is. Technically &#8220;BAND&#8221; is some Fortran code set up to solve 2-point boundary value problems in a way that is convenient for electrochemists. (My own favorite document written about BAND is &#8220;<a href=\"http:\/\/www.joshuagallaway.com\/small-25%20Bennion%20ff.pdf\">Modeling and reactor simulation<\/a>&#8221; by Douglas Bennion in the <em>AIChE symposium serie<\/em>s 1983, Vol 79, Num 229, pp 25-36. It&#8217;s a resource meant for teachers and is somewhat hard to find so I&#8217;ve uploaded it here.) The formulation Newman uses to set up the problem casts each of the equations in this way:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Newman-equation-form.png\" alt=\"\" class=\"wp-image-948\" width=\"340\" height=\"73\"\/><\/figure><\/div>\n\n\n\n<p>Here c is a variable. The coefficients a, b, and d are those for the second derivative, first derivative, and the variable itself. And g is the constant term. When you linearize equation 2 above and then cast all of the four equations this way, you get something that looks like the tables below. I&#8217;ve collected some constants together as \u00df and P to keep it from looking too messy:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"443\" src=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Porous-Tafel-coefficients-1024x443.png\" alt=\"\" class=\"wp-image-949\" srcset=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Porous-Tafel-coefficients-1024x443.png 1024w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Porous-Tafel-coefficients-300x130.png 300w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Porous-Tafel-coefficients-768x332.png 768w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Porous-Tafel-coefficients-500x216.png 500w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Porous-Tafel-coefficients.png 1382w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Once you have this, you can (a) build a block tridiagonal matrix, (b) choose initial guesses for the answers, and (c) iterate to a solution by repeatedly solving the problem until your initial guesses and final answers match. Explaining how this works is too long for a blog post, so follow these links for:<\/p>\n\n\n\n<ul><li>Python code to solve this problem &#8220;<a href=\"http:\/\/www.joshuagallaway.com\/PyBand_Porous_Tafel_Gallaway_V1.txt\">PyBand_porous_Tafel<\/a>&#8220;<\/li><li>A document called &#8220;<a href=\"http:\/\/www.joshuagallaway.com\/Gallaway%20porous%20Tafel%20kinetics%20V1.pdf\">Solving a non-linear electrochemical current distribution problem using BAND in Python<\/a>&#8221; that I made to teach students to use BAND.<\/li><\/ul>\n\n\n\n<p>If you execute the code you should get a figure like that below, which solves the problem. (I still use Python 2.7 so you might have to do some mild editing and debugging.)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"1024\" src=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/porous1-1024x1024.png\" alt=\"\" class=\"wp-image-958\" srcset=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/porous1-1024x1024.png 1024w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/porous1-150x150.png 150w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/porous1-300x300.png 300w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/porous1-768x768.png 768w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/porous1.png 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">What I use this for<\/h2>\n\n\n\n<p>The reason I started writing a BAND-type method in Python is (1) I wanted to learn more about how BAND worked so I could teach it better, and (2) I wanted to model electrochemical systems without having to buy expensive software or use Fortran. It&#8217;s not exactly like Newman&#8217;s code, which also included a function to solve the matrix problem. Rather, this code lets you input the problem in Newman&#8217;s way and build the corresponding block tridiagonal matrix, then it uses SciPy to solve the matrix problem.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sciencedirect.com\/science\/article\/abs\/pii\/S0378775316305262\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"508\" src=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Gallaway-JOPS-2016-1-1024x508.png\" alt=\"\" class=\"wp-image-962\" srcset=\"http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Gallaway-JOPS-2016-1-1024x508.png 1024w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Gallaway-JOPS-2016-1-300x149.png 300w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Gallaway-JOPS-2016-1-768x381.png 768w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Gallaway-JOPS-2016-1-500x248.png 500w, http:\/\/www.joshuagallaway.com\/wp-content\/uploads\/Gallaway-JOPS-2016-1.png 1896w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>When I was working on <a href=\"https:\/\/www.sciencedirect.com\/science\/article\/abs\/pii\/S0378775316305262\">the paper above<\/a> in 2016, I wanted to compare experimental data to the <a href=\"https:\/\/iopscience.iop.org\/article\/10.1149\/1.2220958\">Chen<\/a> + <a href=\"https:\/\/iopscience.iop.org\/article\/10.1149\/1.2054677\/meta\">Podlaha<\/a> + Cheh alkaline battery model developed in the 1990s. Python seems like the best choice for something you can also develop as a teaching tool, so I used that to generate the results in Figure 3 of the paper. Since then I&#8217;ve used it to train some MS students getting insight into shallow-cycled MnO<sub>2<\/sub> cathodes. When <a href=\"https:\/\/repository.library.northeastern.edu\/files\/neu:m044pd995\/fulltext.pdf\">Zhicheng Lu&#8217;s MS thesis<\/a> appeared on the internet, I received a few questions about the model by email. So this post is meant to help anyone doing similar things.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I previously made a post about the basic formulation of porous electrode theory (part 1), and a post about how the choice of kinetic expression determines what the result will look like (part 2). The purpose of this post is &hellip; <a href=\"http:\/\/www.joshuagallaway.com\/?p=946\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,18,7],"tags":[],"_links":{"self":[{"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=\/wp\/v2\/posts\/946"}],"collection":[{"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=946"}],"version-history":[{"count":30,"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=\/wp\/v2\/posts\/946\/revisions"}],"predecessor-version":[{"id":992,"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=\/wp\/v2\/posts\/946\/revisions\/992"}],"wp:attachment":[{"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=946"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.joshuagallaway.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}