Print content
Initial-boundary problem, time-dependent diffusion model
PMiKNoM seminars - class 8
Introduction
- Critical content of chloride ions and methods for establishing the diffusion coefficient in concretes (introduction).
Time-dependent diffusion model - basic equations
Fick second Law
` \frac{\partial c}{\partial t} = D \frac{\partial^2 c}{\partial x^2}`Second central derivative of concentration at point `x_i`
` \frac{\partial^2 c_i}{\partial x^2} = \frac{c_{i+1}-2c_i+c_{i-1}}{h^2}`Explicit Euler's method
` c_i(t_{j+1}) = c_i(t_j)+ \Delta t \cdot \frac{dc_i}{dt}`Final diffusion equation
After combining the three equations above, we obtain:
`c_i(t_{j+1}) = c_i(t_j)+ \frac{\Delta t}{h^2} D \cdot (c_{i+1}-2c_i+c_{i-1})`
Initial and boundary conditions
Initial condition:`c(x,0) = 0`
Boundary conditions:
$$
\left\{ \begin{array}{l}
c(0,t) = c_L = const \\
c(l,t) = c_R = const
\end{array} \right.
$$
Time-dependent diffusion model - program's algorithm
- Declare global constants `cL`, `cR`, `l`, `D`, `t_{end}`, `n` and `m`.
- Begin the main procedure with declarations of variables `h`, `dt`, `i`, `j` and arrays `c(0 \text{ to } n+1)` and `c_\text{new}(1 \text{ to } n)`.
- Calculate the step value `h=l/(n+1)` and the time-step value `dt=t_{end}/m`.
- Write the initial condition for every point: `c(i)=0`.
- Write the boundary condition: `c(0)=cL` and `c(n+1)=cR`.
- Execute the embeded loop, in which for every time-step (for j=1 to m):
- For each point (for i=1 to n), program calculates the new concentration values (see equation), and assign them to the array `c_\text{new}`
- Program switches the arrays, i.e. (for i=1 to n) `c(i)=c_\text{new}(i)`
- Display results.
Time-dependent diffusion model - the obtained software
- Time-dependent diffusion model - implementation in VBA.
- Comparison of the results with application written in JavaScript.