pysep.io.nml.physics package

Submodules

pysep.io.nml.physics.paramConstruct module

Author: Thomas M. Boudreaux

Created: June 2022

Last Modified: June 2022

Dataclasses for physics namelist files. I have transcibed all the default values laied out in the data statements from Parmin.f into dataclasses.

Parameters that are scalers are represented as fields, parameters which are lists/vectors are represented by their own dataclasses. This is primarly to allow for more easily changing / setting values in these lists without having to write out the entire list

Examples

Here we have an example where we want to update just the max fractional timestep, as defined in ATIME. We can load the ATIMEd dataclass with all default parameters except the maxFractionalTimestepChange

>>> from pysep.io.nml.physics import ATIMEd
>>> from pysep.io.nml.physics.defaults import phys1
>>> phys1['atime'] = ATIMEd(maxFractionalTimestepChange=1.04).as_list()
>>> phys1.save("ExampleUpdatedPhysics.nml")

We also know that the DSEP doc defines these in terms of index not names, so if we want to modify the parameters of ATIMEd based on index we can also do that

>>> from pysep.io.nml.physics import ATIMEd
>>> from pysep.io.nml.physics.defaults import phys1
>>> ATIME = ATIMEd()
>>> ATIME[13] = 1.04
>>> phys1['atime'] = ATIME.as_list()
>>> phys1.save("ExampleUpdatedPhysics.nml")
class pysep.io.nml.physics.paramConstruct.ANEWCPd(rs1: str = '   ', rs2: str = '   ', rs3: str = '   ', rs4: str = '   ', rs5: str = '   ', rs6: str = '   ', rs7: str = '   ', rs8: str = '   ', rs9: str = '   ', rs10: str = '   ', rs11: str = '   ', rs12: str = '   ')

Bases: object

as_list() list

Return a list representation of ANEWCP

Returns

outList – list in the correct order for DSEP to interpet

Return type

list[str]

rs1: str = '   '
rs10: str = '   '
rs11: str = '   '
rs12: str = '   '
rs2: str = '   '
rs3: str = '   '
rs4: str = '   '
rs5: str = '   '
rs6: str = '   '
rs7: str = '   '
rs8: str = '   '
rs9: str = '   '
class pysep.io.nml.physics.paramConstruct.ATIMEd(minCentralXBeforeHBurning: float = 0.001, maxChangeXforCoreHBurning: float = 0.02, maxFractionalChangeCentral: float = 0.5, maxChangeYCentral: float = 0.02, maxFractionalChangeYCentral: float = 0.03, maxMassAllowedToBurnInShell: float = 0.0015, maxDepletionInXAtMidpointOfHShell: float = 0.1, maxChangeP: float = 0.005, maxChangeT: float = 0.01, maxChangeR: float = 0.005, maxChangeL: float = 0.005, maxPercentageTimestepChange: float = 0.25, maxFractionalTimestepChange: float = 1.01, maxAbsoluteTimestepChange: float = - 10000000.0)

Bases: object

as_list() list

Return a list representation of ATIME

Returns

outList – list in the correct order for DSEP to interpet

Return type

list[float]

from_list(l: list)
maxAbsoluteTimestepChange: float = -10000000.0
maxChangeL: float = 0.005
maxChangeP: float = 0.005
maxChangeR: float = 0.005
maxChangeT: float = 0.01
maxChangeXforCoreHBurning: float = 0.02
maxChangeYCentral: float = 0.02
maxDepletionInXAtMidpointOfHShell: float = 0.1
maxFractionalChangeCentral: float = 0.5
maxFractionalChangeYCentral: float = 0.03
maxFractionalTimestepChange: float = 1.01
maxMassAllowedToBurnInShell: float = 0.0015
maxPercentageTimestepChange: float = 0.25
minCentralXBeforeHBurning: float = 0.001
class pysep.io.nml.physics.paramConstruct.HTOLERd(convCritDeltaLogP: float = 6e-05, convCritDeltaLogT: float = 4.5e-05, convCritDeltaLLsun: float = 0.003, convCritHeBurning: float = 9e-05, convTolerLogPLogR: float = 3e-05, maxCorrectionDeltaLogP: float = 0.9, maxCorrectionDeltaLogT: float = 0.5, maxCorrectionDeltaLLsun: float = 0.5, maxCorrectionDeltaR: float = 2.0, convTolerRHSofTL: float = 2.5e-06)

Bases: object

as_list() list

Return a list representation of HTOLER

Returns

outList – list in the correct order for DSEP to interpet

Return type

list[list[float]]

convCritDeltaLLsun: float = 0.003
convCritDeltaLogP: float = 6e-05
convCritDeltaLogT: float = 4.5e-05
convCritHeBurning: float = 9e-05
convTolerLogPLogR: float = 3e-05
convTolerRHSofTL: float = 2.5e-06
maxCorrectionDeltaLLsun: float = 0.5
maxCorrectionDeltaLogP: float = 0.9
maxCorrectionDeltaLogT: float = 0.5
maxCorrectionDeltaR: float = 2.0
class pysep.io.nml.physics.paramConstruct.IEOSd(if1: int = 1, if2: int = 101, if3: int = 0)

Bases: object

as_list() list

Return a list representation of IEOS

Returns

outList – list in the correct order for DSEP to interpet

Return type

list[int]

if1: int = 1
if2: int = 101
if3: int = 0
set_eos(eos: str)

Sets the equation of states control flags to the 5 defined equations of state from Irwin

Parameters

eos (str) – equation of state name (from Irwin / free_eos.f). This can be either EOS1, EOS1A, EOS2, EOS3, or EOS4. Case insensitive.

Raises

KeyError – if eos is not one of the defined equaitons of state

class pysep.io.nml.physics.paramConstruct.SHELLTOLd(minChangeLogM: float = 1e-08, maxChangeLogM: float = 0.08, DeltaXReqToFlag: float = 0.05, DeltaYReqToFlag: float = 1.0, maxDisconX: float = 1.0, maxDisconZ: float = 1.0, dLogPEtxtenBelowOvershootAboveBaseSufraceCZ: float = 0.0, maxdLogPSurfCZAboveFineMeshZone: float = 0.05, maxChangeLLsun: float = 0.02, maxdLogPInFineMeshZone: float = 0.05, maxdLogPBelowSurfCZBelowFineMeshZone: float = 0.05, maxdLogOmega: float = 0.1)

Bases: object

DeltaXReqToFlag: float = 0.05
DeltaYReqToFlag: float = 1.0
as_list() list

Return a list representation of SHELLTOL

Returns

outList – list in the correct order for DSEP to interpet

Return type

list[float]

dLogPEtxtenBelowOvershootAboveBaseSufraceCZ: float = 0.0
maxChangeLLsun: float = 0.02
maxChangeLogM: float = 0.08
maxDisconX: float = 1.0
maxDisconZ: float = 1.0
maxdLogOmega: float = 0.1
maxdLogPBelowSurfCZBelowFineMeshZone: float = 0.05
maxdLogPInFineMeshZone: float = 0.05
maxdLogPSurfCZAboveFineMeshZone: float = 0.05
minChangeLogM: float = 1e-08
class pysep.io.nml.physics.paramConstruct.SSTANSARDd(SS1: float = 0.9828, SS2: float = 1.0485, SS3: float = 0.9815, SS4: float = 0.9241, SS5: float = 1.3818, SS6: float = 1.0542, SS7: float = 1.0, SS8: float = 1.0, SS9: float = 1.0, SS10: float = 1.0, SS11: float = 1.0, SS12: float = 1.0, SS13: float = 1.0, SS14: float = 1.0, SS15: float = 1.0108, SS16: float = 0.7819, SS17: float = 0.2875, SS18: float = 1.0, SS19: float = 1.0)

Bases: object

SS1: float = 0.9828
SS10: float = 1.0
SS11: float = 1.0
SS12: float = 1.0
SS13: float = 1.0
SS14: float = 1.0
SS15: float = 1.0108
SS16: float = 0.7819
SS17: float = 0.2875
SS18: float = 1.0
SS19: float = 1.0
SS2: float = 1.0485
SS3: float = 0.9815
SS4: float = 0.9241
SS5: float = 1.3818
SS6: float = 1.0542
SS7: float = 1.0
SS8: float = 1.0
SS9: float = 1.0
as_list() list

Return a list representation of SSTANSARD

Returns

outList – list in the correct order for DSEP to interpet

Return type

list[float]

class pysep.io.nml.physics.paramConstruct.TCUTd(lowTempCuttoffAll: float = 6.5, lowTempCuttoffPP: float = 6.5, lowTempCuttoffCNO: float = 6.82, lowTempCuttoffHe: float = 7.73, lowTempCuttoffNuEmission: float = 7.5)

Bases: object

as_list() list

Return a list representation of TCUT

Returns

outList – list in the correct order for DSEP to interpet

Return type

list[float]

lowTempCuttoffAll: float = 6.5
lowTempCuttoffCNO: float = 6.82
lowTempCuttoffHe: float = 7.73
lowTempCuttoffNuEmission: float = 7.5
lowTempCuttoffPP: float = 6.5
class pysep.io.nml.physics.paramConstruct.base(ATMMIN: float = 0.1, ATMBEG: float = 0.1, ATMERR: float = 0.0003, ATMMAX: float = 0.5, ATMD0: float = 1e-10, ANEWCP: pysep.io.nml.physics.paramConstruct.ANEWCPd = ANEWCPd(rs1='   ', rs2='   ', rs3='   ', rs4='   ', rs5='   ', rs6='   ', rs7='   ', rs8='   ', rs9='   ', rs10='   ', rs11='   ', rs12='   '), ATMP: str = 'REL', ACFPFT: float = 1e-36, ATIME: pysep.io.nml.physics.paramConstruct.ATIMEd = ATIMEd(minCentralXBeforeHBurning=0.001, maxChangeXforCoreHBurning=0.02, maxFractionalChangeCentral=0.5, maxChangeYCentral=0.02, maxFractionalChangeYCentral=0.03, maxMassAllowedToBurnInShell=0.0015, maxDepletionInXAtMidpointOfHShell=0.1, maxChangeP=0.005, maxChangeT=0.01, maxChangeR=0.005, maxChangeL=0.005, maxPercentageTimestepChange=0.25, maxFractionalTimestepChange=1.01, maxAbsoluteTimestepChange=- 10000000.0), ALPHAC: float = 0.0, ALPHAE: float = 0.0, ALFA: float = 1.5, ALPHAM: float = 0.0, ATMSTP: float = 0.5, ABSTOL: float = 1e-05, CMIN: float = 1e-20, CLSUN: float = 3.828e+33, CRSUN: float = 69570000000.0, DPENV: float = 1.0, DTDIF: float = 0.01, DTWIND: float = 10.0, DJOK: float = 0.0001, DT_GS: float = 0.1, ENVERR: float = 0.0003, ENVMAX: float = 0.5, ENVMIN: float = 0.1, ENVBEG: float = 0.1, ENVSTP: float = 0.5, ETADH0: float = - 1.0, ETADH1: float = 1.0, FCORR0: float = 0.8, FCORRI: float = 0.1, FK: float = 1.0, FW: float = 1.0, FC: float = 1.0, FO: float = 1.0, FMU: float = 1.0, FES: float = 1.0, FCORE: float = 1.0, FGSF: float = 1.0, FSS: float = 1.0, FESC: float = 1.0, FSSC: float = 1.0, FGSFC: float = 1.0, FGRY: float = 1.0, FGRZ: float = 1.0, GRTOL: float = 1e-08, HTOLER: pysep.io.nml.physics.paramConstruct.HTOLERd = HTOLERd(convCritDeltaLogP=6e-05, convCritDeltaLogT=4.5e-05, convCritDeltaLLsun=0.003, convCritHeBurning=9e-05, convTolerLogPLogR=3e-05, maxCorrectionDeltaLogP=0.9, maxCorrectionDeltaLogT=0.5, maxCorrectionDeltaLLsun=0.5, maxCorrectionDeltaR=2.0, convTolerRHSofTL=2.5e-06), ITFP1: int = 5, ITFP2: int = 20, IMAX: int = 11, ITDIF1: int = 1, ITDIF2: int = 1, IES: int = 1, IGSF: int = 1, IMU: int = 1, ILAMBDA: int = 1, IEOS: pysep.io.nml.physics.paramConstruct.IEOSd = IEOSd(if1=1, if2=101, if3=0), KTTAU: int = 0, KEMMAX: int = 50, LCOREL: bool = False, LVFC: bool = False, LDIFZ: bool = False, LNEWCP: bool = False, LKUTHE: bool = False, LOVSTC: bool = False, LOVSTE: bool = False, LOVSTM: bool = False, LROT: bool = False, LNEW0: bool = False, LINSTB: bool = False, LWNEW: bool = False, LJDOT0: bool = False, LENVG: bool = False, LNULOS1: bool = False, LTHOUL: bool = False, LCORE: bool = False, LNEWS: bool = False, LISUN: float = 1.45e-11, LSOLID: bool = False, MCORE: int = 0, NITER1: int = 2, NITER2: int = 20, NITER3: int = 2, NITER4: int = 0, NUSE: int = 7, NITER_GS: int = 10, OPTOL: float = 1e-08, OMEGASUN: float = 2.865e-06, RCRIT: float = 1000.0, RELTOL: float = 0.0001, STOLR0: float = 0.001, SHELLTOL: pysep.io.nml.physics.paramConstruct.SHELLTOLd = SHELLTOLd(minChangeLogM=1e-08, maxChangeLogM=0.08, DeltaXReqToFlag=0.05, DeltaYReqToFlag=1.0, maxDisconX=1.0, maxDisconZ=1.0, dLogPEtxtenBelowOvershootAboveBaseSufraceCZ=0.0, maxdLogPSurfCZAboveFineMeshZone=0.05, maxChangeLLsun=0.02, maxdLogPInFineMeshZone=0.05, maxdLogPBelowSurfCZBelowFineMeshZone=0.05, maxdLogOmega=0.1), TCUT: pysep.io.nml.physics.paramConstruct.TCUTd = TCUTd(lowTempCuttoffAll=6.5, lowTempCuttoffPP=6.5, lowTempCuttoffCNO=6.82, lowTempCuttoffHe=7.73, lowTempCuttoffNuEmission=7.5), TSCUT: float = 6.0, TENV0: float = 3.0, TENV1: float = 9.0, TGCUT: float = 6.9, TRIDT: float = 0.01, TRIDL: float = 0.08, TOLLFK: float = 0.0001, TOLLFC: float = 0.0001, WALPCZ: float = 0.0, WNEW: float = 0.0, XMIN: float = 0.001, YMIN: float = 0.001, SSTANSARD: pysep.io.nml.physics.paramConstruct.SSTANSARDd = SSTANSARDd(SS1=0.9828, SS2=1.0485, SS3=0.9815, SS4=0.9241, SS5=1.3818, SS6=1.0542, SS7=1.0, SS8=1.0, SS9=1.0, SS10=1.0, SS11=1.0, SS12=1.0, SS13=1.0, SS14=1.0, SS15=1.0108, SS16=0.7819, SS17=0.2875, SS18=1.0, SS19=1.0), WEAKSCREENING: float = 0.03, LDIFAD: int = False, LNOJ: int = False, SENV0A: int = False, ZENV0: float = 0.02, LSTORE: int = False, NPENV: int = 20, NPRTPT: int = 1, NMODLS: int = 1, NBN: float = 1.0, RSCLCM: float = 1.0, ZSI: float = 0.0, HPTTOL: int = 1, XNEWCP: int = False, LPTIME: int = True, CMIXL: float = 1.72, BETAC: float = 0.0, LADOV: int = False, LEXCOM: int = False, LPULSE: int = False, IPVER: int = 2, LDIFY: int = False, LSNU: int = False, LTHOULFIT: int = False, LDH: int = False, LSEMIC: int = False, LISO: int = False, LNULOS2: int = False, LOPALE: int = False, IAFE: int = 0, LSCV: int = False, LZAMFIT: int = True, LHAFT: int = False, LOPCOEF: int = False, FO95COBIN: str = '/Users/aaron/dsep/run/OPAL_GS98.bin', LHB: int = False, LFREE_EOS: int = False, LUSENEWPHX: int = False)

Bases: object

ABSTOL: float = 1e-05
ACFPFT: float = 1e-36
ALFA: float = 1.5
ALPHAC: float = 0.0
ALPHAE: float = 0.0
ALPHAM: float = 0.0
ANEWCP: pysep.io.nml.physics.paramConstruct.ANEWCPd = ANEWCPd(rs1='   ', rs2='   ', rs3='   ', rs4='   ', rs5='   ', rs6='   ', rs7='   ', rs8='   ', rs9='   ', rs10='   ', rs11='   ', rs12='   ')
ATIME: pysep.io.nml.physics.paramConstruct.ATIMEd = ATIMEd(minCentralXBeforeHBurning=0.001, maxChangeXforCoreHBurning=0.02, maxFractionalChangeCentral=0.5, maxChangeYCentral=0.02, maxFractionalChangeYCentral=0.03, maxMassAllowedToBurnInShell=0.0015, maxDepletionInXAtMidpointOfHShell=0.1, maxChangeP=0.005, maxChangeT=0.01, maxChangeR=0.005, maxChangeL=0.005, maxPercentageTimestepChange=0.25, maxFractionalTimestepChange=1.01, maxAbsoluteTimestepChange=-10000000.0)
ATMBEG: float = 0.1
ATMD0: float = 1e-10
ATMERR: float = 0.0003
ATMMAX: float = 0.5
ATMMIN: float = 0.1
ATMP: str = 'REL'
ATMSTP: float = 0.5
BETAC: float = 0.0
CLSUN: float = 3.828e+33
CMIN: float = 1e-20
CMIXL: float = 1.72
CRSUN: float = 69570000000.0
DJOK: float = 0.0001
DPENV: float = 1.0
DTDIF: float = 0.01
DTWIND: float = 10.0
DT_GS: float = 0.1
ENVBEG: float = 0.1
ENVERR: float = 0.0003
ENVMAX: float = 0.5
ENVMIN: float = 0.1
ENVSTP: float = 0.5
ETADH0: float = -1.0
ETADH1: float = 1.0
FC: float = 1.0
FCORE: float = 1.0
FCORR0: float = 0.8
FCORRI: float = 0.1
FES: float = 1.0
FESC: float = 1.0
FGRY: float = 1.0
FGRZ: float = 1.0
FGSF: float = 1.0
FGSFC: float = 1.0
FK: float = 1.0
FMU: float = 1.0
FO: float = 1.0
FO95COBIN: str = '/Users/aaron/dsep/run/OPAL_GS98.bin'
FSS: float = 1.0
FSSC: float = 1.0
FW: float = 1.0
GRTOL: float = 1e-08
HPTTOL: int = 1
HTOLER: pysep.io.nml.physics.paramConstruct.HTOLERd = HTOLERd(convCritDeltaLogP=6e-05, convCritDeltaLogT=4.5e-05, convCritDeltaLLsun=0.003, convCritHeBurning=9e-05, convTolerLogPLogR=3e-05, maxCorrectionDeltaLogP=0.9, maxCorrectionDeltaLogT=0.5, maxCorrectionDeltaLLsun=0.5, maxCorrectionDeltaR=2.0, convTolerRHSofTL=2.5e-06)
IAFE: int = 0
IEOS: pysep.io.nml.physics.paramConstruct.IEOSd = IEOSd(if1=1, if2=101, if3=0)
IES: int = 1
IGSF: int = 1
ILAMBDA: int = 1
IMAX: int = 11
IMU: int = 1
IPVER: int = 2
ITDIF1: int = 1
ITDIF2: int = 1
ITFP1: int = 5
ITFP2: int = 20
KEMMAX: int = 50
KTTAU: int = 0
LADOV: int = False
LCORE: bool = False
LCOREL: bool = False
LDH: int = False
LDIFAD: int = False
LDIFY: int = False
LDIFZ: bool = False
LENVG: bool = False
LEXCOM: int = False
LFREE_EOS: int = False
LHAFT: int = False
LHB: int = False
LINSTB: bool = False
LISO: int = False
LISUN: float = 1.45e-11
LJDOT0: bool = False
LKUTHE: bool = False
LNEW0: bool = False
LNEWCP: bool = False
LNEWS: bool = False
LNOJ: int = False
LNULOS1: bool = False
LNULOS2: int = False
LOPALE: int = False
LOPCOEF: int = False
LOVSTC: bool = False
LOVSTE: bool = False
LOVSTM: bool = False
LPTIME: int = True
LPULSE: int = False
LROT: bool = False
LSCV: int = False
LSEMIC: int = False
LSNU: int = False
LSOLID: bool = False
LSTORE: int = False
LTHOUL: bool = False
LTHOULFIT: int = False
LUSENEWPHX: int = False
LVFC: bool = False
LWNEW: bool = False
LZAMFIT: int = True
MCORE: int = 0
NBN: float = 1.0
NITER1: int = 2
NITER2: int = 20
NITER3: int = 2
NITER4: int = 0
NITER_GS: int = 10
NMODLS: int = 1
NPENV: int = 20
NPRTPT: int = 1
NUSE: int = 7
OMEGASUN: float = 2.865e-06
OPTOL: float = 1e-08
RCRIT: float = 1000.0
RELTOL: float = 0.0001
RSCLCM: float = 1.0
SENV0A: int = False
SHELLTOL: pysep.io.nml.physics.paramConstruct.SHELLTOLd = SHELLTOLd(minChangeLogM=1e-08, maxChangeLogM=0.08, DeltaXReqToFlag=0.05, DeltaYReqToFlag=1.0, maxDisconX=1.0, maxDisconZ=1.0, dLogPEtxtenBelowOvershootAboveBaseSufraceCZ=0.0, maxdLogPSurfCZAboveFineMeshZone=0.05, maxChangeLLsun=0.02, maxdLogPInFineMeshZone=0.05, maxdLogPBelowSurfCZBelowFineMeshZone=0.05, maxdLogOmega=0.1)
SSTANSARD: pysep.io.nml.physics.paramConstruct.SSTANSARDd = SSTANSARDd(SS1=0.9828, SS2=1.0485, SS3=0.9815, SS4=0.9241, SS5=1.3818, SS6=1.0542, SS7=1.0, SS8=1.0, SS9=1.0, SS10=1.0, SS11=1.0, SS12=1.0, SS13=1.0, SS14=1.0, SS15=1.0108, SS16=0.7819, SS17=0.2875, SS18=1.0, SS19=1.0)
STOLR0: float = 0.001
TCUT: pysep.io.nml.physics.paramConstruct.TCUTd = TCUTd(lowTempCuttoffAll=6.5, lowTempCuttoffPP=6.5, lowTempCuttoffCNO=6.82, lowTempCuttoffHe=7.73, lowTempCuttoffNuEmission=7.5)
TENV0: float = 3.0
TENV1: float = 9.0
TGCUT: float = 6.9
TOLLFC: float = 0.0001
TOLLFK: float = 0.0001
TRIDL: float = 0.08
TRIDT: float = 0.01
TSCUT: float = 6.0
WALPCZ: float = 0.0
WEAKSCREENING: float = 0.03
WNEW: float = 0.0
XMIN: float = 0.001
XNEWCP: int = False
YMIN: float = 0.001
ZENV0: float = 0.02
ZSI: float = 0.0
as_dict() dict
class pysep.io.nml.physics.paramConstruct.lowmass(ATMMIN: float = 0.015, ATMBEG: float = 0.015, ATMERR: float = 1e-05, ATMMAX: float = 0.05, ATMD0: float = 1e-10, ANEWCP: str = '   ', ATMP: str = 'REL', ACFPFT: float = 1e-36, ATIME: pysep.io.nml.physics.paramConstruct.ATIMEd = ATIMEd(minCentralXBeforeHBurning=0.0001, maxChangeXforCoreHBurning=0.02, maxFractionalChangeCentral=0.2, maxChangeYCentral=0.02, maxFractionalChangeYCentral=0.03, maxMassAllowedToBurnInShell=0.0015, maxDepletionInXAtMidpointOfHShell=0.1, maxChangeP=0.02, maxChangeT=0.4, maxChangeR=0.02, maxChangeL=0.02, maxPercentageTimestepChange=0.25, maxFractionalTimestepChange=1.01, maxAbsoluteTimestepChange=- 10000000.0), ALPHAC: float = 0.0, ALPHAE: float = 0.0, ALFA: float = 1.5, ALPHAM: float = 0.0, ATMSTP: float = 0.01, ABSTOL: float = 1e-06, CMIN: float = 1e-20, CLSUN: float = 3.8418e+33, CRSUN: float = 69598000000.0, DPENV: float = 1.0, DTDIF: float = 0.01, DTWIND: float = 10.0, DJOK: float = 0.0001, DT_GS: float = 0.1, ENVERR: float = 1e-05, ENVMAX: float = 0.05, ENVMIN: float = 0.015, ENVBEG: float = 0.015, ENVSTP: float = 0.01, ETADH0: float = - 1.0, ETADH1: float = 1.0, FCORR0: float = 0.8, FCORRI: float = 0.1, FK: float = 1.0, FW: float = 1.0, FC: float = 1.0, FO: float = 1.0, FMU: float = 1.0, FES: float = 1.0, FCORE: float = 1.0, FGSF: float = 1.0, FSS: float = 1.0, FESC: float = 1.0, FSSC: float = 1.0, FGSFC: float = 1.0, FGRY: float = 1.0, FGRZ: float = 1.0, GRTOL: float = 2e-07, HTOLER: pysep.io.nml.physics.paramConstruct.HTOLERd = HTOLERd(convCritDeltaLogP=6e-05, convCritDeltaLogT=4.5e-05, convCritDeltaLLsun=0.003, convCritHeBurning=9e-05, convTolerLogPLogR=3e-05, maxCorrectionDeltaLogP=90000.0, maxCorrectionDeltaLogT=50000.0, maxCorrectionDeltaLLsun=50000.0, maxCorrectionDeltaR=50000000000.0, convTolerRHSofTL=2.5e-06), ITFP1: int = 5, ITFP2: int = 20, IMAX: int = 11, ITDIF1: int = 1, ITDIF2: int = 1, IES: int = 1, IGSF: int = 1, IMU: int = 1, ILAMBDA: int = 4, IEOS: pysep.io.nml.physics.paramConstruct.IEOSd = IEOSd(if1=1, if2=101, if3=0), KTTAU: int = 0, KEMMAX: int = 50, LCOREL: bool = True, LVFC: bool = False, LDIFZ: bool = False, LNEWCP: bool = False, LKUTHE: bool = False, LOVSTC: bool = False, LOVSTE: bool = True, LOVSTM: bool = False, LROT: bool = False, LNEW0: bool = True, LINSTB: bool = False, LWNEW: bool = False, LJDOT0: bool = False, LENVG: bool = False, LNULOS1: bool = True, LTHOUL: bool = False, LCORE: bool = False, LNEWS: bool = True, LISUN: float = 1.45e-11, LSOLID: bool = False, MCORE: int = 1, NITER1: int = 2, NITER2: int = 40, NITER3: int = 0, NITER4: int = 0, NUSE: int = 7, NITER_GS: int = 10, OPTOL: float = 1e-08, OMEGASUN: float = 2.865e-06, RCRIT: float = 1000.0, RELTOL: float = 1e-05, STOLR0: float = 1e-07, SHELLTOL: pysep.io.nml.physics.paramConstruct.SHELLTOLd = SHELLTOLd(minChangeLogM=1e-10, maxChangeLogM=0.05, DeltaXReqToFlag=0.02, DeltaYReqToFlag=1.0, maxDisconX=1.0, maxDisconZ=1.0, dLogPEtxtenBelowOvershootAboveBaseSufraceCZ=0.0, maxdLogPSurfCZAboveFineMeshZone=0.01, maxChangeLLsun=0.01, maxdLogPInFineMeshZone=0.02, maxdLogPBelowSurfCZBelowFineMeshZone=0.02, maxdLogOmega=0.1), TCUT: pysep.io.nml.physics.paramConstruct.TCUTd = TCUTd(lowTempCuttoffAll=6.5, lowTempCuttoffPP=6.5, lowTempCuttoffCNO=6.82, lowTempCuttoffHe=7.73, lowTempCuttoffNuEmission=7.5), TSCUT: float = 6.0, TENV0: float = 3.0, TENV1: float = 9.0, TGCUT: float = 6.9, TRIDT: float = 0.001, TRIDL: float = 8000.0, TOLLFK: float = 0.0001, TOLLFC: float = 0.0001, WALPCZ: float = 0.0, WNEW: float = 0.0, XMIN: float = 0.001, YMIN: float = 0.001, SSTANSARD: pysep.io.nml.physics.paramConstruct.SSTANSARDd = SSTANSARDd(SS1=0.9681, SS2=1.0058, SS3=1.0, SS4=0.8966, SS5=1.2727, SS6=0.512, SS7=0.9894, SS8=1.0, SS9=1.0, SS10=1.0, SS11=1.0, SS12=1.0, SS13=1.0, SS14=1.0, SS15=1.0, SS16=0.8642, SS17=0.2875, SS18=1.0, SS19=1.0), WEAKSCREENING: float = 0.03, LDIFAD: int = False, LNOJ: int = False, SENV0A: int = False, ZENV0: float = 0.02, LSTORE: int = False, NPENV: int = 20, NPRTPT: int = 1, NMODLS: int = 1, NBN: float = 1.0, RSCLCM: float = 1.0, ZSI: float = 0.0, HPTTOL: int = 1, XNEWCP: int = 13, LPTIME: bool = True, CMIXL: float = 1.72, BETAC: float = 0.0, LADOV: int = False, LEXCOM: bool = False, LPULSE: int = False, IPVER: int = 2, LDIFY: bool = True, LSNU: bool = True, LTHOULFIT: bool = False, LDH: bool = True, LSEMIC: bool = False, LISO: int = False, LNULOS2: bool = True, LOPALE: bool = False, IAFE: int = 0, LSCV: int = False, LZAMFIT: int = True, LHAFT: bool = True, LOPCOEF: int = False, FO95COBIN: str = '/Users/aaron/dsep/run/OPAL_GS98.bin', LHB: int = False, LFREE_EOS: bool = True, LUSENEWPHX: int = False, LFIFZ: bool = True)

Bases: pysep.io.nml.physics.paramConstruct.solar

KTTAU: int = 0
LFREE_EOS: bool = True
LNEW0: bool = True
LOVSTC: bool = False
LOVSTE: bool = True
class pysep.io.nml.physics.paramConstruct.solar(ATMMIN: float = 0.015, ATMBEG: float = 0.015, ATMERR: float = 1e-05, ATMMAX: float = 0.05, ATMD0: float = 1e-10, ANEWCP: str = '   ', ATMP: str = 'REL', ACFPFT: float = 1e-36, ATIME: pysep.io.nml.physics.paramConstruct.ATIMEd = ATIMEd(minCentralXBeforeHBurning=0.0001, maxChangeXforCoreHBurning=0.02, maxFractionalChangeCentral=0.2, maxChangeYCentral=0.02, maxFractionalChangeYCentral=0.03, maxMassAllowedToBurnInShell=0.0015, maxDepletionInXAtMidpointOfHShell=0.1, maxChangeP=0.02, maxChangeT=0.4, maxChangeR=0.02, maxChangeL=0.02, maxPercentageTimestepChange=0.25, maxFractionalTimestepChange=1.01, maxAbsoluteTimestepChange=- 10000000.0), ALPHAC: float = 0.0, ALPHAE: float = 0.0, ALFA: float = 1.5, ALPHAM: float = 0.0, ATMSTP: float = 0.01, ABSTOL: float = 1e-06, CMIN: float = 1e-20, CLSUN: float = 3.8418e+33, CRSUN: float = 69598000000.0, DPENV: float = 1.0, DTDIF: float = 0.01, DTWIND: float = 10.0, DJOK: float = 0.0001, DT_GS: float = 0.1, ENVERR: float = 1e-05, ENVMAX: float = 0.05, ENVMIN: float = 0.015, ENVBEG: float = 0.015, ENVSTP: float = 0.01, ETADH0: float = - 1.0, ETADH1: float = 1.0, FCORR0: float = 0.8, FCORRI: float = 0.1, FK: float = 1.0, FW: float = 1.0, FC: float = 1.0, FO: float = 1.0, FMU: float = 1.0, FES: float = 1.0, FCORE: float = 1.0, FGSF: float = 1.0, FSS: float = 1.0, FESC: float = 1.0, FSSC: float = 1.0, FGSFC: float = 1.0, FGRY: float = 1.0, FGRZ: float = 1.0, GRTOL: float = 2e-07, HTOLER: pysep.io.nml.physics.paramConstruct.HTOLERd = HTOLERd(convCritDeltaLogP=6e-05, convCritDeltaLogT=4.5e-05, convCritDeltaLLsun=0.003, convCritHeBurning=9e-05, convTolerLogPLogR=3e-05, maxCorrectionDeltaLogP=90000.0, maxCorrectionDeltaLogT=50000.0, maxCorrectionDeltaLLsun=50000.0, maxCorrectionDeltaR=50000000000.0, convTolerRHSofTL=2.5e-06), ITFP1: int = 5, ITFP2: int = 20, IMAX: int = 11, ITDIF1: int = 1, ITDIF2: int = 1, IES: int = 1, IGSF: int = 1, IMU: int = 1, ILAMBDA: int = 4, IEOS: pysep.io.nml.physics.paramConstruct.IEOSd = IEOSd(if1=1, if2=101, if3=0), KTTAU: int = 5, KEMMAX: int = 50, LCOREL: bool = True, LVFC: bool = False, LDIFZ: bool = False, LNEWCP: bool = False, LKUTHE: bool = False, LOVSTC: bool = True, LOVSTE: bool = False, LOVSTM: bool = False, LROT: bool = False, LNEW0: bool = False, LINSTB: bool = False, LWNEW: bool = False, LJDOT0: bool = False, LENVG: bool = False, LNULOS1: bool = True, LTHOUL: bool = False, LCORE: bool = False, LNEWS: bool = True, LISUN: float = 1.45e-11, LSOLID: bool = False, MCORE: int = 1, NITER1: int = 2, NITER2: int = 40, NITER3: int = 0, NITER4: int = 0, NUSE: int = 7, NITER_GS: int = 10, OPTOL: float = 1e-08, OMEGASUN: float = 2.865e-06, RCRIT: float = 1000.0, RELTOL: float = 1e-05, STOLR0: float = 1e-07, SHELLTOL: pysep.io.nml.physics.paramConstruct.SHELLTOLd = SHELLTOLd(minChangeLogM=1e-10, maxChangeLogM=0.05, DeltaXReqToFlag=0.02, DeltaYReqToFlag=1.0, maxDisconX=1.0, maxDisconZ=1.0, dLogPEtxtenBelowOvershootAboveBaseSufraceCZ=0.0, maxdLogPSurfCZAboveFineMeshZone=0.01, maxChangeLLsun=0.01, maxdLogPInFineMeshZone=0.02, maxdLogPBelowSurfCZBelowFineMeshZone=0.02, maxdLogOmega=0.1), TCUT: pysep.io.nml.physics.paramConstruct.TCUTd = TCUTd(lowTempCuttoffAll=6.5, lowTempCuttoffPP=6.5, lowTempCuttoffCNO=6.82, lowTempCuttoffHe=7.73, lowTempCuttoffNuEmission=7.5), TSCUT: float = 6.0, TENV0: float = 3.0, TENV1: float = 9.0, TGCUT: float = 6.9, TRIDT: float = 0.001, TRIDL: float = 8000.0, TOLLFK: float = 0.0001, TOLLFC: float = 0.0001, WALPCZ: float = 0.0, WNEW: float = 0.0, XMIN: float = 0.001, YMIN: float = 0.001, SSTANSARD: pysep.io.nml.physics.paramConstruct.SSTANSARDd = SSTANSARDd(SS1=0.9681, SS2=1.0058, SS3=1.0, SS4=0.8966, SS5=1.2727, SS6=0.512, SS7=0.9894, SS8=1.0, SS9=1.0, SS10=1.0, SS11=1.0, SS12=1.0, SS13=1.0, SS14=1.0, SS15=1.0, SS16=0.8642, SS17=0.2875, SS18=1.0, SS19=1.0), WEAKSCREENING: float = 0.03, LDIFAD: int = False, LNOJ: int = False, SENV0A: int = False, ZENV0: float = 0.02, LSTORE: int = False, NPENV: int = 20, NPRTPT: int = 1, NMODLS: int = 1, NBN: float = 1.0, RSCLCM: float = 1.0, ZSI: float = 0.0, HPTTOL: int = 1, XNEWCP: int = 13, LPTIME: bool = True, CMIXL: float = 1.72, BETAC: float = 0.0, LADOV: int = False, LEXCOM: bool = False, LPULSE: int = False, IPVER: int = 2, LDIFY: bool = True, LSNU: bool = True, LTHOULFIT: bool = False, LDH: bool = True, LSEMIC: bool = False, LISO: int = False, LNULOS2: bool = True, LOPALE: bool = False, IAFE: int = 0, LSCV: int = False, LZAMFIT: int = True, LHAFT: bool = True, LOPCOEF: int = False, FO95COBIN: str = '/Users/aaron/dsep/run/OPAL_GS98.bin', LHB: int = False, LFREE_EOS: bool = False, LUSENEWPHX: int = False, LFIFZ: bool = True)

Bases: pysep.io.nml.physics.paramConstruct.base

ABSTOL: float = 1e-06
ANEWCP: str = '   '
ATIME: pysep.io.nml.physics.paramConstruct.ATIMEd = ATIMEd(minCentralXBeforeHBurning=0.0001, maxChangeXforCoreHBurning=0.02, maxFractionalChangeCentral=0.2, maxChangeYCentral=0.02, maxFractionalChangeYCentral=0.03, maxMassAllowedToBurnInShell=0.0015, maxDepletionInXAtMidpointOfHShell=0.1, maxChangeP=0.02, maxChangeT=0.4, maxChangeR=0.02, maxChangeL=0.02, maxPercentageTimestepChange=0.25, maxFractionalTimestepChange=1.01, maxAbsoluteTimestepChange=-10000000.0)
ATMBEG: float = 0.015
ATMD0: float = 1e-10
ATMERR: float = 1e-05
ATMMAX: float = 0.05
ATMMIN: float = 0.015
ATMP: str = 'REL'
ATMSTP: float = 0.01
CLSUN: float = 3.8418e+33
CMIN: float = 1e-20
CRSUN: float = 69598000000.0
DPENV: float = 1.0
DT_GS: float = 0.1
ENVBEG: float = 0.015
ENVERR: float = 1e-05
ENVMAX: float = 0.05
ENVMIN: float = 0.015
ENVSTP: float = 0.01
ETADH0: float = -1.0
ETADH1: float = 1.0
FCORE: float = 1.0
FCORR0: float = 0.8
FCORRI: float = 0.1
FGRY: float = 1.0
FGRZ: float = 1.0
GRTOL: float = 2e-07
HTOLER: pysep.io.nml.physics.paramConstruct.HTOLERd = HTOLERd(convCritDeltaLogP=6e-05, convCritDeltaLogT=4.5e-05, convCritDeltaLLsun=0.003, convCritHeBurning=9e-05, convTolerLogPLogR=3e-05, maxCorrectionDeltaLogP=90000.0, maxCorrectionDeltaLogT=50000.0, maxCorrectionDeltaLLsun=50000.0, maxCorrectionDeltaR=50000000000.0, convTolerRHSofTL=2.5e-06)
IEOS: pysep.io.nml.physics.paramConstruct.IEOSd = IEOSd(if1=1, if2=101, if3=0)
ILAMBDA: int = 4
IMAX: int = 11
KEMMAX: int = 50
KTTAU: int = 5
LCORE: bool = False
LCOREL: bool = True
LDH: bool = True
LDIFY: bool = True
LENVG: bool = False
LEXCOM: bool = False
LFIFZ: bool = True
LFREE_EOS: bool = False
LHAFT: bool = True
LNEW0: bool = False
LNEWCP: bool = False
LNEWS: bool = True
LNULOS1: bool = True
LNULOS2: bool = True
LOPALE: bool = False
LOVSTC: bool = True
LOVSTE: bool = False
LOVSTM: bool = False
LPTIME: bool = True
LSEMIC: bool = False
LSNU: bool = True
LTHOULFIT: bool = False
MCORE: int = 1
NITER1: int = 2
NITER2: int = 40
NITER3: int = 0
NITER4: int = 0
NITER_GS: int = 10
NUSE: int = 7
OPTOL: float = 1e-08
RELTOL: float = 1e-05
SHELLTOL: pysep.io.nml.physics.paramConstruct.SHELLTOLd = SHELLTOLd(minChangeLogM=1e-10, maxChangeLogM=0.05, DeltaXReqToFlag=0.02, DeltaYReqToFlag=1.0, maxDisconX=1.0, maxDisconZ=1.0, dLogPEtxtenBelowOvershootAboveBaseSufraceCZ=0.0, maxdLogPSurfCZAboveFineMeshZone=0.01, maxChangeLLsun=0.01, maxdLogPInFineMeshZone=0.02, maxdLogPBelowSurfCZBelowFineMeshZone=0.02, maxdLogOmega=0.1)
SSTANSARD: pysep.io.nml.physics.paramConstruct.SSTANSARDd = SSTANSARDd(SS1=0.9681, SS2=1.0058, SS3=1.0, SS4=0.8966, SS5=1.2727, SS6=0.512, SS7=0.9894, SS8=1.0, SS9=1.0, SS10=1.0, SS11=1.0, SS12=1.0, SS13=1.0, SS14=1.0, SS15=1.0, SS16=0.8642, SS17=0.2875, SS18=1.0, SS19=1.0)
STOLR0: float = 1e-07
TENV0: float = 3.0
TENV1: float = 9.0
TGCUT: float = 6.9
TRIDL: float = 8000.0
TRIDT: float = 0.001
TSCUT: float = 6.0
XMIN: float = 0.001
XNEWCP: int = 13
YMIN: float = 0.001

pysep.io.nml.physics.physics module

Author: Thomas M. Boudreaux

Created: April 2021

Last Modified: June 2021

Module to handel both dsep run (cards in the control namelist file) as well as the entire control namelist file.

Classes

pnml

physics namelist file object. These can be made up of up to 50 crun objects along with a number of attributes not tied into a crun object.

pysep.io.nml.physics.physics.load(path: str) pysep.io.nml.physics.physics.pnml

Load a physics namelist file from disk (note that this loads a fortran physics namelist file into a pnml object, NOT a pickeled pnml object back into memory, for that use pickle.load)

Parameters

path (str) – Path to physics namelist file to load.

Returns

Physics namelist file loaded from disk.

Return type

pysep.io.nml.physics.pnml

class pysep.io.nml.physics.physics.pnml(unit=13, **kwargs)

Bases: object

Physics namelist file object representation. This object is the equivilent to the physics namelist file used when running dsep. It can represent all the same information which a physics namelist file representes. Moreover, it can be written to disk in the form of a fortran namelist file so that dsep can read it in. Because it is a python object though it can also be programatically modified and tested.

When writing to disk (for symlinking) pnml will write a namelist file to a temporaty file in /var/tmp and then symbolically link a unit file in the current working directory to that temporary file. Therefore, the actual physics namelist file will be deleted when the pnml instance goes out of scope. To combat this you can explicitly save a namelist representation of the pnml to disk using the save method.

Finally, when pickled, if the pnml has been locally symlinked (and therefore has open a temporary file) that file will be explicitly deleted as file objects cannot be pickled. Therefore you cannot symlink a pnml object, pickle it, load it, and start back where you were. You have to symlink it again after loading the pickle dump.

unit

The unit number to symbolically link the control namelist file to.

Type

int, default=14

dsepAttrs

Dictionary of all the different attributes which the physics namelist file can store. These are stored as key value pairs with the key being the variale name and the value being the variable value. These are passed to the constructor as an arbitrary number of keyword arguments which will all (aside from unit) become key value pairs in the dsepAttrs dictionary.

Type

dict of control namelist file key value pairs

add_key(key: str, value)

Add a new key to physics namelist. If the key is not created then create it if the key is already present raise an error. All keys will be made lowercase to match FORTRANs case insensitivity.

Parameters
  • key (str) – The name of any class instance attribute which is defined. Case insensitive (will be made lower case automatically).

  • value – Any data to store in the class instance attribute named key

Returns

Return type

None

Raises

KeyError – If key is already in the kind card

as_dict(generalizePaths=False) dict

Get a dictionary representation of the physics namelist file object

Parameters

generalizePaths (bool, default=False) – This does not do anything, but is included as a function argument to maintain compatibility with pysep.io.nml.control.cnml

Returns

dictRepr – Dictionary representation.

Return type

dict

If already locally symlinked then remove the unit file fort.<unit> and set the state of the cnml instance to no longer be locally symlinked.

copy() pysep.io.nml.physics.physics.pnml

Return a deep copy of the pnml object

Returns

newOne – Deep Copy of the parent pnml object.

Return type

pysep.io.nml.physics.pnml

Symbolically link the physics namelist file to the correct unit file in the current working directory. Instead of saving the pnml file to the current working directory or some user defined path, this function saves the pnml file to a NamedTemporaryFile in /var/tmp (on a linux machine at least). This has the advantage of not cluttering up the local directory as well as automatically deleting the nml file after you send the pnml object out of scope. Once the temporary file has been opned f90nml writes the dicitonary version of the data stored in this object to it. Finally that temporary file is symbolically linked to fort.<unit> in the current working directory.

Because we need to keep the file object in scope as long as we want to be able to access the namelist file, the file object is stored as a class attribute, f.

If a file or symlink called fort.<unit> already exists in the current working directory when this method is called it will be deleted and replaced with the symbolic link created by this method.

Raises

OSError – If the NamedTemporaryFile was unable to be properly opened.

save(path: str) bool

Save pnml file as a fortran namelist file to disk.

Parameters

path (str) – Path to save namelist file to. If path exists already it will be overwritten.

Returns

Check whether namelist file was creates sucessfully. Will be true if file exists and false if it was not able to be creates.

Return type

bool

update_key(key: str, value, overwright: bool = True)

update a key in a physics namelist file. By default if the key is already present overwrite it. If the key is not present automatically add it. If overwright is set to false then this will only allow you to add keys (in that case its behavior becomes the same as add_key)

Parameters
  • key (str) – The name of any class instance attribute which is defined.

  • value – Any data to store in the class instance attribute named key

  • overwright (bool, default = True) – if true then if the key already exists overwright it, if false prevent this from happening. If this is true then the old value of the key will be returne from the function. If this is false then None will be returned from the function.

Returns

if overwright is true and the key is in the physics namelist already then the Value which was overwritten will be returned.

Return type

OldValue

pysep.io.nml.physics.utils module

Author: Thomas M. Boudreaux

Created: September 2021

Last Modified: September 2021

Utility Functions for converting pnml to dictionary and back

Functions

  • pnml_from_dict

    Return a pnml object from a dictionary.

pysep.io.nml.physics.utils.pnml_from_dict(params: dict) pysep.io.nml.physics.physics.pnml

Return a cnml object from a dictionary.

Parameters

params (dict) – Dictionary containing all the required information to rebuild the cnml object, including a list of all the crun dictionaries.

Returns

outCnml – cnml object

Return type

pysep.io.nml.physics.physics.cnml

Module contents