Hi, FiPy. I was looking over the diffusion term documentation, http://www.ctcms.nist.gov/fipy/documentation/numerical/discret.html#diffusion-term and I was wondering, do we lose second order spatial accuracy as soon as we introduce any non-uniform spacing (anywhere) into our mesh? I think the equation right after (3) for the normal component of the flux is only second order if the face is half-way between cell centers. If this does lead to loss of second order accuracy, is there a standard way to retain 2nd order accuracy for non-uniform meshes?
I was playing around with this question here: https://gist.github.com/raybsmith/e57f6f4739e24ff9c97039ad573a3621 with output attached, and I couldn't explain why I got the trends I saw. The goal was to look at convergence -- using various meshes -- of a simple diffusion equation with a solution both analytical and non-trivial, so I picked a case in which the transport coefficient varies with position such that the solution variable is an arcsinh(x). I used three different styles of mesh spacing: * When I use a uniform mesh, I see second order convergence, as I'd expect. * When I use a non-uniform mesh with three segments and different dx in each segment, I still see 2nd order convergence. In my experience, even having a single mesh point with 1st order accuracy can drop the overall accuracy of the solution, but I'm not seeing that here. * When I use a mesh with exponentially decreasing dx (dx_i = 0.96^i * dx0), I see 0.5-order convergence. I can't really explain either of the non-uniform mesh cases, and was curious if anyone here had some insight. Thanks, Ray
fipy_convergence.pdf
Description: Adobe PDF document
_______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]