11using RRTMGP. Optics: GrayOpticalThicknessSchneider2004
2- using RRTMGP. Parameters: RRTMGPParameters
32using RRTMGP. AtmosphericStates: GrayAtmosphericState
4- using RRTMGP. RTE: TwoStreamLWRTE
5- using RRTMGP. RTESolver: solve_lw!
3+ using RRTMGP. RTE: TwoStreamLWRTE, TwoStreamSWRTE
4+ using RRTMGP. RTESolver: solve_lw!, solve_sw!
65
76using Oceananigans
87using Oceananigans: field
@@ -17,14 +16,26 @@ DA = array_type(architecture)
1716Nx, Ny, Nz = 1 , 1 , 64
1817Lx, Ly, Lz = 1 , 20_000_000 , 1_000 # domain size in meters
1918Nbnd, Ngpt = 1 , 1 # gray model
19+ deg2rad = FT (π / 180 )
20+
2021lw_inc_flux = nothing # no incoming longwave flux
21- sfc_emissivity = 1
22+ sw_inc_flux = FT (1407.679 ) # no incoming shortwave flux
23+ sw_inc_flux_diffuse = nothing
24+ zenith_angle = FT (52.95 ) # zenith angle in degrees
25+ sfc_emissivity = FT (1 ) # surface emissivity
26+ albedo_direct = FT (0.1 ) # surface albedo (direct)
27+ albedo_diffuse = FT (0.1 ) # surface albedo (diffuse)
28+
2229planet_radius = 6_371_000
2330p_surface = 100_000 # surface pressure (Pa)
2431p_top = 9_000 # top of atmosphere pressure / emission level (Pa)
2532lat_center = 0
2633optical_properties = GrayOpticalThicknessSchneider2004 (FT)
27-
34+ # cos_zenith .= cos(deg2rad * 52.95) # corresponding to ~52.95 deg zenith angle
35+ # toa_flux .= FT(1407.679)
36+ # sfc_alb_direct .= FT(0.1)
37+ # sfc_alb_diffuse .= FT(0.1)
38+ # inc_flux_diffuse = nothing
2839# Grid setup, we also need to say where on the planet our box is located
2940grid = RectilinearGrid (
3041 architecture,
@@ -55,10 +66,28 @@ atmospheric_state = GrayAtmosphericState(
5566
5667# Set up radiation model
5768sfc_emission = DA {FT} (undef, Nbnd, Nx, Ny)
69+ sfc_alb_direct = DA {FT} (undef, Nbnd, Nx, Ny)
70+ sfc_alb_diffuse = DA {FT} (undef, Nbnd, Nx, Ny)
71+ cos_zenith = DA {FT} (undef, Nx, Ny)
72+ toa_flux = DA {FT} (undef, Nx, Ny)
73+ lw_toa_inc_flux = nothing
74+ inc_flux_diffuse = nothing
5875fill! (sfc_emission, FT (sfc_emissivity))
76+ fill! (sfc_alb_direct, FT (albedo_direct))
77+ fill! (sfc_alb_diffuse, FT (albedo_diffuse))
78+ fill! (cos_zenith, FT (cos (deg2rad * zenith_angle)))
79+ fill! (toa_flux, FT (sw_inc_flux))
5980SLVLW = TwoStreamLWRTE
60- slv_lw = SLVLW (grid; sfc_emission, lw_inc_flux)
81+ SLVSW = TwoStreamSWRTE
82+ lw_params = (; sfc_emission, lw_inc_flux)
83+ sw_params = (; cos_zenith, toa_flux, sfc_alb_direct, inc_flux_diffuse, sfc_alb_diffuse)
84+ slv_lw = SLVLW (grid; lw_params... )
85+ slv_sw = SLVSW (grid; sw_params... )
6186
62- # solve the radiation model
63- solve_lw! (slv_lw, atmospheric_state)
87+ # Solve the LW radiation model
88+ function update_radative_fluxes! (slv_lw, slv_sw, atmospheric_state)
89+ solve_lw! (slv_lw, atmospheric_state)
90+ solve_sw! (slv_sw, atmospheric_state)
91+ end
6492
93+ update_radative_fluxes! (slv_lw, slv_sw, atmospheric_state)
0 commit comments