NB. For reading the MESA LOGS/profilexxx.data files: NB. assigns values to all the tabulated column names. NB. Usage: mesa_read 12 (reads "LOGS/profile12.data") NB. -------------------------------------------------- PPP=: '/your_path/LOGS/' require 'plot' mesa_read=: monad define A=. LF cut fread PPP,'profile',(":y),'.data' g_col=: cut >1{A (g_col)=: _&". >cut >2{A print 'Mass';star_mass;' Model No.';model_number;' Age';star_age;' Number of zones in model';num_zones print 'T_eff';Teff;' Luminosity';photosphere_L;' Radius';photosphere_r;' Z';initial_z m=. star_mass print 'H fraction';(star_mass_h1%m);' He fraction';(star_mass_he4%m);' C fraction';(star_mass_c12%m) NB.-------------------------------------------------- head=: cut >4{A NB. column headings erase'y' NB. because y is one of the column names! (head)=: |: _&". >5}.A T6=: 10^(_6+logT) NB. Temperature in 10^6 deg K. print 'He core';(he_core_mass%m);' C core';(c_core_mass%m);' Central density';10^{:logRho ' Maximum & central temperature';(({. \:~T6),({:T6));'million K' ) NB. NB. Here is how you might use it: NB. load'mesa_read.ijs' NB. mesa_read 82 NB. read the (82*30)th model NB. ps=.'pensize 3' NB. make a thick line NB. plot the log of the nuclear energy generation: NB. ps plot mass;10^. eps_nuc NB. plot the temperature in millions of degrees: NB. ps plot mass; T6 NB. plot the run of H, He, and heavy elements: NB. ps plot mass; >x;y;z NB. same plot as function of radius: NB. ps plot radius; >x;y;z NB. plot of logT vs. logRho: NB. 'pensize 5;color red' plot logRho;logT NB. Plot log T vs log rho for all zones and put dots NB. at points of equal mass or radius. E.g., to put NB. dots dividing line into 10 regions of equal mass NB. or radius: mass Trho 10 -or- radius Trho 10 Trho=: dyad define f=. ({.x)*int01 y NB. values of x to be marked NB. get indices of zones closest to the f values: k=. ,I.({."1 /:~"1 a)=(a=.|f-/x) pd'reset' pd 'pensize 3;color red' pd logRho;logT pd 'type dot;pensize 4' pd 'color black' pd (k{logRho);(k{logT) pd 'show' )