Please make a minimal reproducible example.
There is no way we can reproduce the behavior of your code, as, we do not have the mesh.
One thing that stands out is that you overload Phiold
from
which could cause the issue.
Secondly, your problem is far from minimal. Please try to reduce the complexity, as there is alot of code here, and takes a while to digest.
Finally,
Please search the forum for this error message as well,
as you find it in many recent threads, such as:
which points to the issue I’ve highlighted above.