Nonlinear thermal problem in parallel

Dear All,

I am trying to incorporate non-linear thermal properties in my heat transfer problem. My current approach with solving through Newton Raphson iteratively is turning out to be computationally costly due to the number of newtonian iterations for convergence. Parallelizing the code is not adding any benefit to the computational cost. Could you suggest if there is any way with some command that might decrease the computational time for my code?

Thank you in advance…

What do you mean it’s not adding any benefit to the computational cost? Could you share a minimal example that showcases this (unexpected) behavior?

Thank you for the reply,
This is the link with both .edp and .mesh file.
I tried my best to make the script minimal, but I believe its still little long.

https://drive.google.com/drive/folders/1D1jiVFaSJSDY15BhulTiOwwMVs8bB5gi?usp=sharing

Thanks again.

What kind of solver/preconditioner are you using? How many processes?
Also, your script is wrong, line 133, delT and Tparallel are local functions, so you need to to a mpiAllReduce, otherwise, processes won’t share the same value.

Thank you a lot for your suggestion. Now I could really see the improvement in computational time.
1 proc-500s
4 procs-300s.
I have added the improved version to the link.

Currently, I am using Hypre Preconditioner (just trial). What preconditioner do you suggest which could be better with respect to computational time? Further, is there a way to solve the nonlinear problem with any other approach, through some command or function in freefem, better than how I am doing now by solving for jacobian from varf and inverting matrix at each iteration?

If you add the flag -ksp_converged_reason, could you copy/paste the number of iterations needed to reach convergence for each linear solve? For nonlinear problems, you could directly use PETSc nonlinear solvers, see FreeFem-sources/examples/hpddm at develop · FreeFem/FreeFem-sources · GitHub.

The number of iterations needed to reach convergence for each linear solve is 3 and sometimes 4.

OK, I think your problem is symmetric, so you can add the flag sym = 1 when you assemble to varf to speed things up some more.

A = vA(VhParallel, VhParallel, sym = 1);
B = vB(VhParallel, VhParallel, sym = 1);

Is it any better?

I tried adding sym=1, unfortunately, it is leading to more computational time. For instance:

with sym=1, 317 s
vs
nothing: 309 s

Is this normal?
Do you have any other suggestions which I could implement?

I could surely try doing with the PETSC nonlinear solver through the examples that you attached in the previous comment.

No, that is not normal, but I have no idea of the what the time you are reporting is representing.
You need to run with the command line option -log_view and it will be easier to get meaningful metrics in the table you’ll get at the end of the simulation.

I tried getting information about the time with -log_view. Adding sym=1 has certainly improved the computational time

with sym=1: 176 s
vs
nothing: 235 s

Thanks again for your suggestions and time. I will surely implement the petsc nonlinear solver for further gain.