[mesa-users] [Mesa-testing] a couple ways to get wd_cool_0.6M to "work"

Bill Paxton paxton at kitp.ucsb.edu
Fri Nov 29 14:01:26 EST 2013


On Nov 28, 2013, at 10:51 PM, Dean Townsley wrote:

> Just to give a brief intro, the basic issue I am working with is related to the crystallization in the WD core and the latent heat involved.  Bill has tried to allow Mesa/star to treat the latent heat by using an explicitly differenced entropy form for the local energy absorbed/released by the fluid (aka eps_grav).  There is a discontinuity in the entropy at the liquid/solid transition, and this T\Delta S corresponds to the latent heat.  But I think the basic issue is that the numerics just does not like the discontinuity, at least the way it is being treated.

> --------------[section deleted]--------------

> I think that this is a genuine problem in integrating through the crystallization that probably will require some work to make right.  I am concerned that even some of the cases that "worked" here would not hold up if the timestep were reduced with some restrictions in, for example, a convergence test. 


Hi Dean,

As a side-effect of working to get cross-platform reproducibility, I managed to get wd_cool_0.6M to fail on my Mac OS X 10.6.8.  Great progress!  Turns out that rare tiny differences in math routines made my old 10.6.8 miss the nasty problem that kills 10.8.5.  The trap is what you describe -- a cell that happens to hit very close to the transition point for liquid to solid.  Tiny differences in math that might have no impact on the results (no need for chaos here!) -- but cause the run to fail on one platform while it is okay on another.

After a lot of poking around I found that the problem came from an inability to solve for lnT in a single cell -- on each newton iteration the value of lnT would oscillate back and forth between two values, and the size of the oscillation was large enough that it exceeded the limit for max corrections allowed for newton convergence.  Everywhere else in the model things were well converged, but this one variable was flip-flopping.  You can guess why -- gamma for the cell was going back and forth from 165 to 175 or so.  The partial derivatives for lnT were confused by the phase transition so eps_grav and lnT were unable to decide on a solution.  

I tried a bunch of tricks to dance around the problem, but as you suggest, that's not a good solution.

Finally I decided to go into the code for a fix -- if a cell starts the step with a gamma near 170, then I don't include that cell when calculating size of corrections to lnT.  That way it won't kill the convergence by flip-flopping when everything else is okay, and it doesn't seem to have a bad effect overall since ultimately we don't care which option it selects (liquid or solid) when it is very near the transition.

This will be in the next release --- if you'd like to try it now, it is a simple patch to star/private/hydro_newton_procs in the sizeB routine.

OLD
                  if (j > nvar_hydro) then
                     if (s% xa_pre(j-nvar_hydro,k) < x_limit) cycle
                  end if
                  num_terms = num_terms + 1
                  abs_corr = abs(B(j,k))


NEW
                  if (j > nvar_hydro) then
                     if (s% xa_pre(j-nvar_hydro,k) < x_limit) cycle
                  end if
                  
                  if (j == s% i_lnT .and. abs(s% gam_start(k) - 170) < 20) cycle 
                  ! when going from liquid to solid, have trouble converging
                  ! e.g., can jump back and forth from gam = 165ish to 175ish
                  ! for each newton iteration -- and that can cause lnT to jump around
                  ! leading to failure to converge.
                  
                  num_terms = num_terms + 1
                  abs_corr = abs(B(j,k))



For the release I'll make the "170" and "20" be control parameters.

Let me know!

Cheers,
Bill







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20131129/1a88f514/attachment.html>


More information about the Mesa-users mailing list