Description Usage Arguments Value Examples
Function to solve diffusion equation using numerical implicit finite differences method, applied in the condition where: a) the diffusion occurs inside a slab of material unidimensionally, or only along one axis, b) the coefficient of diffusion is constant, and c) the boundary conditions are constant.
1 |
Lx |
Total length of slab in x direction, usually in mm. |
Tt |
Total diffusion time, usually in second. |
nt |
Number of time discretization. |
nx |
Number of dimension x discretization |
D |
Coefficient of diffusion. Must be constant value. |
C_ini |
Initial concentration value inside the slab. |
C_lim |
Boundary condition, written as a vector with one or two elements. If there is only one element, the other side of the slab will be presented as having Neumann boundary condition with flux = 0. If there are two elements, the first element is the dirichlet concentration on the left side, while the second element is the dirichlet concentration on the right side. |
A matrix with nx+1 number of row and nt number of column, profiling the diffusion on slab with Lx length along the time Tt.
1 2 3 4 5 6 7 8 | Lx <- 5 #Length of slab, in mm
Tt <- 20 #Total measured diffusion time, in seconds
nt <- 100 #Number of time discretization, wherein the Tt will be divided into 100 equal parts (0, 0.2, 0.4, ..., 20)
nx <- 50 #Number of dimension discretization
D <- 0.05 #Coefficient of diffusion in mm^2/s.
C_ini <- 0.05 #Initial concentration inside the slab.
C_lim <- c(0.10,0.25) #Dirichlet boundary concentration diffusing into the slab
matC <- diff_1D(Lx, Tt, nt, nx, D, C_ini, C_lim)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.