[Opm] Suggestion: new debug configuration

Atgeirr Rasmussen Atgeirr.Rasmussen at sintef.no
Thu Jun 3 09:17:55 UTC 2021


Hi all,

I agree with Joakim that it is a good idea to add DEBUGF, and think that suggestion should be followed through. Some comments:
 - I think that the default configuration should print something useful.
 - It should also be possible to turn off and on via the command line. The full flexibility of the keyword, especially changing it in the schedule, will not be available on the command line.
 - The proposed code changes are somewhat intrusive. It is not clear how this configuration is passed around.
 - I think the existing code should work as before, until explicitly changed.

I propose that we attach a DebugConfig (and perhaps name it LogVerbosityConfig) to each logging backend (different for each is possible). Then we add new overloads for the logging function.

Example of existing logging function:
  static void debug(const std::string& message);

Example of new function:
  static void debug(const MessageCategory cat,
                    const MessageVerbosityLevel level,
                    const std::string& message);

In the above, MessageCategory enum can be Pvt, Wells, Groups and similar as you suggested, and the MessageVerbosityLevel is either an integer or an enum similar to your suggestion. (A version taking tags would also be added.)

Then your example call would be:

OpmLog::debug(Wells, 1, "The wells are difficult today");
OpmLog::debug(Wells, 3, lots_of_details_about_problematic_well);

In case we really need to get the verbosity level, to avoid doing expensive extra calculations for example, we could access it like this:

auto level = OpmLog::verbosityLevel(Wells);

which would return the maximum level across all active logging backends.

Atgeirr


________________________________
From: Opm <opm-bounces at opm-project.org> on behalf of Joakim Hove <joakim.hove at opm-op.com>
Sent: 03 June 2021 10:39
To: opm at opm-project.org <opm at opm-project.org>
Subject: [Opm] Suggestion: new debug configuration

Fellow opm'ers;

we would like to suggest a new system for controlling and configuring
debug information. The plan consists of both a change affecting the end
users with a new keyword - e.g. DEBUGF - and updates to the code at
callsites.

_
_

_Keyword DEBUGF_

The new keyword should be modelled after e.g the RPTSHCED keyword with
use of mnemonics:


    RUNSPEC

    DEBUGF

         INIT=1 /

    ...

    SCHEDULE

    -- Turn on the PVT debugging (default level)

    DEBUGF

        PVT /


    DATES

       10 'MAI' 2020 /


    -- Turn on maximum debugging of wells, debug level 1 for groups and
    turn off the PVT debugging.

    DEBUGF

         WELL=3 GROUP=1 PVT=0 /


    DATES

        20 MAI 2020 /


    -- Turn off all debugging

    DEBUGF

    /


Some points/thoughts:

 1. As indicated the keyword can be both in RUNSPEC section and the
    SCHEDULE section - the latter is important to turn debugging on and off.
 2. The set of mnemonics is quite relaxed - this should be developer
    centric and it should be simple to add more mnemonics.
 3. In the default configuration with no DEBUGF keyword in the deck the
    .DBG output file should be empty.
 4. ...


_Changes to code:
_

The DEBUGF keyword should be internalized to datastructure looking
something like this:

    struct DebugConfig {

          int well_debug = 0;

          int group_debug = 0;

          pvt_debug = 0;

         ....

    };

Such DebugConfig reference should be passed around in the simulator (and
other places), and then every debug call  should be protected in C++
code as:

    if (debug_config.well_debug > 0) {

          OpmLog::debug("The wells are difficult today");

          if (debug_config.well_debug > 3)

              OpmLog::debug( lots_of_details_about_problematic_well );

    }


Observe that:

 1. The actual printing to the debug file will still be handled with
    OpmLog::debug() calls.
 2. The system with DebugConfig will add to the debug configuration from
    OpmLog - maybe not 100% logical but hopefully not too bad.


Bring on the critque and suggestions!


Joakim








__

__






--
OPM-OP AS
Heyerdahlsvei 12b, 0777 Oslo, Norway
Joakim Hove
CEO
T: +47 92 68 57 04
E: joakim.hove at opm-op.com

_______________________________________________
Opm mailing list
Opm at opm-project.org
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fopm-project.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fopm&data=04%7C01%7CAtgeirr.Rasmussen%40sintef.no%7Cdfacd4ea185444bb9e1308d9266b208d%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637583063834294959%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2%2Fbf9ri3Tx9%2FKHPaXeXWyoPZMCO3%2FGOh6z66joPFe5o%3D&reserved=0


More information about the Opm mailing list