Table of Contents

  • 1  One-dimensional steady-state finite-volume approximation - cont’d

    • 1.1  Summary to this point

    • 1.2  1. Write the total fluxes in terms of specific fluxes:

    • 1.3  2. Write specific fluxes in terms of Fick’s law.

    • 1.4  3. Discrete approximation for Fick’s law

    • 1.5  Your turn

      • 1.5.1  Your answer here:

    • 1.6  Python

      • 1.6.1  Your turn

      • 1.6.2  Your turn

  • 2  1-D steady-state diffusion stencil

      • 2.0.1  Your turn

    • 2.1  Reflection

One-dimensional steady-state finite-volume approximation - cont’d

Summary to this point

We want to express the fundamental 1-D steady-state stencil for an interior gridblock C, with neighbours E, W: \begin{align} \left(J_{EC}+J_{WC}\right) &= 0 \label{eq5141}\\ \end{align}

in terms of concentrations. We laid out a three-step program:

1. Write the total fluxes in terms of specific fluxes:

For a mesh with gridblocks of constant size \(\Delta x\), \(\Delta y\), \(\Delta z\) and fluxes along the x-coordinate direction, we can write:

\begin{align} &J_{EC}=j_{EC}(\Delta y) (\Delta z)\label{eq5143}\\ &J_{WC}=j_{WC}(\Delta y) (\Delta z)\label{eq5142}\\ \end{align}

because the area of the face orthogonal to the \(x\) direction is \((\Delta y)(\Delta z)\).

So in terms of specific fluxes the fundamental 1-D steady-state stencil becomes:

\begin{align} &\left(j_{EC}+j_{WC}\right) (\Delta y) (\Delta z) = 0 \label{eq5144}\\ \end{align}

2. Write specific fluxes in terms of Fick’s law.

Since both \(j_{EC}\) and \(j_{WC}\) are aligned with the \(x\) coordinate direction, the appropriate component of the flux vector is \(j_x\):

\begin{align} j_x &= - D\theta{\partial c \over \partial x} \label{eq5145}\\ \end{align}

3. Discrete approximation for Fick’s law

Consider the stencil below

To approximate specific fluxes such as \(j_x = - D\theta {\partial c \over \partial x}\) in terms of concentrations at nodal values in the centre of gridblocks, we use finite-difference approximations, which are motivated by the definition of the derivative:

\begin{align} {\partial c \over \partial x} &= \lim_{\Delta x \rightarrow 0} {c(x+\Delta x) - c(x)\over \Delta x} \label{eq5146}\\ \end{align}

where \(c(x+\Delta x)\) is notation for “the concentration at the point \(x+\Delta x, y, z\).”

We can use this idea to approximate the component of the gradient in Fick’s law \ref{eq5145} and compute the fluxes \(j_{EC}\) and \(j_{WC}\) in terms of values of concentration located at the centers of gridblocks E, C, W as (here for the case where \(\Delta x\) are the same for each gridblock, so that the nodes are separated by a distance \(\Delta x\)):

\begin{align} j_{EC} &\approx D\theta {c_E - c_C \over \Delta x} \label{eq5147}\\ \end{align}

Recall that by our convention, \(J_{EC}\) and \(j_{EC}\) are positive (\(>0\)) when mass is entering gridblock C.

Your turn

Assume at some instant in time, \(c_E=15~mg/L\) and \(c_C=20~mg/L\).

Your answer here:

  1. Is mass diffusing into or out of the gridblock C? How do you know?

  2. Is the sign of the flux \(j_{EC}\) computed using the finite difference approximation above, Eq (\ref{eq5147}) consistent with our sign convention?

Python

If \(\Delta x= 0.1 m\), \(\Delta y=0.15 m\), and \(\Delta z=0.12 m\), and the diffusion coefficient is \(D=2\times 10^{-10}~m^2/s\), and the porosity is \(\theta = 0.25\), write a short python code to compute \(j_{EC}\) and \(J_{EC}\)

[1]:
"""
Code fragment to compute specific and total fluxes j_ec and J_ec
"""
dx = 0.1
dy = 0.15
dz = 0.12
diff_coef = 2.0e-10
poros = 0.25
j_ec_spec = 11111  # replace 0 with your code
j_ec_tot = 99999  # replace 0 with your code
units_spec = "PUT CORRECT SPECIFIC FLUX UNITS HERE"
units_tot = "PUT CORRECT TOTAL FLUX UNITS HERE"
output_text = f"""
    The specific flux j_ec is {j_ec_spec} {units_spec}
    and the total flux is
    J_ec {j_ec_tot} {units_tot}
    """
print(output_text)

    The specific flux j_ec is 11111 PUT CORRECT SPECIFIC FLUX UNITS HERE
    and the total flux is
    J_ec 99999 PUT CORRECT TOTAL FLUX UNITS HERE

Your turn

The approximation for \(j_{EC}\) is given above in equation \ref{eq5148}.

Write the corresponding discrete approximation for \(j_{WC}\) in terms of \(D\theta\), \(c_W\), \(c_C\) and \(\Delta x\), \(\Delta y\), and \(\Delta z\).

Your turn

\begin{align} j_{WC} &\approx {????} \label{eq5148}\\ \end{align}

  1. Is the sign of the flux \(j_{WC}\) computed using your expression positive for flux entering gridblock C?

  2. Assume values for \(c_w\) and \(c_C\), and show that the sign works out.

1-D steady-state diffusion stencil

Bringing it all together, the 1-D steady-state diffusion stencil in terms of specific fluxes

\begin{align*} &\left(j_{EC}+j_{WC}\right) (\Delta y) (\Delta z) = 0 \\ \end{align*}

becomes in terms of concentrations:

-replace \(j_{WC}\) with the correct expression in terms of concentration.

\begin{align} &\left(D\theta {c_E - c_C \over \Delta x} + j_{WC} \right) (\Delta y) (\Delta z) = 0 \label{eq5149}\\ \end{align}

Reflection

What have you learned? What have you struggled with? Reflect on anything else you have learned or struggled with and write it here.