Skip to content

Commit

Permalink
Run janus (#54)
Browse files Browse the repository at this point in the history
* Add set state functions for atmosphere object.
  • Loading branch information
lsoucasse authored Aug 27, 2024
1 parent a02a032 commit e0b8a10
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
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
29 changes: 27 additions & 2 deletions src/janus/utils/atmosphere_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,35 @@ def from_file(atm, file: str, band_edges: list, vol_mixing: dict = {}, vol_parti

def setSurfaceTemperature(self, Tsurf: float):

self.ts = Tsurf
self.tmp[0] = Tsurf
self.ts = Tsurf
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 = {key: val/tot_mixing for key, val in self.vol_mixing.items()}

# 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:
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 e0b8a10

Please sign in to comment.