Mode search#
Computing eigenfunctions#
- mascaret.mode_search(model, l_m=None, omega_0=100, omega_1=500, n_grid=300, rot_solar_rate=0, method='inverse', x_span=None, parallelise=False, nodes=2, nchunk=None, verbose=True, double_shooting=False, vanishing_rotation=True, xf=None, formalism='fully_compressible', outer_condition='vacuum', reference_frame='corotation', max_iter=100, tol_delta_grid=1e-12, tol_delta=1e-09, tol_delta_grid_ratio=1e-06, output_dir='.', template_filename=None, maxtasksperchild=5, save_adimensioned=True, profile_to_save=None, start_full_span='stitch', summary_filename=None, format_summary='ascii')#
For a given stellar model, search for mode frequencies and eigenfunctions matching the input parameters provided.
This function is a wrapper of
scan_frequency_gridandcompute_eigenfunction_parallel.- Parameters:
l_m (dict) – A dictionary specifying the angular degree
land azimuthal numbersmof mode to compute. Each entry of the dictionary must correspond to anlvalue, with corresponding field given as a list ofm. Optional, defaultNone.omega_0 (float) – Lower bound of the grid, in muHz. Optional, default
100.omega_1 (float) – Upper bound of the grid, in muHz Optional, default
500.n_grid (int) – Number of points to consider on the grid
method (str) – Method to subdivise and scan the frequency grid, can be
inverseorlinear. Optional, defaultinverse.max_iter (int) – Maximum number of iteration. Optional, default
100.tol_delta_grid (float) – Tolerance of interval size between the two points of the grid within which the searched solution is contained. If the interval becomes smaller than
tol_delta_grid, the iteration will stop. Optional, default1e-12.tol_delta (float) – If the discriminant becomes smaller than
tol_delta, the iteration will stop. Optional, default1e-9.tol_delta_grid_ratio – The iteration will stop if the relative difference in size between the current grid interval size and the previous grid interval size becomes smaller than
tol_delta_grid_ratio. Optional, default1e-6.x_span (tuple) – The adimensioned radial span on which to compute the solution. Optional, default
None.rot_solar_rate (float) – The stellar rotatinal frequency, in solar unit. Optional, default
0.verbose (bool) – Output verbosity. Optional, default
False.nodes (float) – Number of computing nodes to use if
parallelisTrue, optional, default2.maxtaskperchild (int) – Number of task that a child process will execute before re-initialising (allowing to free used memory, in particular from created
numpyarrays). Optional, default5.output_dir (str or Path object) – Directory to write the output files. Optional, default
".".template_filename (str) – Filename template to use in order to name the output files containing the mode eigenfunctions. Optional, default
None.double_shooting (bool) – Whether to use double shooting method rather than a simple shooting scheme. Optional, default
False.start_full_span (str) – Whether to start drawing the full-span solution from the external (
surface) or internal (core) boundary, or to stitch ("stitch") the two solutions. Optional, defaultcore.summary_filename (str or Path object) – Summary filename. Optional, default
None.format_summary (str) – Format to use to write the summary, either
"ascii"or"hdf5". Optional, default"ascii".save_adimensioned (bool) – Whether to save or not adimensioned variables computed by the solver.
y1andy2must be provided in this case. Optional, defaultFalse.profile_to_save (list or array-like) – List of profile to interpolate and save from the stellar model. Optional, default
None.formalism (str) – Formalism to consider when solving the equations. Can be fully compressible
"fully_compressible", anelastic"anelastic", LBR anelastic"lbr", or “gamma” (gamma-modes formalism from Ong & Basu 2020). Optional, default"fully_compressible".reference_frame (str) – The reference frame considered to look for and compute eigenfrequencies. Can be
"corotation"or"inertial". Optional, default"corotation".
- Returns:
The table containing the summary properties of the computed modes.
- Return type:
astropy.Table
- mascaret.compute_eigenfunction_parallel(list_intervals, model, l=1, m=0, method='inverse', max_iter=100, tol_delta_grid=1e-12, tol_delta=1e-09, tol_delta_grid_ratio=1e-06, x_span=None, rot_solar_rate=0, output_dir='.', template_filename=None, nodes=2, maxtasksperchild=5, double_shooting=True, start_full_span='stitch', vanishing_rotation=True, xf=None, summary_filename=None, format_summary='ascii', save_adimensioned=False, profile_to_save=None, formalism='fully_compressible', outer_condition='vacuum', reference_frame='corotation')#
Compute eigenfunctions in parallels using a list of interval obtained from
scan_frequency_grid.- Parameters:
list_intervals (list of tuple) – List of frequency intervals obtained from
scan_frequency_grid.l (int) – Angular degree. Optional, default
1.m (int) – Azimuthal number. Optional, default
0.method (str) – Method to subdivise and scan the frequency grid, can be
inverseorlinear. Optional, defaultinverse.max_iter (int) – Maximum number of iteration. Optional, default
100.tol_delta_grid (float) – Tolerance of interval size between the two points of the grid within which the searched solution is contained. If the interval becomes smaller than
tol_delta_grid, the iteration will stop. Optional, default1e-12.tol_delta (float) – If the discriminant becomes smaller than
tol_delta, the iteration will stop. Optional, default1e-12.tol_delta_grid_ratio – The iteration will stop if the relative difference in size between the current grid interval size and the previous grid interval size becomes smaller than
tol_delta_grid_ratio. Optional, default1e-6.x_span (tuple) – The adimensioned radial span on which to compute the solution. Optional, default
None.rot_solar_rate (float) – The stellar rotatinal frequency, in solar unit. Optional, default
0.nodes (float) – Number of computing nodes to use if
parallelisTrue, optional, default2.maxtaskperchild (int) – Number of task that a child process will execute before re-initialising (allowing to free used memory, in particular from created
numpyarrays). Optional, default5.output_dir (str or Path object) – Directory to write the output files. Optional, default
".".template_filename (str) – Filename template to use in order to name the output files containing the mode eigenfunctions. Optional, default
None.double_shooting (bool) – Whether to use double shooting method rather than a simple shooting scheme. Optional, default
False.start_full_span (str) – Whether to start drawing the full-span solution from the external (
surface) or internal (core) boundary, or to stitch ("stitch") the two solutions. Optional, defaultcore.summary_filename (str or Path object) – Summary filename. Optional, default
None.format_summary (str) – Format to use to write the summary, either
"ascii"or"hdf5". Optional, default"ascii".save_adimensioned (bool) – Whether to save or not adimensioned variables computed by the solver.
y1and y2`` must be provided in this case. Optional, defaultFalse.profile_to_save (list or array-like) – List of profile to interpolate and save from the stellar model. Optional, default
None.formalism (str) – Formalism to consider when solving the equations. Can be fully compressible
"fully_compressible", anelastic"anelastic", LBR anelastic"lbr", or “gamma” (gamma-modes formalism from Ong & Basu 2020). Optional, default"fully_compressible".reference_frame (str) – The reference frame considered to look for and compute eigenfrequencies. Can be
"corotation"or"inertial". Optional, default"corotation".
- Returns:
The table containing the summary properties of the computed modes.
- Return type:
astropy.Table
- mascaret.scan_frequency_grid(model, omega_0=100, omega_1=500, n_grid=300, rot_solar_rate=0, l=1, m=0, method='inverse', x_span=None, parallelise=False, nodes=2, nchunk=None, verbose=False, double_shooting=False, vanishing_rotation=True, xf=None, formalism='fully_compressible', outer_condition='vacuum', reference_frame='corotation')#
Scan frequency grid to look for intervals with eigenmodes.
- Parameters:
omega_0 (float) – Lower bound of the grid, in muHz. Optional, default
100.omega_1 (float) – Upper bound of the grid, in muHz Optional, default
500.n_grid (int) – Number of points to consider on the grid
rot_solar_rate (float) – The stellar rotatinal frequency, in solar unit. Optional, default
0.l (int) – Angular degree. Optional, default
1.m (int) – Azimuthal number. Optional, default
0.method (str) – Method to subdivise and scan the frequency grid, can be
inverseorlinear. Optional, defaultinverse.x_span (tuple) – The adimensioned radial span on which to compute the solution. Optional, default
None(in this case the solution will be computed considering the model boundaries).parallelise (bool) – Run in parallel if set to
True. Optional, defaultFalse.nodes (float) – Number of computing nodes to use if
parallelisTrue, optional, default2.nchunk (int) – Number of chunks to subdivise the grid in. Optional, default
None.verbose (bool) – Output verbosity. Optional, default
False.formalism (str) – Formalism to consider when solving the equations. Can be fully compressible
"fully_compressible", anelastic"anelastic", LBR anelastic"lbr", or “gamma” (gamma-modes formalism from Ong & Basu 2020). Optional, default"fully_compressible".reference_frame (str) – The reference frame considered to look for and compute eigenfrequencies. Can be
"corotation"or"inertial". Optional, default"corotation".
- Returns:
A list of restricted intervals to look for eigenmodes by dichotomy
- Return type:
list of tuples
- mascaret.search_eigenfunction_dichotomy(model, omega_0, omega_1, l=1, m=0, method='inverse', max_iter=100, tol_delta_grid=1e-12, tol_delta=1e-09, tol_delta_grid_ratio=1e-06, x_span=(0, 1), verbose=False, rot_solar_rate=0, double_shooting=True, xf=None, start_full_span='stitch', vanishing_rotation=True, formalism='fully_compressible', outer_condition='vacuum', reference_frame='corotation')#
Newton procedure to look for eigenfunction.
- Parameters:
model (object) – Stellar model.
omega_0 (float) – Lower bound for the dichotomy search, in muHz
omega_1 (float) – Upper bound for the dichotomy search, in muHz
l (int) – Angular degree. Optional, default
1.m (int) – Azimuthal number. Optional, default
0.method (str) – Method to subdivise and scan the frequency grid, can be
inverseorlinear. Optional, defaultinverse.max_iter (int) – Maximum number of iteration. Optional, default
100.tol_delta_grid (float) – Tolerance of interval size between the two points of the grid within which the searched solution is contained. If the interval becomes smaller than
tol_delta_grid, the iteration will stop. Optional, default1e-12.tol_delta (float) – If the discriminant becomes smaller than
tol_delta, the iteration will stop. Optional, default1e-12.tol_delta_grid_ratio – The iteration will stop if the relative difference in size between the current grid interval size and the previous grid interval size becomes smaller than
tol_delta_grid_ratio. Optional, default1e-6.x_span (tuple) – The adimensioned radial span on which to compute the solution. Optional, default
(0,1).verbose (bool) – Output verbosity. Optional, default
False.rot_solar_rate (float) – The stellar rotatinal frequency, in solar unit. Optional, default
0.double_shooting (bool) – Whether to use double shooting method rather than a simple shooting scheme. Optional, default
False.xf (float) – The position of the boundary point between the external and internal solution if
double_shootingisTrue. If not provided, it will be taken as the radius where the Brunt-Väisälä frequency is maximum. Optional, defaultNone.start_full_span (str) – Whether to start drawing the full-span solution from the external (
surface) or internal (core) boundary, or to stitch ("stitch") the two solutions. Optional, defaultcore.formalism (str) – Formalism to consider when solving the equations. Can be fully compressible
"fully_compressible", anelastic"anelastic", LBR anelastic"lbr", or “gamma” (gamma-modes formalism from Ong & Basu 2020). Optional, default"fully_compressible".reference_frame (str) – The reference frame considered to look for and compute eigenfrequencies. Can be
"corotation"or"inertial". Optional, default"corotation".
- Returns:
The eigenfrequency
omega, the adimensioned radial coordinatex, the radial displacementxi_r, the reduced pressure perturbationW, the adimensioned variablesy1andy2, the discriminant value of the computed solution, and thescipy.integrate.solve_ivpresult object.- Return type:
tuple
- mascaret.shooting_method_solve_ivp(model, omega=None, omega_ad=None, m=0, l=1, x_span=(0, 1), rot_solar_rate=0, double_shooting=False, xf=None, compute_full_span=False, start_full_span='stitch', vanishing_rotation=True, formalism='fully_compressible', outer_condition='vacuum', reference_frame='corotation')#
Solve the second order problem with a shooting method (see e.g. Numerical Recipes, Press 1992).
- Parameters:
model (StellarModel) – The model object with stellar structure informations.
omega (float) – The dimension frequency of the solution to compute. Optional, default
None.omega_ad (float) – The adimensioned frequency of the solution to compute. The value of
omegawill be ignored if provided. Optional, defaultNone.m (int) – Azimuthal number. Optional, default
0.l (int) – Angular degree. Optional, default
1.x_span (tuple) – The adimensioned radial span on which to compute the solution. Optional, default
(0,1).rot_solar_rate (float) – The stellar rotational frequency, in solar unit. Optional, default
0.double_shooting (bool) – Whether to use double shooting method rather than a simple shooting scheme. Optional, default
False.xf (float) – The position of the boundary point between the external and internal solution if
double_shootingisTrue. If not provided, it will be taken as the radius where the Brunt-Väisälä frequency is maximum. Optional, defaultNone.compute_full_span (bool) – If set to
Trueanddouble_shootingis used, a full span solution will be computed and returned to the user. Otherwise the internal solution spanning fromx_span[0]toxfwill be returned. Optional, defaultFalse.start_full_span (str) – If
compute_full_spanisTrue, whether to start drawing the full-span solution from the external boundary (surface), the internal boundary (core) or stitch ("stitch") the two solutions. Optional, defaultcore.formalism (str) – Formalism to consider when solving the equations. Can be fully compressible
"fully_compressible", anelastic"anelastic", LBR anelastic"lbr", or “gamma” (gamma-modes formalism from Ong & Basu 2020). Optional, default"fully_compressible".outer_condition (str) – Outer boundary condition, can be
"vacuum"or"zero_r". Optional, default"vacuum".reference_frame (str) – The reference frame considered to look for and compute eigenfrequencies. Can be
"corotation"or"inertial". Optional, default"corotation".
- Returns:
The adimensioned radial coordinate
x, the radial displacementxi_r, the reduced pressure perturbationW, the discriminant value of the computed solution, and thescipy.integrate.solve_ivpresult object.- Return type:
tuple
Plotting functions#
- mascaret.plot_eigenfunction(x, xi_r, W, axs=None, model=None, omega=None, rot_solar_rate=None, c1='darkorange', c2='blue', xlabel=None, ylabels=None, **kwargs)#
Plot eigenfunctions computed by shooting method
- Parameters:
x (ndarray) – Radial coordinate.
xi_r (ndarray) – Radial displacement.
W (ndarray) – Reduced pressure perturbation
axs (list of matplotlib.Axes) – The axes to use for the plot. A new figure will be created if not provided. Optional, default
None.model (StellarModel) – The model object with stellar structure informations. Optional, default
None.omega (float) – The mode frequency in muHz. Optional, default
None.rot_solar_rate (float) – The stellar rotation frequency in solar unit. Optional, default
None.c1 (str) – Color to use for the radial displacement. Optional, default
"darkorange".c1 – Color to use for the reduced pressure. Optional, default
"blue".xlabel (str) – Label for x-axis. Optional, default
None.ylabels (tuple of str) – Labels for y-axis. Must be given as tuple with the label for the first panel and the label for the second panel (either can be set to
Noneto use default label). Optional, defaultNone.**kwargs – Keyword arguments to be passed to
matplotlib.pyplot.plot.
- Returns:
The created figure.
- Return type:
matplotlib.Figure
Auxiliary functions#
- mascaret.compute_physical_quantities(result, model, l=1)#
Compute physical quantities from the adimensioned solutions of the IVP.
- Parameters:
result (object) – The
scipy.integrate.solve_ivpresult object.model (StellarModel) – The model object with stellar structure informations.
l (int) – Angular degree. Optional, default
1.
- Returns:
The adimensioned radial coordinate
x, the radial displacementxi_rand the reduced pressure perturbationW.- Return type:
tuple of arrays
- mascaret.compute_radial_order(x, xi_r, W, scheme='eckart_1960')#
Compute radial order of the eigenmode.
- Returns:
A tuple of integers with the global radial order
n, the number of gravity nodesn_gand the number of acoustic nodesn_p.- Return type:
tuple