Skip to content

Commit

Permalink
Merge pull request #45 from FormingWorlds/height_fix
Browse files Browse the repository at this point in the history
Fix to height integration
  • Loading branch information
nichollsh authored Jan 15, 2024
2 parents c53f61a + 29da051 commit cd3a27d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/height.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ def AtmosphericHeight(atm, m_planet, r_planet):
mean_molar_mass += phys.molar_mass[vol]*atm.x_gas[vol][n]

# Temperature below present height
T_mean_below = np.mean(atm.tmp[n:])
# T_mean_below = np.mean(atm.tmp[n:])

# # Direction calculation
# z_profile[n] = - R_gas * T_mean_below * np.log(atm.p[n]/P_s) / ( mean_molar_mass * grav_s )

# Integration
dz = - phys.R_gas * T_mean_below * np.log(atm.p[n+1]/atm.p[n]) / (mean_molar_mass*grav_z)
# dz = - phys.R_gas * T_mean_below * np.log(atm.p[n+1]/atm.p[n]) / (mean_molar_mass*grav_z)
dz = phys.R_gas * atm.tmp[n] / (mean_molar_mass * grav_z * atm.p[n]) * (atm.p[n] - atm.p[n+1])

# Next height
z_profile[n+1] = z_profile[n] + dz
Expand Down

0 comments on commit cd3a27d

Please sign in to comment.