Skip to content

Commit

Permalink
Add set state functions for atmosphere object.
Browse files Browse the repository at this point in the history
  • Loading branch information
lsoucasse committed Aug 21, 2024
1 parent 97ab299 commit 8e7ae60
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/janus/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .socrates import CleanOutputDir

# Stellar Spectrum utilities
from .StellarSpectrum import InsertStellarSpectrum
from .StellarSpectrum import InsertStellarSpectrum, PrepareStellarSpectrum

# Read spectral file
from .ReadSpectralFile import ReadBandEdges
Expand Down
27 changes: 27 additions & 0 deletions src/janus/utils/atmosphere_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,33 @@ def setSurfaceTemperature(self, Tsurf: float):
self.tmp[0] = Tsurf
self.tmpl[0] = Tsurf

def setSurfacePressure(self, Psurf: float):

self.ps = Psurf
self.p[0] = Psurf
self.pl[0] = Psurf

def setPlanetProperties(self, pl_radius:float, pl_mass:float):

self.planet_radius = pl_radius
self.planet_mass = pl_mass
self.grav_s = phys.G*self.planet_mass/(self.planet_radius**2) # m s-2
self.grav_z[0] = self.grav_s

def setVolatiles(self, vol_mixing: dict)

tot_mixing = float(sum(vol_mixing.values())) # Ensure mixing ratios add up to unity
self.vol_list = {}
for vol in vol_mixing.keys():
self.vol_list[vol] = vol_mixing[vol]/tot_mixing

# H2O floor to prevent NaNs
self.vol_list["H2O"] = np.max( [ self.vol_list["H2O"], 1e-20 ] )

# Update volatile surface partial pressure
for vol in self.vol_list.keys():
self.p_vol[vol][0] = self.ps * self.vol_list[vol]

def setTropopauseTemperature(self):

T_eqm = (self.instellation * self.inst_sf * (1.0 - self.albedo_pl) /phys.sigma)**(1.0/4.0)
Expand Down

0 comments on commit 8e7ae60

Please sign in to comment.