[mesa-users] Unexpected metallicity profiles, possibly caused by diffusion

Bill Paxton paxton at kitp.ucsb.edu
Thu Oct 2 11:33:57 EDT 2014

Hi Warrick,

Good work.  But one important correction to your comments about the control 'diffusion_calculates_ionization'.  Perhaps I could have come up better name, and, unfortunately, an incorrect comment was added to controls.defaults recently.  In the old days, there was no comment, so it couldn't be wrong!  (That's my justification for not adding comments!)   So the new (incorrect) comment says "Include ionization in diffusion" when this flag is true.   Given the name of the control, this is a reasonable guess about what it might do.  But that guess is not correct.  If that was the intent, I might have named it "diffusion_uses_ionization" instead.  The name was meant to indicate whether or not diffusion calculates the ionization rather than whether or not it uses it. 

To get the true story, we need to go to the sources -- starting with grep in star/private.  That shows "diffusion_calculates_ionization" in ctrls_io.f and star_controls.inc (those are just to define it as a control) and in element_diffusion.f -- that's where the action is happening, so let's look there.  We find this

         if (.not. s% diffusion_calculates_ionization) then
            do j=1,nc
               typical_charge(j,1:nz) = s% diffusion_class_typical_charge(j)
            end do
         end if

So if diffusion_calculates_ionization is false, it is using a "typical charge" for all points rather than calculating the ionization for the local conditions. But what is "diffusion_class_typical_charge"?  It is another control.  Here's the info from controls.defaults:

         !### diffusion_class_typical_charge(:)

         ! Typical charges for use if `diffusion_calculates_ionization` is false
         ! Use charge 21 for Fe in the sun, from
         ! Thoul, Bahcall, and Loeb (1994), ApJ, 421, 828.

      diffusion_class_typical_charge(1) = 1
      diffusion_class_typical_charge(2) = 2
      diffusion_class_typical_charge(3) = 2
      diffusion_class_typical_charge(4) = 8
      diffusion_class_typical_charge(5) = 21

Those values are for the default set of diffusion classes that are also given in controls.defaults:

      diffusion_class_representative(1) = 'h1'
      diffusion_class_representative(2) = 'he3'
      diffusion_class_representative(3) = 'he4'
      diffusion_class_representative(4) = 'o16'
      diffusion_class_representative(5) = 'fe56'

So ----- you always are using ionization with diffusion.  Even when you set diffusion_calculates_ionization to false.   The difference is only in how the ionization values are determined: are they calculated for the local points, or are they the default values independent of local conditions.  If you decide to set diffusion_calculates_ionization to false, then you need to make sure you have appropriate values for diffusion_class_typical_charge.

The lesson of the story is, of course, never read the documentation.  The corollary is never write documentation.  ;D
If you want to know how it works, read the code.  

But some might object to my conclusion -- so perhaps instead it should be don't believe everything you read in the documentation.  Unlike the code, there is no test_suite for the documentation to make sure it is up to date and correct.  So the chance of bugs in the documentation is much higher than in the code.  

btw: how about editing the documentation for this in controls.defaults and sending me your changes so they can go into the next release?


On Oct 2, 2014, at 1:05 AM, Warrick Ball wrote:

> Okay, I think I resolved this one.  The bumps happen in increasingly heavy metals, most noticeable in Ne20 and Mg24.  So I tried setting
>      diffusion_calculates_ionization = .false. ! instead of .true.
> and the profiles are perfectly smooth.
> I should point out that the profiles are also *different*, as is the evolution.  For example, with ionization, TAMS happens at 6.21 Gyr.
> Without ionization, TAMS is at 6.51 Gyr: 5% later.  With ionization, Teff at TAMS is 5807 K; without ionization it's 5903 K.  At least part of this is because the diffusion speeds come out faster in the model with ionization.
> Cheers,
> Warrick
> On Wed, 1 Oct 2014, Warrick Ball wrote:
>> Hi all,
>> I've been looking more closely at the output of some models I've been fitting.  There was one case I looked at closely (for a different, but also interesting reason), and I found that the model has an unexpectedly bumpy the metallicity profile.  I've attached an appropriate inlist, and the results are taken from the final model of that run, at TAMS.  This is a somewhat metal rich star with M=1.17 Msun, Z=0.042, Y=0.3 and alpha=1.91.
>> I copied the diffusion parameters out of the solar calibration test case, but I think they're basically the same as the defaults anyway.
>> Note that this is a revision 6022.  Obviously, a first thing to try (downloading now!) is to check out the most recent release...
>> The plot shows metallicity Z as a function of logT for a series of models along the main sequence.  As you can see, around logT=6.5, there's a certain bumpiness to the profile.  I immediately suspected the diffusion was to blame, so I added in the diffusion velocities, plotted in the second file. There, I've plotted the magnitude of the diffusion velocity for O16 as a function of logT.  The diffusion is also bumpy, but I a closer look seems to show that this is in the convection zone where it'd be totally overwhelmed. The only structural feature that I think is of interest is the fact that this region is consistently just below the base of the outer convection zone, though I don't use overshooting or semiconvection.
>> Anyway, any help on what's going on and what I'm doing wrong here would be greatly appreciated.  Or, advice on why this effect is real.
>> Cheers,
>> Warrick
>> ------------
>> Warrick Ball
>> Postdoc, Institut für Astrophysik Göttingen
>> wball at astro.physik.uni-goettingen.de
>> +49 (0) 551 39 5069
> ------------
> Warrick Ball
> Postdoc, Institut für Astrophysik Göttingen
> wball at astro.physik.uni-goettingen.de
> +49 (0) 551 39 5069------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
> mesa-users mailing list
> mesa-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mesa-users

More information about the Mesa-users mailing list