[mesa-users] A crude fix for ~1.5Msun pre-MS models with T(tau) atmospheres

Choi, Jieun jieun.choi at cfa.harvard.edu
Thu Aug 18 15:09:43 EDT 2016

Hi Warrick,

I ran into similar problems with photosphere- and tau100-tables in the past
and took the same approach as you. But instead of modifying the code, why
not use run_star_extras.f?

In extras_finish_step,

!     set BC: change to tables after running on simple photosphere
      if (s% model_number == 100) then
         write(*,*) 'switching from simple photosphere to ', s% job%
         s% which_atm_option = s% job% extras_cpar(1)

where I set extras_cpar(1) to photosphere or tau100 tables in the inlist
depending on the mass of my model. I change after 100 steps but of course
you can pick whatever you want.

Hope this helps!

On Thu, Aug 18, 2016 at 1:19 AM, Warrick Ball <
wball at astro.physik.uni-goettingen.de> wrote:

> Hi all,
> In a previous thread, I raised an issue with pre-main-sequence (PMS)
> models around 1.4 to 2.0 solar masses sometimes being slow to converge when
> using an integrated T(tau) relation.  Note that this isn't a bug: no code
> is malfunctioning and it's possible to work around it by converging a
> working PMS model before continuing.  If anything, it's just me asking too
> much of the PMS model builder!
> https://sourceforge.net/p/mesa/mailman/message/34522484/
> To make sure we're all on the same page, I've attached an inlist for r8845
> that fails to converge a PMS model.  Once the PMS model starts relaxing, it
> tries to reduce the timestep too far and halts once it reaches the lower
> limit.  If I comment the line with which_atm_option = ..., the model runs
> with no problem (although the first relaxation step does seem to take a
> long time).
> I came back to this problem recently and decided to try to work around it
> from a new angle.  If the PMS models work without T(tau) atmospheres, why
> not start there and add the atmosphere later?  Coding this approach, I
> followed the calls to the model builder in star/private/init.f90.  The
> layout of the subroutine "model_builder" is pretty straightforward.  I made
> a few changes so that, when using "build_pre_ms_model", MESA first sets
> which_atm_option to 'simple_photosphere', does one relaxation step, then
> changes which_atm_option back to whatever the user chose in the inlist.  So
> far this seems to work but I'm testing it more thoroughly as I write this.
> In terms of code, I've also attached the modifications to init.f90 that
> seem to work.  I know Bill doesn't like us messing with the main codebase.
> I didn't see an appropriate hook to create my own initial models.  Did I
> just miss it, or could one be added?  The code changes are summarized by
> this diff:
> $ diff 8845_pre_ms_fix/star/private/init.f90 8845/star/private/init.f90
> 1097d1096
> <          character (len=strlen) :: which_atm_option
> 1249,1251d1247
> <             which_atm_option = s% which_atm_option
> <             s% which_atm_option = 'simple_photosphere'
> <
> 1271,1280d1266
> <
> <             call do_relax_num_steps( &
> <                s% id, 1, s% dt_next, ierr)
> <             if (ierr /= 0) then
> <                write(*,*) 'failed in do_relax_num_steps'
> <                return
> <             end if
> <
> <             s% which_atm_option = which_atm_option
> <
> 1282c1268
> <                s% id, s% pre_ms_relax_num_steps - 1, s% dt_next, ierr)
> ---
>>                s% id, s% pre_ms_relax_num_steps, s% dt_next, ierr)
> There may be better ways of approaching this problem but in my naive
> approach, I figured we're going to relax the model anyway, so it's no worse
> to do one step with a different atmosphere model before allowing the model
> to relax with the desired one.  If I have more time, I'll look at the
> detailed debug output to see if I can narrow down the troublesome regions.
> Cheers,
> Warrick
> ------------
> Warrick Ball
> Postdoc, Institut für Astrophysik Göttingen
> wball at astro.physik.uni-goettingen.de
> +49 (0) 551 39 5069
> ------------------------------------------------------------
> ------------------
> _______________________________________________
> mesa-users mailing list
> mesa-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mesa-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20160818/aeb8a414/attachment.html>

More information about the Mesa-users mailing list