Mesh size large the results is incorrect, while the size small, the results is nan

Here I just mesh a wire,

Please read Read before posting: How do I get my question answered?

I’ve edited your post because the code was incorrectly formatted, to the point of being unreadable. Please edit it back making sure that the code is within “```” so that it typesets nicely as

def my_function(a,b):
   return a + b

Furthermore, give more context of what you are trying to do. One sentence is not enough.

Thank you for replying me.
I use docker, dolfinx
I calculate the EM wave scattering with a wire. it is a nonlocal scatterig.
Here is part of simulation, not the total code, the total code is too long, the parameter to generate the mesh.

Here when r_nw is smaller than 1, such as r_nw=0.5, the EM scattering is right., While I change it r_nw>1, the results show ‘nan’.

Sorry I do not know how to write the code as you show to me. Sorry for this, I will try to change it

Mesh generation looks fine to me, so the issue is probably elsewhere in the code.

Dear Prof. Francesco Ballarin
Thank you for reply me, thank you so much.
I have changed the

can get the results, so I can not make sure if the

msh_max/msh_min can not too large.

Thank you for replying me.

Is your issue resolved? As you haven’t Added anything but the mesh generation to the question, there isn’t anything we can do to further assist you.

Dear Prof Dokken
Thank you for replying me, it seems change from


where meh_max=r_nw to meh_max=r_nw/2, it seem right now. I think the mesh make my simulation unstable. Thank you so much.

Inorder to make it safe,

set it like this, because I need to consider the compplex source which is determined by mesh, So I need a good mesh, I just know results. But I do not know why need to set like this. If anyone know the reseason, please let me know, thank you.