Skip to content

Commit

Permalink
remove scalar indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Feb 6, 2024
1 parent 7caaa1e commit 79cacbe
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions experiments/AMIP/user_io/user_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,23 @@ Top of the atmosphere radiation fluxes (W m⁻²).
function get_var(cs::CoupledSimulation, ::Val{:toa_fluxes})
atmos_sim = cs.model_sims.atmos_sim
face_space = axes(atmos_sim.integrator.u.f)
z = parent(Fields.coordinate_field(face_space).z)
Δz_top = round(FT(0.5) * (z[end, 1, 1, 1, 1] - z[end - 1, 1, 1, 1, 1]))
n_faces = length(z[:, 1, 1, 1, 1])
nz_faces = length(Spaces.vertical_topology(face_space).mesh.faces)

LWd_TOA = Fields.level(
CA.RRTMGPI.array2field(FT.(atmos_sim.integrator.p.radiation.radiation_model.face_lw_flux_dn), face_space),
n_faces - half,
nz_faces - half,
)
LWu_TOA = Fields.level(
CA.RRTMGPI.array2field(FT.(atmos_sim.integrator.p.radiation.radiation_model.face_lw_flux_up), face_space),
n_faces - half,
nz_faces - half,
)
SWd_TOA = Fields.level(
CA.RRTMGPI.array2field(FT.(atmos_sim.integrator.p.radiation.radiation_model.face_sw_flux_dn), face_space),
n_faces - half,
nz_faces - half,
)
SWu_TOA = Fields.level(
CA.RRTMGPI.array2field(FT.(atmos_sim.integrator.p.radiation.radiation_model.face_sw_flux_up), face_space),
n_faces - half,
nz_faces - half,
)

radiation_sources = @. -(LWd_TOA + SWd_TOA - LWu_TOA - SWu_TOA)
Expand Down

0 comments on commit 79cacbe

Please sign in to comment.