Command-line parameters usable in sif file

Discussion about coding and new developments
Post Reply
raback
Site Admin
Posts: 3665
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Command-line parameters usable in sif file

Post by raback » 03 Jun 2020, 14:38

Hi All,

It is now possible to give parameters as command-line arguments. After dealing with the logic of using predefined MATC variables for the "Run Control" section this was just ~10 lines of additional code.

So now you can say, for example

Code: Select all

ElmerSolver case.sif –rpar 2 1.0 3.14
i.e. the “-rpar” string activates the reading of parameters. First we have #parameters and then their value(s).

To use in code refer to the parameters in MATC (in C-convention) as rpar(0), rpar(1), etc.

For example

Code: Select all

  Heat Source = $rpar(1)
Would in this case result to heat source of 3.14.

Made a simple test and seems to work. Since a few years (F2008 standard) command-line has been standardized also for Fortran so should work on all platforms once the updated executables reach you.

Have fun!

-Peter

Post Reply