[mesa-users] Mesa with Python
Bill Paxton
paxton at kitp.ucsb.edu
Sun Sep 27 14:07:05 EDT 2015
Hi Adam,
The EOS would be a good place to start. The interface is explicitly defined in mesa/eos/public eos_def (for data) and eos_lib (for procedures). Note that I've tried to make things easier for Python interface by using integer "handles" rather than pointers to structures. As a result of this preplanning on my part (excuse the self-congratulations), the args are limited to simple scalars and arrays. And even the arrays are intentionally limited to one dimension. The structures defined in eos_def are for internal use in the implementation, so it may not be necessary to create Python access routines for them. Most of the user access is to arrays of results with the indices given as defined constants (e.g., i_lnE is index of the log of energy value in the results array). The 0 base vs 1 base array indexing will be the main nuisance.
Please feel free to get to work on doing a Python interface for the mesa EOS. Check with Kent for ideas and suggestions.
Good luck,
Bill
On Sep 25, 2015, at 11:23 AM, Adam Jermyn wrote:
> Hi Bill,
>
> How is this handled in terms of making sure that different modules
> within MESA can talk to each other? Does that interface change
> substantially over time? For EOS in particular, it seems that there's
> a pretty well-defined set of inputs and outputs, so that one might be
> more amenable to an API treatment than others...
>
> Thanks!
> -Adam
>
>
> On Fri, Sep 25, 2015 at 3:40 PM, Bill Paxton <paxton at kitp.ucsb.edu> wrote:
>> Hi Adam,
>>
>> Yes, a Python interface would be great. Kent Budge created one:
>>
>> http://mesapp.sourceforge.net/
>>
>> But I don't know when it was last updated -- it takes a substantial effort to keep the Python and C++ interfaces up to date with the rapidly changing MESA versions.
>>
>> Cheers,
>> Bill
>> On Sep 25, 2015, at 6:20 AM, Adam Jermyn wrote:
>>
>>> Dear Dr. Paxton,
>>>
>>> I've been working with MESA, and it occurred to me that it would be
>>> extremely useful to be able to call many of the modules in MESA from
>>> other codes (particularly in high-level languages like Python). For
>>> instance, the EOS module in MESA provides the greatest coverage of any
>>> EOS available, but as far as I can tell there is no MESA equivalent to
>>> the OPAL EOS tables. Are there any plans for providing standalone EOS
>>> tables (or providing interfaces to other languages)?
>>>
>>> Thanks,
>>> -Adam
>>>
>>>
>>> ---
>>> Adam Jermyn
>>> University of Cambridge, IoA
>>> Caltech Class of 2015
>>
More information about the Mesa-users
mailing list