Skip to content

polykin.transport.diffusion¤

profile_constc_semiinf ¤

profile_constc_semiinf(
    t: float, x: float, D: float
) -> float

Concentration profile for transient diffusion in semi-infinite medium.

For a semi-infinite medium, where the concentration is initially \(C_0\) everywhere, and the surface concentration is maintained at \(C_s\), the normalized concentration is:

\[ \frac{C - C_0}{C_s - C_0}= \mathrm{erfc} \left( \frac{x}{2\sqrt{Dt}} \right) \]

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

References

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

Time (s).

TYPE: float

x

Distance from surface (m).

TYPE: float

D

Diffusion coefficient (m²/s).

TYPE: float

RETURNS DESCRIPTION
float

Fractional accomplished concentration change.

Examples:

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

>>> from polykin.transport import profile_constc_semiinf
>>> profile_constc_semiinf(t=1e2, x=0.1e-3, D=1e-10)
0.4795001221869535
Source code in src/polykin/transport/diffusion.py
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
def profile_constc_semiinf(t: float,
                           x: float,
                           D: float
                           ) -> float:
    r"""Concentration profile for transient diffusion in semi-infinite medium. 

    For a semi-infinite medium, where the concentration is initially $C_0$
    everywhere, and the surface concentration is maintained at $C_s$, the
    normalized concentration is:

    $$ \frac{C - C_0}{C_s - C_0}=
        \mathrm{erfc} \left( \frac{x}{2\sqrt{Dt}} \right) $$

    where $x$ is the distance from the surface, $t$ is the time, and $D$ is
    the diffusion coefficient.

    **References**

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

    Parameters
    ----------
    t : float
        Time (s).
    x : float
        Distance from surface (m).
    D : float
        Diffusion coefficient (m²/s).

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

    Examples
    --------
    Determine the fractional concentration change after 100 s in a thick polymer
    film (diffusivity: 1e-10 m²/s) at a depth of 0.1 mm below the surface.
    >>> from polykin.transport import profile_constc_semiinf
    >>> profile_constc_semiinf(t=1e2, x=0.1e-3, D=1e-10)
    0.4795001221869535
    """
    return erfc(x/(2*sqrt(D*t)))