Nan error when solve Navier-Stokes equations using PETSc

Dear all,

I am now working on Navier-Stokes equations with PETSc. I am trying to solve the equations in a 125*100*100 domain, and build this cube domain mesh by Gmsh. However, when I try to solve it with a higher resolution (finer mesh), the simulation will return to a Nan error. The solver I used is:

set(NS, sparams = “-pc_type lu”);

I want to know why this error occurs and if there is any way to solve it.
Thanks in advance!

You can use -ksp_view_converged_reason as an additional parameter in your sparams to see what is the root of the error.

Hi,
Thank you. I added -ksp_view_converged_reason as an additional parameter, but there seem no differences in error in the output. The error is mainly this for every core:

Exec error : In Optimized version
– number :1
err code 8
-nan != -nan diff -nan => Sorry error in Optimization (q) add: int2d(Th,optimize=0)(…)
remark if you add (… , optimize=2) then you remove this check (be carefull);

OK, this is not related to PETSc, but rather FreeFEM itself. I’m sorry, the flag is -ksp_converged_reason, there is not view_, could you please try again?

Yes, I now get the new error message:

Linear solve did not converge due to DIVERGED_PC_FAILED iterations 0
PC failed due to FACTOR_OUTMEMORY

Do you know how to solve this? Thank you!

Either use a larger machine or switch to an iterative solver.

Thank you. The problem is resolved!

Hello, I’m sorry to interrupt, but I’d like to ask you how it all worked out in the end.

I also met the same error. Are there any suggestions to debug? Thanks.
-nan != -nan diff -nan => Sorry error in Optimization add: (p) int2d(Th,optimize=0)(...) remark if you add (.. , optimize=2) then you remove this check (be careful);