Stellar Evolution Simulation Example
This Python code snippet demonstrates an example of using the PySEP library for simulating the evolution of stars. It showcases how to configure stellar models based on default physical parameters and opacity tables, how to prepare models for different initial masses using pre-main sequence (preMS) models for solar metallicity, and how to run parallel stellar evolution calculations. After the evolution, results are stashed for further analysis or visualization.
from pysep.api.parallel import pStellarModel from pysep.dsep import stellarModel as sm from pysep.io.nml.control.defaults import solar from pysep.io.nml.physics.defaults import phys1 from pysep.prems.defaults import m070_GS98, m080_GS98, m090_GS98, m100_GS98 from pysep.opac.opal.defaults import GS98hz import os solar[1]['nmodls'] = 100 path = "/mnt/p/d/Scratch/pTest" modelNames = ["m070", "m080", "m090", "m100"] modelPaths = [os.path.join(path, x) for x in modelNames] premsModels = [m070_GS98, m080_GS98, m090_GS98, m100_GS98] models = [sm(path, solar.copy(), phys1.copy(), GS98hz, premsModel) for path, premsModel in zip(modelPaths, premsModels)] pModel = pStellarModel(models) pModel.pEvolve() pModel.pStash()