# [Mesa-users] Help regarding custom mesa run

Francis Timmes fxt44 at mac.com
Mon Dec 26 15:56:51 UTC 2022

```> Also, we were wondering if there is a limit to the maximum number of steps apart from the physical conditions(which are eventually met) or some condition which sets such a limit?

there is not a limit that i am aware of:

https://docs.mesastar.org/en/release-r22.11.1/reference/controls.html#max-model-number

for example, i've run jobs that have exceed 2 million timesteps.

fxt

> On Dec 25, 2022, at 11:41 PM, Pulkit Ojha via Mesa-users <mesa-users at lists.mesastar.org> wrote:
>
> Dear mesa-users,
>
> I'm Pulkit, working on the same problem along with Abhignan. As Dr. Evan had suggested, we also came to the conclusion that we can just modify our subroutine in binary_extras to reach our target.  Our essential target is to modify a few of the calculated parameters before using that as input for the next step. For instance, if our parameter of interest is mass transfer rate and we need to take square/multiple (just for example) of the calculated rate as input for our next step. We can just write this as an extra line in the subroutine which calculates the mass transfer rate and instruct mesa to use this subroutine. We just need to confirm, should we proceed with this?
>
> Also, we were wondering if there is a limit to the maximum number of steps apart from the physical conditions(which are eventually met) or some condition which sets such a limit?
>
> Shall be grateful for your help.
>
> Truly yours
> Pulkit
>
>
> On Thu, Dec 22, 2022, 10:51 AM ABHIJNAN KAR 20064 <abhijnank20 at iiserbpr.ac.in> wrote:
> Hi,
> I want to read the variables 'dot_Mmt' or accreted mass from the MESA output in each step,then take it in a formula to adjust for the difference between gravitational mass and total accreted mass.After that, the adjusted mass will again be taken as input in the next MESA step.This should go on till the total run is completed.This was my preliminary plan .Also for the change in the mass, other variables will change too but at first I was thinking to implement so as to check whether the code is working correctly or not.I am trying to implement the code in binary_extras as pointed out by Evan.
>
>
>
> On Wed, 21 Dec 2022, 19:17 Pablo Marchant, <pamarca at gmail.com> wrote:
> Dear Abhijnan,
>
> it would be useful for you to be explicit about what variables you would be reading from the MESA model, and which input variables you would modify. When you were picturing doing this by stopping and rerunning a simulation, what was your precise plan? If you're still unfamiliar about binary modeling in general I would suggest you start up with a simpler example, such as the lab Evan points to, before doing more elaborate simulations.
>
>  Cheers
>
> On Tue, Dec 20, 2022 at 6:40 PM ABHIJNAN KAR 20064 <abhijnank20 at iiserbpr.ac.in> wrote:
> Hi Evan,
> Thanks for the response!
> Yeah, I am trying to do it with help of extras routine.
> However, I have one question in the custom code,for the output values of the desired variables/parameters at each step, should i write it like : call run_binary_extras(output variable, age_yr) ?
> will this give an array which will change its value with run?
> And at first I am declaring variables like
> real :: output1, new_input
>
>> On 20-Dec-2022, at 12:31 AM, Evan Bauer <evan.bauer.astro at gmail.com> wrote:
>>
>> Hi Abhijnan,
>>
>> Yes, it should be possible to do what you describe with run_binary_extras. If you aren't already familiar with using run_star_extras and run_binary_extras, here's the place to start learning in the documentation: https://docs.mesastar.org/en/release-r22.11.1/using_mesa/extending_mesa.html
>>
>> For run_binary_extras specifically, Pablo's lab from this year's summer school has a lot of great material that should help you get a sense of how to use it: https://orlox.github.io/mesa2022_hmxb/
>>
>> Cheers,
>> Evan
>>
>>> On Dec 15, 2022, at 11:50 AM, ABHIJNAN KAR 20064 <abhijnank20 at iiserbpr.ac.in> wrote:
>>>
>>> Hi Pablo,
>>> Thanks for the reply!I want to take the output values of MESA run at each step, employ those values in formulae to adjust for difference between gravitational mass and baryonic mass(assuming M acc= delM g is not full expression: Mon. Not. R. Astron. Soc. 413, L47–L50 (2011)), then take the output values of the formulae and use it in again in next step of MESA run.Like this the loop will go on. Now, is it possible without having a driver code for the whole process?(just from run_binary_extras).
>>>
>>>> On 15-Dec-2022, at 7:36 PM, Pablo Marchant <pamarca at gmail.com> wrote:
>>>>
>>>> Dear Abhijnan,
>>>>
>>>> to help you it would be useful to know more precisely what you're trying to do. In particular, what parameters do you need to change, and on what output values do these depend? The use case you describe sounds like something that can be achieved inside a single run using run_binary_extras (without the need to stop and reload simulations), but without further details it is hard to know.
>>>>
>>>> Best,
>>>>
>>>> Pablo
>>>>
>>>> On Wed, Dec 14, 2022 at 5:34 PM ABHIJNAN KAR 20064 <abhijnank20 at iiserbpr.ac.in> wrote:
>>>> Hi all,
>>>> I am currently working the recent mesa version in the field of binary evolution.I am trying to model a binary system consisting of neutron star and a donor star and its orbital parameter. However, what I want to do is that I want to stop the MESA at every step of run binary evolution run and take the output of each step, calculate those outputs in some other formulas regarding some parameters and again start the mesa with the output values from the formulas as input for next step and so on. Can anyone please help in the software aspect i.e how to stop the mesa at every step automatically and extract the output values to be used in some other formulae?
>>>> It would be extremely helpful!
>>>> Regards,
>>>> Abhijnan Kar(He/his/him)
>>>> BS-MS,IISER Berhampur
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>> Regards,
>>> Abhijnan Kar(He/his/him)
>>> BS-MS,IISER Berhampur
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> mesa-users at lists.mesastar.org
>>> https://lists.mesastar.org/mailman/listinfo/mesa-users
>>>
>>
>
> Regards,
> Abhijnan Kar(He/his/him)
> BS-MS,IISER Berhampur
>
>
>
>
>
>
>
>
> --
> Pablo Marchant Campos
> M.Sc on Astrophysics, Universidad Católica de Chile
> PhD on Astrophysics, Argelander-Institut für Astronomie, Universität Bonn
> _______________________________________________
> mesa-users at lists.mesastar.org
> https://lists.mesastar.org/mailman/listinfo/mesa-users
>
> _______________________________________________
> mesa-users at lists.mesastar.org
> https://lists.mesastar.org/mailman/listinfo/mesa-users
>

```