Skip to content

Commit

Permalink
updated restarted ouptut
Browse files Browse the repository at this point in the history
It fixed a NaN bug for the standing dead biomass.
  • Loading branch information
“Jinyun committed Nov 4, 2024
1 parent c25c681 commit 6d15f93
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 17 deletions.
6 changes: 3 additions & 3 deletions f90src/APIData/PlantAPIData.F90
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,8 @@ subroutine plt_bgcrate_init(this)
allocate(this%NH3Emis_CumYr_pft(JP1));this%NH3Emis_CumYr_pft=spval
allocate(this%NodulInfectElms_pft(NumPlantChemElms,JP1));this%NodulInfectElms_pft=spval
allocate(this%NodulInfectElmsCum_pft(NumPlantChemElms,JP1));this%NodulInfectElmsCum_pft=spval
allocate(this%SurfLitrfalStrutElms_CumYr_pft(NumPlantChemElms,JP1));this%SurfLitrfalStrutElms_CumYr_pft=spval
allocate(this%LitrFallStrutElms_col(NumPlantChemElms));this%LitrFallStrutElms_col=spval
allocate(this%SurfLitrfalStrutElms_CumYr_pft(NumPlantChemElms,JP1));this%SurfLitrfalStrutElms_CumYr_pft=0._r8
allocate(this%LitrFallStrutElms_col(NumPlantChemElms));this%LitrFallStrutElms_col=0._r8
allocate(this%NetPrimProduct_pft(JP1));this%NetPrimProduct_pft=spval
allocate(this%NH3Dep2Can_pft(JP1));this%NH3Dep2Can_pft=spval
allocate(this%tRootMycoExud2Soil_vr(NumPlantChemElms,1:jcplx,JZ1));this%tRootMycoExud2Soil_vr=spval
Expand All @@ -1014,7 +1014,7 @@ subroutine plt_bgcrate_init(this)
allocate(this%REcoNH4DmndBand_vr(0:JZ1));this%REcoNH4DmndBand_vr=spval
allocate(this%REcoH1PO4DmndSoil_vr(0:JZ1));this%REcoH1PO4DmndSoil_vr=spval

allocate(this%LitrfalStrutElms_CumYr_pft(NumPlantChemElms,JP1));this%LitrfalStrutElms_CumYr_pft=spval
allocate(this%LitrfalStrutElms_CumYr_pft(NumPlantChemElms,JP1));this%LitrfalStrutElms_CumYr_pft=0._r8
allocate(this%LitrfalStrutElms_pft(NumPlantChemElms,JP1));this%LitrfalStrutElms_pft=spval
allocate(this%LitrfalStrutElms_pvr(NumPlantChemElms,jsken,1:NumOfPlantLitrCmplxs,0:JZ1,JP1))
this%LitrfalStrutElms_pvr=spval
Expand Down
3 changes: 1 addition & 2 deletions f90src/APIs/PlantAPI.F90
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,7 @@ subroutine PlantAPIRecv(I,J,NY,NX)
ENDDO
ENDDO
DO M=1,jsken
StandDeadKCompElms_pft(1:NumPlantChemElms,M,NZ,NY,NX)=&
plt_biom%StandDeadKCompElms_pft(1:NumPlantChemElms,M,NZ)
StandDeadKCompElms_pft(1:NumPlantChemElms,M,NZ,NY,NX)=plt_biom%StandDeadKCompElms_pft(1:NumPlantChemElms,M,NZ)
ENDDO

DO L=1,NL(NY,NX)
Expand Down
2 changes: 1 addition & 1 deletion f90src/ioutils/HistDataType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2588,7 +2588,7 @@ subroutine hist_update(this,I,J,bounds)
this%h1D_STORED_C_ptc(nptc) = SeasonalNonstElms_pft(ielmc,NZ,NY,NX)/AREA(3,NU(NY,NX),NY,NX)
this%h1D_GRAIN_NO_ptc(nptc) = CanopySeedNum_pft(NZ,NY,NX)/AREA(3,NU(NY,NX),NY,NX)
this%h1D_LAIb_ptc(nptc) = CanopyLeafArea_pft(NZ,NY,NX)/AREA(3,NU(NY,NX),NY,NX)
this%h1D_EXUD_CumYr_C_FLX_ptc(nptc) = PlantExudElm_CumYr_pft(ielmc,NZ,NY,NX)/AREA(3,NU(NY,NX),NY,NX)
this%h1D_EXUD_CumYr_C_FLX_ptc(nptc) = PlantExudElm_CumYr_pft(ielmc,NZ,NY,NX)/AREA(3,NU(NY,NX),NY,NX)
this%h1D_LITRf_C_FLX_ptc(nptc) = LitrfalStrutElms_CumYr_pft(ielmc,NZ,NY,NX)/AREA(3,NU(NY,NX),NY,NX)
this%h1D_SURF_LITRf_C_FLX_ptc(nptc) = SurfLitrfalStrutElms_CumYr_pft(ielmc,NZ,NY,NX)/AREA(3,NU(NY,NX),NY,NX)
this%h1D_AUTO_RESP_FLX_ptc(nptc) = GrossResp_pft(NZ,NY,NX)/AREA(3,NU(NY,NX),NY,NX)
Expand Down
25 changes: 21 additions & 4 deletions f90src/ioutils/RestartMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ SUBROUTINE restartnc_plant(ncid,flag)
endif

if(flag=='read')then
datpr3 => datrp_3d(1:npfts,1:jsken,1:NumPlantChemElms)
datpr3 => datrp_3d(1:npfts,1:NumPlantChemElms,1:jsken)
call restartvar(ncid, flag, varname='StandDeadKCompElms_pft', dim1name='pft',dim2name='nkinecmp',&
dim3name='elmnts',long_name='standing dead element fraction', units='g d-2', &
interpinic_flag='skip', data=datpr3, missing_value=spval, fill_value=spval)
Expand All @@ -262,9 +262,10 @@ SUBROUTINE restartnc_plant(ncid,flag)
else
!print*,'StandDeadKCompElms_pft'
if(flag=='write')call cppft(flag,NHW,NHE,NVN,NVS,NP,StandDeadKCompElms_pft,datrp_3d)
datpr3 => datrp_3d(1:npfts,1:jsken,1:NumPlantChemElms)
call restartvar(ncid, flag, varname='StandDeadKCompElms_pft', dim1name='pft',dim2name='nkinecmp',&
dim3name='elmnts',long_name='standing dead element fraction', units='g d-2', &
write(111,*)'restart',datrp_3d(1:npfts,1:NumPlantChemElms,jsken)
datpr3 => datrp_3d(1:npfts,1:NumPlantChemElms,1:jsken)
call restartvar(ncid, flag, varname='StandDeadKCompElms_pft', dim1name='pft',dim2name='elmnts',&
dim3name='nkinecmp',long_name='standing dead element fraction', units='g d-2', &
interpinic_flag='skip', data=datpr3, missing_value=spval, fill_value=spval)

endif
Expand Down Expand Up @@ -1256,6 +1257,22 @@ SUBROUTINE restartnc_plant(ncid,flag)
interpinic_flag='skip', data=datpr2, missing_value=spval, fill_value=spval)
endif

if(flag=='read')then
datpr2 => datrp_2d(1:npfts,1:NumPlantChemElms)
call restartvar(ncid, flag, varname='LitrfalStrutElms_CumYr_pft', dim1name='pft',dim2name='elmnts',&
long_name='total surface LitrFall element', units='g d-2', &
interpinic_flag='skip', data=datpr2, missing_value=spval, fill_value=spval)
call cppft(flag,NHW,NHE,NVN,NVS,NP,LitrfalStrutElms_CumYr_pft,datrp_2d,&
NumActivePlants=NumActivePlants,IsPlantActive_pft=IsPlantActive_pft)
else
if(flag=='write')call cppft(flag,NHW,NHE,NVN,NVS,NP,LitrfalStrutElms_CumYr_pft,datrp_2d,NumActivePlants=NumActivePlants,&
IsPlantActive_pft=IsPlantActive_pft)
datpr2 => datrp_2d(1:npfts,1:NumPlantChemElms)
call restartvar(ncid, flag, varname='LitrfalStrutElms_CumYr_pft', dim1name='pft',dim2name='elmnts',&
long_name='total surface LitrFall element', units='g d-2', &
interpinic_flag='skip', data=datpr2, missing_value=spval, fill_value=spval)
endif

if(flag=='read')then
datpr1 => datrp_1d
call restartvar(ncid, flag, varname='PPI_pft',dim1name='pft',&
Expand Down
6 changes: 3 additions & 3 deletions f90src/plant_bgc/InitPlantMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -822,9 +822,9 @@ subroutine InitMassBalance(NZ)
plt_distb%EcoHavstElmntCum_pft(1:NumPlantChemElms,NZ) = 0._r8
plt_distb%EcoHavstElmnt_CumYr_pft(1:NumPlantChemElms,NZ) = 0._r8
NetCumElmntFlx2Plant_pft(1:NumPlantChemElms,NZ) = 0._r8
ETCanopy_CumYr_pft(NZ)=0._r8
StandDeadStrutElms_pft(1:NumPlantChemElms,NZ)=0._r8
WTSTDX=StandingDeadInitC_pft(NZ)*AREA3(NU)
StandDeadStrutElms_pft(1:NumPlantChemElms,NZ) = 0._r8
ETCanopy_CumYr_pft(NZ) = 0._r8
WTSTDX = StandingDeadInitC_pft(NZ)*AREA3(NU)
D155: DO M=1,jsken
StandDeadKCompElms_pft(ielmc,M,NZ)=WTSTDX*ElmAllocmat4Litr(ielmc,icwood,M,NZ)
StandDeadKCompElms_pft(ielmn,M,NZ)=WTSTDX*rNCStalk_pft(NZ)*ElmAllocmat4Litr(ielmn,icwood,M,NZ)
Expand Down
5 changes: 4 additions & 1 deletion f90src/plant_bgc/PlantBalMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ subroutine SumPlantBiomStates(I,J,NZ,header)
integer, intent(in) :: I,J
integer, intent(in) :: NZ
character(len=*),intent(in) :: header
integer :: NB,NE,K
integer :: NB,NE,K,jk
real(r8) :: root1st,root2nd
real(r8) :: balc

Expand Down Expand Up @@ -173,6 +173,9 @@ subroutine SumPlantBiomStates(I,J,NZ,header)
ShootElms_pft(NE,NZ)=ShootElms_pft(NE,NZ)+StandDeadStrutElms_pft(NE,NZ)
if(ShootElms_pft(NE,NZ)>1.e20)then
write(*,*)'sum3plantstates',StandDeadStrutElms_pft(NE,NZ)
DO jk=1,jsken
write(*,*)NE,StandDeadKCompElms_pft(NE,jk,NZ)
enddo
stop
endif

Expand Down
6 changes: 3 additions & 3 deletions f90src/plant_bgc/PlantDisturbsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ subroutine RemoveStandingDead(I,J,NZ)

D6475: DO M=1,jsken
DO NE=1,NumPlantChemElms
StandeadElmntRemoval(NE)=StandeadElmntRemoval(NE)+(1._r8-FHVSH)*StandDeadKCompElms_pft(NE,M,NZ)
StandeadElmntHarv2Litr(NE)=StandeadElmntHarv2Litr(NE)+(FHVSH-FHVSE)*StandDeadKCompElms_pft(NE,M,NZ)
StandDeadKCompElms_pft(NE,M,NZ)=FHVSE*StandDeadKCompElms_pft(NE,M,NZ)
StandeadElmntRemoval(NE) = StandeadElmntRemoval(NE)+(1._r8-FHVSH)*StandDeadKCompElms_pft(NE,M,NZ)
StandeadElmntHarv2Litr(NE) = StandeadElmntHarv2Litr(NE)+(FHVSH-FHVSE)*StandDeadKCompElms_pft(NE,M,NZ)
StandDeadKCompElms_pft(NE,M,NZ) = FHVSE*StandDeadKCompElms_pft(NE,M,NZ)
ENDDO
ENDDO D6475
end associate
Expand Down

0 comments on commit 6d15f93

Please sign in to comment.