Skip to content

Commit

Permalink
Master fix ningorg refill (#283)
Browse files Browse the repository at this point in the history
* Update upload-artifact version to v4 (compulsory)

* Undo changes made to Recover_N_balance by mistake. Note that the hardcoded ninorg content is set to init_Nmineral rather than the hardcoded value 0.2. The rest of the changes are just a revert to the original code.

---------

Co-authored-by: marcadella <mayeul.marcadella@unibe.ch>
  • Loading branch information
marcadella and marcadella authored Feb 4, 2025
1 parent a965ec6 commit 7be32ed
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
Binary file modified data/biomee_gs_leuning_output.rda
Binary file not shown.
Binary file modified data/biomee_p_model_output.rda
Binary file not shown.
16 changes: 3 additions & 13 deletions src/datatypes.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -932,26 +932,16 @@ end subroutine annual_diagnostics_post_mortality

subroutine Recover_N_balance(vegn)
!////////////////////////////////////////////////////////////////////////
! We scale the N pools to contrain the yearly N (soil + plant) to be constant.
! Update psoil_sl in order to keep the total N constant
! Note: this leads to negative N pools...
!------------------------------------------------------------------------
type(vegn_tile_type), intent(inout) :: vegn
real :: delta, scaling_factor

delta = vegn%totN - vegn%initialN0

if (abs(delta) > 1e-6) then
scaling_factor = 1 - delta / vegn%totN

vegn%psoil_sl%n%n14 = vegn%psoil_sl%n%n14 * scaling_factor
vegn%psoil_fs%n%n14 = vegn%psoil_fs%n%n14 * scaling_factor
vegn%pmicr%n%n14 = vegn%pmicr%n%n14 * scaling_factor
vegn%ninorg%n14 = vegn%ninorg%n14 * scaling_factor
vegn%plabl%n%n14 = vegn%plabl%n%n14 * scaling_factor
vegn%pseed%n%n14 = vegn%pseed%n%n14 * scaling_factor
vegn%pleaf%n%n14 = vegn%pleaf%n%n14 * scaling_factor
vegn%proot%n%n14 = vegn%proot%n%n14 * scaling_factor
vegn%psapw%n%n14 = vegn%psapw%n%n14 * scaling_factor
vegn%pwood%n%n14 = vegn%pwood%n%n14 * scaling_factor
vegn%psoil_sl%n%n14 = vegn%psoil_sl%n%n14 - delta
vegn%totN = vegn%initialN0
endif
end subroutine Recover_N_balance
Expand Down
2 changes: 1 addition & 1 deletion src/vegetation_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ subroutine vegn_N_uptake(vegn, tsoil)
integer :: i

! We artificially refill N inorg
if (myinterface%params_siml%do_closedN_run) vegn%ninorg%n14 = 0.2
if (myinterface%params_siml%do_closedN_run) vegn%ninorg%n14 = myinterface%init_soil%init_Nmineral

! Nitrogen uptake parameter
! It considers competition here. How much N one can absorp depends on
Expand Down

0 comments on commit 7be32ed

Please sign in to comment.