I tried to find the convergence rate of the Poisson problem. I modified an example from the documentation about Poisson’s equation. Please see the attached file.

First, I used the mesh.Refine() command. The convergence results was shown as expected.

[code]while fes.ndof < 10000:

mesh.Refine()

Solve_Poisson()

i = 1

while i < len(output):

order_u = log(output[i-1][1]/output[i][1])/log(2)

```
print("%0.3f | %0.3e" %
(order_u, output[i-1][1]))
i = i+1[/code]
```

In this case, I can’t handle the mesh size as I wish.

Now, I want to handle the mesh generation. Instead of using refine built-in command, I changed the ‘hmax’ parameter by dividing it by 2 each time. But the convergence results didn’t make any sense.

[code]hh=0.2

for i in range(4):

mesh = Mesh(unit_square.GenerateMesh(maxh=hh))

hh=hh/2

Solve_Poisson()

i = 1

while i < len(output):

order_u = log(output[i-1][1]/output[i][1])/log(2)

```
print("%0.3f | %0.3e" %
(order_u, output[i-1][1]))
i = i+1
```

[/code]

Did I make something wrong? Could you please tell me how to handle mesh generation so that using the hmax parameter gives the same convergence results as using the refine command?

Thank you so much.

Attachment: poisson_2020-06-24.py