[Mesa-users] (no subject)

Pablo Marchant pamarca at gmail.com
Mon Jun 29 04:03:18 EDT 2020


Hi Ebrahim,

as I mentioned before, MESA allocates arrays larger than what is actually
needed for the grid size in order to prevent having to do repeated array
allocations, you're just by random running into the point where the number
of cells in your stars matches the size of the array.

Let me be more explicit. Imagine your starting model would need 1000 cells,
MESA will create an array with a larger size to store it say 1200 cells,
but anything beyond cell 1000 has no physical meaning, and you cant even
assure that they will have meaningful values such as zero, so you should
never access those. Now as your model evolves it might require more cells,
so it will start filling out those extra 200 empty indices of the array. So
say in each following step it increases to 1040, 1080, 1100, 1170. If at
the following step the adaptive mesh algorithm determines 1220 cells are
needed, then it will reallocate all arrays with 1420 cells. In this case
you would not find the issue you see. Now, just by chance, it could happen
that in that last step the adaptative mesh says 1200 cells are required. In
this case no reallocation will be made, and your array will have the exact
size given by s% nz. It is in this latter case that you run into your issue.

Cheers

On Mon, Jun 29, 2020 at 9:05 AM Ebrahim Hassani <ee.haji at gmail.com> wrote:

> Dear Dr. Marchant
>
> Thank you for the time you spent answering my questions.
>
> May I ask why star evolve until step 1650 (and when its age is about 10
> Giga Year) and after that, the error occurs?
>
> Is my question correct when I say: If my code is wrong the error must
> occur at the first step and before star starts to evolve.
>
> Cheers
>
> On Sun, Jun 28, 2020 at 11:03 PM Pablo Marchant <pamarca at gmail.com> wrote:
>
>> Hi Ebrahim, please keep mesa-users in your replies.
>>
>> as I mentioned you're accessing values beyond s% nz. Just from a quick
>> glance at your code I see this
>>
>>       do i = s% nz, 1, -1
>>       part3_he4 = part3_he4 + ((avogad * (s% rho(i)) &
>>       *(s% xa(s% net_iso(ihe4),i)) &
>>       / (At_he4))) * ((s% r(i))**2) * ((s% r(i)) - (s% r(i+1))) &
>>       * 1D0
>>       end do
>>
>> when i=s% nz you are reading s% r(s% nz+1) which is wrong. I assume
>> you're trying to compute an integral in radius here, for that you'll have
>> to treat the innermost cell in a special way.
>>
>> Cheers
>>
>> On Sun, Jun 28, 2020 at 7:51 PM Ebrahim Hassani <ee.haji at gmail.com>
>> wrote:
>>
>>> Dear Dr. Pablo
>>>
>>> Thank you so much for your useful guidance.
>>>
>>> The attached files are the "inlist_project" and the "run_star_extras.f"
>>> files that I edited and used in my work.
>>>
>>> I wonder why the star evolves until step 1650 and after that, the error
>>> will occur (why the error didn't occur in step 1).
>>>
>>> It is worth mentioning that I am using the 12778 version of MESA and the
>>> 20.3.1 version of MESA SDK in the ubuntu 2020 operating system.
>>>
>>> Best regards
>>>
>>> Ebrahim
>>>
>>>
>>>
>>> On Sun, Jun 28, 2020 at 2:26 PM Pablo Marchant <pamarca at gmail.com>
>>> wrote:
>>>
>>>> Hi Ebrahim,
>>>>
>>>> can't assess in detail your issue if you do not provide adequate
>>>> information to reproduce your problem. Please note the section "Post a
>>>> question to mesa-users" on the webpage to see what information needs to be
>>>> provided for others to assist you.
>>>>
>>>> As the error message indicates, you are trying to access an index of
>>>> the array beyond its size. You should verify that you do not access
>>>> anything beyond s% r(s% nz), which specifies the number of grid points in
>>>> the mesh. Note that the array might have elements beyond s% nz, this is
>>>> solely because the arrays are allocated with extra space such that each
>>>> remeshing action that increases the number of grid points does not need
>>>> another allocation. But anything beyond s% nz should not be used. Beware
>>>> that you running into this error might be an indication that you are not
>>>> accessing the physical point you want in your star, but again, absent
>>>> proper information we cannot assess if this is the case.
>>>>
>>>> Cheers
>>>>
>>>> On Sun, Jun 28, 2020 at 10:36 AM Ebrahim Hassani via Mesa-users <
>>>> mesa-users at lists.mesastar.org> wrote:
>>>>
>>>>> Dear Mesa-users
>>>>>
>>>>> I edited "run_star_extras.f" file and used "s%r" parameter in my work.
>>>>> Everything is right and my code (for one solar mass star) works correctly.
>>>>> But after about 1650 steps I encountered with the below error:
>>>>>
>>>>> At line 327 of file ../src/run_star_extras.f
>>>>> Fortran runtime error: Index '1524' of dimension 1 of array 's%r'
>>>>> above upper bound of 1523
>>>>>
>>>>> If I want to evolve the star more than 1650 steps what I must to?
>>>>> Does the error has physical interpretation?
>>>>>
>>>>> Best Regards
>>>>>
>>>>> Ebrahim Hassani
>>>>> _______________________________________________
>>>>> mesa-users at lists.mesastar.org
>>>>> https://lists.mesastar.org/mailman/listinfo/mesa-users
>>>>>
>>>>>
>>>>
>>>> --
>>>> Pablo Marchant Campos
>>>> M.Sc on Astrophysics, Universidad Católica de Chile
>>>> PhD on Astrophysics, Argelander-Institut für Astronomie, Universität
>>>> Bonn
>>>>
>>>
>>
>> --
>> Pablo Marchant Campos
>> M.Sc on Astrophysics, Universidad Católica de Chile
>> PhD on Astrophysics, Argelander-Institut für Astronomie, Universität Bonn
>>
>

-- 
Pablo Marchant Campos
M.Sc on Astrophysics, Universidad Católica de Chile
PhD on Astrophysics, Argelander-Institut für Astronomie, Universität Bonn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20200629/d62d2479/attachment.htm>


More information about the Mesa-users mailing list