Skip to content

Commit 3ddabe5

Browse files
Verbosity
1 parent a2f3071 commit 3ddabe5

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

lib/NonlinearSolveBase/src/verbosity.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ verbose = NonlinearVerbosity(
6868
termination_condition
6969
# Numerical
7070
threshold_state
71+
forcing
7172
end
7273

7374
# Group classifications
@@ -76,7 +77,7 @@ const error_control_options = (
7677
:termination_condition
7778
)
7879
const performance_options = ()
79-
const numerical_options = (:threshold_state,)
80+
const numerical_options = (:threshold_state,:forcing)
8081

8182
function option_group(option::Symbol)
8283
if option in error_control_options
@@ -138,7 +139,8 @@ function NonlinearVerbosity(;
138139
alias_u0_immutable = WarnLevel(),
139140
linsolve_failed_noncurrent = WarnLevel(),
140141
termination_condition = WarnLevel(),
141-
threshold_state = WarnLevel()
142+
threshold_state = WarnLevel(),
143+
forcing = Silent(),
142144
)
143145

144146
# Apply group-level settings
@@ -173,7 +175,8 @@ function NonlinearVerbosity(verbose::AbstractVerbosityPreset)
173175
alias_u0_immutable = Silent(),
174176
linsolve_failed_noncurrent = WarnLevel(),
175177
termination_condition = Silent(),
176-
threshold_state = Silent()
178+
threshold_state = Silent(),
179+
forcing = Silent(),
177180
)
178181
elseif verbose isa Standard
179182
# Standard: Everything from Minimal + non-fatal warnings
@@ -186,7 +189,8 @@ function NonlinearVerbosity(verbose::AbstractVerbosityPreset)
186189
alias_u0_immutable = WarnLevel(),
187190
linsolve_failed_noncurrent = WarnLevel(),
188191
termination_condition = WarnLevel(),
189-
threshold_state = WarnLevel()
192+
threshold_state = WarnLevel(),
193+
forcing = InfoLevel(),
190194
)
191195
elseif verbose isa All
192196
# All: Maximum verbosity - every possible logging message at InfoLevel
@@ -196,7 +200,8 @@ function NonlinearVerbosity(verbose::AbstractVerbosityPreset)
196200
alias_u0_immutable = WarnLevel(),
197201
linsolve_failed_noncurrent = WarnLevel(),
198202
termination_condition = WarnLevel(),
199-
threshold_state = InfoLevel()
203+
threshold_state = InfoLevel(),
204+
forcing = InfoLevel(),
200205
)
201206
end
202207
end
@@ -208,7 +213,8 @@ end
208213
Silent(),
209214
Silent(),
210215
Silent(),
211-
Silent()
216+
Silent(),
217+
Silent(),
212218
)
213219
end
214220

lib/NonlinearSolveFirstOrder/src/eisenstat_walker.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ end
2929

3030

3131
function pre_step_forcing!(cache::EisenstatWalkerForcing2Cache, descend_cache::NonlinearSolveBase.NewtonDescentCache, J, u, fu, iter)
32+
@SciMLMessage("Eisenstat-Walker forcing residual norm $(cache.rnorm) with rate estimate $(cache.rnorm / cache.rnorm_prev).", cache.verbosity, :forcing)
33+
3234
# On the first iteration we initialize η with the default initial value and stop.
3335
if iter == 0
3436
cache.η = cache.p.η₀
35-
@SciMLMessage("Eisenstat-Walker initial iteration to η=$(cache.η).", cache.verbosity, :linear_verbosity)
37+
@SciMLMessage("Eisenstat-Walker initial iteration to η=$(cache.η).", cache.verbosity, :forcing)
3638
LinearSolve.update_tolerances!(descend_cache.lincache; reltol=cache.η)
3739
return nothing
3840
end
@@ -57,7 +59,7 @@ function pre_step_forcing!(cache::EisenstatWalkerForcing2Cache, descend_cache::N
5759
# Far away from the root we also need to respect η ∈ [0,1)
5860
cache.η = clamp(cache.η, 0.0, cache.p.ηₘₐₓ)
5961

60-
@SciMLMessage("Eisenstat-Walker iter $iter update to η=$(cache.η).", cache.verbosity, :linear_verbosity)
62+
@SciMLMessage("Eisenstat-Walker iter $iter update to η=$(cache.η).", cache.verbosity, :forcing)
6163

6264
# Communicate new relative tolerance to linear solve
6365
LinearSolve.update_tolerances!(descend_cache.lincache; reltol=cache.η)

0 commit comments

Comments
 (0)