ogstools.logparser package#

functions used by logparser.

ogstools.logparser.parse_file(file_name, maximum_lines=None, force_parallel=False, ogs_res=None)[source]#

Parses a log file from OGS, applying regex patterns to extract specific information,

The function supports processing files in serial or parallel mode. In parallel mode, a specific regex is used to match log entries from different processes.

Parameters:
  • file_name (str | Path) – The path to the log file, as a string or Path object.

  • maximum_lines (int | None) – Optional maximum number of lines to read from the file. If not provided, the whole file is read.

  • force_parallel (bool) – Should only be set to True if OGS run with MPI with a single core

  • ogs_res (list | None)

Returns:

A list of extracted records based on the applied regex patterns. The exact type and structure of these records depend on the regex patterns and their associated processing functions.

Return type:

list[Any]

ogstools.logparser.analysis_convergence_coupling_iteration(df)[source]#
Parameters:

df (Any)

Return type:

Any

ogstools.logparser.analysis_simulation(df)[source]#
Parameters:

df (DataFrame)

Return type:

DataFrame

ogstools.logparser.analysis_convergence_newton_iteration(df)[source]#

Convergence metrics need to be interpreted as norm |x|,`|dx|`, |dx|/|x| and are specific to defined <convergence_criterion> in prj - file.

Parameters:

df (DataFrame)

Return type:

DataFrame

ogstools.logparser.analysis_simulation_termination(df)[source]#
Parameters:

df (DataFrame)

Return type:

DataFrame

ogstools.logparser.analysis_time_step(df)[source]#

Analysis with focus on computation time per time step. It combines time step specific measurements ‘output time’ and ‘time step solution time’ with iteration specific measurements ‘assembly time’, ‘linear solver time’, ‘Dirichlet time’. Time from iteration are accumulated.

Parameters:

df (DataFrame)

Return type:

DataFrame

ogstools.logparser.fill_ogs_context(df_raw_log)[source]#

Fill missing values in OpenGeoSys (OGS) log DataFrame by context. This function fills missing values in an OpenGeoSys (OGS) log DataFrame by context.

Parameters:

df_raw_log (DataFrame) – DataFrame containing the raw OGS log data. Usually, the result of pd.DataFrame(parse_file(file))

Returns:

pd.DataFrame with missing values filled by context.

Return type:

DataFrame

References: Pandas documentation : https://pandas.pydata.org/pandas-docs/stable/user_guide/

Notes: Some logs do not contain information about time_step and iteration. The information must be collected by context (by surrounding log lines from same mpi_process). Logs are grouped by mpi_process to get only surrounding log lines from same mpi_process. There are log lines that give the current time step (when time step starts). It can be assumed that in all following lines belong to this time steps, until next collected value of time step. Some columns that contain actual integer values are converted to float. See https://pandas.pydata.org/pandas-docs/stable/user_guide/integer_na.html ToDo list of columns with integer values are known from regular expression

ogstools.logparser.time_step_vs_iterations(df)[source]#
Parameters:

df (DataFrame)

Return type:

DataFrame

ogstools.logparser.ogs_regexes()[source]#

Defines regular expressions for parsing OpenGeoSys log messages.

Returns:

A list of tuples, each containing a regular expression pattern and the corresponding message class.

Return type:

list[tuple[str, type[Log]]]

Submodules#