Skip to content

Commit 79351f2

Browse files
committed
area weight fluxes for atmosphere only
1 parent 3807833 commit 79351f2

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/FluxCalculator.jl

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -356,26 +356,18 @@ function compute_surface_fluxes!(
356356
@. ustar = ifelse(area_fraction 0, zero(ustar), ustar)
357357
@. buoyancy_flux = ifelse(area_fraction 0, zero(buoyancy_flux), buoyancy_flux)
358358

359-
# multiply fluxes by area fraction
360-
F_turb_ρτxz .*= area_fraction
361-
F_turb_ρτyz .*= area_fraction
362-
F_sh .*= area_fraction
363-
F_lh .*= area_fraction
364-
F_turb_moisture .*= area_fraction
365-
366359
# update the fluxes, which are now area-weighted, of this surface model
367360
fields = (; F_turb_ρτxz, F_turb_ρτyz, F_lh, F_sh, F_turb_moisture)
368361
FluxCalculator.update_turbulent_fluxes!(sim, fields)
369362

370363
# update fluxes in the coupler fields
371364
# add the flux contributing from this surface to the coupler field
372-
# note that the fluxes area-weighted, so if a surface model is
373-
# not present at a point, the fluxes are zero
374-
@. csf.F_turb_ρτxz += F_turb_ρτxz
375-
@. csf.F_turb_ρτyz += F_turb_ρτyz
376-
@. csf.F_lh += F_lh
377-
@. csf.F_sh += F_sh
378-
@. csf.F_turb_moisture += F_turb_moisture
365+
# note that the fluxes are area-weighted here when we provide them to the atmosphere
366+
@. csf.F_turb_ρτxz += F_turb_ρτxz * area_fraction
367+
@. csf.F_turb_ρτyz += F_turb_ρτyz * area_fraction
368+
@. csf.F_lh += F_lh * area_fraction
369+
@. csf.F_sh += F_sh * area_fraction
370+
@. csf.F_turb_moisture += F_turb_moisture * area_fraction
379371

380372
# NOTE: This is still an area weighted contribution, which maybe doesn't make
381373
# too much sense for these quantities...

0 commit comments

Comments
 (0)