Python Script Tutorial: Writing a JSon configuration file

From KratosWiki
Revision as of 16:07, 1 June 2016 by Rrossi (Talk | contribs)
Jump to: navigation, search

As complexity increases one needs more and more flexibility in “configuring” a simulation. This is typically achieved by defining a "configuration file" which organizes all of the "user instructions" to be used in the configuration of the solver.

Some requirements for this configuration are:

  • Must allow nesting of parameters (tree-like structure)
  • Should allow using default values
  • Must allow some form of type checking
  • Should permit to echo all of the defaults in a single place

In order to meet such requirements Kratos introduces a "Parameters" object, which provides a thin wrapper to JSon strings.

The typical structure of a JSon file is like the following:

Personal tools
Categories