Changeset 5300 in historical
- Timestamp:
- 08/16/12 11:37:48 (2 years ago)
- Location:
- trunk
- Files:
-
- 44 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/INSTALLATION.txt
r5140 r5300 169 169 170 170 :term:`FiPy` requires at least version 2.4.x of :term:`Python`. See 171 :ref:`RunningUnderPython3` for instructions on how to run 172 :term:`FiPy` with `Python 3.x`_. 173 174 .. _Python 3.x: http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://docs.python.org/py3k/ 171 the specialized instructions if you wish to :ref:`RunUnderPython3`. 172 175 173 .. _download: http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://www.python.org/download/ 176 174 -
trunk/README.txt
r5140 r5300 55 55 The significant changes since version 2.1 are: 56 56 57 - :ref:`CoupledEquations` are now supported. 58 - A more robust mechanism for specifying :ref:`BoundaryConditions` is now 59 used. 60 - Most :class:`~fipy.meshes.mesh.Mesh`\es can be partitioned by 61 :ref:`MeshingWithGmsh`. 62 - :ref:`PYAMG` and :ref:`SCIPY` have been added to the :ref:`SOLVERS`. 63 - FiPy is capable of :ref:`RunningUnderPython3`. 64 - "getter" and "setter" methods have been pervasively changed to Python 65 properties. 66 - The test suite now runs much faster. 57 67 - Tests can now be run on a full install using `fipy.test()`. 58 - Grid classes now take an `Lx` argument.59 68 - The functions of the :mod:`~fipy.tools.numerix` module are no longer 60 69 included in the :mod:`fipy` namespace. See :mod:`examples.updating.update2_0to3_0` 61 70 for details. 62 - Support for Python 3. Please see :ref:`RunningUnderPython3` for details. 71 - Equations containing a :class:`~fipy.terms.transientTerm.TransientTerm`, 72 must specify the timestep by passing a ``dt=`` argument when calling 73 :meth:`~fipy.terms.term.Term.solve` or :meth:`~fipy.terms.term.Term.sweep`. 63 74 64 75 Tickets fixed in this release:: 65 76 66 171 update the mayavi viewer to use mayavi 2 67 286 'matplotlib: list index out of range' when no title given, but only sometimes 68 197 ~binOp doesn't work on branches/version-2_0 69 194 `easy_install` instructions for MacOSX are broken 70 192 broken setuptools url with python 2.6 71 184 The FiPy webpage seems to be broken on Internet Explorer 72 168 Switch documentation to use `:math:` directive 73 198 FiPy2.0.2 LinearJORSolver.__init__ calls Solver rather than PysparseSolver 74 199 `gmshExport.exportAsMesh()` doesn't work 75 195 broken arithmetic face to cell distance calculations 77 45 Navier Stokes 78 85 CellVariable hasOld() should set self.old 79 101 Grids should take Lx, Ly, Lz arguments 80 145 tests should be run with fipy.tests() 81 177 remove ones and zeros from numerix.py 82 178 Default time steps should be infinite 83 291 term multiplication changes result 84 296 FAQ gives bad guidance for anisotropic diffusion 85 297 Use physical velocity in the manual/FAQ 86 298 mesh manipulation of periodic meshes leads to errors 87 299 Give helpfull error on - or / of meshes 88 301 wrong cell to cell normal in periodic meshes 89 302 gnuplot1d gives error on plot of facevariable 90 309 pypi is failing 91 312 Fresh FiPy gives ""ImportError: No viewers found""" 92 314 Absence of enthought.tvtk causes test failures 93 319 mesh in FiPy name space 94 324 --pysparse configuration should never attempt MPI imports 95 327 factoryMeshes.py not up to date with respect to keyword arguments 96 331 changed constraints don't propagate 97 332 anisotropic diffusion and constraints don't mix 98 333 `--Trilinos --no-pysparse` uses PySparse?!? 99 336 Profile and merge reconstrain branch 100 339 close out reconstrain branch 101 341 Fix fipy.terms._BinaryTerm test failure in parallel 102 343 diffusionTerm(var=var1).solver(var=var0) should fail sensibly 103 346 TeX is wrong in examples.phase.quaternary 104 348 Include Benny's improved interpolation patch 105 354 GmshExport is not tested and does not work 106 355 Introduce mesh.x as shorthand for mesh.cellCenters[0] etc 107 356 GmshImport should support all element types 108 357 GmshImport should read element colors 109 363 Reduce the run times for chemotaxis tests 110 366 tests take *too* long!!! 111 369 Make DiffusionTermNoCorrection the default 112 370 Epetra Norm2 failure in parallel 113 373 remove deprecated `steps=` from Solver 114 376 remove deprecated `diffusionTerm=` argument to ConvectionTerm 115 377 remove deprecated `NthOrderDiffusionTerm` 116 380 remove deprecated Variable.transpose() 117 381 remove deprecated viewers.make() 118 382 get running in Py3k 119 384 gmsh importer and gmsh tests don't clean up after themselves 120 385 `diffusionTerm._test()` requires PySparse 121 390 Improve test reporting to avoid inconsequential buildbot failures 122 391 efficiency_test chokes on liquidVapor2D.py 123 393 two `--scipy` failures 124 395 `--pysparse --inline` failures 125 417 Memory consumption growth with repeated meshing, especially with Gmsh 126 418 Viewers not working when plotting meshes with zero cells in parallel 127 419 examples/cahnHilliard/mesh2D.py broken with --trilinos 128 420 Epetra.PyComm() broken on Debian 129 421 cellVariable.min() broken in parallel 130 426 Add in parallel buildbot testing on more than 2 processors 131 427 Slow PyAMG solutions 132 434 Gmsh I/O 133 438 changes to gmshImport.py caused --inline problems 134 439 gmshImport tests fail on Windows due to shared file 135 441 Explicit convetion terms should fail when the equation has no TransientTerm (dt=None) 136 445 getFaceCenters() should return a FaceVariable 137 446 constraining values with ImplictSourceTerm not documented? 138 448 Gmsh2D does not respect background mesh 139 452 Gmsh background mesh doesn't work in parallel 140 453 faceValue as FaceCenters gives inline failures 141 454 Py3k and Windows test failures 76 142 77 143 .. warning:: -
trunk/documentation/FAQ.txt
r5234 r5300 98 98 99 99 It is important to realize that, even though an expression may 100 superficially resemble one of those shown above, if the dependent variable100 superficially resemble one of those shown in :ref:`section:discretization`, if the dependent variable 101 101 *for that PDE* does not appear in the appropriate place, then that 102 102 term should be treated as a source. … … 193 193 >>> eq = TransientTerm() == (DiffusionTerm(coeff=D1) 194 194 ... + <Specific>ConvectionTerm(coeff=D2 * xi.faceGrad)) 195 196 .. note:: 197 198 With the advent of :ref:`CoupledEquations` in FiPy 3.x, it is now 199 possible to represent both terms with 200 :class:`~fipy.terms.diffusionTerm.DiffusionTerm`. 195 201 196 202 What if the coefficient of a term depends on the variable that I'm solving for? … … 297 303 :class:`Viewer <viewer.AbstractViewer>` that comes closest to producing the image you want. You can 298 304 then override just the behavior you wan to change, while letting :term:`FiPy` do 299 most of the heavy lifting. See :mod:`examples.phase.anisotropy` for an 300 example of creating a custom :term:`Matplotlib` :class:`Viewer 301 <viewer.AbstractViewer>` class. 305 most of the heavy lifting. See :mod:`examples.phase.anisotropy` and 306 :mod:`examples.phase.polyxtal` for examples of creating a custom 307 :term:`Matplotlib` :class:`Viewer <viewer.AbstractViewer>` class; see 308 :mod:`examples.cahnHilliard.sphere` for an example of creating a custom 309 :term:`Mayavi` :class:`Viewer <viewer.AbstractViewer>` class. 302 310 303 311 .. _FAQ-IterationsTimestepsSweeps: … … 391 399 :mod:`examples.diffusion.mesh1D`, 392 400 :mod:`examples.phase.simple`, 393 :mod:`examples.phase.binary `, and :mod:`examples.flow.stokesCavity`.401 :mod:`examples.phase.binaryCoupled`, and :mod:`examples.flow.stokesCavity`. 394 402 395 403 timesteps … … 437 445 :mod:`examples.phase.simple`. The timestep is gradually 438 446 increased as the kinetics slow down in 439 :mod:`examples.cahnHilliard.mesh2D `.447 :mod:`examples.cahnHilliard.mesh2DCoupled`. 440 448 441 449 Finally, we can (and often do) combine all three layers of repetition: … … 497 505 .. currentmodule:: fipy.variables.cellVariable 498 506 499 How do I represent a fixed value (Dirichlet) boundary condition? 500 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 501 502 Use the :meth:`~CellVariable.constrain` method. For 503 example, to fix `var` to have a value of `2` along the upper surface of a domain, 504 use 505 506 >>> var.constrain(2., where=mesh.facesTop) 507 508 .. note:: 509 510 The old equivalent 511 :class:`~fipy.boundaryConditions.fixedValue.FixedValue` boundary 512 condition is now deprecated. 513 514 How do I apply a (Neumann) fixed gradient boundary condition? 515 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 517 Use the :attr:`~.CellVariable.faceGrad`.\ :meth:`~fipy.variables.variable.Variable.constrain` 518 method. For example, to fix `var` to have a gradient of `(0,2)` along the upper 519 surface of a 2D domain, use 520 521 >>> var.faceGrad.constrain(((0,),(2,)), where=mesh.facesTop) 522 523 How do I apply a fixed flux boundary condition? 524 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 525 526 Generally this can be implemented with a judicious use of 527 :attr:`~.CellVariable.faceGrad`.\ :meth:`~fipy.variables.variable.Variable.constrain`. 528 Failing that, an exterior flux term can be added to the equation. Firstly, 529 set the terms' coefficients to be zero on the exterior faces, 530 531 >>> diffCoeff.constrain(0., mesh.exteriorFaces) 532 >>> convCoeff.constrain(0., mesh.exteriorFaces) 533 534 then create an equation with an extra term to account for the exterior flux, 535 536 >>> eqn = (TransientTerm() + ConvectionTerm(convCoeff) 537 ... == DiffusionCoeff(diffCoeff) 538 ... + (mesh.exteriorFaces * exteriorFlux).divergence) 539 540 where `exteriorFlux` is a rank 1 541 :class:`~fipy.variables.faceVariable.FaceVariable`. 542 543 .. note:: 544 545 The old equivalent :class:`~fipy.boundaryConditions.fixedFlux.FixedFlux` 546 boundary condition is now deprecated. 547 548 How do I apply an outlet or inlet boundary condition? 549 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 551 Convection terms default to a no flux boundary condition unless the 552 exterior faces are associated with a constraint, in which case either 553 an inlet or an outlet boundary condition is applied depending on the 554 flow direction. 555 556 How do I apply spatially varying boundary conditions? 557 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 559 The use of spatial varying boundary conditions is best demonstrated with an 560 example. Given a 2D equation in the domain :math:`0 < x < 1` and :math:`0 < y < 1` with 561 boundary conditions, 562 563 .. math:: 564 565 \phi = \left\{ 566 \begin{aligned} 567 xy &\quad \text{on $x>1/2$ and $y>1/2$} \\ 568 \vec{n} \cdot \vec{F} = 0 &\quad \text{elsewhere} 569 \end{aligned} 570 \right. 571 572 where :math:`\vec{F}` represents the flux. The boundary conditions in :term:`FiPy` can 573 be written with the following code, 574 575 >>> x, y = mesh.faceCenters 576 >>> mask = ((x < 0.5) | (y < 0.5)) 577 >>> var.faceGrad.constrain(0, where=mesh.exteriorFaces & mask) 578 >>> var.constrain(x * y, where=mesh.exteriorFaces & ~mask) 579 580 then 581 582 >>> eqn.solve(...) 583 584 Further demonstrations of spatially varying boundary condition can be found 585 in :mod:`examples.diffusion.mesh20x20` 586 and :mod:`examples.diffusion.circle` 587 588 .. % http://thread.gmane.org/gmane.comp.python.fipy/726 589 % http://thread.gmane.org/gmane.comp.python.fipy/846 590 591 % \subsection{Fourth order boundary conditions} 592 593 % http://thread.gmane.org/gmane.comp.python.fipy/923 594 595 % \subsection{Periodic boundary conditions} 596 597 % http://thread.gmane.org/gmane.comp.python.fipy/135 598 599 % \subsection{Time dependent boundary conditions} 600 601 % http://thread.gmane.org/gmane.comp.python.fipy/2 602 603 % \subsection{Internal boundary conditions} 507 See the :ref:`BoundaryConditions` section for more details. 604 508 605 509 What does this error message mean? -
trunk/documentation/USAGE.txt
r5214 r5300 224 224 :term:`FiPy` can use :term:`Trilinos` to solve equations in 225 225 parallel. Most mesh classes in :mod:`fipy.meshes` can solve in 226 paralle d. This includes all "``...Grid...``" and "``...Gmsh...``"226 parallel. This includes all "``...Grid...``" and "``...Gmsh...``" 227 227 class meshes. Currently, the only remaining serial-only meshes are 228 228 :class:`~fipy.meshes.tri2D.Tri2D` and … … 325 325 tolerance may help. 326 326 327 .. _ RunningUnderPython3:327 .. _MeshingWithGmsh: 328 328 329 329 ----------------- … … 354 354 non-orthogonal or non-conjunctional meshes. 355 355 356 .. _CoupledEquations: 357 356 358 ---------------------------- 357 359 Coupled and Vector Equations … … 361 363 all the equations appear in a single system matrix. This results in 362 364 tighter coupling for equations with spatial and temporal derivatives 363 in more than one variable. The use of coupled equation is described in 364 :mod:`examples.diffusin.coupled`. Other examples that demonstrate the 365 use of coupled equations are :mod:`examples.phase.binaryCoupled` and 365 in more than one variable. In :term:`FiPy` equations are coupled 366 together using the ``&`` operator:: 367 368 >>> eqn0 = ... 369 >>> eqn1 = ... 370 >>> coupledEqn = eqn0 & eqn1 371 372 The ``coupledEqn`` will use a combined system matrix that includes 373 four quadrants for each of the different variable and equation 374 combinations. In previous versions of :term:`FiPy` there has been no 375 need to specify which variable a given term acts on when generating 376 equations. The variable is simply specified when calling ``solve`` or 377 ``sweep`` and this functionality has been maintained in the case of 378 single equations. However, for coupled equations the variable that a 379 given term operates on now needs to be specified when the equation is 380 generated. The syntax for generating coupled equations has the form:: 381 382 >>> eqn0 = Term00(coeff=..., var=var0) + Term01(coeff..., var=var1) == source0 383 >>> eqn1 = Term10(coeff=..., var=var0) + Term11(coeff..., var=var1) == source1 384 >>> coupledEqn = eqn0 & eqn1 385 386 and there is now no need to pass any variables when solving:: 387 388 >>> coupledEqn.solve(dt=..., solver=...) 389 390 In this case the matrix system will have the form 391 392 .. math:: 393 394 \left( 395 \begin{array}{c|c} 396 \text{\ttfamily Term00} & \text{\ttfamily Term01} \\ \hline 397 \text{\ttfamily Term10} & \text{\ttfamily Term11} 398 \end{array} \right) 399 \left( 400 \begin{array}{c} 401 \text{\ttfamily var0} \\ \hline 402 \text{\ttfamily var1} 403 \end{array} \right) 404 = 405 \left( 406 \begin{array}{c} 407 \text{\ttfamily source0} \\ \hline 408 \text{\ttfamily source1} 409 \end{array} \right) 410 411 :term:`FiPy` tries to make sensible decisions regarding each term's 412 location in the matrix and the ordering of the variable column 413 array. For example, if ``Term01`` is a transient term then ``Term01`` 414 would appear in the upper left diagonal and the ordering of the 415 variable column array would be reversed. 416 417 The use of coupled equation is described in detail in 418 :mod:`examples.diffusion.coupled`. Other examples that demonstrate the 419 use of coupled equations are :mod:`examples.phase.binaryCoupled`, 420 :mod:`examples.phase.polyxtalCoupled` and 366 421 :mod:`examples.cahnHilliard.mesh2DCoupled`. As well as coupling 367 422 equations, true vector equations can now be written in :term:`FiPy` 368 423 (see :mod:`examples.diffusion.coupled` for more details). 424 425 .. _BoundaryConditions: 426 427 ------------------- 428 Boundary Conditions 429 ------------------- 430 431 .. currentmodule:: fipy.variables.cellVariable 432 433 Applying fixed value (Dirichlet) boundary conditions 434 ==================================================== 435 436 To apply a fixed value boundary condition use the 437 :meth:`~CellVariable.constrain` method. For example, to fix `var` to 438 have a value of `2` along the upper surface of a domain, use 439 440 >>> var.constrain(2., where=mesh.facesTop) 441 442 .. note:: 443 444 The old equivalent 445 :class:`~fipy.boundaryConditions.fixedValue.FixedValue` boundary 446 condition is now deprecated. 447 448 Applying fixed gradient boundary conditions (Neumann) 449 ===================================================== 450 451 To apply a fixed Gradient boundary condition use the 452 :attr:`~.CellVariable.faceGrad`.\ 453 :meth:`~fipy.variables.variable.Variable.constrain` method. For 454 example, to fix `var` to have a gradient of `(0,2)` along the upper 455 surface of a 2D domain, use 456 457 >>> var.faceGrad.constrain(((0,),(2,)), where=mesh.facesTop) 458 459 Applying fixed flux boundary conditions 460 ======================================= 461 462 Generally these can be implemented with a judicious use of 463 :attr:`~.CellVariable.faceGrad`.\ 464 :meth:`~fipy.variables.variable.Variable.constrain`. Failing that, an 465 exterior flux term can be added to the equation. Firstly, set the 466 terms' coefficients to be zero on the exterior faces, 467 468 >>> diffCoeff.constrain(0., mesh.exteriorFaces) 469 >>> convCoeff.constrain(0., mesh.exteriorFaces) 470 471 then create an equation with an extra term to account for the exterior flux, 472 473 >>> eqn = (TransientTerm() + ConvectionTerm(convCoeff) 474 ... == DiffusionCoeff(diffCoeff) 475 ... + (mesh.exteriorFaces * exteriorFlux).divergence) 476 477 where `exteriorFlux` is a rank 1 478 :class:`~fipy.variables.faceVariable.FaceVariable`. 479 480 .. note:: 481 482 The old equivalent :class:`~fipy.boundaryConditions.fixedFlux.FixedFlux` 483 boundary condition is now deprecated. 484 485 Applying outlet or inlet boundary conditions 486 ============================================ 487 488 Convection terms default to a no flux boundary condition unless the 489 exterior faces are associated with a constraint, in which case either 490 an inlet or an outlet boundary condition is applied depending on the 491 flow direction. 492 493 Applying spatially varying boundary conditions 494 ============================================== 495 496 The use of spatial varying boundary conditions is best demonstrated with an 497 example. Given a 2D equation in the domain :math:`0 < x < 1` and :math:`0 < y < 1` with 498 boundary conditions, 499 500 .. math:: 501 502 \phi = \left\{ 503 \begin{aligned} 504 xy &\quad \text{on $x>1/2$ and $y>1/2$} \\ 505 \vec{n} \cdot \vec{F} = 0 &\quad \text{elsewhere} 506 \end{aligned} 507 \right. 508 509 where :math:`\vec{F}` represents the flux. The boundary conditions in :term:`FiPy` can 510 be written with the following code, 511 512 >>> X, Y = mesh.faceCenters 513 >>> mask = ((X < 0.5) | (Y < 0.5)) 514 >>> var.faceGrad.constrain(0, where=mesh.exteriorFaces & mask) 515 >>> var.constrain(X * Y, where=mesh.exteriorFaces & ~mask) 516 517 then 518 519 >>> eqn.solve(...) 520 521 Further demonstrations of spatially varying boundary condition can be found 522 in :mod:`examples.diffusion.mesh20x20` 523 and :mod:`examples.diffusion.circle` 524 525 Applying internal boundary conditions 526 ===================================== 527 528 Applying internal boundary conditions can be achieved through the use 529 of implicit and explicit sources. An equation of the form 530 531 >>> eqn = TransientTerm() == DiffusionTerm() 532 533 can be constrained to have a fixed internal ``value`` at a position 534 given by ``mask`` with the following alterations 535 536 >>> eqn = TransientTerm() == DiffusionTerm() - ImplicitSourceTerm(mask * largeValue) + mask * largeValue * value 537 538 The parameter ``largeValue`` must be chosen to be large enough to 539 completely dominate the matrix diagonal and the RHS vector in cells 540 that are masked. The ``mask`` variable would typically be a 541 ``CellVariable`` boolean constructed using the cell center values. 542 543 One must be careful to distinguish between constraining internal cell 544 values during the solve step and simply applying arbitrary constraints 545 to a ``CellVariable``. Applying a constraint, 546 547 >>> var.constrain(value, where=mask) 548 549 simply fixes the returned value of ``var`` at ``mask`` to be 550 ``value``. It does not have any effect on the implicit value of ``var`` at the 551 ``mask`` location during the linear solve so it is not a substitute 552 for the source term machinations described above. Future releases of 553 :term:`FiPy` may implicitly deal with this discrepancy, but the current 554 release does not. A simple example can be used to demonstrate this:: 555 556 >>> m = Grid1D(nx=2, dx=1.) 557 >>> var = CellVariable(mesh=m) 558 559 Apply a constraint to the faces for a right side boundary condition 560 (which works). 561 562 >>> var.constrain(1., where=m.facesRight) 563 564 Create the equation with the source term constraint described above 565 566 >>> mask = m.x < 1. 567 >>> largeValue = 1e+10 568 >>> value = 0.25 569 >>> eqn = DiffusionTerm() - ImplicitSourceTerm(largeValue * mask) + largeValue * mask * value 570 571 and the expected value is obtained. 572 573 >>> eqn.solve(var) 574 >>> print var 575 [ 0.25 0.75] 576 577 However, if a constraint is used without the source term constraint an 578 unexpected value is obtained 579 580 >>> var.constrain(0.25, where=mask) 581 >>> eqn = DiffusionTerm() 582 >>> eqn.solve(var) 583 >>> print var 584 [ 0.25 1. ] 585 586 although the left cell has the expected value as it is constrained. 587 588 .. % http://thread.gmane.org/gmane.comp.python.fipy/726 589 % http://thread.gmane.org/gmane.comp.python.fipy/846 590 591 % \subsection{Fourth order boundary conditions} 592 593 % http://thread.gmane.org/gmane.comp.python.fipy/923 594 595 % \subsection{Periodic boundary conditions} 596 597 % http://thread.gmane.org/gmane.comp.python.fipy/135 598 599 % \subsection{Time dependent boundary conditions} 600 601 % http://thread.gmane.org/gmane.comp.python.fipy/2 602 603 % \subsection{Internal boundary conditions} 604 605 .. _RunningUnderPython3: 369 606 370 607 ---------------------- -
trunk/documentation/numerical/discret.txt
r5140 r5300 183 183 >>> DiffusionTerm(coeff=Gamma1) 184 184 185 which is synonymous with186 187 >>> ImplicitDiffusionTerm(coeff=Gamma1)188 189 185 or 190 186 191 187 >>> ExplicitDiffusionTerm(coeff=Gamma1) 192 188 193 189 :class:`~explicitDiffusionTerm.ExplicitDiffusionTerm` is provided primarily for 194 190 illustrative purposes, although :mod:`examples.diffusion.mesh1D` … … 273 269 results in a sparse linear system that requires an efficient iterative 274 270 scheme to solve. The iterative schemes available to :term:`FiPy` are 275 currently encapsulated in the :term:`PySparse` suite of solvers 276 and include most common solvers such as the conjugate gradient method 277 and LU decomposition. There are plans to include other solver suites 278 that are compatible with :term:`Python`. 271 currently encapsulated in the :term:`PySparse` and :term:`PyTrilinos` 272 suites of solvers and include most common solvers such as the conjugate 273 gradient method and LU decomposition. 279 274 280 275 Combining Equations :eq:`num:tra`, :eq:`num:con`, -
trunk/documentation/numerical/equation.txt
r5140 r5300 22 22 such diverse problems as determination of the electric potential in 23 23 heart tissue, of fluid flow, stress evolution, and even the 24 Schr \"odinger equation.24 Schroedinger equation. 25 25 26 26 A general conservation equation, solved using :term:`FiPy`, can include any -
trunk/documentation/numerical/index.txt
r5021 r5300 25 25 the FEM using as weighting functions the characteristic functions of 26 26 FV cells, i.e., functions equal to unity [Mattiussi:1997]_. Analogously, 27 the thediscretization of equations with the FVM reduces to the FDM on27 the discretization of equations with the FVM reduces to the FDM on 28 28 Cartesian grids. 29 29 -
trunk/documentation/tutorial/index.txt
r5140 r5300 15 15 :maxdepth: 4 16 16 17 package/generated/ subpackage17 package/generated/package.subpackage 18 18 -
trunk/examples/cahnHilliard/mesh2DCoupled.py
r5214 r5300 32 32 ## 33 33 34 r""" 34 r"""Solve the Cahn-Hilliard problem in two dimensions. 35 35 36 The spinodal decomposition phenomenon is a spontaneous separation of 36 37 an initially homogenous mixture into two distinct regions of different … … 172 173 173 174 >>> source = (- d2fdphi2 * v0 + dfdphi) * (0, 1) 174 >>> impCoeff = -d2fdphi2 * ((0, 0), (1., 0)) + ((0, 0), (0, -1.)) 175 >>> impCoeff = -d2fdphi2 * ((0, 0), 176 ... (1., 0)) + ((0, 0), 177 ... (0, -1.)) 175 178 176 179 This is the same equation as the previous definition of `eq`, but now in 177 180 a vector format. 178 181 179 >>> eq = TransientTerm(((1., 0.), (0., 0.))) == DiffusionTerm([((0., D), (-epsilon**2, 0.))]) + ImplicitSourceTerm(impCoeff) + source 182 >>> eq = TransientTerm(((1., 0.), 183 ... (0., 0.))) == DiffusionTerm([((0., D), 184 ... (-epsilon**2, 0.))]) + ImplicitSourceTerm(impCoeff) + source 180 185 181 186 >>> dexp = -5 -
trunk/examples/cahnHilliard/sphere.py
r5140 r5300 32 32 ## 33 33 34 r""" 35 Solves the Cahn-Hilliard problem on the surface of a sphere, such as 36 mayoccur on vesicles (http://www.youtube.com/watch?v=kDsFP67_ZSE).34 r"""Solves the Cahn-Hilliard problem on the surface of a sphere. 35 36 This phenomenon canoccur on vesicles (http://www.youtube.com/watch?v=kDsFP67_ZSE). 37 37 38 38 >>> from fipy import * -
trunk/examples/convection/exponential1D/mesh1D.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the steady-state convection-diffusion equation in one dimension. 36 36 37 37 This example solves the steady-state convection-diffusion equation … … 42 42 \nabla \cdot \left(D \nabla \phi + \vec{u} \phi \right) = 0 43 43 44 with coefficients :math:`D = 1` and :math:`\vec{u} = (10,)`, or44 with coefficients :math:`D = 1` and :math:`\vec{u} = 10\hat{\i}`, or 45 45 46 46 >>> diffCoeff = 1. … … 62 62 The solution variable is initialized to ``valueLeft``: 63 63 64 >>> var = CellVariable(mesh=mesh, name ="variable")64 >>> var = CellVariable(mesh=mesh, name="variable") 65 65 66 66 and impose the boundary conditions -
trunk/examples/convection/exponential1DSource/mesh1D.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the steady-state convection-diffusion equation with a constant source. 36 36 37 37 Like :mod:`examples.convection.exponential1D.mesh1D` -
trunk/examples/convection/robin.py
r4847 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve an advection-diffusion equation with a Robin boundary condition. 36 36 37 37 This example demonstrates how to apply a Robin boundary condition to -
trunk/examples/convection/source.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve a convection problem with a source. 36 36 37 This example solves the equation 37 38 … … 45 46 currently implemented in FiPy. An :class:`~fipy.terms.implicitSourceTerm.ImplicitSourceTerm` object 46 47 will be used to represent this term. The derivative of :math:`\phi` can be 47 represented by a :class:`~fipy.terms. abstractConvectionTerm._AbstractConvectionTerm` with a constant unitary velocity48 represented by a :class:`~fipy.terms.ConvectionTerm` with a constant unitary velocity 48 49 field from left to right. The following is an example code that includes 49 50 a test against the analytical result. -
trunk/examples/diffusion/anisotropy.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the diffusion equation with an anisotropic diffusion coefficient. 36 36 37 This example demonstrates how to solve diffusion with an anisotropic 38 coefficient. We wish to solve the problem 37 We wish to solve the problem 39 38 40 39 .. math:: … … 87 86 >>> mesh = Gmsh2D(os.path.splitext(__file__)[0] + '.msh', communicator=serial) # doctest: +GMSH 88 87 89 Set the center 88 Set the centermost cell to have a value. 90 89 91 90 >>> var = CellVariable(mesh=mesh, hasOld=1) # doctest: +GMSH -
trunk/examples/diffusion/circle.py
r5287 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the diffusion equation in a circular domain meshed with triangles. 36 36 37 This example demonstrates how to solve a simple diffusion problem on a 37 38 non-standard mesh with varying boundary conditions. The :term:`Gmsh` package … … 55 56 >>> from fipy import * 56 57 >>> mesh = Gmsh2D(''' 57 ... 58 ... 59 ... 60 ... 61 ... 62 ... 63 ... 64 ... 65 ... 66 ... 67 ... 68 ... 69 ... 70 ... 58 ... cellSize = %(cellSize)g; 59 ... radius = %(radius)g; 60 ... Point(1) = {0, 0, 0, cellSize}; 61 ... Point(2) = {-radius, 0, 0, cellSize}; 62 ... Point(3) = {0, radius, 0, cellSize}; 63 ... Point(4) = {radius, 0, 0, cellSize}; 64 ... Point(5) = {0, -radius, 0, cellSize}; 65 ... Circle(6) = {2, 1, 3}; 66 ... Circle(7) = {3, 1, 4}; 67 ... Circle(8) = {4, 1, 5}; 68 ... Circle(9) = {5, 1, 2}; 69 ... Line Loop(10) = {6, 7, 8, 9}; 70 ... Plane Surface(11) = {10}; 71 ... ''' % locals()) # doctest: +GMSH 71 72 72 73 Using this mesh, we can construct a solution variable -
trunk/examples/diffusion/circleQuad.py
r5287 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the diffusion equation in a circular domain meshed with quadrangles. 36 36 37 This example demonstrates how to solve a simple diffusion problem on a 37 38 non-standard mesh with varying boundary conditions. The :term:`Gmsh` package -
trunk/examples/diffusion/coupled.py
r5214 r5300 33 33 ## 34 34 35 r""" 36 How to use coupled equations. 35 r"""Solve the biharmonic equation as a coupled pair of diffusion equations. 37 36 37 :term:`FiPy` has only first order time derivatives so equations such 38 as the biharmonic wave equation written as 38 39 39 ## Coupled 40 .. math:: 41 42 \frac{\partial^4 v}{\partial x^4} + \frac{\partial^2 v}{\partial t^2} &= 0 43 44 cannot be represented as a single equation. We need to decompose the 45 biharmonic equation into two equations that are first order in time in 46 the following way, 40 47 48 .. math:: 49 50 \frac{\partial^2 v_0}{\partial x^2} + \frac{\partial v_1}{\partial t} &= 0 \\ 51 \frac{\partial^2 v_1}{\partial x^2} - \frac{\partial v_0}{\partial t} &= 0 41 52 42 from fipy import Grid1D, CellVariable, TransientTerm, DiffusionTerm, Viewer 53 Historically, :term:`FiPy` required systems of coupled equations to be 54 solved successively, "sweeping" the equations to convergence. As a 55 practical example, we use the following system 43 56 44 m = Grid1D(nx=100, Lx=1.) 57 .. math:: 58 59 \frac{\partial v_0}{\partial t} &= 0.01 \nabla^2 v_0 - \nabla^2 v_1 \\ 60 \frac{\partial v_1}{\partial t} &= \nabla^2 v_0 + 0.01 \nabla^2 v_1 61 62 subject to the boundary conditions 45 63 46 v0 = CellVariable(mesh=m, hasOld=True, value=0.5) 47 v1 = CellVariable(mesh=m, hasOld=True, value=0.5) 64 .. math:: 65 :nowrap: 66 67 \begin{align*} 68 v_0|_{x=0} &= 0 & v_0|_{x=1} &= 1 \\ 69 v_1|_{x=0} &= 1 & v_1|_{x=1} &= 0 70 \end{align*} 48 71 49 v0.constrain(0, m.facesLeft) 50 v0.constrain(1, m.facesRight) 72 This system closely resembles the pure biharmonic equation, but has an 73 additional diffusion contribution to improve numerical stability. The 74 example system is solved with the following block of code using 75 explicit coupling for the cross-coupled terms. 51 76 52 v1.constrain(1, m.facesLeft) 53 v1.constrain(0, m.facesRight) 77 >>> from fipy import Grid1D, CellVariable, TransientTerm, DiffusionTerm, Viewer 54 78 55 eqn0 = TransientTerm(var=v0) == DiffusionTerm(-1, var=v1) + DiffusionTerm(0.01, var=v0) 56 eqn1 = TransientTerm(var=v1) == DiffusionTerm(1, var=v0) + DiffusionTerm(0.01, var=v1) 79 >>> m = Grid1D(nx=100, Lx=1.) 57 80 58 eqn = eqn0 & eqn1 81 >>> v0 = CellVariable(mesh=m, hasOld=True, value=0.5) 82 >>> v1 = CellVariable(mesh=m, hasOld=True, value=0.5) 59 83 60 vi = Viewer((v0, v1)) 84 >>> v0.constrain(0, m.facesLeft) 85 >>> v0.constrain(1, m.facesRight) 61 86 62 for t in range(1): 63 v0.updateOld() 64 v1.updateOld() 65 eqn.solve(dt=1.) 66 vi.plot() 87 >>> v1.constrain(1, m.facesLeft) 88 >>> v1.constrain(0, m.facesRight) 67 89 68 ## Vector 90 >>> eq0 = TransientTerm() == DiffusionTerm(coeff=0.01) - v1.faceGrad.divergence 91 >>> eq1 = TransientTerm() == v0.faceGrad.divergence + DiffusionTerm(coeff=0.01) 69 92 70 v = CellVariable(mesh=m, hasOld=True, value=0.5, elementshape=(2,))93 >>> vi = Viewer((v0, v1)) 71 94 72 v.constrain(0, [m.facesLeft, m.facesRight]) 73 v.constrain(1, [m.facesRight, m.facesLeft]) 95 >>> for t in range(100): 96 ... v0.updateOld() 97 ... v1.updateOld() 98 ... res0 = res1 = 1e100 99 ... while max(res0, res1) > 0.1: 100 ... res0 = eq0.sweep(var=v0, dt=1e-5) 101 ... res1 = eq1.sweep(var=v1, dt=1e-5) 102 ... if t % 10 == 0: 103 ... vi.plot() 74 104 75 eqn = TransientTerm(((1, 0), (0, 1))) == DiffusionTerm([((0.01, -1), (1, 0.01))]) 105 The uncoupled method still works, but it can be advantageous to solve 106 the two equations simultaneously. In this case, by coupling the 107 equations, we can eliminate the explicit sources and dramatically 108 increase the time steps: 76 109 77 vi = Viewer((v[0], v[1])) 110 >>> v0.value = 0.5 111 >>> v1.value = 0.5 78 112 79 for t in range(1): 80 v.updateOld() 81 eqn.solve(var=v, dt=1.) 82 vi.plot() 113 >>> eqn0 = TransientTerm(var=v0) == DiffusionTerm(0.01, var=v0) - DiffusionTerm(1, var=v1) 114 >>> eqn1 = TransientTerm(var=v1) == DiffusionTerm(1, var=v0) + DiffusionTerm(0.01, var=v1) 83 115 84 ## Uncoupled 116 >>> eqn = eqn0 & eqn1 85 117 86 m = Grid1D(nx=100, Lx=1.) 118 >>> for t in range(1): 119 ... v0.updateOld() 120 ... v1.updateOld() 121 ... eqn.solve(dt=1.e-3) 122 ... vi.plot() 87 123 88 v0 = CellVariable(mesh=m, hasOld=True, value=0.5) 89 v1 = CellVariable(mesh=m, hasOld=True, value=0.5) 124 It is also possible to pose the same equations in vector form: 90 125 91 v0.constrain(0, m.facesLeft) 92 v0.constrain(1, m.facesRight) 126 >>> v = CellVariable(mesh=m, hasOld=True, value=[[0.5], [0.5]], elementshape=(2,)) 93 127 94 v1.constrain(1, m.facesLeft)95 v1.constrain(0, m.facesRight)128 >>> v.constrain([[0], [1]], m.facesLeft) 129 >>> v.constrain([[1], [0]], m.facesRight) 96 130 97 eq0 = TransientTerm() == -v1.faceGrad.divergence + DiffusionTerm(0.01) 98 eq1 = TransientTerm() == v0.faceGrad.divergence + DiffusionTerm(0.01) 131 >>> eqn = TransientTerm([[1, 0], 132 ... [0, 1]]) == DiffusionTerm([[[0.01, -1], 133 ... [1, 0.01]]]) 99 134 100 vi = Viewer((v0, v1))135 >>> vi = Viewer((v[0], v[1])) 101 136 102 for t in range(10000): 103 v0.updateOld() 104 v1.updateOld() 105 eq0.solve(var=v0, dt=1e-5) 106 eq1.solve(var=v1, dt=1e-5) 107 vi.plot() 137 >>> for t in range(1): 138 ... v.updateOld() 139 ... eqn.solve(var=v, dt=1.e-3) 140 ... vi.plot() 108 141 142 Whether you pose your problem in coupled or vector form should be dictated by 143 the underlying physics. If :math:`v_0` and :math:`v_1` represent the 144 concentrations of two conserved species, then it is natural to write two 145 seperate governing equations and to couple them. If they represent two 146 components of a vector field, then the vector formulation is obviously more 147 natural. FiPy will solve the same matrix system either way. 109 148 """ 149 __docformat__ = 'restructuredtext' 150 151 if __name__ == '__main__': 152 import fipy.tests.doctestPlus 153 exec(fipy.tests.doctestPlus._getScript()) 154 155 raw_input('finished') 156 -
trunk/examples/diffusion/electrostatics.py
r5124 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the Poisson equation in one dimension. 36 36 37 The Poisson equation is a particular example of the steady-state diffusion 37 38 equation. We examine a few cases in one dimension. -
trunk/examples/diffusion/mesh1D.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve a one-dimensional diffusion equation under different conditions. 36 36 37 To run this example from the base :term:`FiPy` directory, type:: 37 38 … … 58 59 >>> nx = 50 59 60 >>> dx = 1. 60 >>> mesh = Grid1D(nx = nx, dx =dx)61 >>> mesh = Grid1D(nx=nx, dx=dx) 61 62 62 63 :term:`FiPy` solves all equations at the centers of the cells of the mesh. We … … 390 391 391 392 >>> D = FaceVariable(mesh=mesh, value=1.0) 392 >>> x= mesh.faceCenters[0]393 >>> D.setValue(0.1, where=(L / 4. <= x) & (x< 3. * L / 4.))393 >>> X = mesh.faceCenters[0] 394 >>> D.setValue(0.1, where=(L / 4. <= X) & (X < 3. * L / 4.)) 394 395 395 396 The boundary conditions are a fixed value of -
trunk/examples/diffusion/mesh20x20.py
r5124 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve a two-dimensional diffusion problem in a square domain. 36 36 37 37 This example solves a diffusion problem and demonstrates the use of … … 69 69 are automatically applied to the top-right and bottom-left corners. 70 70 71 >>> x, y= mesh.faceCenters72 >>> facesTopLeft = ((mesh.facesLeft & ( y> L / 2))73 ... | (mesh.facesTop & ( x< L / 2)))74 >>> facesBottomRight = ((mesh.facesRight & ( y< L / 2))75 ... | (mesh.facesBottom & ( x> L / 2)))71 >>> X, Y = mesh.faceCenters 72 >>> facesTopLeft = ((mesh.facesLeft & (Y > L / 2)) 73 ... | (mesh.facesTop & (X < L / 2))) 74 >>> facesBottomRight = ((mesh.facesRight & (Y < L / 2)) 75 ... | (mesh.facesBottom & (X > L / 2))) 76 76 77 77 >>> phi.constrain(valueTopLeft, facesTopLeft) -
trunk/examples/diffusion/mesh20x20Coupled.py
r5214 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve a coupled set of diffusion equations in two dimensions. 36 36 37 37 This example solves a diffusion problem and demonstrates the use of -
trunk/examples/diffusion/nthOrder/input4thOrder1D.py
r5124 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve a fourth-order diffusion problem. 36 36 37 37 This example uses the :class:`~fipy.terms.diffusionTerm.DiffusionTerm` class to solve the equation -
trunk/examples/flow/stokesCavity.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the Navier-Stokes equation in the viscous limit. 36 36 37 37 Many thanks to Benny Malengier <[email protected]> for reworking this example and -
trunk/examples/levelSet/advection/circle.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve a circular distance function equation and then advect it. 36 36 37 This example first imposes a circular distance function: 37 38 -
trunk/examples/levelSet/advection/mesh1D.py
r4847 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the distance function equation in one dimension and then advect it. 36 36 37 This example first solves the distance function equation in one dimension: 37 38 -
trunk/examples/levelSet/distanceFunction/circle.py
r4847 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve the level set equation in two dimensions for a circle. 36 36 37 Here we solve the level set equation in two dimensions for a circle. The 2D 38 level set equation can be written, 37 The 2D level set equation can be written, 39 38 40 39 .. math:: -
trunk/examples/levelSet/distanceFunction/mesh1D.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Create a level set variable in one dimension. 36 36 37 Here we create a level set variable in one dimension.The level set37 The level set 38 38 variable calculates its value over the domain to be the distance from 39 39 the zero level set. This can be represented succinctly in the -
trunk/examples/levelSet/electroChem/gold.py
r5140 r5300 32 32 ## 33 33 34 r""" 34 r"""Model electrochemical superfill of gold using the CEAC mechanism. 35 35 36 This input file 36 37 is a demonstration of the use of :term:`FiPy` for -
trunk/examples/levelSet/electroChem/howToWriteAScript.py
r5140 r5300 32 32 ## 33 33 34 r""" 34 r"""Tutorial for writing an electrochemical superfill script. 35 35 36 36 This input file demonstrates how to -
trunk/examples/levelSet/electroChem/leveler.py
r5140 r5300 32 32 ## 33 33 34 r""" 34 r"""Model electrochemical superfill of copper with leveler and accelerator additives. 35 35 36 This input file is a demonstration of the use of :term:`FiPy` for 36 37 modeling copper superfill with leveler and accelerator -
trunk/examples/levelSet/electroChem/simpleTrenchSystem.py
r5140 r5300 32 32 ## 33 33 34 r""" 34 r"""Model electrochemical superfill using the CEAC mechanism. 35 35 36 This input file 36 37 is a demonstration of the use of :term:`FiPy` -
trunk/examples/phase/anisotropy.py
r5140 r5300 31 31 ## 32 32 33 r""" 33 r"""Solve a dendritic solidification problem. 34 34 35 To convert a liquid material to a solid, it must be cooled to a 35 36 temperature below its melting point (known as "undercooling" or "supercooling"). The rate of -
trunk/examples/phase/binaryCoupled.py
r5268 r5300 33 33 ## 34 34 35 r""" 35 r"""Simultaneously solve a phase-field evolution and solute diffusion problem in one-dimension. 36 36 37 It is straightforward to extend a phase field model to include binary alloys. 37 38 As in :mod:`examples.phase.simple`, we will examine a 1D problem -
trunk/examples/phase/impingement/mesh20x20.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve for the impingement of four grains in two dimensions. 36 36 37 37 In the following examples, we solve the same set of equations as in -
trunk/examples/phase/impingement/mesh40x1.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve for the impingement of two grains in one dimension. 36 36 37 37 In this example we solve a coupled phase and orientation equation on a one -
trunk/examples/phase/index.txt
r5214 r5300 13 13 examples.phase.impingement.mesh40x1 14 14 examples.phase.impingement.mesh20x20 15 examples.phase.polyxtal 16 examples.phase.polyxtalCoupled 15 17 -
trunk/examples/phase/quaternary.py
r5268 r5300 33 33 ## 34 34 35 r""" 35 r""" Solve a phase-field evolution and diffusion of four species in one-dimension. 36 36 37 The same procedure used to construct the two-component phase field 37 38 diffusion problem in :mod:`examples.phase.binary` can be used to build up a -
trunk/examples/phase/simple.py
r5140 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve a phase-field (Allen-Cahn) problem in one-dimension. 36 36 37 37 To run this example from the base FiPy directory, type -
trunk/examples/phase/test.py
r5215 r5300 46 46 'simple', 47 47 'symmetry', 48 'binaryCoupled' 48 'binaryCoupled', 49 'polyxtal', 50 'polyxtalCoupled' 49 51 ), 50 52 base = __name__) -
trunk/examples/reactiveWetting/liquidVapor1D.py
r5287 r5300 33 33 ## 34 34 35 r""" 35 r"""Solve a single-component, liquid-vapor, van der Waals system. 36 36 37 37 This example solves a single-component, liquid-vapor, van der Waals system as -
trunk/examples/updating/update0_1to1_0.py
r5140 r5300 31 31 ## 32 32 33 r""" 33 r"""How to update scripts from version 0.1 to 1.0. 34 34 35 35 It seems unlikely that many users are still running :term:`FiPy` 0.1, but for those … … 91 91 >>> from fipy.boundaryConditions.fixedFlux import FixedFlux 92 92 >>> boundaryConditions = ( 93 ... FixedValue(mesh. facesLeft, valueLeft),94 ... FixedValue(mesh. facesRight, valueRight),95 ... FixedFlux(mesh. facesTop, 0.),96 ... FixedFlux(mesh. facesBottom, 0.)93 ... FixedValue(mesh.getFacesLeft(), valueLeft), 94 ... FixedValue(mesh.getFacesRight(), valueRight), 95 ... FixedFlux(mesh.getFacesTop(), 0.), 96 ... FixedFlux(mesh.getFacesBottom(), 0.) 97 97 ... ) 98 98 … … 162 162 163 163 >>> axis = 0 164 >>> x = mesh. cellCenters[:,axis]164 >>> x = mesh.getCellCenters()[:,axis] 165 165 >>> from fipy.tools import numerix 166 166 >>> CC = 1. - numerix.exp(-convCoeff[axis] * x / diffCoeff) … … 228 228 >>> from fipy.boundaryConditions.fixedValue import FixedValue 229 229 >>> boundaryConditions = ( 230 ... FixedValue(mesh. facesLeft, valueLeft),231 ... FixedValue(mesh. facesRight, valueRight))230 ... FixedValue(mesh.getFacesLeft(), valueLeft), 231 ... FixedValue(mesh.getFacesRight(), valueRight)) 232 232 233 233 The creation of the solution variable is unchanged: -
trunk/examples/updating/update1_0to2_0.py
r4152 r5300 56 56 * The dimension axis of a :class:`~fipy.variables.variable.Variable` is now first, not last 57 57 58 >>> x = mesh. cellCenters[0]59 60 instead of 61 62 >>> x = mesh. cellCenters[...,0]58 >>> x = mesh.getCellCenters()[0] 59 60 instead of 61 62 >>> x = mesh.getCellCenters()[...,0] 63 63 64 64 This seemingly arbitrary change simplifies a great many things in :term:`FiPy`, but 65 65 the one most noticeable to the user is that you can now write 66 66 67 >>> x, y = mesh. cellCenters67 >>> x, y = mesh.getCellCenters() 68 68 69 69 instead of 70 70 71 >>> x = mesh. cellCenters[...,0]72 >>> y = mesh. cellCenters[...,1]71 >>> x = mesh.getCellCenters()[...,0] 72 >>> y = mesh.getCellCenters()[...,1] 73 73 74 74 Unfortunately, we cannot reliably automate this conversion, but we find that … … 111 111 manipulate them, such as 112 112 113 >>> phase. faceGrad.dot((( 0, 1),113 >>> phase.getFaceGrad().dot((( 0, 1), 114 114 ... (-1, 0))) 115 115 116 116 instead of the hackish 117 117 118 >>> phase. faceGrad._take((1, 0), axis=1) * (-1, 1)118 >>> phase.getFaceGrad()._take((1, 0), axis=1) * (-1, 1) 119 119 120 120 * For internal reasons, :term:`FiPy` now supports … … 138 138 instead of a list of :class:`~fipy.meshes.face.Face` IDs. Now you write 139 139 140 >>> X, Y = mesh. faceCenters141 >>> FixedValue(faces=mesh. exteriorFaces& (X**2 < 1e-6), value=...)142 143 instead of 144 145 >>> exteriorFaces = mesh. exteriorFaces146 >>> X = exteriorFaces. centers[...,0]140 >>> X, Y = mesh.getFaaceCenters() 141 >>> FixedValue(faces=mesh.getExteriorFaces() & (X**2 < 1e-6), value=...) 142 143 instead of 144 145 >>> exteriorFaces = mesh.getExteriorFaces() 146 >>> X = exteriorFaces.getCenters()[...,0] 147 147 >>> FixedValue(faces=exteriorFaces.where(X**2 < 1e-6), value=...) 148 148 … … 153 153 space and on the current values of any other :class:`~fipy.variables.variable.Variable`. 154 154 155 >>> FixedValue(faces=(mesh. exteriorFaces155 >>> FixedValue(faces=(mesh.getExteriorFaces() 156 156 ... & (((X**2 < 1e-6) 157 157 ... & (Y > 3.)) 158 ... | (phi. arithmeticFaceValue159 ... < sin(gamma. arithmeticFaceValue)))), value=...)158 ... | (phi.getArithmeticFaceValue() 159 ... < sin(gamma.getArithmeticFaceValue())))), value=...) 160 160 161 161 although it probably could have been done with a rather convoluted (and … … 178 178 ... initialArray[cell.ID] = 1. 179 179 180 Although they still exist, we find very li lle cause to ever call180 Although they still exist, we find very little cause to ever call 181 181 :meth:`~fipy.meshes.mesh.Mesh.getCells` 182 182 or :meth:`fipy.meshes.mesh.Mesh.getFaces`. -
trunk/examples/updating/update2_0to3_0.py
r4971 r5300 70 70 .. note:: the old behavior can be obtained, at least for now, by setting 71 71 the :envvar:`FIPY_INCLUDE_NUMERIX_ALL` environment variable. 72 73 * If your equation contains a :class:`~fipy.terms.transientTerm.TransientTerm`, 74 then you must specify the timestep by passing a ``dt=`` argument when calling 75 :meth:`~fipy.terms.term.Term.solve` or :meth:`~fipy.terms.term.Term.sweep`. 72 76 77 The remaining changes are not *required*, but they make scripts easier to read 78 and we recommend them. :term:`FiPy` may issue a :exc:`DeprecationWarning` for some cases, 79 to indicate that we may not maintain the old syntax indefinitely. 80 81 * "getter" and "setter" methods have been replaced with properties, e.g., use 82 83 >>> x, y = mesh.cellCenters 84 85 instead of 86 87 >>> x, y = mesh.getCellCenters() 88 89 * Boundary conditions are better applied with the 90 :meth:`~fipy.variables.cellVariable.CellVariable.constrain` method than with 91 the old :class:`~fipy.boundaryConditions.fixedValue.FixedValue` and 92 :class:`~fipy.boundaryConditions.fixedFlux.FixedFlux` classes. See 93 :ref:`BoundaryConditions`. 94 95 * Individual :class:`~fipy.meshes.mesh.Mesh` classes should be imported 96 directly from :mod:`fipy.meshes` and not :mod:`fipy.meshes.numMesh`. 97 98 * The :term:`Gmsh` meshes now have simplified names: 99 :class:`~fipy.meshes.gmshMesh.Gmsh2D` instead of 100 :class:`~fipy.meshes.gmshMesh.GmshImporter2D`, 101 :class:`~fipy.meshes.gmshMesh.Gmsh3D` instead of 102 :class:`~fipy.meshes.gmshMesh.GmshImporter3D`, and 103 :class:`~fipy.meshes.gmshMesh.Gmsh2DIn3DSpace` instead of 104 :class:`~fipy.meshes.gmshMesh.GmshImporter2DIn3DSpace`. 105 73 106 .. _mailing list: http://www.ctcms.nist.gov/fipy/mail.html 74 107 """
Note: See TracChangeset
for help on using the changeset viewer.