[Mesa-users] MESA EOS

Natasha Ivanova nata.ivanova at ualberta.ca
Tue May 12 00:28:09 UTC 2026


Dear MESA community,

I am trying to invert the MESA EOS so that I can use it as a function of
(\rho) and (u) to recover (T). In principle, writing the inversion is
straightforward: for a given (\rho), I scan or solve for the temperature
such that the MESA EOS returns the requested internal energy. I
used mesa-r24031.


However, I am seeing behaviour in the MESA EOS output that I do not
understand. It appears to occur in regions where the EOS blending may be
problematic. I attach a plot of the recovered (T(\rho,u)) distribution for
a solar mixture. The strange behaviour is seen near the upper-left part of
the recovered map, where large white regions appear.

A concrete example is at

logRho = 3.d0
rho = 10.d0**logRho

For several different values of logT, MESA returns nearly the same
value of logU
= log10(u). This happens below about logT = 5.5. Eventually, near logT ~ 3,
MESA stops returning valid EOS values, which is understandable if that
region is outside the guaranteed EOS coverage. However, the
near-independence of the returned internal energy on temperature before the
failure is very surprising to me.

The debug call was made as follows:

logRho = 3.d0
rho = 10.d0**logRho
logT = 3.5d0

call call_mesa_eos( &
   eos_handle, species, chem_id, net_iso, xa, &
   rho, logRho, logT, &
   res_debug, d_dlnd_debug, d_dlnT_debug, d_dxa_debug, logU, ierr_debug)

where my wrapper is

subroutine call_mesa_eos( &
   eos_handle, species, chem_id, net_iso, xa, &
   rho, logRho, logT, &
   res, d_dlnd, d_dlnT, d_dxa, logU, ierr)

   integer, intent(in) :: eos_handle, species
   integer, pointer :: chem_id(:), net_iso(:)
   real(dp), intent(in) :: xa(:)
   real(dp), intent(in) :: rho, logRho, logT
   real(dp), intent(inout) :: res(:), d_dlnd(:), d_dlnT(:), d_dxa(:,:)
   real(dp), intent(out) :: logU
   integer, intent(out) :: ierr

   real(dp) :: T

   T = 10.d0**logT

   res(:) = 0.d0
   d_dlnd(:) = 0.d0
   d_dlnT(:) = 0.d0
   d_dxa(:,:) = 0.d0

   call eosDT_get( &
      eos_handle, species, chem_id, net_iso, xa, &
      rho, logRho, T, logT, &
      res, d_dlnd, d_dlnT, d_dxa, ierr)

   if (ierr == 0) then
      logU = res(i_lnE)/log(10.d0)
   else
      logU = -99.d0
   endif

end subroutine call_mesa_eos

For a solar-mixture composition, I obtain the following examples.

DEBUG direct MESA EOS point
   input logRho =       3.000000
   input logT   =       3.500000
   ierr         =        0
   returned logU   =      14.9772256241
   returned mu     =       0.6168080185
   returned logP   =      17.8407943434
   returned logS   =      -0.2889342307
   dlnE/dlnT       =     1.90874374E-06

DEBUG direct MESA EOS point
   input logRho =       3.000000
   input logT   =       4.500000
   ierr         =        0
   returned logU   =      14.9782064784
   returned mu     =       0.6168080185
   returned logP   =      17.8413596406
   returned logS   =       0.2563797497
   dlnE/dlnT       =     4.04788813E-03

DEBUG direct MESA EOS point
   input logRho =       3.000000
   input logT   =       5.500000
   ierr         =        0
   returned logU   =      14.9946586586
   returned mu     =       0.6168080185
   returned logP   =      17.8545815407
   returned logS   =       0.7328325988
   dlnE/dlnT       =     4.11903470E-02

This is surprising because, using the ideal-gas estimate with the returned
fully ionized value of

mu = 0.6168080185

one would expect approximately

logT = 3.5 -> log u ≈ 11.806
logT = 4.5 -> log u ≈ 12.806
logT = 5.5 -> log u ≈ 13.806

Instead, MESA returns values close to

log u ≈ 14.98 - 14.99

and the derivative dlnE/dlnT is very small at the lower temperatures.

My questions are:

   1.

   Am I using eosDT_get correctly here?
   2.

   Is res(i_lnE) the correct quantity to interpret as the specific internal
   energy for inversion in ((\rho,u))?
   3.

   Is the nearly temperature-independent value of res(i_lnE) at logRho = 3
   expected because MESA includes a density-dependent cold/degeneracy/Coulomb
   contribution to the internal energy?
   4.

   If I need a thermally meaningful (u) for inversion, should I subtract a
   cold contribution, or is there another MESA EOS quantity or recommended
   procedure for this?
   5.

   How can I verify which EOS component, for example Skye, PC, FreeEOS,
   etc., is being used at these points?

Any advice on the correct way to obtain (T(\rho,u)) from the MESA EOS would
be very helpful.

thanks

Natasha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20260511/68aa41ff/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eos_logT_map.png
Type: image/png
Size: 52276 bytes
Desc: not available
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20260511/68aa41ff/attachment.png>


More information about the Mesa-users mailing list