diff --git a/src/diagnostics/default_diagnostics.jl b/src/diagnostics/default_diagnostics.jl index c51a90d64e..e7f75321b1 100644 --- a/src/diagnostics/default_diagnostics.jl +++ b/src/diagnostics/default_diagnostics.jl @@ -169,9 +169,11 @@ function default_diagnostics( # "pwc", # return a Tuple "si", "sie", + "swo", + "lwo", ] elseif output_vars == :short - soilcanopy_diagnostics = ["gpp", "ct", "lai", "swc", "si"] + soilcanopy_diagnostics = ["gpp", "ct", "lai", "swc", "si", "swo", "lwo", "et", "er"] end if average_period == :hourly diff --git a/src/diagnostics/define_diagnostics.jl b/src/diagnostics/define_diagnostics.jl index d93087247b..0ed4580666 100644 --- a/src/diagnostics/define_diagnostics.jl +++ b/src/diagnostics/define_diagnostics.jl @@ -149,7 +149,7 @@ function define_diagnostics!(land_model) ## Canopy Module ## - ### Canopy - Solar Induced Fluorescence + ### Canopy - Solar Induced Fluorescence # Solar Induced Fluorescence add_diagnostic_variable!( short_name = "sif", @@ -256,7 +256,7 @@ function define_diagnostics!(land_model) ) =# - # Root flux per ground area + # Root flux per ground area add_diagnostic_variable!( short_name = "far", long_name = "Root flux per ground area", @@ -726,6 +726,51 @@ function define_diagnostics!(land_model) compute_soilco2_source_microbe!(out, Y, p, t, land_model), ) + ## Other ## + # Longwave out + add_diagnostic_variable!( + short_name = "lwo", + long_name = "Longwave Radiation Out", + standard_name = "longwave radiation out", + units = "W m^-2", + comments = "Longwave radiation going out of the land surface.", + compute! = (out, Y, p, t) -> + compute_lw_out!(out, Y, p, t, land_model), + ) + + # Shortwave out + add_diagnostic_variable!( + short_name = "swo", + long_name = "Shortwave Radiation Out", + standard_name = "shortwave radiation out", + units = "W m^-2", + comments = "Shortwave radiation going out of the land surface.", + compute! = (out, Y, p, t) -> + compute_sw_out!(out, Y, p, t, land_model), + ) + + # Evapotranspiration + add_diagnostic_variable!( + short_name = "et", + long_name = "Evapotranspiration", + standard_name = "evapotranspiration", + units = "kg m^-2 s^-1", + comments = "Total flux of water mass out of the surface.", + compute! = (out, Y, p, t) -> + compute_evapotranspiration!(out, Y, p, t, land_model), + ) + + # Ecosystem respiration + add_diagnostic_variable!( + short_name = "er", + long_name = "Ecosystem Respiration", + standard_name = "ecosystem respiration", + units = "mol m^-2 s^-1", + comments = "Total respiration flux out of the surface.", + compute! = (out, Y, p, t) -> + compute_total_respiration!(out, Y, p, t, land_model), + ) + ## Stored in Y (prognostic or state variables) ## # Canopy temperature diff --git a/src/diagnostics/land_compute_methods.jl b/src/diagnostics/land_compute_methods.jl index 41d9e33eb7..b974a6fdc2 100644 --- a/src/diagnostics/land_compute_methods.jl +++ b/src/diagnostics/land_compute_methods.jl @@ -158,6 +158,40 @@ end # Convert from kg C to mol CO2. @diagnostic_compute "soilco2_diffusivity" SoilCanopyModel p.soilco2.D @diagnostic_compute "soilco2_source_microbe" SoilCanopyModel p.soilco2.Sm +## Other ## + +@diagnostic_compute "lw_out" SoilCanopyModel p.LW_out +@diagnostic_compute "sw_out" SoilCanopyModel p.SW_out +@diagnostic_compute "runoff" SoilCanopyModel p.soil.R_s + +function compute_evapotranspiration!( + out, + Y, + p, + t, + land_model::SoilCanopyModel{FT}, +) where {FT} + if isnothing(out) + return (p.soil.turbulent_fluxes.vapor_flux_liq .+ p.soil.turbulent_fluxes.vapor_flux_ice .+ p.canopy.conductance.transpiration) .* 1000 # density of liquid water (1000kg/m^3) + else + out .= (p.soil.turbulent_fluxes.vapor_flux_liq .+ p.soil.turbulent_fluxes.vapor_flux_ice .+ p.canopy.conductance.transpiration) .* 1000 # density of liquid water (1000kg/m^3) + end +end + +function compute_total_respiration!( + out, + Y, + p, + t, + land_model::SoilCanopyModel{FT}, +) where {FT} + if isnothing(out) + return p.soilco2.top_bc .* FT(83.26) .+ p.canopy.autotrophic_respiration.Ra + else + out .= p.soilco2.top_bc .* FT(83.26) .+ p.canopy.autotrophic_respiration.Ra + end +end + # variables stored in Y (prognostic or state variables) @diagnostic_compute "canopy_temperature" SoilCanopyModel Y.canopy.energy.T @@ -173,3 +207,4 @@ end # Convert from kg C to mol CO2. @diagnostic_compute "soil_ice_content" EnergyHydrology Y.soil.θ_i @diagnostic_compute "soil_internal_energy" EnergyHydrology Y.soil.ρe_int @diagnostic_compute "soil_temperature" EnergyHydrology p.soil.T +