Python Stellar Evolution Simulation Example

This Python script demonstrates the use of a stellar evolution simulation library (presumably named PySEP) for modeling stellar processes. The example initializes models for solar-type stars using predefined solar parameters, physical constants, and opacity tables. It also demonstrates how to load pre-main sequence files (premsf_file) for two versions (C and a placeholder F version) of a star, evolve these models, and potentially store the evolved data. The focus is on running and comparing two different scenarios or model versions, marked by 'C' and 'F'. It provides a template for stellar astrophysics research, especially for running simulations and analyzing differences in stellar evolution outcomes based on varied initial conditions or physical assumptions.

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.opac.opal.defaults import GS98hz
 
from pysep.dm.filetypes import premsf_file
 
if __name__ == "__main__":
    CSolar = solar.copy()
    FSolar = solar.copy()
 
    CPremsModel = premsf_file("C/m080C.prems")
    # FPremsModel = premsf_file("F/m080F.prems")
    FPremsModel = premsf_file("C/m080FImposter.prems")
    CModel = sm("C", CSolar, phys1, GS98hz, CPremsModel)
    FModel = sm("F", FSolar, phys1, GS98hz, FPremsModel)
 
    print("Evolving C Verision")
    CModel.evolve(debug=False)
    # print("Evolving FORTRAN Verision")
    # FModel.evolve(debug=False)
 
    # CModel.stash(data=True)
    # FModel.stash(data=True)