@@ -19,7 +19,7 @@ function integration_step_monitor(integrator::SciMLBase.DEIntegrator, progress_m
1919 # (; id) = progress_monitor
2020 (; tprev, t, dt, iter) = integrator
2121 # push!(msgs, id => "$id: integrating on [$t, $(t+dt)] with Δt=$dt.")
22- @logmsg LogLevel (- 100 ) " Integrating on [$tprev , $t ]." iter= iter Δt= dt _group= :timeintegration
22+ @logmsg LogLevel (- 100 ) " Integrating on [$t , $(t + dt) ]." iter= iter Δt= dt tprev = tprev _group= :timeintegration
2323end
2424
2525function integration_finalize_monitor (integrator, progress_monitor:: DefaultProgressMonitor )
@@ -39,15 +39,24 @@ function nonlinear_step_monitor(nlcache, time, f, u, progress_monitor::DefaultPr
3939 resnorm = norm (nlcache. residual)
4040 normΔu = norm (linear_solver_cache. u)
4141 if stats === nothing
42- @logmsg LogLevel (- 100 ) " Nonlinear solve step" iter= iter resnorm= resnorm normΔu= normΔu _group= :nlsolve
42+ @logmsg LogLevel (- 100 ) " Nonlinear solve step" time = time iter= iter resnorm= resnorm normΔu= normΔu _group= :nlsolve
4343 else
44- @logmsg LogLevel (- 100 ) " Nonlinear solve step" iter= iter stats= stats _group= :nlsolve
44+ @logmsg LogLevel (- 100 ) " Nonlinear solve step" time = time iter= iter resnorm = resnorm normΔu = normΔu stats= stats _group= :nlsolve
4545 end
4646end
4747
4848function nonlinear_finalize_monitor (nlcache, time, f, progress_monitor:: DefaultProgressMonitor )
4949 # (; id, msgs) = progress_monitor
50- # push!(msgs, id => "$id: done.")
50+ (; iter, linear_solver_cache) = nlcache
51+ stats = hasproperty (linear_solver_cache. cacheval, :stats ) ? linear_solver_cache. cacheval. stats : nothing
52+ # push!(msgs, id => "$id: $(nlcache.iter)\n\t||r||=$(norm(nlcache.residual)) ||Δu||=$(norm(linear_solver_cache.u))\n\t$stats")
53+ resnorm = norm (nlcache. residual)
54+ normΔu = norm (linear_solver_cache. u)
55+ if stats === nothing
56+ @logmsg LogLevel (- 100 ) " Nonlinear solve converged" time= time iter= iter resnorm= resnorm normΔu= normΔu _group= :nlsolve
57+ else
58+ @logmsg LogLevel (- 100 ) " Nonlinear solve converged" time= time iter= iter resnorm= resnorm normΔu= normΔu stats= stats _group= :nlsolve
59+ end
5160end
5261
5362#
7180function nonlinear_step_monitor (cache, time, f, u, monitor:: VTKNewtonMonitor )
7281 nonlinear_step_monitor (cache,time,f,u,monitor. inner_monitor)
7382
83+ mkpath (monitor. outdir)
7484 VTKGridFile (joinpath (monitor. outdir, " newton-monitor-t=$time -i=$(cache. iter) .vtu" ), f. dh) do vtk
7585 write_solution (vtk, f. dh, u)
7686 write_solution (vtk, f. dh, cache. linear_solver_cache. b, " _residual" )
7787 write_solution (vtk, f. dh, cache. linear_solver_cache. u, " _increment" )
7888 end
7989end
8090
81- function nonlinear_finalize_monitor (nlcache, time, f, progress_monitor:: VTKNewtonMonitor )
91+ function nonlinear_finalize_monitor (nlcache, time, f, monitor:: VTKNewtonMonitor )
92+ nonlinear_finalize_monitor (nlcache, time,f, monitor. inner_monitor)
8293end
0 commit comments