Skip to content

polykin.transport.diffusion¤

profile_sheet ¤

profile_sheet(
    t: float, x: float, a: float, D: float
) -> float

Concentration profile for transient diffusion in a plane sheet.

For a plane sheet of thickness \(2a\), with diffusion from both faces, where the concentration is initially \(C_0\) everywhere, and the concentration at both surfaces is maintained at \(C_s\), the normalized concentration is:

\[ \frac{C - C_0}{C_s - C_0} = 1-\frac{4}{\pi}\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1} \exp\left[-\frac{D \pi^2 t}{4 a^2} (2n+1)^2 \right] \cos\left[ \frac{\pi x}{2a} (2n+1) \right] \]

where \(x\) is the distance from the center of the sheet, \(t\) is the time, and \(D\) is the diffusion coefficient.

Tip

This equation is also applicable to a plane sheet of thickness \(a\) if one of the faces is sealed.

References

  • J. Crank, "The mathematics of diffusion", Oxford University Press, 1975, p. 47.
PARAMETER DESCRIPTION
t

Time (s).

TYPE: float

x

Distance from the center or sealed face (m).

TYPE: float

a

Half thickness of sheet (m).

TYPE: float

D

Diffusion coefficient (m²/s).

TYPE: float

RETURNS DESCRIPTION
float

Fractional accomplished concentration change.

See also
  • uptake_sheet: related method to determine the mass uptake.

Examples:

Determine the fractional concentration change after 100 s in a 0.2 mm-thick polymer film (diffusivity: 1e-10 m²/s) at its maximum depth.

>>> from polykin.transport.diffusion import profile_sheet
>>> profile_sheet(t=1e2, x=0., a=0.2e-3, D=1e-10)
0.3145542331096479
Source code in src/polykin/transport/diffusion.py
 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
def profile_sheet(t: float,
                  x: float,
                  a: float,
                  D: float
                  ) -> float:
    r"""Concentration profile for transient diffusion in a plane sheet. 

    For a plane sheet of thickness $2a$, with diffusion from _both_ faces, where
    the concentration is initially $C_0$ everywhere, and the concentration at
    both surfaces is maintained at $C_s$, the normalized concentration is:

    $$ \frac{C - C_0}{C_s - C_0} = 
        1-\frac{4}{\pi}\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}
        \exp\left[-\frac{D \pi^2 t}{4 a^2} (2n+1)^2 \right] 
        \cos\left[ \frac{\pi x}{2a} (2n+1) \right] $$

    where $x$ is the distance from the center of the sheet, $t$ is the time,
    and $D$ is the diffusion coefficient.

    !!! tip

        This equation is also applicable to a plane sheet of thickness $a$ if
        one of the faces is sealed.

    **References**

    * J. Crank, "The mathematics of diffusion", Oxford University Press, 1975,
      p. 47.

    Parameters
    ----------
    t : float
        Time (s).
    x : float
        Distance from the center or sealed face (m).
    a : float
        Half thickness of sheet (m).
    D : float
        Diffusion coefficient (m²/s).

    Returns
    -------
    float
        Fractional accomplished concentration change.

    See also
    --------
    * [`uptake_sheet`](uptake_sheet.md): related method to determine the mass
      uptake.

    Examples
    --------
    Determine the fractional concentration change after 100 s in a 0.2 mm-thick
    polymer film (diffusivity: 1e-10 m²/s) at its maximum depth.
    >>> from polykin.transport.diffusion import profile_sheet
    >>> profile_sheet(t=1e2, x=0., a=0.2e-3, D=1e-10)
    0.3145542331096479
    """
    N = 4  # Number of terms in series expansion (sufficient for convergence)

    A = 2*sqrt(D*t)/a
    if A < 1.:
        # Solution for small times
        S = sum((-1 if n % 2 else 1) * (erfc(((2*n + 1) - x/a)/A) + erfc(((2*n + 1) + x/a)/A))
                for n in range(0, N))
        result = S
    else:
        # Solution for normal times
        B = -D*pi**2*t/(4*a**2)
        C = pi*x/(2*a)
        S = sum((-1 if n % 2 else 1) / (2*n + 1) * exp(B*(2*n + 1)**2) * cos(C*(2*n + 1))
                for n in range(0, N))
        result = 1 - (4/pi)*S

    return result

Graphical Illustration¤

The numbers in the legend are values of \(D t / a^2\).

profile_sheet