Skip to content

Commit

Permalink
More updates that fix floating point errors and more tests of envelop…
Browse files Browse the repository at this point in the history
…e loss.
  • Loading branch information
Rory Barnes committed Apr 16, 2024
1 parent a5a17ff commit aeb051a
Show file tree
Hide file tree
Showing 10 changed files with 480 additions and 1 deletion.
25 changes: 25 additions & 0 deletions tests/Atmesc/HydELimConstXUVLopez12/planet.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sName planet # Body's name
saModules atmesc # Active modules

# Physical Parameters
dMass -2.0 # Mass, negative -> Earth masses
sPlanetRadiusModel lopez12 # Mass-radius model
dRadGyra 0.4 # Radius of gyration; ang. mom. coeff.
dAge 1.0e6 # Age [yr]

# ATMESC Parameters
dFXUV -100 # Incident XUV flux (constant)
dXFrac 1.0 # X-Ray/XUV absorption radius in planet radii
dAtmXAbsEffH 0.1 # H X-ray/XUV absorption efficiency (epsilon)
dSurfWaterMass 0.0 # Initial water mass, negative -> Earth oceans
dEnvelopeMass -1.0 # Initial H envelope mass, negative -> Earth Mass
bInstantO2Sink 0 # Is Oxygen instantly absorbed by the surface?
bHaltSurfaceDesiccated 0 # Halt when dry?
bHaltEnvelopeGone 0 # Halt when H enevlope evaporated?
dJeansTime -12.0 # Time when flow transitions to ballistic escape (Gyr)
bUseEnergyLimited 1 # Is the flow energy-limited?
bUseRRLimited 0 # Is the flow radiation/recombination-limited?
bUseBondiLimited 0 # Is the flow Bondi-limited?
bAtmEscAuto 0 # Should atmesc decide the escape regime?

saOutputOrder Time -Mass -EnvelopeMass -PlanetRadius -BondiRadius -RocheRadius DEnvMassDt
119 changes: 119 additions & 0 deletions tests/Atmesc/HydELimConstXUVLopez12/test_HydELimConstXUVLopez12.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
from benchmark import Benchmark, benchmark
import astropy.units as u

@benchmark(
{
"log.initial.system.Age": {"value": 3.155760e+13, "unit": u.sec},
"log.initial.system.Time": {"value": 0.000000, "unit": u.sec},
"log.initial.system.TotAngMom": {"value": 6.108249e+36, "unit": (u.kg * u.m ** 2) / u.sec},
"log.initial.system.TotEnergy": {"value": 1.948502e+32, "unit": u.Joule},
"log.initial.system.PotEnergy": {"value": -2.725202e+31, "unit": u.Joule},
"log.initial.system.KinEnergy": {"value": 2.221022e+32, "unit": u.Joule},
"log.initial.system.DeltaTime": {"value": 0.000000, "unit": u.sec},
"log.initial.planet.Mass": {"value": 2.000000, "unit": u.Mearth},
"log.initial.planet.Radius": {"value": 2.096446e+08, "unit": u.m},
"log.initial.planet.RadGyra": {"value": 0.400000},
"log.initial.planet.BodyType": {"value": 0.000000},
"log.initial.planet.Density": {"value": 0.309474, "unit": u.kg / u.m ** 3},
"log.initial.planet.HZLimitDryRunaway": {"value": -1.000000, "unit": u.m},
"log.initial.planet.HZLimRecVenus": {"value": -1.000000},
"log.initial.planet.HZLimRunaway": {"value": -1.000000},
"log.initial.planet.HZLimMoistGreenhouse": {"value": -1.000000},
"log.initial.planet.HZLimMaxGreenhouse": {"value": -1.000000},
"log.initial.planet.HZLimEarlyMars": {"value": -1.000000},
"log.initial.planet.Instellation": {"value": -1.000000, "unit": u.kg / u.sec ** 3},
"log.initial.planet.MeanMotion": {"value": -1.000000, "unit": 1 / u.sec},
"log.initial.planet.OrbPeriod": {"value": -1.000000, "unit": u.sec},
"log.initial.planet.SemiMajorAxis": {"value": -1.000000, "unit": u.m},
"log.initial.planet.LXUVTot": {"value": -1.000000, "unit": u.kg / u.sec ** 3},
"log.initial.planet.SurfWaterMass": {"value": 0.000000, "unit": u.kg},
"log.initial.planet.EnvelopeMass": {"value": 1.000000, "unit": u.Mearth},
"log.initial.planet.OxygenMass": {"value": 0.000000, "unit": u.kg},
"log.initial.planet.RGLimit": {"value": -1.000000, "unit": u.m},
"log.initial.planet.XO": {"value": 0.000000},
"log.initial.planet.EtaO": {"value": 0.000000},
"log.initial.planet.PlanetRadius": {"value": 32.869442, "unit": u.Rearth},
"log.initial.planet.OxygenMantleMass": {"value": 0.000000, "unit": u.kg},
"log.initial.planet.RadXUV": {"value": -1.000000, "unit": u.m},
"log.initial.planet.RadSolid": {"value": -1.000000, "unit": u.m},
"log.initial.planet.PresXUV": {"value": 5.000000},
"log.initial.planet.ScaleHeight": {"value": -1.000000, "unit": u.m},
"log.initial.planet.ThermTemp": {"value": 400.000000, "unit": u.K},
"log.initial.planet.AtmGasConst": {"value": 4124.000000},
"log.initial.planet.PresSurf": {"value": -1.000000, "unit": u.Pa},
"log.initial.planet.DEnvMassDt": {"value": -3.642099e+11, "unit": u.kg / u.sec},
"log.initial.planet.FXUV": {"value": 100.000000, "unit": u.W / u.m ** 2},
"log.initial.planet.AtmXAbsEffH2O": {"value": 0.300000},
"log.initial.planet.RocheRadius": {"value": 1.626274e+04, "unit": u.Rearth},
"log.initial.planet.BondiRadius": {"value": -1.567865e-07, "unit": u.Rearth},
"log.initial.planet.HEscapeRegime": {"value": 3.000000},
"log.initial.planet.RRCriticalFlux": {"value": 0.013529, "unit": u.W / u.m ** 2},
"log.initial.planet.CrossoverMass": {"value": 0.000000, "unit": u.kg},
"log.initial.planet.WaterEscapeRegime": {"value": 8.000000},
"log.initial.planet.FXUVCRITDRAG": {"value": 3.000221e-05, "unit": u.W / u.m ** 2},
"log.initial.planet.HREFFLUX": {"value": 1.191370e+21, "unit": 1 / u.m ** 2 / u.sec},
"log.initial.planet.XO2": {"value": 0.000000},
"log.initial.planet.XH2O": {"value": 0.000000},
"log.initial.planet.HDiffFlux": {"value": 3.512237e+14, "unit": 1 / u.m ** 2 / u.sec},
"log.initial.planet.HRefODragMod": {"value": 1.000000},
"log.initial.planet.KTide": {"value": 0.996968},
"log.initial.planet.RGDuration": {"value": 1.00000e+06, "unit": u.yr},
"log.final.system.Age": {"value": 6.311520e+13, "unit": u.sec},
"log.final.system.Time": {"value": 3.155760e+13, "unit": u.sec},
"log.final.system.TotAngMom": {"value": 4.448648e+35, "unit": (u.kg * u.m ** 2) / u.sec},
"log.final.system.TotEnergy": {"value": -8.598579e+30, "unit": u.Joule},
"log.final.system.PotEnergy": {"value": -2.477432e+31, "unit": u.Joule},
"log.final.system.KinEnergy": {"value": 1.617574e+31, "unit": u.Joule},
"log.final.system.DeltaTime": {"value": 5.051641e+09, "unit": u.sec},
"log.final.planet.Mass": {"value": 1.140075, "unit": u.Mearth},
"log.final.planet.Radius": {"value": 7.493549e+07, "unit": u.m},
"log.final.planet.RadGyra": {"value": 0.400000},
"log.final.planet.BodyType": {"value": 0.000000},
"log.final.planet.Density": {"value": 3.862918, "unit": u.kg / u.m ** 3},
"log.final.planet.HZLimitDryRunaway": {"value": -1.000000, "unit": u.m},
"log.final.planet.HZLimRecVenus": {"value": -1.000000},
"log.final.planet.HZLimRunaway": {"value": -1.000000},
"log.final.planet.HZLimMoistGreenhouse": {"value": -1.000000},
"log.final.planet.HZLimMaxGreenhouse": {"value": -1.000000},
"log.final.planet.HZLimEarlyMars": {"value": -1.000000},
"log.final.planet.Instellation": {"value": -1.000000, "unit": u.kg / u.sec ** 3},
"log.final.planet.MeanMotion": {"value": -1.000000, "unit": 1 / u.sec},
"log.final.planet.OrbPeriod": {"value": -1.000000, "unit": u.sec},
"log.final.planet.SemiMajorAxis": {"value": -1.000000, "unit": u.m},
"log.final.planet.LXUVTot": {"value": -1.000000, "unit": u.kg / u.sec ** 3},
"log.final.planet.SurfWaterMass": {"value": 0.000000, "unit": u.kg},
"log.final.planet.EnvelopeMass": {"value": 0.140075, "unit": u.Mearth},
"log.final.planet.OxygenMass": {"value": 0.000000, "unit": u.kg},
"log.final.planet.RGLimit": {"value": -1.000000, "unit": u.m},
"log.final.planet.XO": {"value": 0.000000},
"log.final.planet.EtaO": {"value": 0.000000},
"log.final.planet.PlanetRadius": {"value": 11.748874, "unit": u.Rearth},
"log.final.planet.OxygenMantleMass": {"value": 0.000000, "unit": u.kg},
"log.final.planet.RadXUV": {"value": -1.000000, "unit": u.m},
"log.final.planet.RadSolid": {"value": -1.000000, "unit": u.m},
"log.final.planet.PresXUV": {"value": 5.000000},
"log.final.planet.ScaleHeight": {"value": -1.000000, "unit": u.m},
"log.final.planet.ThermTemp": {"value": 400.000000, "unit": u.K},
"log.final.planet.AtmGasConst": {"value": 4124.000000},
"log.final.planet.PresSurf": {"value": -1.000000, "unit": u.Pa},
"log.final.planet.DEnvMassDt": {"value": -2.909361e+10, "unit": u.kg / u.sec},
"log.final.planet.FXUV": {"value": 100.000000, "unit": u.W / u.m ** 2},
"log.final.planet.AtmXAbsEffH2O": {"value": 0.300000},
"log.final.planet.RocheRadius": {"value": 1.626274e+04, "unit": u.Rearth},
"log.final.planet.BondiRadius": {"value": -1.567865e-07, "unit": u.Rearth},
"log.final.planet.HEscapeRegime": {"value": 3.000000},
"log.final.planet.RRCriticalFlux": {"value": 0.096640, "unit": u.W / u.m ** 2},
"log.final.planet.CrossoverMass": {"value": 0.000000, "unit": u.kg},
"log.final.planet.WaterEscapeRegime": {"value": 8.000000},
"log.final.planet.FXUVCRITDRAG": {"value": 0.000213, "unit": u.W / u.m ** 2},
"log.final.planet.HREFFLUX": {"value": 7.455889e+20, "unit": 1 / u.m ** 2 / u.sec},
"log.final.planet.XO2": {"value": 0.000000},
"log.final.planet.XH2O": {"value": 0.000000},
"log.final.planet.HDiffFlux": {"value": 1.567038e+15, "unit": 1 / u.m ** 2 / u.sec},
"log.final.planet.HRefODragMod": {"value": 1.000000},
"log.final.planet.KTide": {"value": 0.998916},
"log.final.planet.RGDuration": {"value": 1.00000e+06, "unit": u.yr},
}
)
class Test_HydELimConstXUVLopez12(Benchmark):
pass
16 changes: 16 additions & 0 deletions tests/Atmesc/HydELimConstXUVLopez12/vpl.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sSystemName system
iVerbose 5
bOverwrite 1
saBodyFiles planet.in
sUnitMass solar
sUnitLength AU
sUnitTime YEARS
sUnitAngle d
bDoLog 1
iDigits 6
dMinValue 1e-10
bDoForward 1
bVarDt 1
dEta 0.01
dStopTime 1e6
dOutputTime 1e6
25 changes: 25 additions & 0 deletions tests/Atmesc/HydELimConstXUVNone/planet.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sName planet # Body's name
saModules atmesc # Active modules

# Physical Parameters
dMass -2.0 # Mass, negative -> Earth masses
sPlanetRadiusModel none # Mass-radius model
dRadGyra 0.4 # Radius of gyration; ang. mom. coeff.
dAge 1.0e6 # Age [yr]

# ATMESC Parameters
dFXUV -100 # Incident XUV flux (constant)
dXFrac 1.0 # X-Ray/XUV absorption radius in planet radii
dAtmXAbsEffH 0.1 # H X-ray/XUV absorption efficiency (epsilon)
dSurfWaterMass 0.0 # Initial water mass, negative -> Earth oceans
dEnvelopeMass -1.0 # Initial H envelope mass, negative -> Earth Mass
bInstantO2Sink 0 # Is Oxygen instantly absorbed by the surface?
bHaltSurfaceDesiccated 0 # Halt when dry?
bHaltEnvelopeGone 0 # Halt when H enevlope evaporated?
dJeansTime -12.0 # Time when flow transitions to ballistic escape (Gyr)
bUseEnergyLimited 1 # Is the flow energy-limited?
bUseRRLimited 0 # Is the flow radiation/recombination-limited?
bUseBondiLimited 0 # Is the flow Bondi-limited?
bAtmEscAuto 0 # Should atmesc decide the escape regime?

saOutputOrder Time -Mass -EnvelopeMass -PlanetRadius -BondiRadius -RocheRadius DEnvMassDt
119 changes: 119 additions & 0 deletions tests/Atmesc/HydELimConstXUVNone/test_HydELimConstXUVNone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
from benchmark import Benchmark, benchmark
import astropy.units as u

@benchmark(
{
"log.initial.system.Age": {"value": 3.155760e+13, "unit": u.sec},
"log.initial.system.Time": {"value": 0.000000, "unit": u.sec},
"log.initial.system.TotAngMom": {"value": 5.653691e+33, "unit": (u.kg * u.m ** 2) / u.sec},
"log.initial.system.TotEnergy": {"value": -8.955530e+32, "unit": u.Joule},
"log.initial.system.PotEnergy": {"value": -8.957586e+32, "unit": u.Joule},
"log.initial.system.KinEnergy": {"value": 2.055740e+29, "unit": u.Joule},
"log.initial.system.DeltaTime": {"value": 0.000000, "unit": u.sec},
"log.initial.planet.Mass": {"value": 2.000000, "unit": u.Mearth},
"log.initial.planet.Radius": {"value": 6.378100e+06, "unit": u.m},
"log.initial.planet.RadGyra": {"value": 0.400000},
"log.initial.planet.BodyType": {"value": 0.000000},
"log.initial.planet.Density": {"value": 1.099008e+04, "unit": u.kg / u.m ** 3},
"log.initial.planet.HZLimitDryRunaway": {"value": -1.000000, "unit": u.m},
"log.initial.planet.HZLimRecVenus": {"value": -1.000000},
"log.initial.planet.HZLimRunaway": {"value": -1.000000},
"log.initial.planet.HZLimMoistGreenhouse": {"value": -1.000000},
"log.initial.planet.HZLimMaxGreenhouse": {"value": -1.000000},
"log.initial.planet.HZLimEarlyMars": {"value": -1.000000},
"log.initial.planet.Instellation": {"value": -1.000000, "unit": u.kg / u.sec ** 3},
"log.initial.planet.MeanMotion": {"value": -1.000000, "unit": 1 / u.sec},
"log.initial.planet.OrbPeriod": {"value": -1.000000, "unit": u.sec},
"log.initial.planet.SemiMajorAxis": {"value": -1.000000, "unit": u.m},
"log.initial.planet.LXUVTot": {"value": -1.000000, "unit": u.kg / u.sec ** 3},
"log.initial.planet.SurfWaterMass": {"value": 0.000000, "unit": u.kg},
"log.initial.planet.EnvelopeMass": {"value": 1.000000, "unit": u.Mearth},
"log.initial.planet.OxygenMass": {"value": 0.000000, "unit": u.kg},
"log.initial.planet.RGLimit": {"value": -1.000000, "unit": u.m},
"log.initial.planet.XO": {"value": 0.000000},
"log.initial.planet.EtaO": {"value": 0.000000},
"log.initial.planet.PlanetRadius": {"value": 1.000000, "unit": u.Rearth},
"log.initial.planet.OxygenMantleMass": {"value": 0.000000, "unit": u.kg},
"log.initial.planet.RadXUV": {"value": -1.000000, "unit": u.m},
"log.initial.planet.RadSolid": {"value": -1.000000, "unit": u.m},
"log.initial.planet.PresXUV": {"value": 5.000000},
"log.initial.planet.ScaleHeight": {"value": -1.000000, "unit": u.m},
"log.initial.planet.ThermTemp": {"value": 400.000000, "unit": u.K},
"log.initial.planet.AtmGasConst": {"value": 4124.000000},
"log.initial.planet.PresSurf": {"value": -1.000000, "unit": u.Pa},
"log.initial.planet.DEnvMassDt": {"value": -1.022577e+07, "unit": u.kg / u.sec},
"log.initial.planet.FXUV": {"value": 100.000000, "unit": u.W / u.m ** 2},
"log.initial.planet.AtmXAbsEffH2O": {"value": 0.300000},
"log.initial.planet.RocheRadius": {"value": 1.626274e+04, "unit": u.Rearth},
"log.initial.planet.BondiRadius": {"value": -1.567865e-07, "unit": u.Rearth},
"log.initial.planet.HEscapeRegime": {"value": 3.000000},
"log.initial.planet.RRCriticalFlux": {"value": 483.281634, "unit": u.W / u.m ** 2},
"log.initial.planet.CrossoverMass": {"value": 0.000000, "unit": u.kg},
"log.initial.planet.WaterEscapeRegime": {"value": 8.000000},
"log.initial.planet.FXUVCRITDRAG": {"value": 1.065443, "unit": u.W / u.m ** 2},
"log.initial.planet.HREFFLUX": {"value": 3.613898e+19, "unit": 1 / u.m ** 2 / u.sec},
"log.initial.planet.XO2": {"value": 0.000000},
"log.initial.planet.XH2O": {"value": 0.000000},
"log.initial.planet.HDiffFlux": {"value": 3.794622e+17, "unit": 1 / u.m ** 2 / u.sec},
"log.initial.planet.HRefODragMod": {"value": 1.000000},
"log.initial.planet.KTide": {"value": 0.999908},
"log.initial.planet.RGDuration": {"value": 1.00000e+06, "unit": u.yr},
"log.final.system.Age": {"value": 6.311520e+13, "unit": u.sec},
"log.final.system.Time": {"value": 3.155760e+13, "unit": u.sec},
"log.final.system.TotAngMom": {"value": 5.653538e+33, "unit": (u.kg * u.m ** 2) / u.sec},
"log.final.system.TotEnergy": {"value": -8.955046e+32, "unit": u.Joule},
"log.final.system.PotEnergy": {"value": -8.957102e+32, "unit": u.Joule},
"log.final.system.KinEnergy": {"value": 2.055685e+29, "unit": u.Joule},
"log.final.system.DeltaTime": {"value": 3.155760e+13, "unit": u.sec},
"log.final.planet.Mass": {"value": 1.999946, "unit": u.Mearth},
"log.final.planet.Radius": {"value": 6.378100e+06, "unit": u.m},
"log.final.planet.RadGyra": {"value": 0.400000},
"log.final.planet.BodyType": {"value": 0.000000},
"log.final.planet.Density": {"value": 1.098978e+04, "unit": u.kg / u.m ** 3},
"log.final.planet.HZLimitDryRunaway": {"value": -1.000000, "unit": u.m},
"log.final.planet.HZLimRecVenus": {"value": -1.000000},
"log.final.planet.HZLimRunaway": {"value": -1.000000},
"log.final.planet.HZLimMoistGreenhouse": {"value": -1.000000},
"log.final.planet.HZLimMaxGreenhouse": {"value": -1.000000},
"log.final.planet.HZLimEarlyMars": {"value": -1.000000},
"log.final.planet.Instellation": {"value": -1.000000, "unit": u.kg / u.sec ** 3},
"log.final.planet.MeanMotion": {"value": -1.000000, "unit": 1 / u.sec},
"log.final.planet.OrbPeriod": {"value": -1.000000, "unit": u.sec},
"log.final.planet.SemiMajorAxis": {"value": -1.000000, "unit": u.m},
"log.final.planet.LXUVTot": {"value": -1.000000, "unit": u.kg / u.sec ** 3},
"log.final.planet.SurfWaterMass": {"value": 0.000000, "unit": u.kg},
"log.final.planet.EnvelopeMass": {"value": 0.999946, "unit": u.Mearth},
"log.final.planet.OxygenMass": {"value": 0.000000, "unit": u.kg},
"log.final.planet.RGLimit": {"value": -1.000000, "unit": u.m},
"log.final.planet.XO": {"value": 0.000000},
"log.final.planet.EtaO": {"value": 0.000000},
"log.final.planet.PlanetRadius": {"value": 1.000000, "unit": u.Rearth},
"log.final.planet.OxygenMantleMass": {"value": 0.000000, "unit": u.kg},
"log.final.planet.RadXUV": {"value": -1.000000, "unit": u.m},
"log.final.planet.RadSolid": {"value": -1.000000, "unit": u.m},
"log.final.planet.PresXUV": {"value": 5.000000},
"log.final.planet.ScaleHeight": {"value": -1.000000, "unit": u.m},
"log.final.planet.ThermTemp": {"value": 400.000000, "unit": u.K},
"log.final.planet.AtmGasConst": {"value": 4124.000000},
"log.final.planet.PresSurf": {"value": -1.000000, "unit": u.Pa},
"log.final.planet.DEnvMassDt": {"value": -1.022513e+07, "unit": u.kg / u.sec},
"log.final.planet.FXUV": {"value": 100.000000, "unit": u.W / u.m ** 2},
"log.final.planet.AtmXAbsEffH2O": {"value": 0.300000},
"log.final.planet.RocheRadius": {"value": 1.626274e+04, "unit": u.Rearth},
"log.final.planet.BondiRadius": {"value": -1.567865e-07, "unit": u.Rearth},
"log.final.planet.HEscapeRegime": {"value": 3.000000},
"log.final.planet.RRCriticalFlux": {"value": 483.255523, "unit": u.W / u.m ** 2},
"log.final.planet.CrossoverMass": {"value": 0.000000, "unit": u.kg},
"log.final.planet.WaterEscapeRegime": {"value": 8.000000},
"log.final.planet.FXUVCRITDRAG": {"value": 1.065385, "unit": u.W / u.m ** 2},
"log.final.planet.HREFFLUX": {"value": 3.613995e+19, "unit": 1 / u.m ** 2 / u.sec},
"log.final.planet.XO2": {"value": 0.000000},
"log.final.planet.XH2O": {"value": 0.000000},
"log.final.planet.HDiffFlux": {"value": 3.794519e+17, "unit": 1 / u.m ** 2 / u.sec},
"log.final.planet.HRefODragMod": {"value": 1.000000},
"log.final.planet.KTide": {"value": 0.999908},
"log.final.planet.RGDuration": {"value": 1.00000e+06, "unit": u.yr},
}
)
class Test_HydELimConstXUVNone(Benchmark):
pass
Loading

0 comments on commit aeb051a

Please sign in to comment.