# Improving accuracy in linear system

224

views

1

Hi all,

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.

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.

Is it a 1D problem? Is the mesh uniform?

written
7 months ago by
KristianE

It is a 1D problem. The mesh is not uniform, it's a custom one that's finer around the transition and coarser where the function is flat. I've modified the post accordingly, thanks!

written
7 months ago by
scaramouche-00

### 1 Answer

2

I found the reason behind my problem: I will post it in case it's useful for others. In my non-uniform mesh, the closest points could not be distinguished within machine precision (their distance was negative) and this was a source of error.

Please login to add an answer/comment or follow this question.