Skip to content

Commit

Permalink
got PML with P-model Gs running. Complemented vignette. Performs very…
Browse files Browse the repository at this point in the history
… good.
  • Loading branch information
stineb committed Aug 15, 2024
1 parent 5de81fb commit 21f4e98
Show file tree
Hide file tree
Showing 3 changed files with 308 additions and 99 deletions.
23 changes: 16 additions & 7 deletions R/run_pmodel_f_bysite.R
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,23 @@ run_pmodel_f_bysite <- function(
}

# If PML is used, then ensure that site info has reference height and canopy height
if (params_siml$use_pml){
continue = !is.nanull(site_info$canopy_height) &
!is.nanull(site_info$reference_height)
} else {
site_info$canopy_height = NA
site_info$reference_height = NA
avl_canopy_height = !is.nanull(site_info$canopy_height)
if (!avl_canopy_height){
if (params_siml$use_pml){
continue <- FALSE
} else {
site_info$canopy_height <- NA
}
}

avl_reference_height = !is.nanull(site_info$reference_height)
if (!avl_reference_height){
if (params_siml$use_pml){
continue <- FALSE
} else {
site_info$reference_height <- NA
}
}


if (continue){

Expand Down
20 changes: 20 additions & 0 deletions src/waterbal_splash.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,22 @@ subroutine calc_et( tile_fluxes, grid, climate, sw, fapar, using_phydro, using_g
tile_fluxes%canopy%daet_e_canop = (epsilon * fapar * tile_fluxes%canopy%drn + (rho_water * cp / gamma) &
* ga * climate%dvpd) / (epsilon + 1.0 + ga / gw)


! print*,'-----------------------'
! print*,'canopy_height ', myinterface%canopy_height
! print*,'dwind ', climate%dwind
! print*,'reference_height ', myinterface%reference_height
! print*,'epsilon ', epsilon
! print*,'fapar ', fapar
! print*,'net rad ', tile_fluxes%canopy%drn
! print*,'rho_watr', rho_water
! print*,'cp ', cp
! print*,'gamma ', gamma
! print*,'ga ', ga
! print*,'vpd ', climate%dvpd
! print*,'gw ', gw
! print*,'-----------------------'

! ! W m-2 ---> mol m-2 s-1
! tile_fluxes%canopy%daet_canop = tile_fluxes%canopy%daet_e_canop &
! * (55.5 / par_env%lv)
Expand All @@ -470,6 +486,8 @@ subroutine calc_et( tile_fluxes, grid, climate, sw, fapar, using_phydro, using_g
! XXX test: these units don't convert
tile_fluxes%canopy%daet_canop = tile_fluxes%canopy%daet_e_canop * energy_to_mm

! print*,'PML: tile_fluxes%canopy%daet_canop, tile_fluxes%canopy%daet_soil ', tile_fluxes%canopy%daet_canop, tile_fluxes%canopy%daet_soil

else
!---------------------------------------------------------
! Canopy transpiration using the diffusion equation (mm d-1)
Expand All @@ -479,6 +497,8 @@ subroutine calc_et( tile_fluxes, grid, climate, sw, fapar, using_phydro, using_g
tile_fluxes%canopy%daet_canop = tile_fluxes%canopy%dtransp
tile_fluxes%canopy%daet_e_canop = tile_fluxes%canopy%daet_canop / energy_to_mm ! mm d-1 ---> J m-2 d-1

! print*,'DIF: tile_fluxes%canopy%daet_canop, tile_fluxes%canopy%daet_soil ', tile_fluxes%canopy%daet_canop, tile_fluxes%canopy%daet_soil

end if

tile_fluxes%canopy%daet = tile_fluxes%canopy%daet_canop + tile_fluxes%canopy%daet_soil
Expand Down
Loading

0 comments on commit 21f4e98

Please sign in to comment.