Skip to content

Commit

Permalink
compute fractional absorbances
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck committed Nov 13, 2024
1 parent 1a98220 commit 9b73ade
Show file tree
Hide file tree
Showing 27 changed files with 146 additions and 238 deletions.
6 changes: 3 additions & 3 deletions docs/src/APIs/canopy/RadiativeTransfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ ClimaLand.Canopy.BeerLambertParameters
## Methods

```@docs
ClimaLand.Canopy.compute_absorbances!
ClimaLand.Canopy.plant_absorbed_pfd_beer_lambert
ClimaLand.Canopy.plant_absorbed_pfd_two_stream
ClimaLand.Canopy.compute_fractional_absorbances
ClimaLand.Canopy.canopy_sw_rt_beer_lambert
ClimaLand.Canopy.canopy_sw_rt_two_stream
ClimaLand.Canopy.extinction_coeff
ClimaLand.Canopy.canopy_radiant_energy_fluxes!
```
1 change: 0 additions & 1 deletion docs/tutorials/standalone/Canopy/canopy_tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ rt_params = TwoStreamParameters(
τ_NIR_leaf = FT(0.25),
Ω = FT(0.69),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
)

rt_model = TwoStreamModel{FT}(rt_params);
Expand Down
1 change: 0 additions & 1 deletion experiments/integrated/fluxnet/US-Ha1/US-Ha1_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ ld = FT(0.5)
G_Function = ConstantGFunction(ld)
α_PAR_leaf = FT(0.1)
λ_γ_PAR = FT(5e-7)
λ_γ_NIR = FT(1.65e-6)
τ_PAR_leaf = FT(0.05)
α_NIR_leaf = FT(0.45)
τ_NIR_leaf = FT(0.25)
Expand Down
1 change: 0 additions & 1 deletion experiments/integrated/fluxnet/US-MOz/US-MOz_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ soil_α_NIR = FT(0.2)
G_Function = CLMGFunction(χl)
α_PAR_leaf = FT(0.1)
λ_γ_PAR = FT(5e-7)
λ_γ_NIR = FT(1.65e-6)
τ_PAR_leaf = FT(0.05)
α_NIR_leaf = FT(0.45)
τ_NIR_leaf = FT(0.25)
Expand Down
1 change: 0 additions & 1 deletion experiments/integrated/fluxnet/US-NR1/US-NR1_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ ld = FT(0.5)
G_Function = ConstantGFunction(ld)
α_PAR_leaf = FT(0.1)
λ_γ_PAR = FT(5e-7)
λ_γ_NIR = FT(1.65e-6)
τ_PAR_leaf = FT(0.05)
α_NIR_leaf = FT(0.35)
τ_NIR_leaf = FT(0.25)
Expand Down
1 change: 0 additions & 1 deletion experiments/integrated/fluxnet/US-Var/US-Var_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ ld = FT(0.5)
G_Function = ConstantGFunction(ld)
α_PAR_leaf = FT(0.11)
λ_γ_PAR = FT(5e-7)
λ_γ_NIR = FT(1.65e-6)
τ_PAR_leaf = FT(0.05)
α_NIR_leaf = FT(0.35)
τ_NIR_leaf = FT(0.34)
Expand Down
1 change: 0 additions & 1 deletion experiments/standalone/Vegetation/no_vegetation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ rt_params = TwoStreamParameters(
τ_NIR_leaf = FT(0.25),
Ω = FT(0.69),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
)

rt_model = TwoStreamModel{FT}(rt_params);
Expand Down
1 change: 0 additions & 1 deletion experiments/standalone/Vegetation/timestep_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ rt_params = TwoStreamParameters(
τ_NIR_leaf = FT(0.25),
Ω = FT(0.69),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
)
rt_model = TwoStreamModel{FT}(rt_params);

Expand Down
1 change: 0 additions & 1 deletion experiments/standalone/Vegetation/varying_lai.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ rt_params = TwoStreamParameters(
τ_NIR_leaf = FT(0.25),
Ω = FT(0.69),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
)

rt_model = TwoStreamModel{FT}(rt_params);
Expand Down
1 change: 0 additions & 1 deletion experiments/standalone/Vegetation/varying_lai_with_stem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ rt_params = TwoStreamParameters(
τ_NIR_leaf = FT(0.25),
Ω = FT(0.69),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
)

rt_model = TwoStreamModel{FT}(rt_params);
Expand Down
2 changes: 0 additions & 2 deletions ext/CreateParametersExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,6 @@ function TwoStreamParameters(
) where {F}
name_map = (;
:wavelength_per_PAR_photon => :λ_γ_PAR,
:wavelength_per_NIR_photon => :λ_γ_NIR,
:canopy_emissivity => :ϵ_canopy,
)

Expand Down Expand Up @@ -670,7 +669,6 @@ function BeerLambertParameters(
) where {F}
name_map = (;
:wavelength_per_PAR_photon => :λ_γ_PAR,
:wavelength_per_NIR_photon => :λ_γ_NIR,
:canopy_emissivity => :ϵ_canopy,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function radiative_transfer_harvard(;
ld = ConstantGFunction(FT(0.5)),
α_PAR_leaf = FT(0.1),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
τ_PAR_leaf = FT(0.05),
α_NIR_leaf = FT(0.45),
τ_NIR_leaf = FT(0.25),
Expand All @@ -121,7 +120,6 @@ function radiative_transfer_harvard(;
ϵ_canopy = ϵ_canopy,
Ω = Ω,
λ_γ_PAR = λ_γ_PAR,
λ_γ_NIR = λ_γ_NIR,
n_layers = n_layers,
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function radiative_transfer_ozark(;
ld = ConstantGFunction(FT(0.5)),
α_PAR_leaf = FT(0.1),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
τ_PAR_leaf = FT(0.05),
α_NIR_leaf = FT(0.45),
τ_NIR_leaf = FT(0.25),
Expand All @@ -121,7 +120,6 @@ function radiative_transfer_ozark(;
ϵ_canopy = ϵ_canopy,
Ω = Ω,
λ_γ_PAR = λ_γ_PAR,
λ_γ_NIR = λ_γ_NIR,
n_layers = n_layers,
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function radiative_transfer_niwotridge(;
ld = ConstantGFunction(FT(0.5)),
α_PAR_leaf = FT(0.1),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
τ_PAR_leaf = FT(0.05),
α_NIR_leaf = FT(0.35),
τ_NIR_leaf = FT(0.25),
Expand All @@ -121,7 +120,6 @@ function radiative_transfer_niwotridge(;
ϵ_canopy = ϵ_canopy,
Ω = Ω,
λ_γ_PAR = λ_γ_PAR,
λ_γ_NIR = λ_γ_NIR,
n_layers = n_layers,
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function radiative_transfer_vairaranch(;
ld = ConstantGFunction(FT(0.5)),
α_PAR_leaf = FT(0.1),
λ_γ_PAR = FT(5e-7),
λ_γ_NIR = FT(1.65e-6),
τ_PAR_leaf = FT(0.05),
α_NIR_leaf = FT(0.45),
τ_NIR_leaf = FT(0.25),
Expand All @@ -121,7 +120,6 @@ function radiative_transfer_vairaranch(;
ϵ_canopy = ϵ_canopy,
Ω = Ω,
λ_γ_PAR = λ_γ_PAR,
λ_γ_NIR = λ_γ_NIR,
n_layers = n_layers,
)
end
Expand Down
1 change: 0 additions & 1 deletion lib/ClimaLandSimulations/src/Fluxnet/run_fluxnet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ function run_fluxnet(
G_Function = params.radiative_transfer.G_Function,
α_PAR_leaf = params.radiative_transfer.α_PAR_leaf,
λ_γ_PAR = params.radiative_transfer.λ_γ_PAR,
λ_γ_NIR = params.radiative_transfer.λ_γ_NIR,
τ_PAR_leaf = params.radiative_transfer.τ_PAR_leaf,
α_NIR_leaf = params.radiative_transfer.α_NIR_leaf,
τ_NIR_leaf = params.radiative_transfer.τ_NIR_leaf,
Expand Down
40 changes: 8 additions & 32 deletions src/diagnostics/land_compute_methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,38 +111,14 @@ end
@diagnostic_compute "vcmax25" Union{SoilCanopyModel, LandModel} p.canopy.photosynthesis.Vcmax25

# Canopy - Radiative Transfer
@diagnostic_compute "near_infrared_radiation_down" Union{
SoilCanopyModel,
LandModel,
} p.canopy.radiative_transfer.inc_nir
@diagnostic_compute "near_infrared_radiation_absorbed" Union{
SoilCanopyModel,
LandModel,
} p.canopy.radiative_transfer.nir.abs
@diagnostic_compute "near_infrared_radiation_reflected" Union{
SoilCanopyModel,
LandModel,
} p.canopy.radiative_transfer.nir.refl
@diagnostic_compute "near_infrared_radiation_transmitted" Union{
SoilCanopyModel,
LandModel,
} p.canopy.radiative_transfer.nir.trans
@diagnostic_compute "photosynthetically_active_radiation_down" Union{
SoilCanopyModel,
LandModel,
} p.canopy.radiative_transfer.inc_par
@diagnostic_compute "photosynthetically_active_radiation_absorbed" Union{
SoilCanopyModel,
LandModel,
} p.canopy.radiative_transfer.par.abs
@diagnostic_compute "photosynthetically_active_radiation_reflected" Union{
SoilCanopyModel,
LandModel,
} p.canopy.radiative_transfer.par.refl
@diagnostic_compute "photosynthetically_active_radiation_transmitted" Union{
SoilCanopyModel,
LandModel,
} p.canopy.radiative_transfer.par.trans
@diagnostic_compute "near_infrared_radiation_down" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.nir_d
@diagnostic_compute "near_infrared_radiation_absorbed" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.nir.abs
@diagnostic_compute "near_infrared_radiation_reflected" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.nir.refl
@diagnostic_compute "near_infrared_radiation_transmitted" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.nir.trans
@diagnostic_compute "photosynthetically_active_radiation_down" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.par_d
@diagnostic_compute "photosynthetically_active_radiation_absorbed" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.par.abs
@diagnostic_compute "photosynthetically_active_radiation_reflected" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.par.refl
@diagnostic_compute "photosynthetically_active_radiation_transmitted" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.par.trans
@diagnostic_compute "radiation_longwave_net" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.LW_n
@diagnostic_compute "radiation_shortwave_net" Union{SoilCanopyModel, LandModel} p.canopy.radiative_transfer.SW_n

Expand Down
33 changes: 13 additions & 20 deletions src/integrated/soil_canopy_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,7 @@ function lsm_radiant_energy_fluxes!(
= LP.Stefan(earth_param_set)
LW_d = p.drivers.LW_d
SW_d = p.drivers.SW_d
c = LP.light_speed(earth_param_set)
h = LP.planck_constant(earth_param_set)
N_a = LP.avogadro_constant(earth_param_set)
(; λ_γ_PAR, λ_γ_NIR) = canopy_radiation.parameters
energy_per_photon_PAR = h * c / λ_γ_PAR
energy_per_photon_NIR = h * c / λ_γ_NIR

T_canopy =
ClimaLand.Canopy.canopy_temperature(canopy.energy, canopy, Y, p, t)

Expand All @@ -315,27 +310,25 @@ function lsm_radiant_energy_fluxes!(
R_net_soil = p.soil.R_n
LW_u = p.LW_u
SW_u = p.SW_u
par_d = p.canopy.radiative_transfer.par_d
nir_d = p.canopy.radiative_transfer.nir_d
f_abs_par = p.canopy.radiative_transfer.par.abs
f_abs_nir = p.canopy.radiative_transfer.nir.abs
f_refl_par = p.canopy.radiative_transfer.par.refl
f_refl_nir = p.canopy.radiative_transfer.nir.refl
f_trans_par = p.canopy.radiative_transfer.par.trans
f_trans_nir = p.canopy.radiative_transfer.nir.trans
# in total: d - u = CANOPY_ABS + (1-α_soil)*CANOPY_TRANS
# SW upwelling = reflected par + reflected nir
@. SW_u =
energy_per_photon_NIR * N_a * p.canopy.radiative_transfer.nir.refl +
energy_per_photon_PAR * N_a * p.canopy.radiative_transfer.par.refl
@. SW_u = par_d * f_refl_par + f_refl_nir * nir_d

# net canopy
@. SW_net_canopy =
energy_per_photon_NIR * N_a * p.canopy.radiative_transfer.nir.abs +
energy_per_photon_PAR * N_a * p.canopy.radiative_transfer.par.abs
@. SW_net_canopy = f_abs_par * par_d + f_abs_nir * nir_d

# net soil = (1-α)*trans for par and nir
@. R_net_soil .=
energy_per_photon_NIR *
N_a *
p.canopy.radiative_transfer.nir.trans *
(1 - α_soil_NIR) +
energy_per_photon_PAR *
N_a *
p.canopy.radiative_transfer.par.trans *
(1 - α_soil_PAR)
f_trans_nir * nir_d * (1 - α_soil_NIR) +
f_trans_par * par_d * (1 - α_soil_PAR)

# Working through the math, this satisfies: LW_d - LW_u = LW_c + LW_soil
ϵ_canopy = p.canopy.radiative_transfer.ϵ # this takes into account LAI/SAI
Expand Down
25 changes: 11 additions & 14 deletions src/standalone/Vegetation/Canopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ function ClimaLand.make_update_aux(
ψ = p.canopy.hydraulics.ψ
ϑ_l = Y.canopy.hydraulics.ϑ_l
fa = p.canopy.hydraulics.fa
inc_par = p.canopy.radiative_transfer.inc_par
inc_nir = p.canopy.radiative_transfer.inc_nir
par_d = p.canopy.radiative_transfer.par_d
nir_d = p.canopy.radiative_transfer.nir_d
frac_diff = p.canopy.radiative_transfer.frac_diff

bc = canopy.boundary_conditions
Expand All @@ -436,10 +436,8 @@ function ClimaLand.make_update_aux(
R = FT(LP.gas_constant(earth_param_set))
T_freeze = FT(LP.T_freeze(earth_param_set))
thermo_params = earth_param_set.thermo_params
(; G_Function, Ω, λ_γ_PAR, λ_γ_NIR) =
canopy.radiative_transfer.parameters
energy_per_photon_PAR = planck_h * c / λ_γ_PAR
energy_per_photon_NIR = planck_h * c / λ_γ_NIR
(; G_Function, Ω, λ_γ_PAR) = canopy.radiative_transfer.parameters
energy_per_mole_photon_par = planck_h * c / λ_γ_PAR * N_a
(; g1, g0, Drel) = canopy.conductance.parameters
area_index = p.canopy.hydraulics.area_index
LAI = area_index.leaf
Expand All @@ -453,8 +451,8 @@ function ClimaLand.make_update_aux(
(1 - exp(-(LAI + SAI))) #from CLM 5.0, Tech note 4.20
p.canopy.radiative_transfer.G .= compute_G(G_Function, θs)
RT = canopy.radiative_transfer
compute_PAR!(inc_par, RT, bc.radiation, p, t)
compute_NIR!(inc_nir, RT, bc.radiation, p, t)
compute_PAR!(par_d, RT, bc.radiation, p, t)
compute_NIR!(nir_d, RT, bc.radiation, p, t)
K = p.canopy.radiative_transfer.K
@. K = extinction_coeff(p.canopy.radiative_transfer.G, θs)
DOY =
Expand All @@ -469,11 +467,9 @@ function ClimaLand.make_update_aux(
thermo_params,
)

compute_absorbances!(
compute_fractional_absorbances!(
p,
RT,
inc_par,
inc_nir,
LAI,
K,
ground_albedo_PAR(
Expand All @@ -490,9 +486,6 @@ function ClimaLand.make_update_aux(
p,
t,
),
energy_per_photon_PAR,
energy_per_photon_NIR,
N_a,
θs,
frac_diff,
)
Expand Down Expand Up @@ -573,6 +566,8 @@ function ClimaLand.make_update_aux(
medlyn_factor,
c_co2_air,
R,
energy_per_mole_photon_par,
par_d,
)
# update SIF
SIF = p.canopy.sif.SIF
Expand All @@ -585,6 +580,8 @@ function ClimaLand.make_update_aux(
R,
T_freeze,
canopy.photosynthesis.parameters,
energy_per_mole_photon_par,
par_d,
)
@. GPP = compute_GPP(An, K, LAI, Ω)
@. gs = medlyn_conductance(g0, Drel, medlyn_factor, An, c_co2_air)
Expand Down
Loading

0 comments on commit 9b73ade

Please sign in to comment.