Skip to content

Overview

In this section we outline the standard structure for the configuration file used as the starting point for generating an environmental mesh using the MeshiPhi software package. These configuration files are written in JSON, can be passed to MeshiPhi as command-line arguments or through a Python interpreter.

Example configuration files are provided in the examples/environment_config/ directory on GitHub.

Descriptions of the configuration options for the Mesh Construction can be found in the Configuration - Mesh Construction section of the documentation.

Config Validation

The configs supplied by the user are validated using a template JSON Schema. This schema checks that the correct keywords and datatypes are provided in the config JSON file. They also perform rudimentary checks on the values within the config to ensure that they make sense (e.g. start_time is before end_time).

flexi_json_input(config)

Allows flexible inputs. If a string is parsed, then assume it's a file path and read in as a json. If a dict is parsed, then assume it's already a valid loaded json, and return it as is

Parameters:

Name Type Description Default
config str or dict

Input to translate into a dict.

required

Raises:

Type Description
TypeError

If input is neither a str nor a dict, then wrong input type

Returns:

Name Type Description
dict

Dictionary read from JSON

validate_mesh_config(config)

Validates a mesh config

Parameters:

Name Type Description Default
config str or dict

Mesh config to be validated. If type 'str', tries to read in as a filename and open file as json If type 'dict', assumes it's already read in from a json file

required

Raises:

Type Description
TypeError

Incorrect config parsed in. Must be 'str' or 'dict'

FileNotFoundError

Could not read in file if 'str' parsed

ValidationError

Malformed mesh config