Stellar models#

class mascaret.StellarModel(logs_dir=None, num_profile=None, filename=None, interpolation=None, preserve_original_datapoints=True, kind='linear', remove_atmosphere=False, add_kappa_rad=False, add_micro_viscosity=False, rot_solar_rate=0, vanishing_rotation=False, convective_neutral=True, add_centre=True)#

Class containing profiles and information read and computed from an input MESA model.

__init__(logs_dir=None, num_profile=None, filename=None, interpolation=None, preserve_original_datapoints=True, kind='linear', remove_atmosphere=False, add_kappa_rad=False, add_micro_viscosity=False, rot_solar_rate=0, vanishing_rotation=False, convective_neutral=True, add_centre=True)#

Initialise a StellarModel object, including necessary quantities to compute mode eigenfunctions. Either filename should be provided, or both logs_dir and num_profile. The MESA computed profiles should include the following quantities: R, Rho, mass, g, brunt_N2, T, P, csound. If add_micro_viscosity is set to True, x_mass_fraction_H should also be included. If add_kappa_rad is set to True, cp and opacity should also be included.

Parameters:
  • logs_dir (str or Path) – Directory with MESA logs. Optional, default None.

  • num_profile (int) – Profile index in logs_dir. Optional, default None.

  • filename (str or Path object) – Filename of the profile. Will be used instead of logs_dir and num_profile if provided. Optional, default None.

  • interpolation (int) – Number of points on which to interpolate the profiles. Optional, default None.

  • kind (str) – Type of interpolation. Optional, default linear.

  • preserve_original_datapoints (bool) – If True and interpolation is not None, the original data points of the radial profile will be conserved together with the interpolated points.

  • remove_atmosphere (bool) – If True, the region with positive Brunt-Vaisala frequency above the convective envelope will be removed. Optional, default False.

  • add_kappa_rad (bool) – If True, the thermal radiativity coefficient kappa_rad will be computed among other profiles. Optional, default False.

  • add_kappa_rad – If True, the microscopic viscosity will be computed among other profiles. Optional, default False.

  • rot_solar_rate (float or ndarray) – Stellar rotation frequency, in solar rotation units. It can be an array with the same number of elements as the stellar profile. Optional, default 0.

  • vanishing_rotation (bool) – If True, the rotation profile vanishes following an exponential decay close to the centre. Optional, default True.

  • convective_neutral (bool) – If True, the square of the Brunt-Väisälä frequency will be set to zero where N2<0 (neutral stratification), otherwise the input value of the model will be conserved. Optional, default True.

  • add_centre (bool) – If True, add a x=0 central point to the model. Optional, default True.

compute_adimensioned_quantities(omega=None, omega_ad=None, add_centre=True)#

Add adimensioned quantities to model. Note that some of the quantities are computed with respect to a characteristic frequency (provided through omega or omega_ad) which can be e.g. the frequency of an eigenmode.

Parameters:
  • omega (float) – Characteristic frequency, in rad.s-1. Optional, default None.

  • omega_ad (float) – Adimensioned characteristic frequency. Optional, default None. Will be considered rather than omega if provided.

  • add_centre (bool) – If True, add a central point x=0 to the stellar profiles. Optional, default True.

compute_model_properties(add_kappa_rad=False, add_micro_viscosity=False, interpolation=None, preserve_original_datapoints=True, remove_atmosphere=False, convective_neutral=True, kind='linear', rot_solar_rate=0, vanishing_rotation=False, add_centre=True)#

Compute model base properties after profile quantities have been loaded.

compute_omega_critic(rot_solar_rate=0, l=1)#

Compute critical frequency for mode damping.

compute_rotation_profile(rot_solar_rate=0, vanishing_rotation=False, x0=0.0001, a=1)#

Compute stellar rotation profile and the corresponding zeta profile (2*Omega + r*dOmega/dr), as well as their adimensioned counterparts.

Parameters:
  • rot_solar_rate (float or ndarray) – Stellar rotation frequency, in solar rotation units. It can be an array with the same number of elements as the stellar profile. Optional, default 0.

  • x0 (float) – Characteristic radius where the rotation profile starts to decay (this is done to enforce the regularisation condition at x=0).

  • vanishing_rotation (bool) – If True, the rotation profile vanishes following an exponential decay close to the centre.

  • a (float) – Exponent controlling the decay rate of the rotation profile.

Returns:

The computed rotation profile and the zeta profile, followed by their adimensioned counterparts.

Return type:

tuple of ndarray

load_mesa_model(logs_dir=None, num_profile=None, filename=None, add_kappa_rad=False, add_micro_viscosity=False)#

Load MESA model.

make_interpolation(interpolation, preserve_original_datapoints=True, kind='linear')#

Interpolate quantities with a radial dependence.

truncate_model(x_span)#

Truncate model according to a new x_span.

mascaret.load_example_profile(interpolation=None, remove_atmosphere=False, convective_neutral=False, add_kappa_rad=False, add_micro_viscosity=False, rot_solar_rate=0, add_centre=True, vanishing_rotation=True)#

Load example profile that is included with the module (1 solar mass star at metallicity Z = 0.02124).

class mascaret.MESAModel(logs_dir=None, num_profile=None, filename=None, interpolation=None, preserve_original_datapoints=True, kind='linear', remove_atmosphere=False, add_kappa_rad=False, add_micro_viscosity=False, rot_solar_rate=0, vanishing_rotation=False, convective_neutral=True, add_centre=True)#

An alias name for the StellaModel class.

class mascaret.SolarModel(interpolation=None, preserve_original_datapoints=True, kind='linear', remove_atmosphere=False, add_kappa_rad=False, add_micro_viscosity=False, rot_solar_rate=0, vanishing_rotation=False, convective_neutral=True, add_centre=True)#

Class containing standard solar model (S model) structure informations.

More information about the S model can be found at: https://users-phys.au.dk/jcd/solar_models.

__init__(interpolation=None, preserve_original_datapoints=True, kind='linear', remove_atmosphere=False, add_kappa_rad=False, add_micro_viscosity=False, rot_solar_rate=0, vanishing_rotation=False, convective_neutral=True, add_centre=True)#

Initialise a SolarModel object from a standard solar model, including necessary quantities to compute mode eigenfunctions.

Parameters:
  • interpolation (int) – Number of points on which to interpolate the profiles. Optional, default None.

  • kind (str) – Type of interpolation. Optional, default linear.

  • preserve_original_datapoints (bool) – If True and interpolation is not None, the original data points of the radial profile will be conserved together with the interpolated points.

  • remove_atmosphere (bool) – If True, the region with positive Brunt-Vaisala frequency above the convective envelope will be removed. Optional, default False.

  • add_kappa_rad (bool) – If True, the thermal radiativity coefficient kappa_rad will be computed among other profiles. Optional, default False.

  • add_kappa_rad – If True, the microscopic viscosity will be computed among other profiles. Optional, default False.

  • rot_solar_rate (float or ndarray) – Stellar rotation frequency, in solar rotation units. It can be an array with the same number of elements as the stellar profile. Optional, default 0.

  • vanishing_rotation (bool) – If True, the rotation profile vanishes following an exponential decay close to the centre. Optional, default True.

  • convective_neutral (bool) – If True, the square of the Brunt-Väisälä frequency will be set to zero where N2<0 (neutral stratification), otherwise the input value of the model will be conserved. Optional, default True.

  • add_centre (bool) – If True, add a x=0 central point to the model. Optional, default True.

load_standard_solar_model()#

Load standard solar model (S model) structure informations.

class mascaret.CustomModel(profiles, interpolation=None, preserve_original_datapoints=True, kind='linear', remove_atmosphere=False, add_kappa_rad=False, add_micro_viscosity=False, rot_solar_rate=0, vanishing_rotation=True, convective_neutral=False, add_centre=True)#

Class allowing the user to create and manipulate a custom structure model.

__init__(profiles, interpolation=None, preserve_original_datapoints=True, kind='linear', remove_atmosphere=False, add_kappa_rad=False, add_micro_viscosity=False, rot_solar_rate=0, vanishing_rotation=True, convective_neutral=False, add_centre=True)#

Initialise a CustomModel object from a dictionary of profiles provided by the user.

Parameters:
  • profiles (dict) – A dictionary with the structure profiles and additional attributes of the model. Mandatory entries for the model are: r (radius in cm), rho (density in g/cm**3), Mr (internal mass at given radius, in g), g (gravity acceleration in cm/s**2), N2 (square of the Brunt-Väisälä frequency in (rad/s)**2), T (temperature in K), P (pressure in Ba), cs (sound speed in cm/s). If add_kappa_rad is set to True, providing opacity and cp is also mandatory. If add_micro_viscosity, providing x_H (hydrogen mass fraction) is also mandatory.

  • interpolation (int) – Number of points on which to interpolate the profiles. Optional, default None.

  • kind (str) – Type of interpolation. Optional, default linear.

  • preserve_original_datapoints (bool) – If True and interpolation is not None, the original data points of the radial profile will be conserved together with the interpolated points.

  • remove_atmosphere (bool) – If True, the region with positive Brunt-Vaisala frequency above the convective envelope will be removed. Optional, default False.

  • add_kappa_rad (bool) – If True, the thermal radiativity coefficient kappa_rad will be computed among other profiles. Optional, default False.

  • add_kappa_rad – If True, the microscopic viscosity will be computed among other profiles. Optional, default False.

  • rot_solar_rate (float or ndarray) – Stellar rotation frequency, in solar rotation units. It can be an array with the same number of elements as the stellar profile. Optional, default 0.

  • vanishing_rotation (bool) – If True, the rotation profile vanishes following an exponential decay close to the centre. Optional, default True.

  • convective_neutral (bool) – If True, the square of the Brunt-Väisälä frequency will be set to zero where N2<0 (neutral stratification), otherwise the input value of the model will be conserved. Optional, default True.

  • add_centre (bool) – If True, add a x=0 central point to the model. Optional, default True.