Stellar Evolution Calibration and Evolution Script

This Python script is used for calibrating and evolving stellar models using the OPAL and OPLIB opacity library configurations. It performs solar calibration using predefined physical and control parameters, evolves the models, and stashes the evolved data for further analysis.

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.prems.defaults import m100_GS98
from pysep.dm.filetypes import opacf_file
 
from pysep.dsep.calibrate import basic_solar_calib
 
def main():
    OPALControl = solar.copy()
    OPALControl[0]['rsclz'] = 0.017
    OPALModel = sm("OPALModel/", OPALControl.copy(), phys1.copy(), GS98hz, m100_GS98)
 
    OPLIBhz = opacf_file("inputs/opac/GS98_ATOMIC_opac")
    OPLIBControl = solar.copy()
    OPLIBControl[0]['rsclz'] = 0.017
    OPLIBModel = sm("OPLIBModel/", OPLIBControl.copy(), phys1.copy(), OPLIBhz, m100_GS98)
 
    print('=======================\nCALIBRATING OPAL\n========================')
    OPAL_solarX, OPAL_solarML = basic_solar_calib(OPALModel)
    print('=======================\nCALIBRATING OPLIB\n========================')
    OPLIB_solarX, OPLIB_solarML = basic_solar_calib(OPLIBModel)
 
    OPALControl[0]['rsclx'] = OPAL_solarX
    OPALControl[0]['cmixla'] = OPAL_solarML
    OPALControl[1]['cmixla'] = OPAL_solarML
 
    OPLIBControl[0]['rsclx'] = OPLIB_solarX
    OPLIBControl[0]['cmixla'] = OPLIB_solarML
    OPLIBControl[1]['cmixla'] = OPLIB_solarML
 
    OPALControl[1]['nmodls'] = 3000
    OPLIBControl[1]['nmodls'] = 3000
 
    print('=======================\nEVOLVING OPAL\n========================')
    OPALModelRun = sm("OPALModel/", OPALControl, phys1.copy(), GS98hz, m100_GS98)
    print('=======================\nEVOLVING OPLIB\n========================')
    OPLIBModelRun = sm("OPLIBModel/", OPLIBControl, phys1.copy(), OPLIBhz, m100_GS98)
 
    OPALModelRun.evolve()
    OPLIBModelRun.evolve()
 
    OPALModelRun.stash(data=True)
    OPLIBModelRun.stash(data=True)
 
 
if __name__ == "__main__":
    main()