namespace mom_file_parser

Overview

The MOM6 facility to parse input files for runtime parameters. More…

namespace mom_file_parser {

// interfaces

interface get_param;
interface log_param;
interface log_version;
interface read_param;

// global variables

integer, parameter, public max_param_files = 5;

// global functions

subroutine, public open_param_file(
    filename filename,
    CS CS,
    checkable checkable,
    component component,
    doc_file_dir doc_file_dir
    );

subroutine, public close_param_file(CS CS, quiet_close quiet_close, component component);
subroutine, public clearparameterblock(CS CS);
subroutine, public openparameterblock(CS CS, blockName blockName, desc desc);
subroutine, public closeparameterblock(CS CS);

} // namespace mom_file_parser

Detailed Documentation

The MOM6 facility to parse input files for runtime parameters.

By Robert Hallberg and Alistair Adcroft, updated 9/2013.

The subroutines here parse a set of input files for the value a named parameter and sets that parameter at run time. Currently these files use use one of several formats: #define VAR ! To set the logical VAR to true. VAR = True ! To set the logical VAR to true. #undef VAR ! To set the logical VAR to false. VAR = False ! To set the logical VAR to false. #define VAR 999 ! To set the real or integer VAR to 999. VAR = 999 ! To set the real or integer VAR to 999. #override VAR = 888 ! To override a previously set value. VAR = 1.1, 2.2, 3.3 ! To set an array of real values.

Global Variables

integer, parameter, public max_param_files = 5

Maximum number of parameter files.

Global Functions

subroutine, public open_param_file(
    filename filename,
    CS CS,
    checkable checkable,
    component component,
    doc_file_dir doc_file_dir
    )

Make the contents of a parameter input file availalble in a param_file_type.

Parameters:

filename

An input file name, optionally with the full path

cs

The control structure for the file_parser module, it is also a structure to parse for run-time parameters

checkable

If this is false, it disables checks of this file for unused parameters. The default is True.

component

If present, this component name is used to generate parameter documentation file names; the default is”MOM”

doc_file_dir

An optional directory in which to write out the documentation files. The default is effectively ‘./’.

subroutine, public close_param_file(
    CS CS,
    quiet_close quiet_close,
    component component
    )

Close any open input files and deallocate memory associated with this param_file_type. To use this type again, open_param_file would have to be called again.

Parameters:

cs

The control structure for the file_parser module, it is also a structure to parse for run-time parameters

quiet_close

if present and true, do not do any logging with this call.

component

If present, this component name is used to generate parameter documentation file names

subroutine, public clearparameterblock(CS CS)

Resets the parameter block name to blank.

Parameters:

cs

The control structure for the file_parser module, it is also a structure to parse for run-time parameters

subroutine, public openparameterblock(CS CS, blockName blockName, desc desc)

Tags blockName onto the end of the active parameter block name.

Parameters:

cs

The control structure for the file_parser module, it is also a structure to parse for run-time parameters

blockname

The name of a parameter block being added

desc

A description of the parameter block being added

subroutine, public closeparameterblock(CS CS)

Remove the lowest level of recursion from the active block name.

Parameters:

cs

The control structure for the file_parser module, it is also a structure to parse for run-time parameters