CABLE-LSM / CABLE-Trac-archive

Archive CABLE Trac contents as issues
Other
0 stars 0 forks source link

Negative NPP in casa CNP #241

Closed penguian closed 2 years ago

penguian commented 4 years ago

keyword_nogit owner:yxw599@nci.org.au resolution_fixed type_defect | by mgk576


The trunk is missing a correction for negative NPP and the fix, which is in Vanessa's call_climate block still does not guard against negative NPP. The solution is as follows:

https://trac.nci.org.au/trac/cable/browser/trunk/core/biogeochem/casa_cnp.F90

! Calculate new NPP accounting for respiration losses.
casaflux%cnpp(:) = casaflux%Cgpp(:)-SUM(casaflux%crmplant(:,:),2) - &
                                       casaflux%crgplant(:)

! Ensure NPP does not become negative, reduce respiration losses if so
WHERE(casaflux%Cnpp < 0.0)
   ! change made here by ypw on 11-7-2016 to include leaf maintenance respiration
   delcrmleaf(:)  = casaflux%Cnpp(:) * casaflux%crmplant(:,leaf) &
                 / max(1E-06,(casaflux%crmplant(:,leaf)+casaflux%crmplant(:,wood) &
                           + casaflux%crmplant(:,froot)))
   delcrmwood(:)  = casaflux%Cnpp(:) * casaflux%crmplant(:,wood) &
                 / max(1E-06,(casaflux%crmplant(:,leaf)+casaflux%crmplant(:,wood) &
                           + casaflux%crmplant(:,froot)))
   delcrmfroot(:) = casaflux%Cnpp(:) * casaflux%crmplant(:,froot) &
                 / max(1E-06,(casaflux%crmplant(:,leaf)+casaflux%crmplant(:,wood) &
                           + casaflux%crmplant(:,froot)))
   casaflux%crmplant(:,leaf)  = casaflux%crmplant(:,leaf)  + delcrmleaf(:)
   casaflux%crmplant(:,wood)  = casaflux%crmplant(:,wood)  + delcrmwood(:)
   casaflux%crmplant(:,froot) = casaflux%crmplant(:,froot) + delcrmfroot(:)
   casaflux%Cnpp(:) = casaflux%Cnpp(:) -delcrmwood(:)-delcrmfroot(:)
   casaflux%crgplant(:) = 0.0
   casaflux%cnpp(:) = casaflux%Cgpp(:)-SUM(casaflux%crmplant(:,:),2) - casaflux%crgplant(:)

   ! The logic above can still lead to a negative NPP as
   ! SUM(casaflux%crmplant(:,:),2) can be a tiny number, if this
   ! happens, set NPP to zero
   WHERE(casaflux%Cnpp < 0.0)
      casaflux%cnpp(:) = 0.0
   ENDWHERE
ENDWHERE

Issue migrated from trac:241 at 2023-11-27 11:31:24 +1100

penguian commented 4 years ago

@mgk576@nci.org.au commented


The two key elements that are wrong with the existing logic ...

First, you need to first recalculate casaflux%cnpp(:) before you check if it is negative, i.e. above the where statement. Otherwise it may very well be negative but not be corrected.

Second, Cnpp can still be negative after the correction because SUM(casaflux%crmplant(:,:),2) can be a tiny value 0.0000000000001, so you need the final correction.

penguian commented 4 years ago

@mgk576@nci.org.au changed _comment0 which not transferred by tractive

penguian commented 4 years ago

@mgk576@nci.org.au _uploaded file spinup_carbon_pools_single_file_5.pdf (180.4 KiB)_

Proof the fix works

penguian commented 2 years ago

@jxs599@nci.org.au changed status from new to closed

penguian commented 2 years ago

@jxs599@nci.org.au set resolution to fixed

penguian commented 2 years ago

@jxs599@nci.org.au set milestone to 1. Closed

penguian commented 2 years ago

@jxs599@nci.org.au commented


pushed @8686

penguian commented 1 year ago

@ccc561@nci.org.au set keywords to nogit