Creating a main program
A main program built on the SDK generally follows this sequence:
- Read parameters from input files. You may also hard-code every parameter and read nothing.
- Normalise the parameters. This is purely for numerical benefit: avoiding the multiplication of very large by very small values improves solver accuracy.
- Set up the simulation system using the normalised parameters.
- Run the main iteration loop.
- Finalise.
Reading input
Section titled “Reading input”We recommend TOML for input parameters. Call mupro_toml_read_file and then
get_value to obtain each parameter.
Calling into the SDK
Section titled “Calling into the SDK”Some SDK routines are called directly; others are type-bound procedures of a derived type.
Directly called routines
Section titled “Directly called routines”These are either global routines that need to be called once, or input readers
— thin wrappers around the toml-f library:
mupro_size_setupmupro_fft_setupmupro_toml_read_fileget_valuemupro_toml_evaluate_value
Routines bound to a derived type
Section titled “Routines bound to a derived type”Most SDK routines are attached to a derived type, because they need a specific data context and that data is held in the type. For example:
setupontype_mupro_electricContextsolveontype_mupro_electricContext
There are many more. The module reference lists, for each solver, what it computes, what its context requires, and what it currently cannot do. Contexts, validation and status describes the pattern all of them follow — including how to ask a context whether it is complete before you commit to a run.
