CliMA / ClimaAtmos.jl

ClimaAtmos.jl is a library for building atmospheric circulation models that is designed from the outset to leverage data assimilation and machine learning tools. We welcome contributions!
Apache License 2.0
84 stars 17 forks source link

Verify that ClimaAtmos inputs to RRTMGP match RRTMGP's test suite #2686

Closed charleskawczynski closed 9 months ago

charleskawczynski commented 9 months ago

I'm concerned that we might be passing ReshapedArrays to RRTMGP (e.g., reshape(view(rand(300,400), 1:3, 1:4), 4, 3)), which could result in a large discrepancy between performance we see in RRTMGP's test suite vs performance of RRTMGP that we see in ClimaAtmos.

charleskawczynski commented 9 months ago

I just checked on main, and we do in fact avoid passing in views (in the solver, which is the important part):

julia> using StructuredPrinting

julia> @structured_print integrator.p.radiation.radiation_model.solver PrintingOptions(; print_type_params=true)
integrator.p.radiation.radiation_model.solver
integrator.p.radiation.radiation_model.solver.context::ClimaComms.SingletonCommsContext{ClimaComms.CPUSingleThreaded}
integrator.p.radiation.radiation_model.solver.context.device::ClimaComms.CPUSingleThreaded
integrator.p.radiation.radiation_model.solver.as::RRTMGP.AtmosphericStates.AtmosphericState{Float64, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, Matrix{Bool}, RRTMGP.AtmosphericStates.MaxRandomOverlap, RRTMGP.Vmrs.VmrGM{Float64, Vector{Float64}, Matrix{Float64}}}
integrator.p.radiation.radiation_model.solver.as.lon::Vector{Float64}
integrator.p.radiation.radiation_model.solver.as.lat::Vector{Float64}
integrator.p.radiation.radiation_model.solver.as.p_lay::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.p_lev::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.t_lay::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.t_lev::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.t_sfc::Vector{Float64}
integrator.p.radiation.radiation_model.solver.as.col_dry::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.vmr::RRTMGP.Vmrs.VmrGM{Float64, Vector{Float64}, Matrix{Float64}}
integrator.p.radiation.radiation_model.solver.as.vmr.vmr_h2o::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.vmr.vmr_o3::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.vmr.vmr::Vector{Float64}
integrator.p.radiation.radiation_model.solver.as.cld_r_eff_liq::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.cld_r_eff_ice::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.cld_path_liq::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.cld_path_ice::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.cld_frac::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.as.cld_mask_lw::Matrix{Bool}
integrator.p.radiation.radiation_model.solver.as.cld_mask_sw::Matrix{Bool}
integrator.p.radiation.radiation_model.solver.as.cld_mask_type::RRTMGP.AtmosphericStates.MaxRandomOverlap
integrator.p.radiation.radiation_model.solver.as.ice_rgh::Int64
integrator.p.radiation.radiation_model.solver.as.nlay::Int64
integrator.p.radiation.radiation_model.solver.as.ncol::Int64
integrator.p.radiation.radiation_model.solver.as.ngas::Int64
integrator.p.radiation.radiation_model.solver.op::RRTMGP.Optics.TwoStream{Matrix{Float64}}
integrator.p.radiation.radiation_model.solver.op.τ::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.op.ssa::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.op.g::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.src_lw::RRTMGP.Sources.SourceLW2Str{Float64, Vector{Float64}, Matrix{Float64}, RRTMGP.Parameters.RRTMGPParameters{Float32}}
integrator.p.radiation.radiation_model.solver.src_lw.param_set::RRTMGP.Parameters.RRTMGPParameters{Float32}
integrator.p.radiation.radiation_model.solver.src_lw.param_set.grav::Float32
integrator.p.radiation.radiation_model.solver.src_lw.param_set.molmass_dryair::Float32
integrator.p.radiation.radiation_model.solver.src_lw.param_set.molmass_water::Float32
integrator.p.radiation.radiation_model.solver.src_lw.param_set.gas_constant::Float32
integrator.p.radiation.radiation_model.solver.src_lw.param_set.kappa_d::Float32
integrator.p.radiation.radiation_model.solver.src_lw.param_set.Stefan::Float32
integrator.p.radiation.radiation_model.solver.src_lw.param_set.avogad::Float32
integrator.p.radiation.radiation_model.solver.src_lw.sfc_source::Vector{Float64}
integrator.p.radiation.radiation_model.solver.src_lw.lev_source::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.src_lw.albedo::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.src_lw.src::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.src_sw::RRTMGP.Sources.SourceSW2Str{Float64, Vector{Float64}, Matrix{Float64}}
integrator.p.radiation.radiation_model.solver.src_sw.sfc_source::Vector{Float64}
integrator.p.radiation.radiation_model.solver.src_sw.albedo::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.src_sw.src::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.bcs_lw::RRTMGP.BCs.LwBCs{Float64, Matrix{Float64}, Nothing}
integrator.p.radiation.radiation_model.solver.bcs_lw.sfc_emis::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.bcs_lw.inc_flux::Nothing
integrator.p.radiation.radiation_model.solver.bcs_sw::RRTMGP.BCs.SwBCs{Float64, Vector{Float64}, Nothing, Matrix{Float64}}
integrator.p.radiation.radiation_model.solver.bcs_sw.cos_zenith::Vector{Float64}
integrator.p.radiation.radiation_model.solver.bcs_sw.toa_flux::Vector{Float64}
integrator.p.radiation.radiation_model.solver.bcs_sw.sfc_alb_direct::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.bcs_sw.inc_flux_diffuse::Nothing
integrator.p.radiation.radiation_model.solver.bcs_sw.sfc_alb_diffuse::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.fluxb_lw::RRTMGP.Fluxes.FluxLW{Float64, Matrix{Float64}}
integrator.p.radiation.radiation_model.solver.fluxb_lw.flux_up::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.fluxb_lw.flux_dn::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.fluxb_lw.flux_net::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.fluxb_sw::RRTMGP.Fluxes.FluxSW{Float64, Matrix{Float64}}
integrator.p.radiation.radiation_model.solver.fluxb_sw.flux_up::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.fluxb_sw.flux_dn::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.fluxb_sw.flux_net::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.fluxb_sw.flux_dn_dir::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.flux_lw::RRTMGP.Fluxes.FluxLW{Float64, Matrix{Float64}}
integrator.p.radiation.radiation_model.solver.flux_lw.flux_up::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.flux_lw.flux_dn::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.flux_lw.flux_net::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.flux_sw::RRTMGP.Fluxes.FluxSW{Float64, Matrix{Float64}}
integrator.p.radiation.radiation_model.solver.flux_sw.flux_up::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.flux_sw.flux_dn::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.flux_sw.flux_net::Matrix{Float64}
integrator.p.radiation.radiation_model.solver.flux_sw.flux_dn_dir::Matrix{Float64}