Improving accuracy in linear system
10 weeks ago by
I'm a Fenics newbie. I have a system of two linear equations of a single real variable - a radius. I'm comparing against an exact solution and I'm getting L2 error norm 1e-6 and maximum error at vertices 1e-8: however, this accuracy is not sufficient for my purposes and I haven't been able to improve it so far.
Because the Dirichlet boundary condition is imposed at infinity, I need a big mesh: however, if the mesh is too big, I don't have enough points at the mesh end to define a boundary. I obtain the highest accuracy for r_max = 1e11.
if I rise the number of mesh points, accuracy first improves and then gets worse: I suspect this can be due to either rounding errors (the tutorial mentions that machine precision gets worse with more mesh points) or memory problems, as at some point I start getting NaN's. I get the best results for 1000 mesh points.
The source is a step function. If I use a Fermi function where I can adjust the steepness, I get better results compared to an actual step function. However, the steepness must be small enough that the transition is not too sharp and large enough that the difference between this approximation and an actual step function is small.
EDIT: the mesh is not uniform, it's tailored to be fine around the transition and coarse where the function is flat.
If I increase the degree of interpolating polynomials, accuracy first improves, then I also get NaN's.
I have tried to make the mesh coarser/finer around the transition, but I get more NaN's past a certain point.
The convergence rates I get look like this:
num_cells = 100 | 1/h = 1.0e-02 | cr = 2.7e+00
num_cells = 1000 | 1/h = 1.0e-03 | cr = 4.0e+00
num_cells = 10000 | 1/h = 1.0e-04 | cr = -4.9e+00
num_cells = 100000| 1/h = 1.0e-05 | cr = nan
where I'm indicating with 1/h the approximate mesh size - even though I have a highly non-uniform mesh, so I'm not sure this comparison makes sense.
It seems to me there's a lot of fine tuning involved to get even just 1e-6 (i.e. enough mesh points, but not too many, high enough degree, but not too high... etc), so I'm wondering if there's any magical trick I'm missing that could help raise the accuracy. Could you please give me any suggestions?
Thanks in advance for your time.
Community: FEniCS Project
Please login to add an answer/comment or follow this question.