Creating a main program
Creating a main program#
The general procedure of creating a main program based on the SDK is as follows:
Read necessary parameters from the input files. You may also hard coded all parameters in the program with reading from external input files.
Normalize the parameters. This is purely for numerical benefits, as avoiding multiplication of very large and very small value can improve the solver accuracy.
Simulation system setup using the normalized parameters.
Start the main iteration loop.
Finalize the whole program
We recommend using the toml file for input parameters. You can call the
mupro_toml_read_file subroutine and
get_value subroutine to obtain desired parameter from.
Using the SDK#
Some of the subroutines from the SDK needs to be called directly, while others needs to be called as procedure of a derived type
Direct called subroutines#
These are usually either global functions that can only needs to be called once or input file reader which is a thin wrapper around the procedures provided by the toml-f library. Here are a list of them:
Call subroutines from a derived type#
For most subroutines from the SDK, they are attached to some derived type, this is because most subroutines needs to be called within specific data context and those necessary data are kept in the derived type. A few examples of these subroutines include:
setup from the type_mupro_electricContext
solve from the type_mupro_electricContext
There are many more, and you should read the modules section of this manual to learn available solvers that you can use for your program.