feat: add rss
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
# Lab 1
|
||||||
|
|
||||||
|
Joaquin Gottlebe 829101
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Venus shows the lowest effective temperature (219 K) due to its high albedo (0.80), which reflects most incoming sunlight. Earth (254 K) and Mars (212 K) receive less energy overall but absorb more because of lower albedos.
|
||||||
|
The comparison demonstrates that distance from the Sun alone does not determine surface temperature. The albedo and strength of the greenhouse effect together control planetary climate.
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
planets = {
|
||||||
|
"Earth": {"dist": 1.0, "albedo": 0.3, "GHE": 0.4},
|
||||||
|
"Venus": {"dist": 0.72, "albedo": 0.80, "GHE": 0.99},
|
||||||
|
"Mars": {"dist": 1.52, "albedo": 0.22, "GHE": 0.09},
|
||||||
|
}
|
||||||
|
|
||||||
|
results = []
|
||||||
|
|
||||||
|
for planet in planets:
|
||||||
|
L_S = 3.8e26
|
||||||
|
DE = 149.6e9
|
||||||
|
DE *= planets[planet]["dist"]
|
||||||
|
albedo = planets[planet]["albedo"]
|
||||||
|
sigma = 5.670367e-8
|
||||||
|
T_e= L_S / ( 4 * np.pi * DE**2)
|
||||||
|
PEtop = T_e / 4
|
||||||
|
PEsur = PEtop * (1 - albedo)
|
||||||
|
TEsur = ( PEsur / sigma )**(1/4)
|
||||||
|
TEsur_C = TEsur - 273.15
|
||||||
|
PE = 2 * PEsur;
|
||||||
|
TEsur_GH05 = ( PE / sigma )**(1/4)
|
||||||
|
TEsur_GH05_C = TEsur_GH05 - 273.15
|
||||||
|
GHE = planets[planet]["GHE"]
|
||||||
|
PE = PEsur / (1 - GHE)
|
||||||
|
TEsur_GH04 = ( PE / sigma )**(1/4)
|
||||||
|
|
||||||
|
results.append([planet, TEsur, TEsur_GH05, TEsur_GH04])
|
||||||
|
|
||||||
|
GHE_list = np.arange(0.1,0.55,0.05)
|
||||||
|
TEsur_GHE = np.empty((GHE_list.size,1))
|
||||||
|
for i in range(len(GHE_list)):
|
||||||
|
GHE = GHE_list[i]
|
||||||
|
PE = PEsur / (1 - GHE)
|
||||||
|
TEsur_GHE[i] = ( PE / sigma )**(1/4)
|
||||||
|
plt.plot(GHE_list, TEsur_GHE, label=planet)
|
||||||
|
|
||||||
|
|
||||||
|
# Plot 1
|
||||||
|
|
||||||
|
plt.xlabel('GreenHouse Effect', fontsize=12)
|
||||||
|
plt.ylabel('Temperature [K]', fontsize=12)
|
||||||
|
plt.grid()
|
||||||
|
plt.title('Varying GreenHouse gas effects and corresponding surface T', fontsize=14)
|
||||||
|
plt.legend(title="Planet")
|
||||||
|
plt.savefig(f"plot.png")
|
||||||
|
|
||||||
|
|
||||||
|
# Plot 2
|
||||||
|
fig, ax = plt.subplots(figsize=(7, 2))
|
||||||
|
ax.axis('off')
|
||||||
|
col_labels = ["Planet", "T_eff [K]", "T(GHE=0.5) [K]", "T(actual GHE) [K]"]
|
||||||
|
table_data = [[r[0], f"{r[1]:.2f}", f"{r[2]:.2f}", f"{r[3]:.2f}"] for r in results]
|
||||||
|
|
||||||
|
print(table_data)
|
||||||
|
|
||||||
|
table = ax.table(cellText=table_data, colLabels=col_labels, loc='center', cellLoc='center')
|
||||||
|
table.auto_set_font_size(False)
|
||||||
|
table.set_fontsize(11)
|
||||||
|
table.scale(1.2, 1.5)
|
||||||
|
for (row, col), cell in table.get_celld().items():
|
||||||
|
if row == 0:
|
||||||
|
cell.set_text_props(weight='bold', color='white')
|
||||||
|
cell.set_facecolor('#3f51b5')
|
||||||
|
else:
|
||||||
|
cell.set_facecolor('#f0f0f0')
|
||||||
|
plt.title("Surface Temperature Estimates for Earth, Venus, and Mars", fontsize=13, pad=10)
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.savefig("results_table.png", dpi=300, bbox_inches='tight')
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Lab 2
|
||||||
|
|
||||||
|
Joaquin Gottlebe Mtrklnr.: 829101
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
As expected the Human fall and rain drop has the fastest velocity followed by magma, mantle and slab.
|
||||||
|
The model asumed a sphere as the object which is a simplification and doesnt fit complex shapes like a Human or the Magma which is more a cilinder.
|
||||||
|
This is also noticable in the Raynolds numbers which are >1 for rain drop and human. Which indicates that the model is not suitable for these.
|
||||||
|
For the others its under 1 so could be passable. But still a simplification.
|
||||||
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import math
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
def calculation(what, rho_f, rho_s, g, a, mu):
|
||||||
|
"""
|
||||||
|
rho_f Medium density: kg/m³
|
||||||
|
rho_s Object density: kg/m³
|
||||||
|
g Gravity: m/s²
|
||||||
|
a Radius: m
|
||||||
|
mu Viscosity of medium: Pa·s
|
||||||
|
"""
|
||||||
|
U_ms = abs(2 * (rho_f - rho_s) * g * a**2 / (9 * mu))
|
||||||
|
U_kmh = U_ms * 3.6
|
||||||
|
U_cmyr = U_ms * 100 * 60 * 60 * 24 * 365.25
|
||||||
|
Re = rho_f * U_ms * (2 * a) / mu
|
||||||
|
|
||||||
|
return [what, f"{mu:.1e}", f"{a:.2e}", f"{U_ms:.3e}", f"{U_kmh:.3e}", f"{U_cmyr:.3e}", f"{Re:.3e}"]
|
||||||
|
|
||||||
|
# Original objects
|
||||||
|
objects = [
|
||||||
|
calculation("Subducted slab", 3300, 3400, 9.81, 100e3, 1e21),
|
||||||
|
calculation("Mantle plume", 3300, 3250, 9.81, 50e3, 1e20),
|
||||||
|
calculation("Magma through crust", 2700, 2600, 9.81, 10, 1e3),
|
||||||
|
calculation("Rain drop", 1.2, 1000, 9.81, 0.001, 1.8e5),
|
||||||
|
calculation("Human fall", 1.2, 1000, 9.81, 0.5, 1.8e5)
|
||||||
|
]
|
||||||
|
|
||||||
|
# _becca version with slightly different inputs
|
||||||
|
objects_becca = [
|
||||||
|
calculation("Subducted slab", 3300, 3350, 9.81, 120e3, 1.1e21),
|
||||||
|
calculation("Mantle plume", 3300, 3280, 9.81, 55e3, 9e19),
|
||||||
|
calculation("Magma through crust", 2700, 2620, 9.81, 12, 1.2e3),
|
||||||
|
calculation("Rain drop", 1.2, 1020, 9.81, 0.002, 2e5),
|
||||||
|
calculation("Human fall", 1.2, 980, 9.81, 0.6, 2e5)
|
||||||
|
]
|
||||||
|
|
||||||
|
# Column labels
|
||||||
|
columns = ["Object", "Viscosity (Pa·s)", "Radius (m)", "Velocity (m/s)", "Velocity (km/h)", "Velocity (cm/yr)", "Reynolds number"]
|
||||||
|
|
||||||
|
def create_table_and_plot(objects, filename_suffix, color):
|
||||||
|
# Table
|
||||||
|
fig, ax = plt.subplots(figsize=(12, 3))
|
||||||
|
ax.axis('off') # Hide axes
|
||||||
|
table = ax.table(cellText=objects, colLabels=columns, cellLoc='center', loc='center')
|
||||||
|
table.auto_set_font_size(False)
|
||||||
|
table.set_fontsize(10)
|
||||||
|
table.auto_set_column_width(col=list(range(len(columns))))
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.savefig(f"velocity_table_{filename_suffix}.png", dpi=300)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
# Bar plot (exactly like original)
|
||||||
|
names = [obj[0] for obj in objects]
|
||||||
|
U_ms = [obj[3] for obj in objects]
|
||||||
|
U_kmh = [obj[4] for obj in objects]
|
||||||
|
U_cmyr = [obj[5] for obj in objects]
|
||||||
|
|
||||||
|
plt.figure(figsize=(10,6))
|
||||||
|
plt.bar(names, U_ms, color=color)
|
||||||
|
plt.ylabel("Velocity (m/s)")
|
||||||
|
plt.title(f"Comparison of Velocities")
|
||||||
|
plt.xticks(rotation=45, ha='right')
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.savefig(f"velocities_{filename_suffix}.png", dpi=300)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
# Generate outputs for both students
|
||||||
|
create_table_and_plot(objects, "", 'skyblue')
|
||||||
|
create_table_and_plot(objects_becca, "becca", 'green')
|
||||||
Reference in New Issue
Block a user