From charlesreid1

Line 24: Line 24:


<math>
<math>
\nabla u = 0 \mbox{\@} x = 0
\nabla u = 0 \text{at} x = 0
</math>
</math>


Line 30: Line 30:


<math>
<math>
\nabla u = v ( 1 - u ) \mbox{\@} x = 1
\nabla u = v ( 1 - u ) \text{at} x = 1
</math>
</math>



Revision as of 22:58, 27 February 2014

This page contains notes on verification of Fipy.

What is Verification

Two important activities of model development are verification and validation.

Verification is confirmation that the code implemented and solved the equations correctly, and relates to how well the discrete mathematical representation matches the (exact) mathematical formulation.

Validation is confirming that the correct equations are being solved, and relates to how well the mathematics describe the physics.

Desirable to verify Fipy because we want to make sure it is solving the correct equations. Also, useful for benchmarking/other activities.

Reaction Diffusion Equation: Solution Verification

The reaction diffusion equation for a first-order reaction consists of the following equation:

$ \nabla^2 u = \phi^2 u $

which is derived from a non-dimensionalized material balance which contains only a second-order diffusion term (the left-hand side) and a reaction rate term (the right-hand side). $ \phi $ is the Thiele modulus and is a ratio of the reaction rate and the diffusion rate. A large Thiele modulus indicates a reaction rate that is very fast relative to the diffusion rate.

The first (symmetry) boundary condition is given by the Neumann boundary condition:

$ \nabla u = 0 \text{at} x = 0 $

The second (surface) boundary condition relates to the rate of diffusive flux, and is given by the Robin boundary condition:

$ \nabla u = v ( 1 - u ) \text{at} x = 1 $

where $ v $ is the Sherwood number.

Wolfram Alpha was used to determine an analytical solution to this equation. The solution page is available here: http://wolfr.am/1kddYKK

The solution to the equation is given by the function:

$ u(x) = \dfrac{ v \cosh{ax} }{ v \cosh{a} + a \sinh{a} } $

(Note that the link above gives the solution in terms of exponentials; this can be simplified/rearranged into the above trigonometric form; see http://wolfr.am/1cdxLHK.)