pycesam Module

The pycesam modeule is installed automatically with Cesam2k20. It allows to post-process and visualise models.

Module pycesam

How to run a model with pycesam:

from pycesam import *

mdl = CModel( 'my_model' ) # create instance of CModel
mdl( )                     # run model if not already computed

This will get you a model run with default parameters, very similar to the sun.
To change parameters vefore running the model, you can set different values like this:

mdl.params.y0 = 0.26                # changes initial helium
mdl.params.alpha = 1.70             # changes value of alpha parameter
mdl.params.diffusion = True         # activate diffusion
mdl.params.nom_difft_ = 'difft_sun' # turbulent diffusion following Gabriel+1997
mdl.params.mkdon( )                 # build .don file
mdl( )                              # run model

Data generated are automatically read. Variables read in .HRnew file are stored, for the most important one with following name:

mdl.log_teff (list): \(\log T_{\rm eff}\) along evolution
mdl.log_l (list): \(\log L / L_\odot\) along evolution
mdl.log_g (list): \(\log g\) along evolution
mdl.log_r (list): \(\log R/R_\odot\) along evolution
mdl.age (list): Age (Myrs) at each time step of the evolution
mdl.ab_c (dict): Central abundances along evolution (e.g: mdl.ab_c['H1'] is the central abundance of hydrogen along evolution)
mdl.ab_s (dict): Surface abundances along evolution (e.g: mdl.ab_s['H1'] is the surface abundance of hydrogen along evolution)

Variables stored in the .osc file are global variables stored in mdl.glob and structure variables in mdl.var. These array may habve an extra dimension if .osc file is written not only for last model, but at all time step.

In mdl.glob:

mdl.glob[0]: \(M_\star\)
mdl.glob[1]: \(R_\star\)
mdl.glob[2]: \(L_\star\)
mdl.glob[3]: Initial \(Z\)
mdl.glob[4]: Initial \(X\)
mdl.glob[5]: \(\alpha_\mathrm{MLT}\)
mdl.glob[6]: Surface \(X\)
mdl.glob[7]: Surface \(Y\)
mdl.glob[8]: \(\partial^2 p / \partial r^2\) at center
mdl.glob[9]: \(\partial^2 \rho / \partial r^2\) at center
mdl.glob[10]: Age

In mdl.var:

mdl.var[0]: \(r~\rm (cm)\),
mdl.var[1]: \(m/M_{\star}\),
mdl.var[2]: \(T~\rm (K)\),
mdl.var[3]: \(P_\mathrm{tot}~\rm (dyn/cm^2)\),
mdl.var[4]: \(\rho~\rm (g/cm)^3\),
mdl.var[5]: \(\nabla\),
mdl.var[6]: \(L ~\rm (erg/s)\),
mdl.var[7]: \(\kappa~\rm(cm^2/g)\),
mdl.var[8]: \(\varepsilon~\rm (erg/g/s)\),
mdl.var[9]: \(\Gamma_1\),
mdl.var[10]: \(\nabla_\mathrm{ad}\),
mdl.var[21]: \(\nabla_\mathrm{rad}\),
mdl.var[31]: \(u\),
mdl.var[45]: \(X_\mathrm{H1}\),
mdl.var[46]: \(X_\mathrm{He3}\),
mdl.var[47]: \(X_\mathrm{He4}\),
mdl.var[48]: \(X_\mathrm{C12}\),
mdl.var[49]: \(X_\mathrm{C13}\),
mdl.var[50]: \(X_\mathrm{N14}\),
mdl.var[51]: \(X_\mathrm{N15}\),
mdl.var[52]: \(X_\mathrm{O16}\),
mdl.var[53]: \(X_\mathrm{O17}\),
mdl.var[54]: \(X_\mathrm{Si29}\).

Module pycesam.gui

pycesam also comes with a package that offers some plot methods.
from pycesam.gui import *

mdl = CModelGUI( 'my_model' ) # create instance of CModelGUI

Many methods exists, please refer to the english documentation. Main methods are:
mdl.plot_hr(): plots HR diagram
mdl.plot_kiel: plots Kiel diagram
mdl.plot_cz(): plots Kippenhahn diagram