diff --git a/config/model_configs/single_column_radiative_equilibrium_allsky_idealized_clouds.yml b/config/model_configs/single_column_radiative_equilibrium_allsky_idealized_clouds.yml index d009d3c5bb1..02bdda01bae 100644 --- a/config/model_configs/single_column_radiative_equilibrium_allsky_idealized_clouds.yml +++ b/config/model_configs/single_column_radiative_equilibrium_allsky_idealized_clouds.yml @@ -14,3 +14,5 @@ z_max: 70000.0 dt_save_to_sol: "30hours" job_id: "single_column_radiative_equilibrium_allsky_idealized_clouds" rad: "allskywithclear" +netcdf_interpolation_num_points: [2, 2, 70] +FLOAT_TYPE: "Float32" diff --git a/src/callbacks/callbacks.jl b/src/callbacks/callbacks.jl index 3963489b2ea..bfc8c0b677f 100644 --- a/src/callbacks/callbacks.jl +++ b/src/callbacks/callbacks.jl @@ -104,6 +104,7 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator) if !idealized_insolation current_datetime = p.start_date + Dates.Second(round(Int, t)) # current time max_zenith_angle = FT(π) / 2 - eps(FT) + min_cos_zenith_angle = FT(cos(Float64(π) / 2 - eps(Float64))) irradiance = FT(CAP.tot_solar_irrad(params)) au = FT(CAP.astro_unit(params)) date0 = DateTime("2000-01-01T11:58:56.816") @@ -132,7 +133,8 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator) bottom_coords.long, bottom_coords.lat, ) # the tuple is (zenith angle, azimuthal angle, earth-sun distance) - @. cos_zenith = cos(min(first(insolation_tuple), max_zenith_angle)) + @. cos_zenith = + max(cos(first(insolation_tuple)), min_cos_zenith_angle) @. weighted_irradiance = irradiance * (au / last(insolation_tuple))^2 else diff --git a/src/parameterized_tendencies/radiation/RRTMGPInterface.jl b/src/parameterized_tendencies/radiation/RRTMGPInterface.jl index 48487d6952b..5522054a8f4 100644 --- a/src/parameterized_tendencies/radiation/RRTMGPInterface.jl +++ b/src/parameterized_tendencies/radiation/RRTMGPInterface.jl @@ -1211,11 +1211,36 @@ end # TODO: Change these methods back to using face_sw_flux/face_clear_sw_flux # instead of face_sw_flux_up - face_sw_flux_dn -update_net_fluxes!(radiation_mode, model) = +function update_net_fluxes!(radiation_mode, model) + parent(model.face_sw_flux_up) .= + ifelse.( + parent(model.cos_zenith) .> Float32(7.54979f-8), + parent(model.face_sw_flux_up), + 0, + ) + parent(model.face_sw_flux_dn) .= + ifelse.( + parent(model.cos_zenith) .> Float32(7.54979f-8), + parent(model.face_sw_flux_dn), + 0, + ) parent(model.face_flux) .= parent(model.face_lw_flux) .+ parent(model.face_sw_flux_up) .- parent(model.face_sw_flux_dn) +end function update_net_fluxes!(::AllSkyRadiationWithClearSkyDiagnostics, model) + parent(model.face_sw_flux_up) .= + ifelse.( + parent(model.cos_zenith) .> Float32(7.54979f-8), + parent(model.face_sw_flux_up), + 0, + ) + parent(model.face_sw_flux_dn) .= + ifelse.( + parent(model.cos_zenith) .> Float32(7.54979f-8), + parent(model.face_sw_flux_dn), + 0, + ) parent(model.face_clear_flux) .= parent(model.face_clear_lw_flux) .+ parent(model.face_clear_sw_flux_up) .-