[mesa-users] other_mixing routine

Bill Paxton paxton at kitp.ucsb.edu
Mon Jun 3 13:47:22 EDT 2013


[mesa-users: I've cc'd you just for the record.  The question is how to adjust gradT in overshooting regions.
my 1st answer was to use the adjust_mlt_gradT_fraction -- but that doesn't work, as Diego found when he tried it.
The actual solution has required adding 2 new routines to the star_lib interface as described below.]



Hi Diego,

Now I see the problem!  The order of execution in the code is 1) MLT, 2) overshooting, 3) other_mixing.
The 'adjust_mlt_gradT_fraction' array is used by the MLT routine and that routine has to run before overshooting is added.
Your other_mixing routine needs to see which zones have overshooting, so it has to run after the overshooting routine.
So we can't do this by simply setting adjust_mlt_gradT_fraction in other_mixing -- that happens too late to have an effect.

I've added 2 routines to star_lib and made a new private release of mesa for you to deal with this.
Once you get version 5038 installed, you can rewrite your other_mixing routine like this:

instead of doing
	s% adjust_mlt_gradT_fraction(k)=f
do this
	call star_adjust_gradT_fraction(id, k, f)
	call star_adjust_gradT_excess(id, k)

those routines are defined in star_lib, so change
         use star_lib, only: star_ptr
to
         use star_lib, only: star_ptr, star_adjust_gradT_fraction, star_adjust_gradT_excess

Let me know how it goes!

Cheers,
Bill







On Jun 3, 2013, at 1:40 AM, Diego Bossini wrote:

> Hi,
> please find attached my work directory. 
> My routine is on the end of the file run_star_extras.f
> 
> thanks
> Diego
> 
> 
> 2013/5/31 Bill Paxton <paxton at kitp.ucsb.edu>
> Okay --- next step is for me to reproduce that behavior.
> so please send me what I need to do that.  
> inlists, run_star_extras, starting model (if needed)
> 
> -Bill
> 
> 
> 
> 
> On May 31, 2013, at 6:09 AM, Diego Bossini wrote:
> 
>> Dear Bill,
>> 
>> Thanks for reply so fast
>> 
>> I added the lines as you told me.
>> 
>> This is the last lines of the output
>> 
>> > All this and more are saved in the LOGS directory during the run.
>> > STOP STOP STOP failed to find 0d0 for adjust_mlt_gradT_fraction(k /= nz)STOP failed to find 0d0 for adjust_mlt_gradT_fraction(k /= nz)
>> > failed to find 0d0 for adjust_mlt_gradT_fraction(k /= nz)
>> > failed to find 0d0 for adjust_mlt_gradT_fraction(k /= nz)
>> >
>> > ven 31 mag 2013, 10.54.31, BST
>> 
>> Since I put a flag when my routine runs, I know that in this case the program stops before.
>> 
>> For what I can see, the program runs in order:
>> -numerous times do1_mlt 
>> -my routine
>> -numerous times do1_mlt 
>> -my routine
>> 
>> Regards,
>> Diego
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 2013/5/30 Bill Paxton <paxton at kitp.ucsb.edu>
>> 
>> On May 30, 2013, at 10:21 AM, Diego Bossini wrote:
>> 
>> > Dear Bill,
>> > I'm Diego Bossini, a PhD student working with Andrea Miglio.
>> > I'm trying to force 'gradT=grada' in the overshooting region.
>> > I followed your instructions step by step ... but without success.
>> 
>> Hi Diego,
>> 
>> before exploring alternatives, let's understand exactly why this didn't work as expected.
>> 
>> please add some debugging output to see what is going on.
>> 
>> as a simple test, change your other_mixing routine to set adjust_mlt_gradT_fraction
>> to one for k=s% nz and zero elsewhere.   add a write statement in the routine to say
>> it has done this.
>> 
>> edit star/private/mlt_info to add a check to see what it is doing.
>> 
>> old:
>>          f = s% adjust_mlt_gradT_fraction(k)
>> 
>> new:
>>          f = s% adjust_mlt_gradT_fraction(k)
>>          if (k == s% nz .and. f /= 1d0) stop 'failed to find 1d0 for adjust_mlt_gradT_fraction(k == nz)'
>>          if (k /= s% nz .and. f /= 0d0) stop 'failed to find 0d0 for adjust_mlt_gradT_fraction(k /= nz)'
>> 
>> rebuild mesa/star with this edit
>> cd star/test
>> ./mk
>> ./export
>> 
>> recompile and rerun your test.  what happens?  does your change to adjust_mlt_gradT_fraction work?
>> 
>> once we have an answer for that, we can go to the next step.
>> 
>> -b
>> 
>> 
>> 
>> 
>> 
>> 
>> > My routine changes 'adjust_mlt_gradT_fraction' for each zone correctly but does not change 'gradT'
>> > (as I can see from the output, I added an extra column for 'adjust_mlt_gradT_fraction' ).
>> >
>> > It seems like it does not run the appropriate subroutine after my other_mixing routine.
>> >
>> >
>> > I found an alternative solution but I do not know if it is correct:
>> >
>> > After a little research in the mesa scripts, I found the subrouine 'do1_mlt' in star/private/mlt_info.f'.
>> > Thus I copied the corresponding binary file from 'star/make/' in 'src/' folder and I called 'do1_mlt' in my routine.
>> > It seems to work now and it also changes other variables, like the brunt-vaisala frequency.
>> >
>> > Is this procedure correct? does it change all the model structure consistently?
>> >
>> > Thanks
>> >
>> > Diego.
>> >
>> >
>> > (here is my routine)
>> >
>> >       subroutine grada_overshooting_mixing(id, ierr)
>> >          use mlt_def
>> >          use star_lib, only: star_ptr
>> >          use mlt_info, only: do1_mlt
>> >          integer, intent(in) :: id
>> >          integer, intent(out) :: ierr
>> >          type (star_info), pointer :: s
>> >          integer :: k
>> >          real ::f
>> >
>> >          call star_ptr(id, s, ierr)
>> >          f=0.9999
>> >          do k=1,s% nz
>> >                if (s% mixing_type(k)==overshoot_mixing) then
>> >                   s% adjust_mlt_gradT_fraction(k)=f
>> >                end if
>> >                call do1_mlt(s,k,s% mixing_length_alpha,ierr)
>> >           end do
>> >       end subroutine grada_overshooting_mixing
>> 
>> 
> 
> 
> <grada_othermix.tar.gz>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20130603/4e0b2a7f/attachment.html>


More information about the Mesa-users mailing list