nazmulislam said:
I have used the following central difference formula for the spatial derivatives: (written in Latex)
$$\frac{\partial^2 c}{\partial z^2} = \frac{c_{\rm i+1,j}^{k}-2 c_{\rm i,j}^{k}+c_{\rm i-1,j}^{k}}{(\Delta z)^2}+O[(\Delta z)^2]$$
$$\frac{\partial c}{\partial r} = \frac{c_{\rm i,j+1}^{k}-c_{\rm i,j-1}^{k}}{(\Delta z)^2}+O[(\Delta r)^2]\tag{1}$$
$$\frac{\partial^2 c}{\partial r^2}=\frac{c_{\rm i,j+1}^{k}-2 c_{\rm i,j}^{k}+c_{\rm i,j-1}^{k}}{(\Delta r)^2}+O[(\Delta r)^2]$$
and the forward time difference of the time derivative
$$\frac{\partial c}{\partial t}=\frac{c_{\rm i,j}^{k+1}-c_{\rm i,j}^{k}}{\Delta t}+O[(\Delta t)].$$
I have imposed the symmetry condition at r=0 as follows:
$$\frac{\partial c(z,r,t)}{\partial z}=0\tag{2}$$ at r=0.
Also, I have used the following periodic conditions:
c(z,r,t)|_{z=-L/2} = c(z,r,t)|_{z=L/2},
$$\frac{\partial c(z,r,t)}{\partial z}\right|_{z=-L/2} = \frac{\partial c(z,r,t)}{\partial z}\right|_{z=L/2}$$
where 'L' is the length of the tube. Periodic condition indicate that the concentration is the same at two ends-left & right.
At first, i have calculated the concentrations at all interior points by using finite difference approximations that I wrote in the first message. Then, I update the concentrations at boundary by the boundary conditions.
Thanks.
You left out the delimiters on the LaTex expressions so I tried editing your post. I was able to edit most of the equations, but not all of them.
I have big issues with how you worked this problem numerically. I don't even know where to start.
First let me correct some of your equations above. Eqns. labeled 1 and 2 above are both incorrect. Eqn. 1 should have a ##2Δr## in the denominator, and Eqn. 2 should have a partial with respect to r in the denominator.
Now for your finite difference equations. You are trying to represent ##\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial c}{\partial r}\right)## by a second order accurate finite difference approximation. The relationship you used is fine for all the points except at the grid point at r = 0. However, a better approximation is:
$$\frac{r_{(j+1/2)}(c_{j+1}-c_j)-r_{(j-1/2)}(c_j-c_{j-1})}{r_j(Δr)^2}$$
EDIT: Actually, this gives you exactly the same approximation you already haveRather than solving for the concentrations in the interior region only and just applying a first-order extension at r = 0 and r = outer radius, you would do much better if you carried out the time-dependent integration at these locations as well.
At r = 0, the first derivative of concentration with respect to r is zero, so in the vicinity at r = 0, the concentration must be approximately quadratic with r, according to ##c = c_0+(c_1-c_0)\frac{r^2}{(Δr)^2}## to second order accuracy. This leads to the result that:
$$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial c}{\partial r}\right)=\frac{4(c_1-c_0)}{(Δr)^2}$$
at r = 0, to second order accuracy. See if you can verify this result.
With this result, you can apply the time dependent integration not only at the interior points, but also at r = 0.
At the outer radius, you know that ##c_{n+1}=c_{n-1}##. You can substitute this result into your finite difference equation and thereby include the point at the outer radius in the time dependent integration.
It looks like you have set this problem up to solve for the concentration distribution as a function of time, based on some pre-specified concentration distribution at time = 0. Is this correct?
Also, the necessity for periodic boundary conditions on z is a little confusing. Please tell me what the purpose of this is, and please tell me what the initial concentration distribution looks like.
Chet