kronbichler / adaflo

adaflo, an adaptive finite element solver for incompressible fluid flow and two-phase flow
Other
24 stars 14 forks source link

Initialize number of linear iterations of `NavierStokes::solver_control_strong` to 0 #73

Closed mschreter closed 1 year ago

mschreter commented 1 year ago

This PR suggests to initialize the default value of the number of linear iterations recorded by solver_control_strong to 0.

Previously, if the initially evaluated residual was 0 in a time step, this block https://github.com/kronbichler/adaflo/blob/6e1a28d2e5de937d95defd716994a761847ea1da/source/navier_stokes.cc#L605-L632 would have never been reached. This led to a recorded number of linear iterations from solver_control_strong of numbers::invalid_unsigned_int (default value of SolverControl::last_step()), which produced output like this:

   Nonlin Res     Prec Upd     Increment   Lin Iter     Lin Res
   ____________________________________________________________
   0.000e+00        ---        0.00e+00        -1       0.00e+00
   0.000e+00     converged.

With this PR, the output looks as follows:

   Nonlin Res     Prec Upd     Increment   Lin Iter     Lin Res
   ____________________________________________________________
   0.000e+00        ---        0.00e+00        0       0.00e+00
   0.000e+00     converged.