[Mesa-users] Usage of the MESA EoS module outside of MESA/star

trobolo dinni trobolo.trobolo.dinni5 at gmail.com
Thu Jul 30 01:41:20 EDT 2020


Dear Rob,

I would like to ask you another question regarding the usage of pyMesa.
When I run the eos.py script I get the following error:

*In [10]: run eos.py

                                                        *


* failed: allocate          failed to find weak reaction for ni56 to co56
        failed to find weak reaction for co56 to fe56*

>From the commands:







*if pym.MESA_VERSION >= 10000:     #Function sig changed
 rates_lib.rates_init('reactions.list','jina_reaclib_results_20130213default2',
                  'rate_tables',False,False,'','','',ierr)else:
 rates_lib.rates_init('reactions.list','jina_reaclib_results_20130213default2',
                  'rate_tables',False,'','','',ierr)*

net_lib.net_init(ierr)

The script still delivers the values of the thermodynamic quantities I
require, but I am wondering if I should worry about these errors and how I
can eventually fix them.

Thanks in advance,
Roberto

On Wed, 29 Jul 2020 at 10:09, trobolo dinni <
trobolo.trobolo.dinni5 at gmail.com> wrote:

> Dear Rob,
>
> Thanks a lot, that solved the problem.
>
> Best,
> Roberto
>
>
>
>
> On Tue, 28 Jul 2020 at 17:26, Rob Farmer <r.j.farmer at uva.nl> wrote:
>
>> HI,
>> The .fpy files are generated the first time you load a fortran module.
>> The problem here is:
>>
>> >PermissionError: [Errno 13] Permission denied: '/xc/home/roberto.fpy'
>>
>> It's trying a) to write a file to a folder it doesn't have permission to
>> b) trying to write a file "roberto.fpy", instead this should be "const.fpy"
>>
>> The problem is the "." in your username "*/xc/home/roberto.iaconi/*" is
>> messing up some string handling in gfort2py.
>>
>> You'll need to checkout gfort2py from git (but stay on the master
>> branch), then find the file parseMod.py and replace the function
>>
>> def fpyname(filename):
>> return filename.split('.')[0] + '.fpy'
>>
>> with
>>
>> def fpyname(filename):
>> return os.path.splitext(filename)[0]+'.fpy'
>>
>>
>> Rob
>>
>>
>>
>>
>> On Tue, 28 Jul 2020 at 05:14, trobolo dinni <
>> trobolo.trobolo.dinni5 at gmail.com> wrote:
>>
>>> Dear Rob,
>>>
>>> Thank you for the link.
>>>
>>> I am trying to use your pyMesa package at the moment actually, which
>>> fits better my needs I think.
>>> I managed to build it properly, then I built the gfort2py package.
>>> However, when running an example from the files you provide in the
>>> mesa_model folder of pyMesa I receive the following error (in this case is
>>> the const.py script):
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *In [1]: run const.py
>>>
>>>
>>> ---------------------------------------------------------------------------FileNotFoundError
>>>                         Traceback (most recent call
>>> last)~/.local/lib/python3.7/site-packages/gfort2py/gfort2py.py in
>>> _load_data(self, ffile, rerun)     48         try:---> 49             f =
>>> open(self._fpy, 'rb')     50         except FileNotFoundError as
>>> e:FileNotFoundError: [Errno 2] No such file or directory:
>>> '/xc/home/roberto.fpy'During handling of the above exception, another
>>> exception occurred:PermissionError                           Traceback
>>> (most recent call
>>> last)/xc/home/roberto.iaconi/codes/pyMesa/mesa_models/const.py in <module>
>>>     1 import pyMesaUtils as pym      2 ----> 3 const_lib,const_def =
>>> pym.loadMod("const")      4       5
>>> /xc/home/roberto.iaconi/codes/pyMesa/pyMesaUtils.py in loadMod(module)
>>> 114     115     try:--> 116         x =
>>> gf.fFort(SHARED_LIB,MODULE_LIB,rerun=True)    117     except
>>> FileNotFoundError:    118
>>> pass~/.local/lib/python3.7/site-packages/gfort2py/gfort2py.py in
>>> __init__(self, libname, ffile, rerun)     41         self._ffile = ffile
>>>  42         self._fpy = pm.fpyname(ffile)---> 43
>>> self._load_data(ffile, rerun)     44         self._init()     45
>>> self._initialized =
>>> True~/.local/lib/python3.7/site-packages/gfort2py/gfort2py.py in
>>> _load_data(self, ffile, rerun)     51             if e.errno !=
>>> errno.ENOENT:     52                 raise---> 53             pm.run(ffile,
>>> save=True)     54         else:     55
>>> f.close()~/.local/lib/python3.7/site-packages/gfort2py/parseMod/parseMod.py
>>> in run(filename, output, save, unpack)     60
>>> output=fpyname(filename)     61 ---> 62         x.save(output)     63
>>>  64     if
>>> unpack:~/.local/lib/python3.7/site-packages/gfort2py/parseMod/parseModCommon.py
>>> in save(self, output)     68         self.pickler(output,
>>> self.PYFILE_VERSION,      69                     self.mod_data,
>>> self.mod_vars, self.param,---> 70                     self.funcs,
>>> self.dt_defs, self.func_ptrs)     71      72
>>> ~/.local/lib/python3.7/site-packages/gfort2py/parseMod/parseModCommon.py in
>>> pickler(self, filename, *args)     72      73     def
>>> pickler(self,filename, *args):---> 74         with open(filename, 'wb') as
>>> f:     75             for i in args:     76                 pickle.dump(i,
>>> f, protocol=2)PermissionError: [Errno 13] Permission denied:
>>> '/xc/home/roberto.fpy'In [2]:
>>>  *
>>>
>>> Looks like the .fpy file had to be created automatically upon
>>> building gfort2py, but it wasn't.
>>> Can I ask if you witnessed this error before?
>>>
>>> Best,
>>> Roberto
>>>
>>>
>>> On Mon, 27 Jul 2020 at 16:45, Rob Farmer <r.j.farmer at uva.nl> wrote:
>>>
>>>> Hi,
>>>>
>>>> There is an example from a previous mesa summer school
>>>> https://zenodo.org/record/3372835
>>>> <https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fzenodo.org%2Frecord%2F3372835&data=02%7C01%7Cr.j.farmer%40uva.nl%7C05e7bd4f6fc14bc05ad708d832a45945%7Ca0f1cacd618c4403b94576fb3d6874e5%7C1%7C0%7C637315028737573847&sdata=lB%2FblBSNLOC27UiXjHL%2BsiSLTlflkbhXDYjWz9nPN6g%3D&reserved=0>
>>>> by Frank Timmes which
>>>>  shows how to use the eos, kap, and net modules separately.
>>>>
>>>> Rob
>>>>
>>>> On Mon, 27 Jul 2020 at 08:42, trobolo dinni via Mesa-users <
>>>> mesa-users at lists.mesastar.org> wrote:
>>>>
>>>>> Dear MESA users,
>>>>>
>>>>> I am interested in directly querying the tabulated equation of state
>>>>> of MESA to obtain some thermodynamic quantities.
>>>>> Specifically, I want to give as inputs density and pressure, and
>>>>> receive as outputs internal energy and temperature.
>>>>>
>>>>> I know that the MESA EoS module can be used independently from
>>>>> MESA/star, but I have never done it and I am not sure on how to proceed.
>>>>> Can I ask for a simple explanation/tutorial on how to do it?
>>>>>
>>>>> Thanks in advance,
>>>>> Roberto
>>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20200730/51fcf397/attachment.htm>


More information about the Mesa-users mailing list