- Thank you received: 1
How to handle mesh generation: refine and maxh
4 years 5 months ago #2900
by dong
How to handle mesh generation: refine and maxh was created by dong
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.
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.
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.
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
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
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.
Attachments:
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
4 years 5 months ago #2901
by mneunteufel
Replied by mneunteufel on topic How to handle mesh generation: refine and maxh
Hi dong,
if you generate new meshes instead of refining an existing one, you need to recreate all FESpaces, bilinearforms, etc.
Attached I added a "SetUp" function to your file handling this stuff.
Best,
Michael
if you generate new meshes instead of refining an existing one, you need to recreate all FESpaces, bilinearforms, etc.
Attached I added a "SetUp" function to your file handling this stuff.
Best,
Michael
Attachments:
Time to create page: 0.110 seconds