38. Assignment 4 two layer solution#
38.1. Q4#
For the following set of layers:
Fig. 38.1 Two grey layers over a black surface#
Write down a system of three equations in three unknowns for the equilibrium case where the fluxes at each level are in balance.
Write a python function that returns the three layer temperatures \(T_g,\ T_1,\ T_2\) given \(\epsilon_1\), \(\epsilon_2\) and \(I_0\). Hand in notebook that uses that function to solve for \(\epsilon_1=0.8\), \(\epsilon_2 = 0.4\) and \(I_0 = 240\ W\,m^{-2}\)
Possible helpful
numpy.linalg.solvevideo from Kindson the Genius
38.2. Solution#
The three equations:
Here is the energy budget (heating rate) for each layer where F means flux (positive downward
layer 2 budget
heating2 = abs2*Tr1*Fg + abs2*F1 - 2*F2
layer 1 budget
heating1 = abs1*Fg - 2*F1 + abs1*F2
Ground budget
heatingg = Sol - Fg + F1 + Tr1*F2
or you could write the flux for each level (downward positive)
level 2 flux
F2 = Sol - Tr2*Tr1*Fg - Tr2*F1
F1 = Sol - Tr1*Fg + F2
Fg = Sol + Tr1*F2 + F1
Convince yourself that these two systems are identical – i.e. that the heating rate for layer 2 is given by subtracting the flux through level 1 from the flux through level 2
do_two_matrix(Sol=341.,albedo=0.3,epsilon1=0.55,epsilon2=0.55)
-- this solves the two layer model numerically
import numpy as np
from scipy import linalg
sigma=5.67e-8 #W/m^2/K^4
def do_two_matrix(Sol=240,albedo=0.0,epsilon1=0.8,epsilon2=0.4):
"""
do_two_matrix(Sol=341.,albedo=0.3,epsilon1=0.55,epsilon2=0.55)
returns [Fg,F1,F2] -- layer fluxes in W/m^2
"""
Sol=Sol*(1-albedo)
abs1=epsilon1
abs2=epsilon2
Tr1=1. - abs1
Tr2=1. - abs2
#layer 2 budget
#dF2/dt = abs2*Tr1*Fg + abs2*F1 - 2*F2
#layer 1 budget
#dF1/dt = abs1*Fg - 2*F1 + abs1*F2
#Ground budget
#dFg/dt = Sol - Fg + F1 + Tr1*F2
the_array=[[abs2*Tr1, abs2, -2.], \
[abs1, -2., abs1],\
[-1., 1., Tr1]]
the_array=np.array(the_array)
rhs=[0,0,-Sol]
the_inv=linalg.inv(the_array)
fluxes=np.dot(the_inv,rhs)
return fluxes
def find_temps(fluxes,epsilon1=0.8,epsilon2=0.4):
"""
find_temps(fluxes,epsilon1=0.55,epsilon2=0.55)
fluxes=(Fg,F1,F2)
returns (Tg,T1,T2)
"""
Tg=(fluxes[0]/sigma)**0.25
T1=(fluxes[1]/(sigma*epsilon1))**0.25
T2=(fluxes[2]/(sigma*epsilon2))**0.25
return (Tg,T1,T2)
numeric_fluxes=do_two_matrix()
print(f"numeric temperatues: {find_temps(numeric_fluxes)}")
numeric temperatues: (np.float64(300.11913993127195), np.float64(260.2241342082808), np.float64(226.79164443904006))