Skip to content

Commit 2b8efca

Browse files
committed
more writing
1 parent f828bdf commit 2b8efca

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

docs/src/interfaces/Verbosity.md

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,57 @@
11
# SciML Verbosity
2-
The SciML verbosity system is designed to make it easy for users to specify what messages are logged, and at what level they are logged at, during the solution process.
2+
The SciML verbosity system is designed to make it easy for users to specify what messages are logged and at what level they are logged at during the solution process.
33

4-
At the highest level are the `AbstractVerbositySpecifier` subtypes, e.g. `ODEVerbosity`, `LinearVerbosity`, and so on. These hold `group` objects that group the error messages into three broad categories. The first is error control, which contains options related to solver error control and adaptivity algorithms, such as convergence issues and correctness guarantees (e.g. `dt < dtmin)
4+
At the highest level are the `AbstractVerbositySpecifier` subtypes, e.g. `ODEVerbosity`, `LinearVerbosity`, and so on. These hold "group" objects that group the error messages into three broad categories. The first is error control, which contains options related to solver error control and adaptivity algorithms, such as convergence issues and correctness guarantees (e.g. `dt < dtmin`). The numerical group holds options pertaining to performance issues, such as large condition numbers and detection of potential floating point issues. Finally the performance group has options related to potential performance issues. For example, mismatched input/output types in out of place functions, and other known performance traps. An example of a group object would be `ODEPerformanceVerbosity`.
55

6-
At the lowest level are the `option` settings. These correspond to either individual messages or groups of messages in
6+
At the lowest level are the `option` settings. These correspond to either individual messages or groups of messages relating to a specific issue or piece of information. For example, the `dt_NaN` option in the `ODEErrorControl` group sets the level of a log message that states that the adaptive timestepping algorithm set `dt` to `NaN`.
77

8-
## Verbosity Types
8+
The system is also hierarchical in the sense that for example `ODEVerbosity` also contains a `NonlinearVerbosity` and a `LinearVerbosity`, because an ODE solve might use NonlinearSolve and LinearSolve. Note that `NonlinearVerbosity` also has a `LinearVerbosity`, because NonlinearSolve also can use LinearSolve. The `LinearVerbosity` in the `ODEVerbosity` handles any calls to LinearSolve that are not inside of a call to NonlinearSolve.
9+
10+
# Base Verbosity Types
11+
The base verbosity specifiers are [Moshi.jl](https://rogerluo.dev/Moshi.jl/) algebraic data types. These allow for pattern matching and gives a namespace `Verbosity` to access the types with.
12+
There are five of these types that are used for the lowest level option toggles:
13+
14+
- `None`: indicates that this message should not be logged.
15+
- `Info`: indicates that this message should be logged with a log level of `Info`
16+
- `Warn`: indicates that this message should be logged with a log level of `Warn`
17+
- `Error`: indicates that this message should be logged with a log level of `Error`
18+
- `Level`: indicates that this message should be logged with a custom log level held by the `Level` type, e.g. `Verbosity.Level(4)` corresponds to `Logging.LogLevel(4)`
19+
20+
Three of these types are only meant to be used for higher level constructors of the verbosity types:
21+
22+
- `Edge`: messages in this group or verbosity specifier are only logged when they relate to edge cases
23+
- `All`: All messages in this group or verbosity specifier are logged
24+
- `Default`: only the default messages of this group or verbosity specifier are logged.
25+
26+
# Constructors
27+
28+
The constructors for the verbosity specifiers are designed to be flexible. For example, they can takes some of the base verbosity types described above:
29+
30+
```julia
31+
ODEVerbosity(Verbosity.None()) #logs nothing
32+
ODEVerbosity(Verbosity.All()) #logs everything
33+
ODEVerbosity(Verbosity.Default()) #logs somethings
34+
```
35+
36+
They also have keyword argument constructors that can take base verbosity types and automatically construct the correct group object, while also taking a group object for a different
37+
group:
38+
39+
```julia
40+
# Doesn't print out any error_control information, warns if there is an `init_dt` issue, errors if there is a `dt_NaN` issue, uses Verbosity.Default() for ODENumericalVerbosity
41+
ODEVerbosity(error_control = Verbosity.None(), performance = ODEPerformanceVerbosity(init_dt = Verbosity.Warn(), dt_NaN = Verbosity.Error()))
42+
```
43+
44+
Similarly, all of the group objects have equally flexible constructors, but take different base verbosity types.
45+
46+
```julia
47+
ODENumericalVerbosity(Verbosity.None()) #logs nothing
48+
ODENumericalVerbosity(Verbosity.Warn()) #everything is logged as a warning
49+
```
50+
51+
# SciMLMessage Macro
52+
```@docs
53+
SciMLBase.SciMLMessage
54+
```
55+
56+
# Verbosity API
957

0 commit comments

Comments
 (0)