# [Mesa-users] Help regarding custom mesa run

ABHIJNAN KAR 20064 abhijnank20 at iiserbpr.ac.in
Wed Dec 28 12:19:06 UTC 2022

Dear Pablo,
Yeah, we want to do that sort of thing, as you mentioned in the reply.Basically, when mass is accreted, the accreted rest mass is considered to be the gravitational one.But according to https://doi.org/10.1111/j.1745-3933.2011.01030.x & http://dx.doi.org/10.3847/1538-4357/835/1/4  the accreted rest mass is the baryonic one(when we consider binding energy too).So, one needs to convert the total accreted mass(which is delM_baryonic) into the gravitational one in order to properly calculate.
What we want to do is to convert the usual mtransfer_rate of mesa to gravitational mass transfer rate, because total accreted rest mass consists of binding energy too ,acc to mentioned paper.
So we want to take the mtranmsfer_rate into a formula and take the output as the modified mass transfer rate on basis of which other parameters will change.For example, I tried to write a subroutine which is attached below:
￼

> On 28-Dec-2022, at 4:59 PM, Pablo Marchant <pamarca at gmail.com> wrote:
>
> Dear Abhijnan, Pulkit,
>
> If I understand what you're trying to do, essentially you have a relationship between the gravitational and baryonic mass of the neutron star
> M_G = M_G(M_B)
> such that as the neutron star accretes, you want its gravitational mass (which is what the binary modules takes as the mass) to change according to
> \dot{M}_G = (d M_G/d M_B) \dot{M}_B
> where \dot{M}_B would be more or less the mass transfer rate that is given by MESA. Is this what you're trying to do?
>
> In such a case, this can be achieved using the option use_this_for_mdot_edd_eta. This was mostly made for black hole accretors that are expected to radiate a significant fraction \eta of the accreted materials rest mass energy. From the documentation (https://docs.mesastar.org/en/release-r22.11.1/reference/binary_controls.html#use-radiation-corrected-transfer-rate), we have that with the option use-radiation-corrected-transfer-rate the mass of the point mass changes as (you can ignore the BH notation in the docs, MESA does not know what is the nature of the point mass)
> delta_Mbh = (1-eta)*mass_transfer_rate*dt
> By default MESA will compute eta assuming a BH accretor, but in your case you could set it explicitly. If I understood what you're doing, then you just need to set
> eta = 1 - (d M_G/d M_B)
> you can set the value of this option during each step of a run using run_binary_extras, with the extras_binary_start_step subroutine.
>
> Cheers
>
> On Mon, Dec 26, 2022 at 4:57 PM Francis Timmes via Mesa-users <mesa-users at lists.mesastar.org <mailto:mesa-users at lists.mesastar.org>> wrote:
>> > 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 <mailto: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 <mailto: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 <mailto: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 <mailto: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 <mailto: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 <mailto: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 <mailto: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 <mailto: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 <mailto: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 <mailto: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 <mailto:mesa-users at lists.mesastar.org>
>> > https://lists.mesastar.org/mailman/listinfo/mesa-users
>> >
>> > _______________________________________________
>> > mesa-users at lists.mesastar.org <mailto:mesa-users at lists.mesastar.org>
>> > https://lists.mesastar.org/mailman/listinfo/mesa-users
>> >
>>
>> _______________________________________________
>> mesa-users at lists.mesastar.org <mailto: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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20221228/9da62620/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...