Using Diagnostics

An experiment can configure ClimateMachine to output various diagnostic variables to NetCDF files at specifiable intervals during a simulation. To do so, it must create a ClimateMachine.DiagnosticsConfiguration which is passed to ClimateMachine.invoke! with the diagnostics_config keyword.

A DiagnosticsConfiguration is constructed with a list of the DiagnosticsGroups of interest. The DiagnosticsGroups currently defined together with the functions used to construct them are:

Each of these diagnostics groups contains a set of diagnostic variables.

Users can define their own diagnostics groups, and the ClimateMachine.DiagnosticsMachine, currently in development, provides functionality to simplify doing so.

Here is a code snippet adapted from the Taylor-Green vortex experiment, showing the creation of three diagnostics groups and their use:

...
using ClimateMachine.Diagnostics
...
    ts_dgngrp = setup_atmos_turbulence_stats(
        AtmosLESConfigType(),
        "360steps",
        driver_config.name,
        tnor,
        titer,
    )

    boundaries = [
        xmin ymin zmin
        xmax ymax zmax
    ]
    interpol = ClimateMachine.InterpolationConfiguration(
        driver_config,
        boundaries,
        resolution,
    )
    ds_dgngrp = setup_atmos_spectra_diagnostics(
        AtmosLESConfigType(),
        "0.06ssecs",
        driver_config.name,
        interpol = interpol,
        snor,
    )

    me_dgngrp = setup_atmos_mass_energy_loss(
        AtmosLESConfigType(),
        "0.02ssecs",
        driver_config.name,
    )

    dgn_config = ClimateMachine.DiagnosticsConfiguration([
        ts_dgngrp,
        ds_dgngrp,
        me_dgngrp,
    ],)
...
    result = ClimateMachine.invoke!(
        solver_config;
        diagnostics_config = dgn_config,
        check_cons = check_cons,
        check_euclidean_distance = true,
    )

When this experiment is run with the command line argument --diagnostics=default, three NetCDF files are created, one for each group. The AtmosLESSpectra diagnostic variables are output on an interpolated grid, as specified above. Each group has a different interval specified, thus the number of entries in each NetCDF file (along the unlimited time dimension) will differ.

When designing customized diagnostics groups, please use the above example as a template and refer to the list of current diagnostics variables.