public
Created

iPython notebook with really poor performance and a latex cell that does not render.

  • Download Gist
gistfile1.json
JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779
{
"metadata": {
"name": "Cell centered finite volumes"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": "A cell centered grid\n--------------------"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<script type=\"text/javascript\">\nshow=true;\nfunction toggle(){\nif (show){\n$('div.input').hide();\n}else{\n$('div.input').show();\n}\nshow = !show\n}\n</script>\n<a href=\"javascript:toggle()\" target=\"_self\">toggle input</a>"
},
{
"cell_type": "code",
"collapsed": false,
"input": "from IPython.core.display import Image \nImage(filename=\"/Users/daniel/.ipython/files/cell_centered_grid.png\")",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAATsAAACBCAYAAAC/+h1gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB\n1Wl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/awJeb+zebv8eRFZ5AzazrxZ++s202MjORX9AaJmK\n1rQ84OOOKtWXk7Z7QFL7SWRmZUCTwaWZ8SoGb8UOgR4xtmd6rlU1Co6fP8Cnv7//6DZUD6sFgQWD\nuPHzAbMH2uzhxgdc/rD/GQ4HBpufE49N17BzGKevD5QqXo4Lf/H6adixfy0UYu1zf1w5Af/8biYM\n6zYJ8GXzIiMNCvgX5PcE5qPrXwdIGcYXScECgVA/oqnkJ+50aNKbNz+Ypynt83yY5Lctm0lGNP4m\nWbHiZZlfU0pooBsPMq2dUqtqQ/iP9iMgpkFXUQz6tUHA640dfheJQwtwwxv894tHVDN0qB+9Vals\n3FOQwZoBPh+zHqKjTAtm2wqDfovej+clnMOn9sJXW2fDc8b/7fZ/txfc7f4R4XUgov9cGM82S9cw\n8q+QsNr2GDusQtpryytauATgprRDQ7z0v3ZAxZBqEFI6TOnkDBG/1xs7cy0GBRSGJnVam3t5dN/d\nVSqPCm+WWNFCJaBVg85mPvZ3sTrWvF47vtkPRWdsEWhUs5Utb/KzQ4CMnR0wnvZ2tkrlaTm9NT2s\nmv+DtYuhS3pwna2p6g/7ju/kx2PjZsnG6HFP+qc5AjR5p+ZUQgJpncDh03shgLXZRdVooXVRST4z\nAl4/9MSMBe0SASJgYAJUjdWhcr/dvcSm1NizTE55AhXKVuLVWOVTohTcSYCMnTtpeiiuiiHVPZQS\nJWOLQHgo8bfFRet+1GandQ2RfESACLiFALXZuQUjRUIEiIDWCZCx07qGSD4iQATcQoCMnVswUiRE\ngAhonQAZO61riOQjAkTALQT+H2tnQzFTGWEVAAAAAElFTkSuQmCC\n",
"prompt_number": 2,
"text": "<IPython.core.display.Image object at 0x1115be390>"
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": "\nLinear interpolation between cell $\\{ x_{j-1} \\}$ and $\\{ x_{j+1} \\}$ to find the face value at $\\{ x_{j+1/2}\\}$\n------------------------------------------------------------------------------------------------------------\n\nLinear interpolation between two points $(x_0, x_1)$ can be used to find the value of a function at $f(x)$,\n\n$$\nf(x) = \\frac{x - x_1}{x_0 - x_1}f(x_0) + \\frac{x - x_0}{x_1 - x_0}f(x_1) \n$$\n\nIn a cell centered grid we know the value of the variable $w$ at difference points, $w_j$ and $w_{j+1}$. We can apply the linear interpolation formular above to determine value at cell vertex $w_{j+1/2}$.\n\n$$\nw_{j+1/2} = \\frac{x_{j+1/2} - x_{j+1}}{x_{j} - x_{j+1}} w_j + \\frac{x_{j+1/2} - x_j}{x_{j+1} - x_j} w_{j+1} \n$$\n\nThis can be simplifed firstly by using function to represent the distance between cell centres,\n\n$$\nh_{-} = x_j - x_{j-1} \\quad \nh_{+} = x_{j+1} - x_{j}\n$$\n\nto give, \n\n$$\nw_{j+1/2} = \\frac{x_{j+1} - x_{j+1/2}}{h_{+}} w_j + \\frac{x_{j+1/2} - x_j}{h_{+}} w_{j+1}\n$$\n\nThis expression still contains $x_{j+1/2}$ which we can simplify further by using an expression for the position of cell centres,\n\n$$\nx_j = \\frac{1}{2} \\left( x_{j-\\frac{1}{2}} + x_{j+\\frac{1}{2}} \\right) \\quad\nx_{j+1} = \\frac{1}{2} \\left( x_{j+\\frac{1}{2}} + x_{j+\\frac{3}{2}} \\right)\n$$\n\nNote, this expression is still valid of non-uniform grids, it simply says that cell centres are always equidistant from two vertices. Rearranging the above expression and substituing in for $x_{j}$ and $x_{j+1}$ terms gives, \n\n$$\nw_{j+1/2} = \\frac{\\frac{1}{2} \\left( x_{j+\\frac{1}{2}} + x_{j+\\frac{3}{2}} \\right) - x_{j+1/2}}{h_{+}} w_j + \\frac{x_{j+1/2} - \\frac{1}{2} \\left( x_{j-\\frac{1}{2}} + x_{j+\\frac{1}{2}} \\right)}{h_{+}} w_{j+1}\n$$\n\nFinally, by defining the distance between vertices as, $h_j = x_{j+\\frac{1}{2}} - x_{j-\\frac{1}{2}}$, we can simplify to the following expression,\n\n$$\nw_{j+1/2} = \\frac{h_{j+1}}{2h_{+}} w_j + \\frac{h_j}{2h_{+}} w_{j+1}\n$$\n\nSimilarly the $w_{j-1/2}$ can be found,\n\n$$\nw_{j-1/2} = \\frac{h_{j}}{2h_{-}} w_{j-1} + \\frac{h_{j-1}}{2h_{-}} w_{j}\n$$\n\nStandard choice cell centered central flux\n------------------------------------------\n\nFrom the above interpolation the flux at the cell vertex can be written as (see Hundsdorfer pg. 273, eq. 4.18 and pg. 82)\n\n$$\nf_{j+\\frac{1}{2}}(t,w) = a_{j+\\frac{1}{2}}\\left( \\frac{h_{j+1}}{2h_{+}} w_j + \\frac{h_j}{2h_{+}} w_{j+1} \\right) + d_{j+\\frac{1}{2}} \\frac{w_j - w_{j+1}}{h_{+}}\n$$\n\n$$\nf_{j-\\frac{1}{2}}(t,w) = a_{j-\\frac{1}{2}}\\left( \\frac{h_{j}}{2h_{-}} w_{j-1} + \\frac{h_{j-1}}{2h_{-}} w_{j} \\right) + d_{j-\\frac{1}{2}} \\frac{w_{j-1} - w_{j}}{h_{-}}\n$$\n\nIn the above expression the diffusion term has also been included. Using flux conserving form the advection-diffusion equation $u_t + (f)_x = s(x,t)$ gives,\n\n$$\nw_j^{\\prime} = \\frac{f_{j-1/2} - f_{j+1/2}}{h_j}\n$$\n\nThis leads to the non-uniform cell centered advection-diffusion discretization,\n\n$$\nw_j^{\\prime} = \\frac{w_{j-1}}{h_j} \\left( \\frac{a_{j-1/2} h_j}{2h_{-}} + \\frac{d_{j-1/2}}{h_{-}}\\right) + \\frac{w_j}{h_j}\\left( \\frac{a_{j-1/2}h_{j-1}}{2h_{-}} - \\frac{a_{j+1/2}h_{j+1}}{2h_{+}} - \\frac{d_{j-1/2}}{h_{-}} - \\frac{d_{j+1/2}}{h_{+}} \\right) + \\frac{w_{j+1}}{h_j} \\left( \\frac{-a_{j+1/2}h_j}{2h_{+}} +\\frac{d_{j+1/2}}{h_{+}} \\right)\n$$\n\nHundsdorfer points out (pg. 266) that upwinding (or exponential fitting) can be introduced by altering the diffusion coefficient,\n\n$$\nd_{j\\pm\\frac{1}{2}} \\rightarrow d_{j\\pm\\frac{1}{2}} + \\frac{1}{2}\\kappa_{\\pm\\frac{1}{2}} h_{\\pm\\frac{1}{2}} a_{j\\pm\\frac{1}{2}}\n$$\n\nwhere $\\kappa$ changes sign according to the advection direction, $\\kappa_{\\pm}=\\text{sgn}(a_{j\\pm\\frac{1}{2}})$. It would appear that this is the only place in the hybrid expression where signs need to be considered because the other terms are *central* differences.\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Simplification\n--------------\n\nWe want the stability of implicit/explicit method, so we write the above equation as the average of the present and future time step,\n\n$$\nw_{j}^{n+1} - \\theta r_a w_{j-1}^{n+1} - \\theta r_b w_{j}^{n+1} - \\theta r_c w_{j+1}^{n+1} = w_j^n + (1-\\theta) r_a w_{j-1}^n + (1-\\theta) r_b w_j^n + (1-\\theta) r_c w_{j+1}^n + s(x,t)\n$$\n\nIn the above we have moved the future time step (superscipt $n+1$) to the left hand side because they are unknowns, the current time step (knowns) are moved to the right hand side. We have also made the following subsitutions to simplify the notation,\n\n$$\nr_a = \\frac{\\Delta t}{h_j} \\left( \\frac{a_{j-1/2} h_j}{2h_{-}} + \\frac{d_{j-1/2}}{h_{-}}\\right) \\quad\nr_b = \\frac{\\Delta t}{h_j}\\left( \\frac{a_{j-1/2}h_{j-1}}{2h_{-}} - \\frac{a_{j+1/2}h_{j+1}}{2h_{+}} - \\frac{d_{j-1/2}}{h_{-}} - \\frac{d_{j+1/2}}{h_{+}} \\right) \\quad\nr_c = \\frac{\\Delta t}{h_j} \\left( \\frac{-a_{j+1/2}h_j}{2h_{+}} +\\frac{d_{j+1/2}}{h_{+}} \\right)\n$$\n\nIt should be understood that spatial index for each of the above coefficients is relative to the central term. For example, if we wish to evalualte the equation at point $j=2$, then the *j*-th term should be set to 2 for all of the above coefficients. "
},
{
"cell_type": "markdown",
"metadata": {},
"source": "The definitions of the other terms defined,\n\n$$\nh_{-} = x_j - x_{j-1} \\quad h_{+} = x_{j+1} - x_{j}\n$$\n\nwhere the points in $\\{x_j\\}$ are distributed (possiblity non-uniformally) along the mesh. "
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Natural boundary conditions within the finite-volume framework\n--------------------------------------------------------------\n\nAt the boundaries of the system the we must include *boundary conditions* if we are to have a well poised problem. At the boundaries we will specify a known value of **flux** i.e. the quantity $\\cal{F}=au + du_x$. Technically this call a Robin boundary condition and as we will see this is naturally resolved when using the finite volume method. Integrating the general advection diffusion equation over the boundary cell $\\Omega_1$ on the left hand side gives,\n\n$$\n\\int_{x=0}^{x=h} u_t dx = \\int_{x=0}^{x=h} (-au + du_x)_x dx + \\int_{x=0}^{x=h} s(x,t,u) dx\n$$\n"
},
{
"cell_type": "code",
"collapsed": false,
"input": "from IPython.display import Latex\nLatex(r\"\"\"\n\\begin{align}\n\\begin{pmatrix}\n w_1^{n+1} \\\\\n w_2^{n+1} \\\\\n \\vdots \\\\\n w_{J-1}^{n+1} \\\\\n w_J^{n+1} \\\\\n\\end{pmatrix} + \n\\begin{pmatrix}\n-r_b & -r_c & & & 0 \\\\\n-r_a & -r_b & -r_c & & \\\\\n & \\ddots & \\ddots & \\ddots& \\\\\n & & -r_a & -r_b & -r_c \\\\\n 0 & & & -r_a & -r_b\n\\end{pmatrix}\n\\begin{pmatrix}\n w_1^{n+1} \\\\\n w_2^{n+1} \\\\\n \\vdots \\\\\n w_{J-1}^{n+1} \\\\\n w_J^{n+1} \\\\\n\\end{pmatrix} = \n\\begin{pmatrix}\n w_1^{n} \\\\\n w_2^{n} \\\\\n \\vdots \\\\\n w_{J-1}^{n} \\\\\n w_J^{n} \\\\\n\\end{pmatrix} + \n\\begin{pmatrix}\nr_b & r_c & & & 0 \\\\\nr_a & r_b & r_c & & \\\\\n & \\ddots & \\ddots & \\ddots& \\\\\n & & r_a & r_b & r_c \\\\\n 0 & & & r_a & r_b\n\\end{pmatrix}\n\\begin{pmatrix}\n w_1^n \\\\\n w_2^n \\\\\n \\vdots \\\\\n w_{J-1}^n \\\\\n w_J^n \\\\\n\\end{pmatrix}\n\\end{align}\"\"\")",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "\n\\begin{align}\n\\begin{pmatrix}\n-r_b & -r_c & & & 0 \\\\\n-r_a & -r_b & -r_c & & \\\\\n & \\ddots & \\ddots & \\ddots& \\\\\n & & -r_a & -r_b & -r_c \\\\\n 0 & & & -r_a & -r_b\n\\end{pmatrix}\n\\begin{pmatrix}\n w_1^{n+1} \\\\\n w_2^{n+1} \\\\\n \\vdots \\\\\n w_{J-1}^{n+1} \\\\\n w_J^{n+1} \\\\\n\\end{pmatrix} = \n\\begin{pmatrix}\nr_b & r_c & & & 0 \\\\\nr_a & r_b & r_c & & \\\\\n & \\ddots & \\ddots & \\ddots& \\\\\n & & r_a & r_b & r_c \\\\\n 0 & & & r_a & r_b\n\\end{pmatrix}\n\\begin{pmatrix}\n w_1^n \\\\\n w_2^n \\\\\n \\vdots \\\\\n w_{J-1}^n \\\\\n w_J^n \\\\\n\\end{pmatrix}\n\\end{align}",
"output_type": "pyout",
"prompt_number": 3,
"text": "<IPython.core.display.Latex object at 0x1115be350>"
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Boundary conditions\n-------------------\n\nWe will apply Robin boundary conditions to this equation because it is conveient way to fix the flux at the interfaces, where the flux is determinded by a advection and diffusion currents. The value of the known flux at the left hand side interface ($x_{\\frac{1}{2}}=L$) can be written as,\n\n$$\nj \\bigg|_{x=L} = \\sigma_L = (d_L u_x + a_L u)\n$$\n\nApproximating the derivate,\n\n$$\nu_x = \\frac{w_1 - w_0}{h_{-}}\n$$\n\nwe can write the boundary condition using the ghost cell at $x_0$,\n\n$$\n\\sigma_L = d_L \\frac{w_1 - w_0}{h_{-}} + a_L w_{L}\n$$\n\nThe $w_L$ is the mass at the left hand interface of the the first cell. In the finite-volume method, mass is defined as the average over a cell therefore we need to make some assumptions in order to find the value at the face. Two possible options are:\n\n * Interpolate between $w_0$ and $w_1$ to estimate $w_{1/2}$.\n * Average the concentration for $w_0$ and $w_1$ to estimate $w_{1/2}$.\n * Extrapolation from $w_1$ and $w_2$ to estimate $w_{1/2}$.\n\n### Linear interpolation approach ###\n\nFrom the linear interpolation of $w_L$ is,\n\n$$\nw_L = \\frac{h_1}{2h_{-}}w_0 + \\frac{h_0}{h_{-}}w_1\n$$\n\nSubstituing this into the boundary condition,\n\n$$\n\\sigma_L = d_L \\frac{w_1 - w_0}{h_{-}} + a_L \\left( \\frac{h_1}{2h_{-}}w_0 + \\frac{h_0}{h_{-}}w_1 \\right)\n$$\n\nand factoring,\n\n$$\n\\sigma_{L} = \\frac{w_{0} \\left( a_{L} h_{1} - 2 d_{L} \\right) + w_{1} \\left(a_{L} h_{0} + 2 d_{L}\\right)}{2 h_{{-}}}\n$$\n\nnow making the substitions,\n\n$$\n\\chi_0=a_Lh_0 - 2d_L \\quad \\quad \\chi_1=a_Lh_1 + 2d_L\n$$\n\nyields the expression for the ghost cell concentration,\n\n$$\nw_0 = \\frac{2 \\sigma_L h_{-} - \\chi_1w_1}{\\chi_0}\n$$\n\nWe will often want to have zero velocity at the left boundary, therefore would should explore the limits of the function for this case,\n\n$$\\lim_{a_L \\to 0} \\frac{2 \\sigma_L h_{-} - \\chi_1w_1}{\\chi_0} = w_1 - \\frac{\\sigma_{L} h_{{-}}}{d_{L}} $$\n\n### Averaging approach ###\n\nAs second approach is to assume that,\n\n$$\nw_L = \\frac{1}{2}(w_0 + w_1)\n$$\n\nThat is, it takes the average value over the cells. Substituing into the boundary condition equation gives,\n\n$$\n\\sigma_L = d_L \\frac{w_1 - w_0}{h_{-}} + a_L \\frac{1}{2}(w_0 + w_1)\n$$\n\nFactoring the expression using $\\chi_{-}=a_L h_{-} - 2d_L$ and $\\chi_{+}=a_Lh_{-} + 2d_L$ yields,\n\n$$\n\\sigma_L = \\frac{\\chi_{-}w_0 + \\chi_{+}w_1}{2h_{-}}\n$$\n\nRearraning for the ghost point,\n\n$$\nw_{0} = \\frac{2 \\sigma_{L} h_{{-}} - \\chi_{{+}} w_{1}}{\\chi_{{-}}}\n$$\n\nIn the limit if zero velocity at the boundary point this also reduces to,\n\n$$\n\\lim_{a_L \\to 0} \\frac{2 \\sigma_{L} h_{{-}} - \\chi_{{+}} w_{1}}{\\chi_{{-}}} = w_1 - \\frac{\\sigma_{L} h_{{-}}}{d_{L}}\n$$\n\n### Extrapolation approach ###\n\n(to appear...)\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Applying boundary conditions\n----------------------------\n\nSubstituing the Robin boundary condition into the advection-diffusion equation gives,\n\n$$\n- r_{b} w_1^{n+1} - r_{c} w_2^{n+1} + w_1^{n+1} = w^n_1 + \\frac{r_{a} \\left(- \\chi_{1} w_1^{n} + 2 h_{-} \\sigma_{L}\\right)}{2 \\chi_0} s^n_1 \n$$"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "-----------------\n\n(Applying Robin boundary conditions)"
},
{
"cell_type": "code",
"collapsed": false,
"input": "ra, rb, rc, t = symbols(\"r_a, r_b, r_c, theta\")\nwn = symbols(\"w_{1}^{n+1}, w_{2}^{n+1}, w_{0}^{n+1}\")\nw = symbols(\"w_{1}^{n}, w_{2}^{n}, w_{0}^{n}\")\ns = symbols(\"s_1^n\")\nf = Eq( wn[0] - t*ra*wn[-1] - t*rb*wn[0] - t*rc*wn[1] , w[0] + (1-t)*ra*w[-1] + (1-t)*rb*w[0] + (1-t)*t*rc*w[1] + s )\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- r_{a} \\theta w^{{n+1}}_{{0}} - r_{b} \\theta w^{{n+1}}_{{1}} - r_{c} \\theta w^{{n+1}}_{{2}} + w^{{n+1}}_{{1}} = r_{a} w^{{n}}_{{0}} \\left(- \\theta + 1\\right) + r_{b} w^{{n}}_{{1}} \\left(- \\theta + 1\\right) + r_{c} \\theta w^{{n}}_{{2}} \\left(- \\theta + 1\\right) + s^{n}_{1} + w^{{n}}_{{1}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgo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b8 + 1) + r_b\u22c5w_{1}^{n}\u22c5(-\u03b8 + 1) + r_c\u22c5\u03b8\u22c5w_{2}^{n}\u22c5(-\u03b8 + 1) + s\u207f\u2081 + \nw_{1}^{n}"
}
],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": "f = f.subs(t,1)\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- r_{a} w^{{n+1}}_{{0}} - r_{b} w^{{n+1}}_{{1}} - r_{c} w^{{n+1}}_{{2}} + w^{{n+1}}_{{1}} = s^{n}_{1} + w^{{n}}_{{1}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAAcCAYAAACpkyKfAAAABHNCSVQICAgIfAhkiAAABrNJREFU\neJzt3X2sHFUZx/FPKRSwCFFjBWJrUYivXE0QBQO0ik1AMEhK0NioiVSCRlArQf3LjcYIJr6hSKAG\n1zQECWgikajBoBTf8CUhgoZaVMAQjZFUisaXaOsfz2zu3Ht3787uzO6dmT3fZLNzds6cOed3zp1z\nznOeM5dEIpFIJBJT5+m4HRtWOiMNJelXnqRhf5Iuidrx3iHnt6ODg9g46cw0lOU0TPoNJ7XB/iRd\nEo2kUzBeariD6RSIk/QbTKdgvFnTsFMw3qzpUlsOXekMVMQz8Q5swtV4MY7BenxwBfPVJJKG5Uj6\n9SfpErRBhzaUoTDbcRj24i3Zb0fjHwWv7xSM1+bR0DQ0TPoNplMwXtM0TLoEZXWoA4XK0JaZyq1Y\nh8Pxtey3U/CbPnGfg/djVe63M3BELvwUPlF9NmtN0rAcSb/+JF2CUXSoK20ow0i8Hd1c+EvYIaZn\nq/pdkKNT8B51Hw2VZdIaJv0G0yl4j6o0nDO9QWWTdJkkZXQYxDTrkQJlOGSKmZk0Z+Pu7HgVLsYt\nuFQ0uMRwkoblaJJ+O/DcKd2rSbpMkknoMM16pEAZ2tSpnIi7suOD+CHOy77Lsg3XZ8dXG+7m2FQm\npWHSrzxN1jDpEkxSh2kxtTJsx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PvveW64otWPW21Y/3iZMYp8U5qG1om31syLUhVbV45eF4IQf9D7ld/R/RJga\n8uzFW0umW2f2CBs+4cFxR0XptnU0uZgbxeiMmPXdW3H6u/DpitOcBF3Tq+9ZaVvLUZeZShmmOlMZ\nxpzYwfnsXHi3GC2W4UlLvYSOEpuP2sjzRHnvy8LHmtc0MZxTxfpH711J3xN7W6riErG214Rd4Pvx\nr5XORKI0tavHab376/Xi3TD/zMK9l5I9o2S6D4kHa49DszQfLZluXTnFwnfsbLF0ppYYzGb8QHi7\nEFP8v1SUds/v/yqxu39jRelOiivErulEs6ldPU6rU9knRnDETGIrfqS8mWq3GKn33NzOFB5gewZe\n0Wz2ix27hHfRnGaYWurC45baii+sIN1N4n+B3CkGOefguArSTSQax+op3echseV/LV4hZhInCc+t\nh5e5bhgHxOa3d4t1mgvEus0Ty13UYB4Rs5PjcZFw9Stb1m14j9jvc5x4KNZ5obEMD4r1qBPFouTp\nYqHyqRJpPl+sy1wk3C2vFKbeHeZnRLPKLLWtQbRBgzaUIZFIJBKJRCKRSCQSiUQikUgkEolEolb8\nH5g2YJyHLvsbAAAAAElFTkSuQmCC\n",
"prompt_number": 4,
"text": "-r\u2090\u22c5w_{0}^{n+1} - r_b\u22c5w_{1}^{n+1} - r_c\u22c5w_{2}^{n+1} + w_{1}^{n+1} = s\u207f\u2081 + w_{1\n}^{n}"
}
],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": "# The boundary condition\nsigmaL, hm, chi0, chi1 = symbols(\"sigma_L, h_{-}, chi_{0}, chi_{1}\")\nw0 = (2*sigmaL * hm - chi1*w[0])/(2*chi0)\nw0",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\frac{- \\chi_{{1}} w^{{n}}_{{1}} + 2 h_{{-}} \\sigma_{L}}{2 \\chi_{{0}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAGMAAAAmCAYAAADQriVKAAAABHNCSVQICAgIfAhkiAAABB1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9uqRU5OTk5Fumo3aTvz\nxce7KSIIdJ8Ix+aMMfWESXPGiLniTbwQQZwsnI2Btmn0P6ZamHS0IeCcFpENk9YbAh43dOohtnIM\n4ljFaNrB9PtOfEn+JtVPF+eh4N6UXyLCuh1Npx7VKWVZ+l8vHviskvrNuFEsY4VY/GL8JQJXZ+Os\nI65lk4yHwagUJs1SLgS8QHyCJ47OXHRk1Wye0YZdx4pqYdIClULAM7A/pfeLgexoOn0wdolwZzVu\nwhPCe7pacTC68U+ZdMcyHpapaqwSru0+cVrxKsUQ8F7FozCTxbGbjmY8eVOl1AoB7xRHgrbjZrGf\ndPyAHK30iHeSAdzdZl1ycnJycnJayn+SYb6i3IxE8wAAAABJRU5ErkJggg==\n",
"prompt_number": 3,
"text": "-chi_{1}\u22c5w_{1}^{n} + 2\u22c5h_{-}\u22c5sigma_L\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5chi_{0} "
}
],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": "g = f.subs(wn[-1],w0)\nlatex(g)",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 9,
"text": "- r_{b} w^{{n+1}}_{{1}} - r_{c} w^{{n+1}}_{{2}} + w^{{n+1}}_{{1}} - \\frac{r_{a\n} \\left(- \\chi_{{1}} w^{{n}}_{{1}} + 2 h_{{-}} \\sigma_{L}\\right)}{2 \\chi_{{0}}\n} = s^{n}_{1} + w^{{n}}_{{1}}"
}
],
"prompt_number": 9
},
{
"cell_type": "markdown",
"metadata": {},
"source": "-------------\n(Calculation boundary conditions averaging)"
},
{
"cell_type": "code",
"collapsed": false,
"input": "w0, w1, wL, dL, aL, hm, h0, h1 = symbols(\"w_0, w_1, w_{-1/2}, d_{-1/2}, a_{-1/2}, h_{-}, h_0, h_1\")\nsigma = Symbol(\"\\sigma_{-1/2}\")\nwL = Rational(1,2)*(w0+w1)\nf = Eq(sigma, dL *(w1 - w0)/hm + aL*wL)\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\sigma_{{-1/2}} = a_{{-1/2}} \\left(\\frac{1}{2} w_{0} + \\frac{1}{2} w_{1}\\right) + \\frac{d_{{-1/2}} \\left(- w_{0} + w_{1}\\right)}{h_{{-}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAUIAAAAjCAYAAADhcgPXAAAABHNCSVQICAgIfAhkiAAACZlJREFU\neJztnX2QVWUdxz/L7spusCxGrBqipLAg2jpWWBYCS0qimbQpphSgy2CDNhQaRmZv6qCkmcyQWGaX\nsXxdm0mdUccatxzHXumFcqZJi7IXtbSAaMyw7Y/vczrnnr3n3PN+X/b5zNy55zz3Pi+/e895Xn6/\n3/M7YLFYLBaLxVKnfAL4L3BErRtisVgstaIX+HWB9U0ssK5qXJJDmYHyjcuhMovFkg1LgUcLqmsm\nsLiguqLwuhzKbCWgg7UdocVSP7QBVwFr0Q27nGI6whZgELg/Zr42YB2wAzjRpJ0GbDPH1wKfyqKB\nGdW5B/g5MOD/wHaEzcNF6CKxpKcPeHsN6t0OvAh8GbgD3eiPFVDvMuDJBPkGgDuBLuBIk/YeYJc5\nvh94berWZVvn48BZ/kR74zQHm4BfAgdq3ZAm4RfATcDLwM6C6uwD3g9MNefHAz8A9kbMPw64HthQ\n5TsXA53mfIt5PwtY7/neOuCokHJ+BNwNPIL6kPnACvPZYuCL5vgp4Pvm+LPoGj0cuNFX3iHAR9DM\n1GE+0OE53wdcE7POoN/kJSPfb0NktDQYpwJf8KV1AUM0j7WxFvK8Bi1LuwqqbwPwsOf8arTEOzhC\n3m6TP6jTnoM6jjOB6SbtPuDN5viRuI31sBK4yxxPBf7s+WwAzc6WIAs4aNY7M0K5n0lZZ9hv8lF8\ns0K7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WoFiAlhQEjbrzgAsC8rwbdQYgg02l/I1AHrJPQVZO72DW\ngpaSTmd1rKk7rlU9iMWULxHb0E0+O6Py/eQtj0PYjHAp2nI61hmHVDIXoBiHtxIe9MMSQNDFtoXK\nz4VYiDqCQ81rGdKdNSJ5yb6D8GgaWasU2tDzIZxnh/RT3MONID8VSVhHeBfyMx3rzEMeA05A03W4\nj9C0RMDZND+CLirvpvnxjH6iFWhJtI/RAR8q+c7VM3nLPovgxz0Ooo7Wv5RNyzuR9XUVMkz0Zlx+\nEHnIE/b/gCz3wxnW18hcQbn3xG2Ue5lYUnAOWm6NRbKSfTOjFfnNolJwqJU8dyOnbIsGBCc4bSeK\nMt1DtKfsWarg9Z8ba2QlezvwTVwn52ZSKUDt5DkPN6ryWGcC6vgcffQACnk2EddP05KQSeTrn1fP\nZC37wciy2ktzqBQcaqUi6UPPFLaIk4Cve85PMOfrSbfrzGKxWCz1wlhdllosluxI+oQ9i8VisdQL\n/wMYTE8SjlNFlwAAAABJRU5ErkJggg==\n",
"prompt_number": 49,
"text": " \u239bw\u2080 w\u2081\u239e d_{-1/2}\u22c5(-w\u2080 + w\u2081)\n\\sigma_{-1/2} = a_{-1/2}\u22c5\u239c\u2500\u2500 + \u2500\u2500\u239f + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \u239d2 2 \u23a0 h_{-} "
}
],
"prompt_number": 49
},
{
"cell_type": "code",
"collapsed": false,
"input": "f = f.factor([w0,w1])\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\sigma_{{-1/2}} = \\frac{w_{0} \\left(a_{{-1/2}} h_{{-}} - 2 d_{{-1/2}}\\right) + w_{1} \\left(a_{{-1/2}} h_{{-}} + 2 d_{{-1/2}}\\right)}{2 h_{{-}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAUQAAAAkCAYAAADxaUMoAAAABHNCSV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Sn+wnSHHlcUP4K4XJKYmVA5ymhttJvWhJn3ow7v\n+WLdoccVpRTWbG9rkcCgztneXjTr1CPxCBUlFbxaiMOAOR7bFAs9riilqEC6zJZPejCiP2s0QiUS\nzm0Oyc1ApyjN8LogrkKG5bgZjVwM+5jPZMSvqChhcbtc0pqZUMk4SQSInYUdaXol8C7wqEl3QuKU\nuQdj+4UeV5QwFHO5RDEDnaJEzjRk4LeixIGXy6VAsjMTKkcJac+6dzEy05aiRI3XbG9pzkCnZJw0\n51TpDvyMvjqnRI+fyyWtGegURVEU5ejBHSBWUfJOFmYmVBRFUZR0+R8QNfdAPNfA2gAAAABJRU5E\nrkJggg==\n",
"prompt_number": 50,
"text": " w\u2080\u22c5(a_{-1/2}\u22c5h_{-} - 2\u22c5d_{-1/2}) + w\u2081\u22c5(a_{-1/2}\u22c5h_{-} + 2\u22c5d_{-\n\\sigma_{-1/2} = \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{-} \n\n1/2})\n\u2500\u2500\u2500\u2500\u2500\n "
}
],
"prompt_number": 50
},
{
"cell_type": "code",
"collapsed": false,
"input": "Xm, Xp = symbols(\"chi_{-}, chi_{+}\")\nf = f.subs(aL*hm - 2*dL, Xm)\nf = f.subs(aL*hm + 2*dL, Xp)\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\sigma_{{-1/2}} = \\frac{\\chi_{{+}} w_{1} + \\chi_{{-}} w_{0}}{2 h_{{-}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAJIA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VWIw7BdH75VYqhANP1zkwGQswR5xLpIzyOkVwb4N2Ij7FQXlWsBAA2mD\nwnHEdHFQlyVl9aT2S1qoJ2eIUm0gHY1bij53CdeWDaxpqX29a6HBSjW33SvO8UpznXIS1QbSWpEo\nVoktIvvvYKAWt70KD7RTVLM0Gv1frfoP/776cmLKZRtmrBSR6XbtHA80k3GT2G3uwqsi9nYOnk51\n5ou0jpwyVJqRZirKtCvhQjGQiJ1jufZDjYHcdrdI11ghgroPy3es/ag0kNaL44FS5ohBNDG9Fmou\n4WywUuq2Z4pMxSwld7XCvzkGLe1IbFsm0j+JtcEO8a8H4uxopEhmL2YyXhLriWLGHiCNnaKc254v\nZqEsJXeG1qaCHJQsFifnw5FKbns7zk72KJGFOAFHtFFb3XQ6Z3su3uiwhk4wR2zzXxZuu08cgYwW\na6YsVHWBCKTvEQ/doKWTOds9+Nbwi3VVc9vTxT9BsmzJ3fhNzFwb2yWwEUoT23IGN7Uk8efkDF3+\nB86o7YkPYRzpAAAAAElFTkSuQmCC\n",
"prompt_number": 51,
"text": " chi_{+}\u22c5w\u2081 + chi_{-}\u22c5w\u2080\n\\sigma_{-1/2} = \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{-} "
}
],
"prompt_number": 51
},
{
"cell_type": "code",
"collapsed": false,
"input": "f = Eq(w0, solve(f, w0)[0])\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$w_{0} = \\frac{2 \\sigma_{{-1/2}} h_{{-}} - \\chi_{{+}} w_{1}}{\\chi_{{-}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAI4AAAAjCAYAAABCfzI4AAAABHNCSVQICAgIfAhkiAAABPJJREFU\neJzt23mI1VUUwPGPzhiJli1kq2ELtBiGZUVSiW22b9CmEJNGi9NmRgtESP1j0WJRSRRFRaFtFO1k\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i6jdNBGRb41N8KNYsKuUB7NdF\n/S6X+9d+zUk4PqVf1noef7yY5++SyZsi9opyBjijxNR8lJiynZApuwlfl9SfgEt6R7WcWuAa4ZaG\nZPLe1nZ0uUzERDkDlNIFwKPxmuJiUoOISx4tqbcP7kjp8WLDbJHYP7kJn7fT1n1an52phFl4PaU3\ndPHanF5kiXjwBXYUDyy7CLaH4nGGTcRGWWFJ/gCxb5RT55Tuji/C7hl5qnBdOyW5QSwE3ZXkifhN\ncUn+A+yldSCdU4eUGs5M/I0HhSv6TJxBOVNsqs3F7fg91R8tTqMV2KB2VlR7gmoe76xrrhXT9yzL\nVHbAqB6p5vHOfk13d8fXKi4iFhgu9nIGItU83tmv6e4JwKXiJF6BRnFcckX71QcU88Ve1xh1ZjTV\noFGcVd05yZOUP7c70DhYnJtp6KxiLdLdH7UeH+EisYd1sthfWt3RRQOABtEX48RZ5NKV95qnND7J\nqQ4Xiw3hG8UqfHOmrJonAnPqiGmK617jFGdXQ8peUYPUpf/tQyaLta9lSf5e/J3nGLEKX+mf9HJy\ncnJycnK6x39es+hMSekWkwAAAABJRU5ErkJggg==\n",
"prompt_number": 52,
"text": " 2\u22c5\\sigma_{-1/2}\u22c5h_{-} - chi_{+}\u22c5w\u2081\nw\u2080 = \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n chi_{-} "
}
],
"prompt_number": 52
},
{
"cell_type": "code",
"collapsed": false,
"input": "f.subs({Xm:aL*hm - 2*dL, Xp:aL*hm + 2*dL}).rhs().limit(aL,0)",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{\\sigma_{{-1/2}} h_{{-}}}{d_{{-1/2}}} + w_{1}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAGsAAAApCAYAAAAyL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urCrUJI243zjPkoWomri+5AHmwSMusEj8Zf2Le4\n7rQEE5bBPFgieCh2v/oYwOt1XN8heDRqnXOVYNzZUOPcZmcQDwqD9ZSJz2TTyhBeSuiNuEU2B1IW\n59NyIcKq5n6aUeQRYOww9mp+Ns7Gq8ILxVpkcT69gYNNdD/NOPIIMJ7EicKPOSvqAVM3Y3YLe9+o\nsGx0x/KlwvNLSUFUqpSlnU/McPdT0a9IGuV8on73U8k0UUnpRcY7n2gO91Nbk8X5RPO4n0pSNKvz\nqaQKpyi9eyUlJSXtyH855N1jHRtqEAAAAABJRU5ErkJggg==\n",
"prompt_number": 55,
"text": " \\sigma_{-1/2}\u22c5h_{-} \n- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + w\u2081\n d_{-1/2} "
}
],
"prompt_number": 55
},
{
"cell_type": "markdown",
"metadata": {},
"source": "--------\n( Calculation of boundary conditions interpolation)"
},
{
"cell_type": "code",
"collapsed": false,
"input": "w0, w1, wL, dL, aL, hm, h0, h1 = symbols(\"w_0, w_1, w_{-1/2}, d_{-1/2}, a_{-1/2}, h_{-}, h_0, h_1\")\nsigma = Symbol(\"\\sigma_{-1/2}\")\nwL = h1/(2 * hm)*w0 + h0/(2*hm)*w1\nf = Eq(sigma, dL *(w1 - w0)/hm + aL*wL)\n#wL, f, solve(f,w0)[0].collect(w1)\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\sigma_{{-1/2}} = a_{{-1/2}} \\left(\\frac{h_{0} w_{1}}{2 h_{{-}}} + \\frac{h_{1} w_{0}}{2 h_{{-}}}\\right) + \\frac{d_{{-1/2}} \\left(- w_{0} + w_{1}\\right)}{h_{{-}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAUYAAAAoCAYAAACCXlNuAAAABHNCSVQICAgIfAhkiAAACmtJREFU\neJztnXuwVVUdxz+Xe+URTyNA8RESo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xDX+eEplTEt0pZ9M+pcT6BvAFI/\nvNRzr3eqFH2hcR5ynIk2AWxJMM2yUsY2UxrOQQvIm5GkZN9GePurn3rejTy9IJvd0yi6dZQ30mVJ\nXnLcht42aChfmykVzvV7zUZSss9DS3lqxdb0U88Ho0Ztaw+dVGesixMoX9LkJcdI5DhJal1vmSlb\nmykVw8j/3Rl5kbTsD+H/bmmQet5D39iaw1Cn4nyh1nTr+1KKF0EmTzlW4P/isWajTG3G0MTMAn6N\nifiSFqPRa1NPyLsghmxoVjW2EbkBBVC9NuF063lVZ9GIK8t6tBNqbRqFakAaqc0YSs4A5Ig5rdaN\nhkicj1GhDYZSMxy4GwW+MNTPZLQkypgoDAaDwWAwGAwGg8FgMBj8+T88d5nwn41nXAAAAABJRU5E\nrkJggg==\n",
"prompt_number": 27,
"text": " \u239b h\u2080\u22c5w\u2081 h\u2081\u22c5w\u2080 \u239e d_{-1/2}\u22c5(-w\u2080 + w\u2081)\n\\sigma_{-1/2} = a_{-1/2}\u22c5\u239c\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u239f + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \u239d2\u22c5h_{-} 2\u22c5h_{-}\u23a0 h_{-} "
}
],
"prompt_number": 27
},
{
"cell_type": "code",
"collapsed": false,
"input": "f = f.factor([w0,w1])\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\sigma_{{-1/2}} = \\frac{w_{0} \\left(a_{{-1/2}} h_{1} - 2 d_{{-1/2}}\\right) + w_{1} \\left(a_{{-1/2}} h_{0} + 2 d_{{-1/2}}\\right)}{2 h_{{-}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAT4AAAAkCAYAAAAQAlZ5AAAABHNCSVQICAgIfAhkiAAAB5BJREFU\neJztnXmMFEUUh79dbpdLdL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oZng3pipyKSJ\nEH8aa0VRlLzYjox+thgJfIPM8JAEYTe+Vdi9zLXIXGXWZI5dzfENCeVFUZQyxvmu7mTgIeTVlbbI\nS8t1yKjptOkD/Ijd7AybxlpR/AhykfQC7kXmcAuaeFVREiPoiW8xwUJ0T2OtKF5EcZGktQKdcgyR\n7+ws+UxVHkQ//Nf+dE9jrSh+WCt9rUYmpHSu9PWc2acemQ9PUTLB74lvKDDL5xivaawVxY8KpKlr\n+YoHI7qzev0rkemYZpH+qmOKAvjf+FbgPYHhSOSm19t8JiF+P0WJittFkuUKdEoJk8VEpDMQZzKI\n/+Ut4GET7oDMn+UetBw0jbWiRMHLRRK26piiZMIUZIC0oiSJn4ukCf9Vx5QyotirrI1CVltSlKTw\nW+krbNUxpYwo5pobXYHv0VfGlOQIcpGkvQKdoiiKopQu7olIFaVcKWS1M0VRFEUpbf4H+UkkyArK\nd4wAAAAASUVORK5CYII=\n",
"prompt_number": 28,
"text": " w\u2080\u22c5(a_{-1/2}\u22c5h\u2081 - 2\u22c5d_{-1/2}) + w\u2081\u22c5(a_{-1/2}\u22c5h\u2080 + 2\u22c5d_{-1/2})\n\\sigma_{-1/2} = \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{-} "
}
],
"prompt_number": 28
},
{
"cell_type": "code",
"collapsed": false,
"input": "X0, X1 = symbols(\"chi_0, chi_1\")\nf2 = f.subs(aL*h1 - 2*dL, X0)\nf2 = f2.subs(aL*h0 + 2*dL, X1)\nf2 = Eq(w0, solve(f2, w0)[0])\nf2",
"language": "python",
"metad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2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \u03c7\u2080 "
}
],
"prompt_number": 42
},
{
"cell_type": "code",
"collapsed": false,
"input": "f2.rhs()",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\frac{2 \\sigma_{{-1/2}} h_{{-}} - \\chi_{1} w_{1}}{\\chi_{0}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAF8AAAAkCAYAAADvqeb3AAAABHNCSVQICAgIfAhkiAAAA9lJREFU\naIHt2muIVVUUwPHfzGgo5kxJTm8SC4oKRXqRVKJFWhRlpJJFmEYPjdCKQoiwPklkSFAS9KESIit7\n0AvJD0NU9CCRgoikpA9lpY2Z2AMz+7D2eI+ne6/zunPm4vnDMHutffbeaz/OWvvufSgZFlyAZViB\n93BJodYEx+J5fFe0IY3kSKzMyHPxB04sxpyDuBVrijaikUzCvzg1ye3YLyahaF7CtUUb0UhahNtp\nSfJZYvCnZJ5Zhi/xG/7E13ijwXa14hfcgtl4xuC7w3bcjdexIJc3T2VB5hmBxXgO5yfdLDyZ0ivx\nUH8MWotVGXkllovJGYstGNWfivvIefge45K8WKVzg0WbmOSp+FWlXzPUn+i5OBqvYk7SPYU7Unoq\nVtdreEQV3SJswwNJPhMXYlqSd2MXOvBXvcoTrXgM9xzimSUYneRH0//LxWrvTvK5+LwXbRITNbFO\n/mdYh31J/gjbxerdijF4M2djth8bxPhdhBuTbobKgH+Fj2uUrcpVYvCJFTAB9+H+zDPj8EW9SjJ0\npAY31cg/Ixl/NU5OuvU4J6W7xAoiJmY7OsWKawQr8C7m5/S1+nEzXkzp8fgxk3edGKuaY9CaSU8T\nW7u3cZxYAcdjh4NX+INiQnrDLjyO32vkT8eHwq/ekHTfiokYI2LPp0l/BT4Ru7A5GsMGsRjW5fS1\n+jFeuEXCQ2xL6RaxSLrrlD3gdibiLbHlzNIhXs8VIuh14h1s7H1/anIE9orAvibJMFm8upPEYPyT\n9FtFsF+Epweh/Txtwq11Czf7QS/KvCBsXSD6sSmlR+HlBtjYL7qq6GaLNyvLxSKwF8FdYjOxWu2g\n3jWA+v9XtlrA7QtjxXYszw/Cd9bjBJXXlHjLpuORIWg7z0Kx1dwtto4bca8Ixnv7WNewoysnT8CV\nOd0SjEx/lzXepAPMFC4uyyo8gdty+q4BtDOQsv1iNJbiZxHxe7aStwsf28N8EZB2YCfOHkIbe0Ot\nfjS67KDTJga/pAAuFW6npKSkpKTksKHn/H5/oVaUlJQcRrQd+pHCaRc/ypaL08LNmbx54rh7ZwF2\nHRb05prvYXHGv2zIrRsArYd+pHD2iS8rstd8k8Vly/viqvFvcX5+Ok4rxsy+0wxuJ8sxuEYcRa9P\nupvEJcYWnCKOqjdXLT3MaIaVn6XaNV8n9qT0HnEV2hQ00+Dnr/l6aFX5AiGbHvY00+DfiWfxmspl\nO/FRVc8ZebuICyWDyEKclNJTVHY9I0UAXpry1oqvCJqCZgi4M/GNCKjwk/Drs8SHvK/gehwljkvW\nV6mjpKSkpKSkUP4DjYW36iZGV8QAAAAASUVORK5CYII=\n",
"prompt_number": 43,
"text": "2\u22c5\\sigma_{-1/2}\u22c5h_{-} - \u03c7\u2081\u22c5w\u2081\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \u03c7\u2080 "
}
],
"prompt_number": 43
},
{
"cell_type": "code",
"collapsed": false,
"input": "f2 = f2.subs({X0:aL*h1 - 2*dL, X1:aL*h0 + 2*dL})\nf2",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$w_{0} = \\frac{2 \\sigma_{{-1/2}} h_{{-}} - w_{1} \\left(a_{{-1/2}} h_{0} + 2 d_{{-1/2}}\\right)}{a_{{-1/2}} h_{1} - 2 d_{{-1/2}}}$$",
"output_type": "pyout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Kmp78Q58HOF9btV4sDp3UL/mn8Jff7/apr6TKpDNprXNU8\nxU08l2s+JEq44ShyHi0xPAblaa+qnuLGmn4POe/V7JaBeFG72qRNjI5Bedqrqqe4sabfRnmn5gOo\nU8KVwl3tk080s9FrXJU9xU0sU+I0e32NsNrMPksmndngNa4bVfIUN7b0e8j5AbwYb8J3RY/casye\nqLbXuHZ5F/Wwl6dqnuISiY5U1Wtct7yLUkVPcWPLuHmzG1eq6jWuW95FqKqnuLFlUnz0jJqqeo3r\nlyp7ikskBk6tTVxZnvba5V0Fam3ixtW7YGHSSFkNRuU1blSM0rtgIlEatZbwtPI87bXmXRVqLeFp\n4+tdMDGLGKTXuG6e70bFbPIumJgQJtFr3CTqnBgjJtFr3CTqnEgkEolEIpFIVJ3/AbzJ54oo2cHO\nAAAAAElFTkSuQmCC\n",
"prompt_number": 44,
"text": " 2\u22c5\\sigma_{-1/2}\u22c5h_{-} - w\u2081\u22c5(a_{-1/2}\u22c5h\u2080 + 2\u22c5d_{-1/2})\nw\u2080 = \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n a_{-1/2}\u22c5h\u2081 - 2\u22c5d_{-1/2} "
}
],
"prompt_number": 44
},
{
"cell_type": "code",
"collapsed": false,
"input": "f2.rhs().limit(aL,0)",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{\\sigma_{{-1/2}} h_{{-}}}{d_{{-1/2}}} + w_{1}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAGsAAAApCAYAAAAyL9drAAAABHNCSVQICAgIfAhkiAAAA9tJREFU\neJzt2ltoHFUcx/GPSU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2v/oYwOt1XN8heDRqnXOVYNzZUOPcZmcQDwqD9ZSJz2TTyhBeSuiNuEU2B1IW\n59NyIcKq5n6aUeQRYOww9mp+Ns7Gq8ILxVpkcT69gYNNdD/NOPIIMJ7EicKPOSvqAVM3Y3YLe9+o\nsGx0x/KlwvNLSUFUqpSlnU/McPdT0a9IGuV8on73U8k0UUnpRcY7n2gO91Nbk8X5RPO4n0pSNKvz\nqaQKpyi9eyUlJSXtyH855N1jHRtqEAAAAABJRU5ErkJggg==\n",
"prompt_number": 48,
"text": " \\sigma_{-1/2}\u22c5h_{-} \n- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + w\u2081\n d_{-1/2} "
}
],
"prompt_number": 48
},
{
"cell_type": "markdown",
"metadata": {},
"source": "------------------\n(A short calculation to find a nice way to write the terms)"
},
{
"cell_type": "code",
"collapsed": false,
"input": "h = symbols(\"h_{j}, h_{j+1}, h_{j-1}\")\nhm, hp = symbols(\"h_{-}, h_{+}\")\nw = symbols(\"w_{j}, w_{j+1}, w_{j-1}\")\nam, ap = symbols(\"a_{j-1/2}, a_{j+1/2}\")\ndm, dp = symbols(\"d_{j-1/2}, d_{j+1/2}\")\n#from IPython.core.display import *\n#Latex(\"\\begin{eqnarray}...\\end{eqnarray}\")\n",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 15
},
{
"cell_type": "code",
"collapsed": false,
"input": "f1 = am * ( h[0]/(2*hm)*w[-1] + h[-1]/(2*hm)*w[0] ) - dm*(w[-1]-w[0])/hm # flux w_j-1/2\nf2 = ap * ( h[1]/(2*hp)*w[0] + h[0]/(2*hp)*w[1] ) - dp*(w[0]-w[1])/hp # flux w_j+1/2\nEq(Symbol(\"\\mathcal{F}_{j-1/2}\"), f1)",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\mathcal{F}_{{j-1/2}} = a_{{j-1/2}} \\left(\\frac{h_{{j-1}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tU6PBVNIw7jzVR2b+iK\neL5IbC2Ti5EnR9g6t3FoZDbJc4ftorA1z2uQH3vZ3B/jUMZ6Zpy70ToSaYlSQhuR61iQOUgBHeUd\ni0nvFpQXtpbJcWRfyKiaoNnkVOQl4O9x1kdlG/eyYEue70DjQ0OR0tYzU+vUDkPTt4N+vnF4BxUF\nsQFtEHq9dz0CteqeDjwzAS1zODJwf0yK9PPC5jJ5HC1M9TbS73rsE2Y2WYBaL/4eZzMpx0QOH1vy\n3IO2fjKx5EArUvZ6lpmZ5OOucw7ZWpxFYnuZrEDKJcu+j1Fmk0HM7LBtIzbleTkaXE5rkmp1Bilv\nPUtNB/pajUKz2uIuep2Eaj/dVqCVymQEGqQ8N+XzUWaTHvSC+L2xJVRa8qszyGsDtuV5O3BFjvHb\nTJnrWSYORS3CS5Fvp2lGAx/OId48abUyWYEWpEqq6CcgU8rBwDEaKarbqsJO967XknwGpE3YlucF\naJXDQ3KK33bKWs8cDtrQynirGgV0WEUHmokatqmrowS0kpnAkQ9HI1vdGWjiSd7kvYW8jZjO80eQ\nZ437oEYzFOuZo2TMB+7FdQFbgTegVQ+HqgnD4RhSnE22dT0c+TMezTgcXbAcDofD4XA4HA6Hw+Fw\nOBwOh8//Af1stOtNjfZvAAAAAElFTkSuQmCC\n",
"prompt_number": 5,
"text": " \u239bh_{j-1}\u22c5w_{j} h_{j}\u22c5w_{j-1}\u239e d_{j-1/2}\u22c5(w\n\\mathcal{F}_{j-1/2} = a_{j-1/2}\u22c5\u239c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u239f - \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \u239d 2\u22c5h_{-} 2\u22c5h_{-} \u23a0 h\n\n_{j-1} - w_{j})\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n_{-} "
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": "Eq(Symbol(\"\\mathcal{F}_{j+1/2}\"), f2)",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\mathcal{F}_{{j+1/2}} = a_{{j+1/2}} \\left(\\frac{h_{{j+1}} w_{{j}}}{2 h_{{+}}} + \\frac{h_{{j}} w_{{j+1}}}{2 h_{{+}}}\\right) - \\frac{d_{{j+1/2}} \\left(- w_{{j+1}} + w_{{j}}\\right)}{h_{{+}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAApCAYAAADef+VUAAAABHNCSVQICAgIfAhkiAAAC4tJREFU\neJztnXuwV1UVxz9cLq+58ioQMBEGzQfEpZsoVqSXa5gPNKNAhbJLEBY0Q4JTZqPeHhSRPagYAsku\nFWgUpYyl1hQUOhYamcwYSSSpSaX5wAJUlP74njO/3z2cc37n/fjd/Zm5c8/vvPZae+9zzt5rr702\nGAwGg8FgMERkJjAkbyEMoRgCvC9nGa4DXgNOyFmO3sDonGUoIscCr8tbCEN5uQZYWfV7GPA94G/5\niJM7ZdJ/DbAox/RPBv6SY/oAjcCNQL+c5YjLx1K4ZwPwBaAphXsb6px5wJ2oEjn3r8penMJQFv17\nAncBc3JKfxHwrZzStlkCNOcsQxJ0pHTfYcBXU7q3oU5pAZ5AXU8nG4FLsxWnUJRJ/+OAfwBvyiCt\nRuBzwHzU0r0PeHcG6XrRH9gU8dpGYAGwDjjT2nc+lV70MuCGWNKFo8PnWFxZV+Ew/TlbgwaDTSOw\nHrgW+LfjWAPQCgwG3gOsBc5OSYYiPZw2YfQvgg5PWWmsJ/1n/tvAf5A5awPSeUvKafoxFbg/4rXT\ngVvRB2aUte8SYKe1vZni2OvjyroFuKx6R2PCAhrqhwXAEfSAOzkdOAjcATwLjEAV67cx02wAbgIW\nW7/tCv9OVOG3owr/sHV8Mxooz5ow+mehgzPf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i0J3CPWcgL\nLcs1o7sL7XkLkBamshj8OIw+DJuBXcR3bTVkTwsKpzKN+l6nw5AwDXkLYCg8+5C3zQq00l3WvFL7\nlLomjv5DUIDIi4GnkhHH4KC710+DwWAwGAwGg8FgMBgMBoPBYDAYDAZf/g+L3e+HoQE9GAAAAABJ\nRU5ErkJggg==\n",
"prompt_number": 6,
"text": " \u239bh_{j+1}\u22c5w_{j} h_{j}\u22c5w_{j+1}\u239e d_{j+1/2}\u22c5(-\n\\mathcal{F}_{j+1/2} = a_{j+1/2}\u22c5\u239c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u239f - \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \u239d 2\u22c5h_{+} 2\u22c5h_{+} \u23a0 h\n\nw_{j+1} + w_{j})\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n_{+} "
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": "f3 = (-f2 + f1)/h[0]\nf3 = f3.factor(list(w))\nf3",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{w_{{j+1}} \\left(a_{{j+1/2}} h_{{-}} h_{{j}} + 2 d_{{j+1/2}} h_{{-}}\\right) + w_{{j-1}} \\left(- a_{{j-1/2}} h_{{+}} h_{{j}} + 2 d_{{j-1/2}} h_{{+}}\\right) + w_{{j}} \\left(a_{{j+1/2}} h_{{-}} h_{{j+1}} - a_{{j-1/2}} h_{{+}} h_{{j-1}} - 2 d_{{j+1/2}} h_{{-}} - 2 d_{{j-1/2}} h_{{+}}\\right)}{2 h_{{+}} h_{{-}} h_{{j}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAuYAAAArCAYAAAA0cE0QA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pMCc2BUQETmNPQNczuAWkYuSv88nf+cA1wDn4s6s72X2rS5VhW7Hqh4i\nIiIiIp3wMHBfZnot8BKwJJneAdw/xnZDt2NVDxERKaEz5iIi7bAdOAx8PjNvI+7s9JFk+lLg2TG2\nHbodq3qIiIiIiLTaZtwXc4D5wHTyug9ckbxeALwMnIe7pSTPioL5vtuxXl9ERCrQGXMRkbiuxv0c\n4WPA+cD1wAXAQmA18HSy3CbgKeA4cFPBtvLu+x5nO+Ouv7vC9kREpIB+LlFEJJ4VwD7czyZmLcb9\nYst+4PVk3ovAMdyZ9Qc8ygjdjs/6uxAREREREXqRyl0PbItYvojIRNAZcxGRblsNXJe8Xgeck7x+\nA/fLKSdGrH8WcHPO/IPA4xXrcBT3YGjRPe4iIiIiIqeVXsSy9wAXRyxfRKTz9PCniIhYWAU8F7sS\nIiJdpltZREQmx2sRypyP+8dDhyKULSIiIiIiuJ9SfBS4G7gwcl1ERERERERERERERERERERERERE\nREREREREJsb/AJCAbc3bqU9bAAAAAElFTkSuQmCC\n",
"prompt_number": 16,
"text": "-(w_{j+1}\u22c5(a_{j+1/2}\u22c5h_{-}\u22c5h_{j} + 2\u22c5d_{j+1/2}\u22c5h_{-}) + w_{j-1}\u22c5(-a_{j-1/2}\u22c5h_\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \n\n{+}\u22c5h_{j} + 2\u22c5d_{j-1/2}\u22c5h_{+}) + w_{j}\u22c5(a_{j+1/2}\u22c5h_{-}\u22c5h_{j+1} - a_{j-1/2}\u22c5h_\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{+}\u22c5h_{-}\u22c5h_{j} \n\n{+}\u22c5h_{j-1} - 2\u22c5d_{j+1/2}\u22c5h_{-} - 2\u22c5d_{j-1/2}\u22c5h_{+}))\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n "
}
],
"prompt_number": 16
},
{
"cell_type": "markdown",
"metadata": {},
"source": "**The $w_{j+1}$ terms**"
},
{
"cell_type": "code",
"collapsed": false,
"input": "f3 = f3.together(deep=True)\n-f3.as_terms()[1][3].as_terms()[0][0][0]/(2*hp*hm*h[0]).cancel()",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{w_{{j+1}} \\left(a_{{j+1/2}} h_{{j}} + 2 d_{{j+1/2}}\\right)}{2 h_{{+}} h_{{j}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAKUAAAArCAYAAAAZkUhyAAAABHNCSVQICAgIfAhkiA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500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{+}\u22c5h_{j} "
}
],
"prompt_number": 20
},
{
"cell_type": "markdown",
"metadata": {},
"source": "**The $w_{j}$ terms**"
},
{
"cell_type": "code",
"collapsed": false,
"input": "-f3.as_terms()[1][3].as_terms()[0][1][0]/(2*hp*hm*h[0]).factor([am, ap])",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{w_{{j}} \\left(a_{{j+1/2}} h_{{-}} h_{{j+1}} - a_{{j-1/2}} h_{{+}} h_{{j-1}} - 2 d_{{j+1/2}} h_{{-}} - 2 d_{{j-1/2}} h_{{+}}\\right)}{2 h_{{+}} h_{{-}} h_{{j}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAV0AAAArCAYAAADbhFvfAAAABHNCSVQICAgIfAhkiAAABxlJREFU\neJztnVuoFVUYx3/HW56OaRl2sQsH7SJZGpSX7tnFshSy6JQKscGo0CCz6PYgUT1IWBRRUfhSgd0o\nCpSyHjoYQfeCQJJu9JAiiVqQD1nZwzfDnrPPzOyZvdZczjn/38uetfasNd/3n7VnrVlr9nwghBBi\nRLIImF+1EUII4cg87HoWy6gSDUnjPOBs4NOqDUngWOBl4OeKyg93fOlTJ53nAXcDDwMfAhen7PsQ\n8B9wcvFmxVKmbnXXxYcWnwFnUONBZBfwAdBTtSFtuBV4vsLywx1f+tRB5wnA+ki6DzgAnJCw/2nA\njqKNakMZug0VXXxocTiwOe6LOox0FwLfA39VbUgbFgJbKyw/3PGlTx10ngbcB0wP0u8D3cAFCfsv\nwkZ9VVKGbkNFFx9aHAB+BC5v/cLHRXcMsAp4CZgb5F0NPBtsrwfWpZRfDGyLqfNR4DZgNbCF5omq\nglHApcBRwFJgI+m3Rb7LF0VddPalT110/g6bMgtvUU8KPn8IPqO634mN+Kq86Jal21DQxacWHwNL\n/Jg1kD7MwLeBG4O854A7gu3zgadSy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lptCnXH9nuBa5p+X41NgE+Frgip00uJPkD1Yx0Id2mOPpb0r34\n17fRQZkoeXzqdzxWp/hqC73Up337wKU99lKMFo2E/HHAux3W6Z24K/98ms/nudQDySJ0B8fYja1s\ndgO3A6Mj+yzHJt/3YD3rmTltciGtR2zE5MX5U6ZNWWwpQt9GB2WiZPGpDG3T8NUW6tS+feDSHovS\nopGQv4bmUxCVMR4b3r+Y8P1VNP/R5lLPioT8VkZjJ6Jq2vkD2X3yRRab2lGUvp1q4cOnovHZFurS\nvn3geu6K1CLufMwh5S1jZdGDzdneA5xYg3rA/hPd61iHKz798YUvm+qgb0gddW7Ft4110t8FH7oM\nFy2EEEIIIYQQQgghwB7XCjkLm6juSti3lW9pvklMCCFEBrJeYNM45KEOIYQQQgghhBBCCCEykhYN\nti5RgesUVVgMM8p+4Y0Y2UzA3vQUvp6vD3tx9anYy0p2Y9ErXIOUutbjyw4hhKiUWdgbmMKYeBOx\nhdi+yD5vkP9Vn3G41uPLDiEGUIcQ7GLk0C4abF2iAtclqrAQQnilNRpsXaIC1zWqsBgGaKQrqiKM\nBntvJC8uEuv2Dup2rceXHUIIUQviosGCv0iseevxXV6IRDTSFWWTFA3WVyTWOkRvFiIRPTImyiQt\nGmwVUYFdy5cZvVkIISqnUdFxO4lMKwSgka4YerhGBi4qerMQQgx7GhUeO29kWiEALaQJ0SkzgB1V\nGyGGHppeEEOZgxUcczz2p4mdFRxbCCFGFEMhqrAQQgghhBBCCCGEEEIIITzxP0yrRYmKP/eOAAAA\nAElFTkSuQmCC\n",
"prompt_number": 29,
"text": "-w_{j}\u22c5(a_{j+1/2}\u22c5h_{-}\u22c5h_{j+1} - a_{j-1/2}\u22c5h_{+}\u22c5h_{j-1} - 2\u22c5d_{j+1/2}\u22c5h_{-} \n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{+}\u22c5h_{-}\u22c5h_{j} \n\n- 2\u22c5d_{j-1/2}\u22c5h_{+})\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n "
}
],
"prompt_number": 29
},
{
"cell_type": "markdown",
"metadata": {},
"source": "**The $w_{j-1}$ terms**"
},
{
"cell_type": "code",
"collapsed": false,
"input": "-f3.as_terms()[1][3].as_terms()[0][2][0]/(2*hp*hm*h[0]).cancel().simplify()",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{w_{{j-1}} \\left(- a_{{j-1/2}} h_{{j}} + 2 d_{{j-1/2}}\\right)}{2 h_{{-}} h_{{j}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAKgAAAArCAYAAADsb8PCAAAABHNCSVQICAgIfAhkiAAABUxJREFU\neJzt3FmoHFUex/HPjTGTmEziFpc4isRtcImKS9zHGIlmVHDBuIEEIiqJ4DaMy4MEF4iioogjig9u\nqCiKAxHHmQeDIriOguCCGz4YCYZEHSYPKsaHfzXdt29139tV1dW5N+cLl646dc6p3/3XOf9zTvX5\nN4lEom8sxjGDFpEoxXzxHHOZVKOQqjkWh+GtQQspyK54Al/VcK/5uBYr8R+c1CXvzfgNe/VfFngb\nB5pgjmYI/8b0QQspyWV4qIJ6rupybQZWtZwvwSbs0SH//visAk29sB1W510Yrx50ET7F/wctpCSL\n8GoF9ezc5dpc/B37ZOf/wjQc3yH/YuFl62QTvsDC9gtVNNDJWI7Hc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GnAWjpRhcaFYlgbtI6ybCm2SCQSiUQiMTFp3XBwiJgQD3XI286H\nmjuWEom+MNbG2I3NFdSRSCQSiUQiMUC6RUeWjdKsM8pz3FD3ZpHxzAyxM6ex9WyJ2Oy7n9gwsU7s\nzi8ayFe2fGIrZ54IDWnEQs0UC8QlLXmeU24bYNnyE47xGnY8CEaLjiwbpVlXlGdiK6E9OrJslGaV\nUZ4ThuRBi9GIjvxbS1pelObHPdRZtnwigfzoSMpHaZYtPyFJHrQ3OkVH9hKlmUfdUZ6JCchc8YMI\nm9v+ZorF01MteQ/Pzq82/AcVOlG2/ISliu/iE/UwX7zimoLHBiulPtKL+nooE8HaoJcoz0RiIGwJ\nUZ6JREe2hCjPWklD/PhgqniBv3a0jIlE3WwJUZ6JRCKRSCQSicRWw++XxiTBamhZGwAAAABJRU5E\nrkJggg==\n",
"prompt_number": 22,
"text": "-w_{j-1}\u22c5(-a_{j-1/2}\u22c5h_{j} + 2\u22c5d_{j-1/2})\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{-}\u22c5h_{j} "
}
],
"prompt_number": 22
},
{
"cell_type": "markdown",
"metadata": {},
"source": "**Simplifcations**\n\nLet's see what the above expression redcues to if we assume constant velocity and diffusion coefficient,"
},
{
"cell_type": "code",
"collapsed": false,
"input": "a, d = symbols(\"a,d\")\nf4 = f3.subs([(am,a),(ap,a),(dm,d),(dp,d)])\nf4",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{h_{{+}} w_{{j-1}} \\left(- a h_{{j}} + 2 d\\right) + h_{{-}} w_{{j+1}} \\left(a h_{{j}} + 2 d\\right) + w_{{j}} \\left(- a h_{{+}} h_{{j-1}} + a h_{{-}} h_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kSuQmCC\n",
"prompt_number": 30,
"text": "-(h_{+}\u22c5w_{j-1}\u22c5(-a\u22c5h_{j} + 2\u22c5d) + h_{-}\u22c5w_{j+1}\u22c5(a\u22c5h_{j} + 2\u22c5d) + w_{j}\u22c5(-a\u22c5h\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{+}\u22c5h_{-}\u22c5h_{j} \n\n_{+}\u22c5h_{j-1} + a\u22c5h_{-}\u22c5h_{j+1} - 2\u22c5d\u22c5h_{+} - 2\u22c5d\u22c5h_{-}))\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n "
}
],
"prompt_number": 30
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Again, this time with uniform mesh,"
},
{
"cell_type": "code",
"collapsed": false,
"input": "hu = Symbol(\"h\")\nf4.subs([(hm,hu),(hp,hu),(h[0],hu), (h[1], hu), (h[2], hu)]).factor([a,d,2*hu])",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{a \\left(h w_{{j+1}} - h w_{{j-1}}\\right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VGUAjER8Ud469UMQwbuzbHyvAxclbEu\nRVEKShPSPfEG/I1HbhqTTbgZ+B6Z/Tq4OJSiKAprkcWEPc5EZrX2przvxl+pSxlE6OAuxYW3UNBS\nK861ONSujHUpilJAqi0UVCF8cShlkKAtDcWm2kJBURaHUhRlkNGJrGt6IPAZhqyk/oKVd7IJL6bv\nuqiKoiiKoiiKoiiKoiiKUkj+B5disCrvZ0LzAAAAAElFTkSuQmCC\n",
"prompt_number": 31,
"text": "-(a\u22c5(h\u22c5w_{j+1} - h\u22c5w_{j-1}) + d\u22c5(2\u22c5w_{j+1} + 2\u22c5w_{j-1} - 4\u22c5w_{j}))\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2 \n 2\u22c5h "
}
],
"prompt_number": 31
},
{
"cell_type": "code",
"collapsed": false,
"input": "t = symbols(\"\\Delta_T\")\nf = t/h[-1] * (a * h[-1] / (2*hm) + d / hm) * Rational(1,2) *( -a * (hm+ hp) - w[1] ) \nf.expand().cancel()",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{\\Delta_{T} a^{2} h_{{+}} h_{{j-1}} + \\Delta_{T} a^{2} h_{{-}} h_{{j-1}} + 2 \\Delta_{T} a d h_{{+}} + 2 \\Delta_{T} a d h_{{-}} + \\Delta_{T} a h_{{j-1}} w_{{j+1}} + 2 \\Delta_{T} d w_{{j+1}}}{4 h_{{-}} h_{{j-1}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAecAAAAvCAYAAADZwQI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9FuyS9dUJtqGOV+L3s24L2NcFXoVdjbdQXj2ormbsk23KXMt0NfOm\nHKv5xHzeTb0W+a4n1PpiaaIPzkpWyVw1ucoy89idmu4OvC2ibEOapm9LtzQ1XnzWo/5mlFUiq4AH\ngI8CGxJvy6xRtiL+mhovGpf+lJWIiIiIiIiIiIiIHOuyPzz+Guxk9ooxdfN+wejOHCIiIhKI7xtx\nmaMBliEiIiIiIiIiIiIiIiKddgd2k/ehdcA9wBNTLq9uexFpSMobX4jIeOcDVwPfzTz2R+Ag8Pcp\nl1m3vYg0JMVva4tIuTXYb/8+XlC2jXp31KnbXkQaoDdnkfbZAXyt4PE54E3AScAl2A3iz6uw3Lrt\nRaQhOqwt0i4XYffgfa6gbDPwD+BB7L6x67H7+B70XHbd9iLSEH1yFmmP07Cbsf9yTPk27NPuYTe/\nBXiswvLrts+aA+6csq2IiEhnXAPcCtzi/p7CfrXvQlc+AM5x0wvAIeAU7DC1j7rth9Zg9559tGI7\nERGRzvsddo4Y7LZ0hxidiroU2I/dMH6Hx7KqtN/juX0Dz3oiUpHOOYu0zwbgI8Cp2D1iVwNPY1dZ\n/9vV+S3wF+Baii8ey9tUof0tNbZdREREAtoKbAd6nvUH0bZE5BinT84is+EE7MrrvCexq799HMEu\nFlsMtDwREREJYC+w0bPuIOJ2iIiIiLPfo84CcBP2c6C73LyIiIgENo99z/ru1BsiIiIi9jWrB7Ar\nwzck3hYRERERERERERERERERERERERERkdnxP447GeOq8hH1AAAAAElFTkSuQmCC\n",
"prompt_number": 13,
"text": " \u239b 2 2 \n-\u239d\\Delta_T\u22c5a \u22c5h_{+}\u22c5h_{j-1} + \\Delta_T\u22c5a \u22c5h_{-}\u22c5h_{j-1} + 2\u22c5\\Delta_T\u22c5a\u22c5d\u22c5h_{+}\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 4\u22c5h_{-}\u22c5h\n\n \u239e\n + 2\u22c5\\Delta_T\u22c5a\u22c5d\u22c5h_{-} + \\Delta_T\u22c5a\u22c5h_{j-1}\u22c5w_{j+1} + 2\u22c5\\Delta_T\u22c5d\u22c5w_{j+1}\u23a0\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n_{j-1} "
}
],
"prompt_number": 13
},
{
"cell_type": "markdown",
"metadata": {},
"source": "![caption](\"files/cell centered grid.png\")"
},
{
"cell_type": "code",
"collapsed": false,
"input": "\nimport os\nos.path.exists(\"/Users/daniel/myimage.png\")",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAACsAAAASCAYAAADCKCelAAAABHNCSVQICAgIfAhkiAAAAjJJREFU\nSInt1Vtoz2EYB/DPThiNslIa0syFHNpKc8qiqU2Klhs3oiV3SOLKhQuUQ9wop5Q55UJJEW7YyI0i\nFE3LULhgKdzMqbl437/99vM/JG0lvjfv7/d9n8P3fXre5+UvQlHieyYe4hMe4yPK0YAvuI1vkatD\nBSrxfgj1/sQuHMaIBDcdfTiRsp2Md0Mjqx+lie9aLMf3BNcQ1xspvxe4M3iysqM4rnVoN1Ao/WJv\npfgi9AyerPxYhvFZ+Nd4noUfiVWDqug3USP0a1uWvZU4hEuC8DXYg7OojzZTos1lvx5sI67lyFuL\nYzHeAZwSLnNetEaxrSl+OPbG7y5cwUJhMryMAotxBGXYhEepGPdwOkvOtcJEqkpw27CikNiTUWxN\nim9CC4ahFzsjPxEPsAhLhOrDVVxI+FcII3BdKu48fMWCBFcvFGNcIbHdQs+mMRdjhMvXh1lZbKri\nYaqES9uS2GuOflNTPtfxFvuwHwexHqMLCZ0QA57PY7NDmAhFeWw244PQOhnsxpuUXZlQ7aP5RBXn\n4HONrCQWo0M4VC404SY+p2Jn4lbHtRIlePYnYjty7JcL7dCeLzgm4WnKb7bwdMOWuPYIz3vykcpg\nmtjf2cQWo1F485/kEDFf6MlCYrswNvG/PQp6jhnojHymBZoNbKtGbMUZiY0SXMQooRqZGXtX6Lk2\nnEsEWY0NmCN/G1QLI6wz5jqOpcLE6BYq2xttS4XZWoVXQjHux9z5cvzHv4UfsudwW40c0GcAAAAA\nSUVORK5CYII=\n",
"prompt_number": 24,
"text": "True"
}
],
"prompt_number": 24
},
{
"cell_type": "code",
"collapsed": false,
"input": "from IPython.core.display import Image \nImage(filename=\"/Users/daniel/.ipython/files/cell centered grid.png\")",
"language": "python",
"metadata": {},
"outputs": [
{
"ename": "IOError",
"evalue": "[Errno 2] No such file or directory: u'/Users/daniel/.ipython/files/cell centered grid.png'",
"output_type": "pyerr",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mIOError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-25-2b49980c6bab>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mIPython\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcore\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdisplay\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mImage\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"/Users/daniel/.ipython/files/cell centered grid.png\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/usr/local/lib/python2.7/site-packages/IPython/core/display.pyc\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, data, url, filename, format, embed)\u001b[0m\n\u001b[1;32m 478\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0municode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 479\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0membed\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0membed\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0membed\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mNone\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0murl\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 480\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mImage\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 481\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 482\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mreload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python2.7/site-packages/IPython/core/display.pyc\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, data, url, filename)\u001b[0m\n\u001b[1;32m 263\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0murl\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 264\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfilename\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mNone\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfilename\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mNone\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0municode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 265\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 266\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 267\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mreload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python2.7/site-packages/IPython/core/display.pyc\u001b[0m in \u001b[0;36mreload\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 483\u001b[0m \u001b[0;34m\"\"\"Reload the raw data from file or URL.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0membed\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 485\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mImage\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 486\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 487\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_repr_html_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python2.7/site-packages/IPython/core/display.pyc\u001b[0m in \u001b[0;36mreload\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 268\u001b[0m \u001b[0;34m\"\"\"Reload the raw data from file or URL.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 269\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfilename\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 270\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_read_flags\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 271\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 272\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0murl\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mIOError\u001b[0m: [Errno 2] No such file or directory: u'/Users/daniel/.ipython/files/cell centered grid.png'"
]
}
],
"prompt_number": 25
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Naturally resolved boundary conditions\n--------------------------------------\n\n------------------------"
},
{
"cell_type": "code",
"collapsed": false,
"input": "##\n## LEFT HAND SIDE\n##\nh = symbols(\"h_{j}, h_{j+1}, h_{j-1}\")\nhm, hp = symbols(\"h_{-}, h_{+}\")\nw = symbols(\"w_{j}, w_{j+1}, w_{j-1}\")\nam, ap = symbols(\"a_{j-1/2}, a_{j+1/2}\")\ndm, dp = symbols(\"d_{j-1/2}, d_{j+1/2}\")\ngR_left = symbols(\"g_R\")\nf1 = am * ( h[0]/(2*hm)*w[-1] + h[-1]/(2*hm)*w[0] ) - dm*(w[-1]-w[0])/hm # flux w_j-1/2\nf2 = ap * ( h[1]/(2*hp)*w[0] + h[0]/(2*hp)*w[1] ) - dp*(w[0]-w[1])/hp # flux w_j+1/2\nf = (-f2 + gR_left)/h[0]\nf = f.factor(list(w) )\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$- \\frac{- 2 g_{R} h_{{+}} + w_{{j+1}} \\left(a_{{j+1/2}} h_{{j}} + 2 d_{{j+1/2}}\\right) + w_{{j}} \\left(a_{{j+1/2}} h_{{j+1}} - 2 d_{{j+1/2}}\\right)}{2 h_{{+}} h_{{j}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAArCAYAAAB1no8bAAAABHNCSVQICAgIfAhkiAAACLdJREFU\neJztnWuMHWUZx39bSm3d2nKr5WqWooCsFIy0C6JCRYqLJRGx5Ro9SQ2QlqRIFQiJZBVNVlPUL4gX\nYkAMXlCDhiYCHywQoqBYk5JGgpZoYgsp6QLFekGoH553MtM5M3Pm8s6ZObv/X3Jy5vLOO888z3/O\nvLczLwghhBBi4BkHzmzaCJGbMSxmbUM6mr5kam5WHw0JGAM+C0wAjwAf8pDnYuAHwA4PeQ0aZwGn\nA79r2pAU+hmbItq6BXgTeEf9ZnXxJHAK7frRlY7KIc2VYD4wGVlfA+w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dUAghxIBSZgx+nP0e8hBCCCGEEEIIIYQQQgiPjGEz3E1gUwRGX+27\nGJsEaUf3YYXwlY8QjdGml84J4ZP52Ny2wWt+12AThbwLe2Pti9hbGKtO2O4rHyGEEJ5Zir2tMZiL\ndwE2sGFNJM1PgY97OJevfIRohCYnoxaiTrYBZxE22QSzND3nvmcB52JTB16Mvdm2zMx1vvIRQghR\nM/dirzoPWIZN7RjM5bsOe+d7UXzlI0RjqEYgZgJrsUk7PhfZthIrvQfzt54BbC+Rt698hBBC1MQq\n7EEA9vrfEbe8hfDd7POA3dgk74em5JM2e1rRfIRoHaoRiOnMOdjwzs3Akdh0jEdhrwIeBZ5y6caB\nJ7FZ71an5JXU7l8kn8lSVyCEEKI0S4C92Eih6GcB1on8w0ja97r1DVitIYlOwrYy+QghhBhQOiWP\nG8OmDix7vBC1oz+UCZHOKHC+W14OHOKW38BGBr2ZI48prCM5rY9BCCHEgNCpcOwm4CRPdgjhHXUW\nC1E/JwPPNm2EEGmoaUiIfLxe4pi52B/Ndnq2RQghxAAwDDwAbASObdgWIYQQQgghhBBCCCGEEEII\nIbr4P6oxhkuBwqe7AAAAAElFTkSuQmCC\n",
"prompt_number": 53,
"text": "-(-2\u22c5g_R\u22c5h_{+} + w_{j+1}\u22c5(a_{j+1/2}\u22c5h_{j} + 2\u22c5d_{j+1/2}) + w_{j}\u22c5(a_{j+1/2}\u22c5h_\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{+}\u22c5h_{j} \n\n{j+1} - 2\u22c5d_{j+1/2}))\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n "
}
],
"prompt_number": 53
},
{
"cell_type": "code",
"collapsed": false,
"input": "##\n## RIGHT HAND SIDE\n##\nh = symbols(\"h_{j}, h_{j+1}, h_{j-1}\")\nhm, hp = symbols(\"h_{-}, h_{+}\")\nw = symbols(\"w_{j}, w_{j+1}, w_{j-1}\")\nam, ap = symbols(\"a_{j-1/2}, a_{j+1/2}\")\ndm, dp = symbols(\"d_{j-1/2}, d_{j+1/2}\")\ngR_right = symbols(\"g_R\")\nf1 = am * ( h[0]/(2*hm)*w[-1] + h[-1]/(2*hm)*w[0] ) - dm*(w[-1]-w[0])/hm # flux w_j-1/2\nf2 = ap * ( h[1]/(2*hp)*w[0] + h[0]/(2*hp)*w[1] ) - dp*(w[0]-w[1])/hp # flux w_j+1/2\nf = (-gR_right + f1)/h[0]\nf = f.factor(list(w))\nf",
"language": "python",
"metadata": {},
"outputs": [
{
"latex": "$$\\frac{- 2 g_{R} h_{{-}} + w_{{j-1}} \\left(a_{{j-1/2}} h_{{j}} - 2 d_{{j-1/2}}\\right) + w_{{j}} \\left(a_{{j-1/2}} h_{{j-1}} + 2 d_{{j-1/2}}\\right)}{2 h_{{-}} h_{{j}}}$$",
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAWIAAAArCAYAAABCfIJqAAAABHNCSVQICAgIfAhkiAAAB69JREFU\neJztnWuoFVUYhp+jZpq3sszSCtMy07CizMpuZlimQXaxrCjByFBB0+5QnLLIoitRZkl0w+5RUJT1\no0MRdO+HIUU3CrIkUUvzR0X245tpj3Nm9szsWbNn9jnvA4cza2bNWt+31rv2uszsvUAIIYTohkwD\nji3bCAHARKw+qoh00nWoq7MeDSZ4FdAOvAOc1JBZOzMUeAr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jWyimedeIYToNozHNg7w92cbiD04nhWI8wLZfhIySJ57hWgaZWxSKYRP0u67\neXYNruqOw0IIUWnCu+/m2TW47B2HhUiNRsSiKvi7714dOBe1a/C6lOnluVcIIbodcbuCd9D4rsF5\n7hWiqWhELMombvfdLDtLhyl6V2ohhOgyjAS2Ym9KBP8GYg/xngnEPdILL8JGzfXIc68QTadV9osT\nwjUTsdfmemNbeAlRGvpCh2hV8u4QXMau1EIIIUKUsSu1EEKIAGXsSi1EJ7Q0IbojfbAveqwv2xAh\nhOiOtOJuw0IIIYQQQgghhBBCCCGE6KL8ByB7S8NsQLTaAAAAAElFTkSuQmCC\n",
"prompt_number": 51,
"text": "-2\u22c5g_R\u22c5h_{-} + w_{j-1}\u22c5(a_{j-1/2}\u22c5h_{j} - 2\u22c5d_{j-1/2}) + w_{j}\u22c5(a_{j-1/2}\u22c5h_{j\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2\u22c5h_{-}\u22c5h_{j} \n\n-1} + 2\u22c5d_{j-1/2})\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n "
}
],
"prompt_number": 51
},
{
"cell_type": "markdown",
"metadata": {},
"source": "------------------\nA look at generating a cell centered grid."
},
{
"cell_type": "code",
"collapsed": false,
"input": "N = 5\nmesh_range = (-11,11)\n#faces = linspace(mesh_range[0], mesh_range[1], N)\nfaces = np.array([-10, -9, 0, 4, 10])\ncells = 1/2 * (faces[0:-1] + faces[1:])\nlen(faces), len(cells)",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "cells[where(cells < 0)]",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "cells[where(cells > 0)]",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "a = np.zeros(len(cells))\na",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "a[where(cells < 0)] = -1\na[where(cells > 0)] = 1\na",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "# h- and h+ differences\nnp.array([2,3,4,5]) - np.array([1,2,3,4])",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "a = array([2,3,4,5])\nb = array([1,2,3,4])\nc = array([1,2,3,4,5])\nc[1:] - c[0:-1]",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "hp = cells[1:] - cells[0:-1]\nhp",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "#hm = cells[1::-1] - cells[0:-1:-1]",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "hp = lambda j, cells: cells[j+1] - cells[j]\nhm = lambda j, cells: cells[j] - cells[j-1]\nhm(0, cells), hp(0, cells)",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "hp = cells[1:] - cells[0:-1]\nhp",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "def hp(index, cells):\n if index < (len(cells) - 1):\n return cells[index+1] - cells[index]\n else:\n raise ValueError, \"The index is out of bounds for the hp term.\"\n\ndef hm(index, cells):\n if index > 0:\n return cells[index] - cells[index-1]\n else:\n raise ValueError, \"The index is out od bounds for the hm term.\"\n\nhj = faces[1:] - faces[0:-1]\nhj",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "hm(1,cells)",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "hmp = cells[1:] - cells[0:-1]\nprint len(hmp)\nhmp_joint = (hmp[0], (hmp[0], hmp[1]), hmp[2] )\nhmp_joint",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "[hm(j,cells) for j in range(1,N-1)]",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "cells",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "faces",
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": "",
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.