magnus.solarmodels

solarmodels.py

Standard solar models, tabulated by their authors, as profiles along a radial path.

The osc_prob_*_sun* wrappers describe the Sun by an exponential fit to its electron density unless told otherwise. Twelve published standard solar models ship with the package, and naming one through density_profile puts that model’s profile in its place: the electron density, from the tabulated mass density and hydrogen mass fraction, and, for the wrappers with sterile states, the neutron-to-proton ratio at every radius.

Name

Model

'BP2000'

Bahcall, Pinsonneault & Basu (2001)

'BP04'

Bahcall & Pinsonneault (2004)

'BS05-OP'

Bahcall, Serenelli & Basu (2005), GS98 composition

'BS05-AGS-OP'

Bahcall, Serenelli & Basu (2005), AGS05 composition

'B16-GS98'

Vinyoles et al. (2017), GS98 composition

'B16-AGSS09met'

Vinyoles et al. (2017), AGSS09met composition

'B23-GS98'

Herrera & Serenelli (2023), GS98 composition

'B23-AGSS09'

Herrera & Serenelli (2023), AGSS09 composition

'B23-C11'

Herrera & Serenelli (2023), C11 composition

'B23-AAG21'

Herrera & Serenelli (2023), AAG21 composition

'B23-MB22m'

Herrera & Serenelli (2023), MB22 meteoritic composition

'B23-MB22p'

Herrera & Serenelli (2023), MB22 photospheric composition

Names are matched without regard to case. solar_model_info() gives each model’s full reference, the source it was taken from, the date, its terms of use, and the radial range it covers; the tables themselves, in magnus/data/solar_models/, carry the same in their headers, together with the authors’ original header. They hold three columns of the original – radius, mass density and hydrogen mass fraction – copied as written.

Outside the table. Only the B23 tables start at the centre; the others begin between 0.0005 and 0.0065 \(R_\odot\). Some stop well short of the surface: BP2000 and BP04 end at 0.95 \(R_\odot\), the BS05 models at 0.98. Below the first row the density is held at its first value, since the core is flat. Past the last row it continues along the logarithmic slope of the last tabulated interval, so that it keeps falling rather than stopping at a constant or dropping to zero. That is a continuation, not a model of the solar atmosphere: from 0.95 \(R_\odot\) it reaches about \(1.6 \times 10^{-3}\) g cm-3 at the surface, where the B16 and B23 models, which are tabulated there, give \(1.7 \times 10^{-7}\). The wrappers’ stop_at_table_edge refuses a probability past the last row instead. The composition is held at its first and last tabulated values.

Between rows. The density is interpolated linearly in its logarithm, so the profile has a kink at every row, and the Bahcall tables, printed to four significant figures, step through the flat core. Phase-averaged probabilities do not notice. A coherent probability over most of the Sun can: the hybrid engine may then not certify it and hand it to the slab ladder, which warns when it runs out of slabs. The rows are where to put t_breakpoints (see Standard solar models).

Routine listings

  • available_solar_models - The names of the models that ship with the package

  • canonical_name - A model’s name as the package spells it

  • solar_model_info - Reference, source, terms and radial range of one model

  • load_solar_model - The tabulated radius, mass density and hydrogen fraction of one model

  • table_edge - Distance from the centre of the last tabulated radius

  • electron_density_profile - Electron number density along a radial path

  • neutron_to_proton_ratio_profile - Neutron-to-proton ratio along a radial path

Added in version 1.1.1.

Attributes

EXPONENTIAL

The density_profile value that selects the exponential fit to the Sun's electron

SOLAR_MODELS

The standard solar models that ship with the package, oldest first.

Functions

available_solar_models(→ Tuple[str, ...])

The names of the standard solar models that ship with the package.

canonical_name(→ str)

A solar model's name as the package spells it; the match ignores case.

load_solar_model(→ Dict[str, numpy.ndarray])

The tabulated radius, mass density and hydrogen mass fraction of one standard solar model.

solar_model_info(→ Dict[str, object])

Reference, source, terms of use and radial range of one standard solar model.

table_edge(→ float)

Distance from the centre of the Sun to a model's last tabulated radius.

electron_density_profile(→ Callable)

Electron number density of a standard solar model along a radial path.

neutron_to_proton_ratio_profile(→ Callable)

Neutron-to-proton ratio of a standard solar model along a radial path.

Module Contents

magnus.solarmodels.EXPONENTIAL = 'exp'[source]

The density_profile value that selects the exponential fit to the Sun’s electron density, which is the default of every Sun wrapper.

Added in version 1.1.1.

Type:

str

magnus.solarmodels.SOLAR_MODELS = ('BP2000', 'BP04', 'BS05-OP', 'BS05-AGS-OP', 'B16-GS98', 'B16-AGSS09met', 'B23-GS98',...[source]

The standard solar models that ship with the package, oldest first.

Added in version 1.1.1.

Type:

tuple of str

magnus.solarmodels.available_solar_models() → Tuple[str, ...][source]

The names of the standard solar models that ship with the package.

Added in version 1.1.1.

Returns:

The names accepted by density_profile, oldest model first.

Return type:

tuple of str

Examples

from magnus import solarmodels

print(solarmodels.available_solar_models())
('BP2000', 'BP04', 'BS05-OP', 'BS05-AGS-OP', 'B16-GS98', 'B16-AGSS09met', 'B23-GS98', 'B23-AGSS09', 'B23-C11', 'B23-AAG21', 'B23-MB22m', 'B23-MB22p')
magnus.solarmodels.canonical_name(name: str) → str[source]

A solar model’s name as the package spells it; the match ignores case.

Added in version 1.1.1.

Parameters:

name (str) – A model name, in any case, such as 'b16-gs98'.

Returns:

The name as listed in SOLAR_MODELS.

Return type:

str

Raises:

ValueError – If the name is not one of the shipped models; the message lists them.

magnus.solarmodels.load_solar_model(name: str) → Dict[str, numpy.ndarray][source]

The tabulated radius, mass density and hydrogen mass fraction of one standard solar model.

Added in version 1.1.1.

Parameters:

name (str) – One of SOLAR_MODELS, in any case.

Returns:

'r_over_r_sun', the radius in units of the solar radius; 'rho_g_per_cm3', the mass density in g cm-3; and 'x_hydrogen', the hydrogen mass fraction. Each is an array with one entry per tabulated row, the radius strictly increasing. Where the authors tabulate the logarithm of the density, it is exponentiated here.

Return type:

dict

magnus.solarmodels.solar_model_info(name: str) → Dict[str, object][source]

Reference, source, terms of use and radial range of one standard solar model.

Added in version 1.1.1.

Parameters:

name (str) – One of SOLAR_MODELS, in any case.

Returns:

'name'; 'reference', the paper or data release to cite; 'source', where the table was taken from; 'original', the file it was taken from; 'retrieved'; 'sha256' of that original file; 'terms', the authors’ terms of use; 'rows'; and 'r_min' and 'r_max', the first and last tabulated radius in units of the solar radius.

Return type:

dict

Examples

from magnus import solarmodels

info = solarmodels.solar_model_info('B16-GS98')
print(info['reference'])
print('tabulated from %.4f to %.4f R_sun' % (info['r_min'], info['r_max']))
N. Vinyoles, A. M. Serenelli, F. L. Villante, S. Basu, J. Bergström, M. C. Gonzalez-Garcia, M. Maltoni, C. Peña-Garay and N. Song, "A new generation of standard solar models", ApJ 835, 202 (2017), doi:10.3847/1538-4357/835/2/202, arXiv:1611.09867
tabulated from 0.0005 to 1.0000 R_sun
magnus.solarmodels.table_edge(name: str) → float[source]

Distance from the centre of the Sun to a model’s last tabulated radius.

Added in version 1.1.1.

Parameters:

name (str) – One of SOLAR_MODELS, in any case.

Returns:

The distance [\(\text{eV}^{-1}\)], in the units of the wrappers’ L.

Return type:

float

magnus.solarmodels.electron_density_profile(name: str) → Callable[source]

Electron number density of a standard solar model along a radial path.

The density is \(n_e = \rho\,(1 + X)/(2 m_N)\), the hydrogen mass fraction \(X\) counting one electron per nucleon and everything heavier one per two, with \(m_N\) the mean nucleon mass. It is interpolated linearly in \(\ln n_e\). Below the first tabulated radius it holds its first value; past the last, it continues along the logarithmic slope of the last interval (see the module notes).

Added in version 1.1.1.

Parameters:

name (str) – One of SOLAR_MODELS, in any case.

Returns:

n_e(l), with l the distance from the centre [\(\text{eV}^{-1}\)], scalar or array, returning the number density in the package’s natural units – the form the wrappers take with density_is_of_number_of_electrons=True.

Return type:

Callable

Examples

import magnus.globaldefs as gd
from magnus import solarmodels

ne = solarmodels.electron_density_profile('B16-GS98')
per_cm3 = gd.N_AV*gd.UNIT_PER_CM3
for r in (0.0, 0.5, 0.9):
    print('r = %.1f R_sun: n_e = %6.2f N_A per cm^3'
          % (r, ne(r*gd.SUN_RADIUS*gd.UNIT_KM)/per_cm3))
r = 0.0 R_sun: n_e = 100.75 N_A per cm^3
r = 0.5 R_sun: n_e =   1.15 N_A per cm^3
r = 0.9 R_sun: n_e =   0.02 N_A per cm^3
magnus.solarmodels.neutron_to_proton_ratio_profile(name: str) → Callable[source]

Neutron-to-proton ratio of a standard solar model along a radial path.

With the hydrogen mass fraction \(X\) and everything heavier holding as many neutrons as protons, \(n_n/n_p = (1 - X)/(1 + X)\), the ratio the sterile states’ matter term needs; it is the \((1 - Y_e)/Y_e\) of the Earth’s layers, with \(Y_e = (1 + X)/2\). \(X\) is interpolated linearly, and held at its first and last tabulated values outside the table.

Added in version 1.1.1.

Parameters:

name (str) – One of SOLAR_MODELS, in any case.

Returns:

r(l), with l the distance from the centre [\(\text{eV}^{-1}\)], scalar or array.

Return type:

Callable