[Mesa-users] avg_charge in MESA

Farag, Ebraheem ebraheem.farag at yale.edu
Thu Feb 27 15:46:58 UTC 2025


Hello Jason,

Unfortunately, the EOS in MESA does not calculate ionization directly. In previous MESA versions, the ionization module existed which could  estimate the ionization fraction. Recently, the ionization module was resurrected and re-included in mesa-releases, but consider it still a developmental feature (fine for classrooms, but not ready for science).

I can't provide much more details except that in the past, something like the "avg_charge_H" was calculated through a call to the ionization module:

               avg_charge_H = get_ion_info(ion_iZ_H,k,chem_isos% Z(ih1))

Where "get_ion_info", is a wrapper for the ionization library:

---
         real(dp) function get_ion_info(id,k,Z)
            use ionization_lib, only: eval_ionization
            integer, intent(in) :: id, k, Z
            integer :: ierr
            ierr = 0
            if (ionization_k /= k) then
               call eval_ionization( &
                  s% Z(k), s% X(k), s% Rho(k), s% lnd(k)/ln10, &
                  s% T(k), s% lnT(k)/ln10, ionization_res, ierr)
               ionization_k = k
            end if
            if (ierr /= 0) then
               get_ion_info = Z
            else
               get_ion_info = ionization_res(id)
            end if
         end function get_ion_info
---

Feel free to try using this wrapper and calling the ionization module for the values you're interested in (for example, by adding this into your run_star_extras as an extra profile column).

I hope this is helpful.

-EbF


________________________________
From: Mesa-users <mesa-users-bounces at lists.mesastar.org> on behalf of Jason Wright via Mesa-users <mesa-users at lists.mesastar.org>
Sent: Thursday, February 27, 2025 10:11 AM
To: mesa-users <mesa-users at lists.mesastar.org>
Subject: [Mesa-users] avg_charge in MESA

Hi, all!  I'm once again using MESA to teach stellar structure and I've run into some curiosities and problems from my assignments four years ago.

The first is that a few output parameters I was relying on seem to have disappeared.  I was using the profile outputs

avg_charge [isotope]

but this no longer seems to be an allowed output.  The reason I want this number is to calculate the Coulomb pressure as part of an assignment to explore the EOS used by MESA.

Is there a way I can access these values? I tried the advertised profile outputs:

typical_charge [isotope]

but they are all zero.

Thanks,

--
                                                -
---------------
Jason T Wright
Professor of Astronomy and Astrophysics
Director, Penn State Extraterrestrial Intelligence Center
he/him/his
https://sites.psu.edu/astrowright/
https://bsky.app/profile/astrowright.bsky.social
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20250227/24b8a6ef/attachment.htm>


More information about the Mesa-users mailing list