[Mesa-users] f90nml: Fortran 90 namelist manipulation with Python (incl. command line tool)

Warrick Ball wball at bison.ph.bham.ac.uk
Wed Apr 4 05:52:17 EDT 2018


Hi everyone,

I've just stumbled upon a Python package called `f90nml` that might be 
quite useful for MESA users.

https://pypi.python.org/pypi/f90nml
http://f90nml.readthedocs.io

It provides a module with which to manipulate Fortran 90 namelists, like 
MESA's inlists.  In particular, it provides a command line tool that has 
various options.  It doesn't quite do everything I'd wish for but it 
certainly covers a lot of simple use cases (e.g. adding or updating 
options). e.g. to update a parameter and preserve comments,

     $ cat inlist_mesa
     &star_job
     /

     &controls
         initial_mass = 1.0d0  ! comment
     /
     $ f90nml inlist_mesa inlist_mesa_new -p -g controls -v initial_mass=1.5
     $ cat inlist_mesa_new
     &star_job
     /

     &controls
         initial_mass = 1.5  ! comment
     /

It's installable from the Python Package Index (PyPI) as `f90nml`.

In case it isn't clear, this isn't my work, just something I found 
(although I might try to contribute).  It isn't MESA specific, so could be 
useful for any program that uses Fortran 90 namelists, including GYRE.

Cheers,
Warrick



------------
Warrick Ball
Postdoc, School of Physics and Astronomy
University of Birmingham, Edgbaston, Birmingham B15 2TT
wball at bison.ph.bham.ac.uk
+44 (0)121 414 4552



More information about the Mesa-users mailing list