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

Warrick Ball wball at astro.physik.uni-goettingen.de
Thu Aug 18 04:19:50 EDT 2016

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!


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
<          character (len=strlen) :: which_atm_option
<             which_atm_option = s% which_atm_option
<             s% which_atm_option = 'simple_photosphere'
<             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
<                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 


Warrick Ball
Postdoc, Institut für Astrophysik Göttingen
wball at astro.physik.uni-goettingen.de
+49 (0) 551 39 5069
-------------- next part --------------
! reproduce non-convergent pre MS model (Warrick Ball 2016-08-18)


  ! begin with a pre-main sequence model
    create_pre_main_sequence_model = .true.
    pre_ms_T_c = 8.5d5 ! slow with 8.5d5

  ! display on-screen plots
    pgstar_flag = .false.

/ !end of star_job namelist


  ! starting specifications
    initial_mass = 1.75 ! in Msun units ! slow with 1.65
    which_atm_option = 'Eddington_grey' ! slow with any T(tau), esp. Eddington_grey

    initial_Y = 0.28 ! slow with 0.28
    initial_Z = 0.02 ! slow with 0.02

    max_model_number = 100

/ ! end of controls namelist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init.f90
Type: text/x-fortran
Size: 46438 bytes
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20160818/1638e41e/attachment.bin>

More information about the Mesa-users mailing list