#include <lambda_klencki21.h>
|
| static double | estimate_lambda (double R, const std::vector< double > &coefficients) |
| |
|
| static thread_local std::vector< double > | Mzams_list |
| |
| static thread_local std::vector< std::vector< double > > | Z_list |
| |
| static thread_local bool | already_loaded_lists =false |
| |
| static thread_local std::vector< std::vector< double > > | table |
| |
| static thread_local bool | already_loaded =false |
| |
Derived class from Lambda_Klencki to estimate the lambda using a Mzams-Z interpolation from the tracks tabulated by Klencki+21.
◆ Lambda_Klencki_interpolator() [1/2]
| Lambda_Klencki_interpolator::Lambda_Klencki_interpolator |
( |
const Star * |
s | ) |
|
◆ Lambda_Klencki_interpolator() [2/2]
| Lambda_Klencki_interpolator::Lambda_Klencki_interpolator |
( |
const IO * |
io | ) |
|
◆ estimate_lambda()
| double Lambda_Klencki::estimate_lambda |
( |
double |
R, |
|
|
const std::vector< double > & |
coefficients |
|
) |
| |
|
staticprotectedinherited |
Estimate lambda from Klencki+21 using Eq. A.1
- Parameters
-
| R | radius in Rsun |
| coefficients | coefficients of the Eq. A.1 in Klencki + R12,R23 and Rmax, it has to be a vector with dimension 17 with the following columns:
- 0: Mzams
- 1: Z
- 2: R12
- 3: R23
- 4: Rmax
- 5-8: a1,b1,c1,d1
- 9-12: a2,b2,c2,d2
- 13-16: a3,b3,c3,d3
|
- Returns
-
value of lambda
◆ fill_interpolators_lists()
| void Lambda_Klencki_interpolator::fill_interpolators_lists |
( |
| ) |
|
|
protected |
Read the already loaded table to find all the Mzams and Z in the Klencki tables
◆ find_interpolators()
| void Lambda_Klencki_interpolator::find_interpolators |
( |
double |
Mzams, |
|
|
double |
Z |
|
) |
| |
|
protected |
Find the four interpolating tracks in the Klencki tables for a given Mzams, Z couple. If Mzams and Z are smaller or larger than the minimum and maximum values in the table, they are internally set to the minimum/maximum values in the table. This function set also the weights
- Parameters
-
| Mzams | zams mass in Msun |
| Z | metallicity |
◆ find_row()
| std::vector< double > Lambda_Klencki::find_row |
( |
double |
Mzams, |
|
|
double |
Z |
|
) |
| |
|
inherited |
Find the row of the Klencki table that best match Mzams and Z in input. The best match is the one for which Mtrack>Mzams and Ztrack>Z. If Mzams<10, Mtracks=10 is used, for Z/Zsun<0.01, Z/Zsun=0.01 is used.
- Parameters
-
| Mzams | zams mass (Msun) of the star for which we want to find the the related track in the Klencki table |
| Z | Z of the star for which we want to find the the related track in the Klencki table |
- Returns
- return the quantities of the matched table row as a vector with dimension 17
◆ operator()() [1/2]
| double Lambda_Klencki::operator() |
( |
const Star * |
s | ) |
|
|
overridevirtualinherited |
Estimate lambda for a given star. Internally it calles the operator(double Mzams, double Z, double R).
- Parameters
-
| s | Star for which we want to estimate lambda |
- Returns
- value of lambda. Notice: the lambda is estimated by Klenci+21 using MESA tracks between 10 and 80 Msun and Z/Zsun 0.01 - 0.1, where Zsun=0.017 (not all the tracks contains all the ranges in Z). The lambda is estimated in a quantised way, i.e. for a Mzams and a Z not present in the table, the closest track with Mtrack>Mzams and Ztrack>Z. If Mzams<10, Mtracks=10 is used, for Z/Zsun<0.01, Z/Zsun=0.01 is used.
Implements Lambda_Base.
◆ operator()() [2/2]
| double Lambda_Klencki_interpolator::operator() |
( |
double |
Mzams, |
|
|
double |
Z, |
|
|
double |
R |
|
) |
| |
|
overridevirtual |
Estimate the value of lambda as function of Mzams,Z and R. The lambda is estimated interpolating the lambdas obtained for the four interpolating tracks in the Klencki tables. The interpolating tracks are so that Mzams_track1<= Mzams <Mzams_track2 and Z_track12 <= Z < Z_track34. So the four interpolating tracks have: 1 - Mzams_track1, Ztrack1 -> lambda1 2- Mzams_track1, Ztrack2 -> lambda2 3- Mzams_track2, Ztrack3 -> lambda3 4- Mzams_track2, Ztrack4 -> lambda4 The final lambda is estimated as wM1*(wZ1*lambda1 + wZ2*lambda2) + wM2*(wZ3*lambda3 + wZ4*lambda4), whew wM1,wM2,wZ1,wZ2,wZ3,wZ4 are the interpolateing weights estimates as wM1 = (Mzams_track2 - Mzams) / (Mzams_track2 - Mzams_track1) wM2 = (Mzams - Mzams_track1) / (Mzams_track2 - Mzams_track1) wZ1 = (Ztrack2 - Z) / (Ztrack2 - Ztrack1) wZ2 = (Z - Ztrack1) / (Ztrack2 - Ztrack1) .... etc. etc.
If Mzams and Z are smaller or larger than the minimum and maximum values in the table, they are internally set to the minimum/maximum values in the tabe.
Some part of the lambda estimate are cached. In particular the coefficient from Klencki+21 depends on the Mzams and Z, therefore these two values are cached and the coefficients (see find_interpolators) are loaded only if Mzams or Z are different with respect to the last call.
- Parameters
-
| Mzams | Zams mass in Msun |
| Z | metallicity |
| R | radius in Rsun |
- Returns
- value of lambda.
Reimplemented from Lambda_Klencki.
◆ already_loaded
| thread_local bool Lambda_Klencki::already_loaded =false |
|
staticprotectedinherited |
flag to check if it is needed to load table
◆ already_loaded_lists
| thread_local bool Lambda_Klencki_interpolator::already_loaded_lists =false |
|
staticprotected |
flag to check if Mzams_list and Z_list have been already loaded
◆ Mzams_cache
| double Lambda_Klencki::Mzams_cache {0} |
|
protectedinherited |
◆ Mzams_interpolators
| double Lambda_Klencki_interpolator::Mzams_interpolators[2] = {0.,0.} |
|
private |
Mzams of the four interpolator
◆ Mzams_list
| thread_local std::vector< double > Lambda_Klencki_interpolator::Mzams_list |
|
staticprotected |
list of all zams masses in the Klencki table
◆ svlog
◆ table
| thread_local std::vector< std::vector< double > > Lambda_Klencki::table |
|
staticprotectedinherited |
Here now we define two quantities that are used to load the external table only once per class per thread. In this way we can save memory not loading one table for each Lambda instance, this is possibile using static variables. At the same time using thread_local we force to have one separate definition for these variable for each thread avoiding data racing. In this case it is equivalent to defining the variable as threadprivate (see https://stackoverflow.com/questions/60932116/does-thread-local-work-for-openmp-threads), Variables that appear in threadprivate directives or variables with the _Thread_local (in C) or thread_local (in C++) storage-class specifier are threadprivate
In the class constructors the table is loaded only if the variable already_loaded is set to false, after the table loading alread_loaded is set to false. 2D table 170 rows, 17 columns
◆ vector_cache
| std::vector<std::vector<double> > Lambda_Klencki_interpolator::vector_cache |
|
protected |
2d vectors with 4 rows (the interpolating tracks) and 17 columns (each one from a given track in the table)
◆ wM
| double Lambda_Klencki_interpolator::wM[2] = {0., 0.} |
|
private |
interpolator weights for the two Mzams
◆ wZ
| double Lambda_Klencki_interpolator::wZ[4] = {0., 0., 0., 0.} |
|
private |
interpolator weights for the four metallicities
◆ Z_cache
| double Lambda_Klencki::Z_cache {0} |
|
protectedinherited |
Last Mzams and Z used to estimate lambda
◆ Z_interpolators
| double Lambda_Klencki_interpolator::Z_interpolators[4] = {0.,0.,0.,0.} |
|
private |
Z of the four interpolator
◆ Z_list
| thread_local std::vector< std::vector< double > > Lambda_Klencki_interpolator::Z_list |
|
staticprotected |
list of all metallicity in the Klencki table
◆ Zsun
| const double Lambda_Klencki::Zsun =0.017 |
|
protectedinherited |
Value of Z for the sun as assumed in Klencki+21
The documentation for this class was generated from the following files: