Logging

Lizzy uses Python’s standard logging module for communication. See the standard library documentation for more information. By default, if no logger is set up, all termninal output is suppressed. This complies with standard logging practice.

Enabling log output

Call logging.basicConfig() before creating a LizzyModel instance:

import logging
import lizzy

logging.basicConfig(level=logging.INFO)

model = lizzy.LizzyModel()
# ... etc ...

This will produce output in the console when the script is run:

 |    _)
 |     | _  / _  /  |  |
____| _| ___| ___| \_, |
                  ___/
        v0.1.0

INFO:lizzy.io: Reading mesh file: ../mesh_file.msh
INFO:lizzy.mesh: Creating Mesh...
INFO:lizzy.solver: Preprocessing...
INFO:lizzy.solver: Solving...
INFO:lizzy.solver: Solve completed in $ seconds
INFO:lizzy.io: Saving results...
INFO:lizzy.io: Results saved in results/NAME_RES

It is recommended to use logging in normal Lizzy use - otherwise you won’t get any feedback on what is happning.

Note

Configure logging before creating a LizzyModel.

Logger hierarchy

Lizzy uses the following logger names, which follow the standard Python hierarchy under the lizzy root:

Logger

What it covers

lizzy

Root logger

lizzy.model

Model setup and operations

lizzy.solver

Preprocessing and solving logic

lizzy.io

Mesh file reading, result saving

lizzy.mesh

Mesh operations

Log levels

Level

What it shows

INFO

General operational information. Recommended in mose cases.

WARNING

Non-critial issues that may require attention (e.g. unassigned parameters running with default values)

DEBUG

PETSc convergence - not fully implemented yet

Progress bar

In addition to log messages, Lizzy can display a tqdm progress bar while solving. This is independent of the logging system and is controlled by the progress_bar parameter of set_simulation_parameters():

model.set_simulation_parameters(progress_bar=True)