Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Sensing Linkage January 2025 #466

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
4 changes: 4 additions & 0 deletions CSM_Main/CSM.for
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,17 @@ C The variable "ISWITCH" is of type "SwitchType".

DONE = .FALSE.
YRDOY_END = 9999999
! dummy change


! Pick up model version for setting the name of some files
WRITE(ModelVerTxt,'(I2.2,I1)') Version%Major, Version%Minor

!Delete existing output files
CALL OPCLEAR



CALL GETLUN('FILEIO', LUNIO)
FILEIO = 'DSSAT48.INP'

Expand Down
1 change: 1 addition & 0 deletions InputModule/COMSOI.blk
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
& PTERMA,PTERMB,EXK,EXMG,EXNA,EXTS,SLEC, EXCA, SASC,
& SAEA,
& alphaVG, mVG, nVG, WCR

23 changes: 20 additions & 3 deletions InputModule/IPSOIL_Inp.for
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ C=======================================================================
CHARACTER*15 HEADER(MAXCOL)
! COL keeps beginning and ending column for each header
INTEGER COL(MAXCOL,2), C1, C2, COUNT, L






TYPE (SwitchType) ISWITCH

PARAMETER (ERRKEY = 'IPSOIL')
PARAMETER (LUNSL = 12)
PARAMETER (BLANK = ' ')



NLSOIL = 0
!-----------------------------------------------------------------------
! No soil file read - default conditions
Expand Down Expand Up @@ -235,6 +241,7 @@ C
SASC = -99.
SAEA = -99.


!-----------------------------------------------------------------------
! Find correct soil within soil file
I = 0
Expand Down Expand Up @@ -346,6 +353,7 @@ C-KRT*******************************************************************
DO I = 1, COUNT
C1 = COL(I,1)
C2 = COL(I,2)

SELECT CASE (TRIM(HEADER(I)))

CASE('SCOM'); READ(C255(C1:C2),*,IOSTAT=ERR) SCOM
Expand All @@ -360,6 +368,7 @@ C-KRT*******************************************************************
CASE('SMKE'); READ(C255(C1:C2),*,IOSTAT=ERR) SMKE
CASE('SGRP'); READ(C255(C1:C2),*,IOSTAT=ERR) SGRP


! CASE('SOILLAT'); READ(C255(C1:C2),*,IOSTAT=ERR) SLAT
! CASE('SOILLONG');READ(C255(C1:C2),*,IOSTAT=ERR) SLONG
! CASE('SLTX'); READ(C255(C1:C2),*,IOSTAT=ERR) SLTXS
Expand All @@ -372,9 +381,9 @@ C-KRT*******************************************************************
! CASE('ETDR'); READ(C255(C1:C2),*,IOSTAT=ERR) ETDR

END SELECT

IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILES,LINSOL)
ENDDO

ELSE
!Soil layer data
L = L + 1
Expand Down Expand Up @@ -473,7 +482,8 @@ C-KRT*******************************************************************
CLOSE (LUNSL)

! Check validity of soil values
IF (SWCON .LT. 0.0) CALL ERROR (ERRKEY,10,FILES,LINSOL)

IF (SWCON .LT. 0.0) CALL ERROR (ERRKEY,10,FILES,LINSOL)
IF (CN2 .LE. 0.0) CALL ERROR (ERRKEY,11,FILES,LINSOL)
IF (SALB .LE. 0.0) THEN
! SALB = 0.13
Expand Down Expand Up @@ -614,6 +624,13 @@ C-KRT*******************************************************************

ENDIF








RETURN

C-----------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions InputModule/input_sub.for
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ C-----------------------------------------------------------------------
CALL IPVAR (FILEG,NSENS,RNMODE,VARNO,VARTY,VRNAME,PATHGE,
& ECONO, MODEL, ATLINE) !, CROP)
ENDIF


C-----------------------------------------------------------------------
C Call IPSLIN to read initial soil conditions
Expand Down
1 change: 1 addition & 0 deletions InputModule/ipexp.for
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ C saved as real numbers for placement in real array.
MSG(2) = FILEX
CALL WARNING(2, ERRKEY, MSG)
ENDIF


IF(YCRD .GE. -90.0 .AND. YCRD .LE. 90.0 .AND.
& XCRD .GE.-180.0 .AND. XCRD .LE. 180.0 .AND.
Expand Down
9 changes: 7 additions & 2 deletions InputModule/optempy2k.for
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,16 @@ C-----------------------------------------------------------------------
C-----------------------------------------------------------------------
C
C-----------------------------------------------------------------------

WRITE (LUNIO,980,IOSTAT=ERRNUM) SCOM,SALB,U,SWCON,CN2,SLNF,SLPF,
& SMHB,SMPX,SMKE,SGRP

LINIO = LINIO + 1
IF (ERRNUM .NE. 0) CALL ERROR (ERRKEY,ERRNUM,FILEIO,LINIO)


980 FORMAT (1X,A5,1X,F5.2,1X,F5.1,1X,F5.2,1X,F5.0,2(1X,F5.2),4(1X,A5))

C-----------------------------------------------------------------------
C
C-----------------------------------------------------------------------
Expand Down Expand Up @@ -807,8 +813,7 @@ C-----------------------------------------------------------------------
960 FORMAT (1X,A10,2X,A11,1X,A5,1X,F5.0,1X,A50)
970 FORMAT (2(1X,A11),2(F8.3),1X,A50)

980 FORMAT (1X,A5,1X,F5.2,1X,F5.1,1X,F5.2,1X,F5.0,2(1X,F5.2),4(1X,A5),
& F6.2)
!

1000 FORMAT (A6,1X,A16,1X,A6,1X,7(F6.1))
1050 FORMAT (A6,1X,A16,1X,A6,9(1X,F5.0),1X,I5,1X,F5.2,1X,F5.0,1X,F5.1)
Expand Down
2 changes: 1 addition & 1 deletion Plant/CROPGRO/DEMAND.for
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ C 24 changed to TS by Bruce Kimball on 3Jul17
! Total N Demand
!-----------------------------------------------------------------------
NDMTOT = NDMREP + NDMVEG + NDMOLD
!-----------------------------------------------------------------------
!----------------------------------------------------------------------
! Compute Total Demand for C, and Max. C that Could be Mined
! CDMTOT not used - chp
!-----------------------------------------------------------------------
Expand Down
39 changes: 36 additions & 3 deletions Plant/CROPGRO/GROW.for
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ C=======================================================================
REAL TOSHMINE, TOCHMINE
REAL HPODWT,HSDWT,HSHELWT
REAL NHSHWT, NHSDWT

!WDB 8/14/2023
!RSWLIDOT - New leaf weight to add if Remote sensing increases leaf area
!Used to get around adding leaf N when adding leaf weight and LAI
REAL RSWLIDOT
!-----------------------------------------------------------------------
! Constructed variable types defined in ModuleDefs.for.
TYPE (ControlType) CONTROL
Expand Down Expand Up @@ -496,8 +501,25 @@ C to account for mass, N and C lost this way in sections below
C-----------------------------------------------------------------------
C WLDOT = Net leaf growth rate
C-----------------------------------------------------------------------

!WDB 8/14/2023 To add LAI for remote sensing, WLIDOT is negative
!If RS reduces LAI, run the damage through WLIDOT
!If RS increases LAI, set WLIDOT to 0 and run damage through RSWLIDOT
!Add positive leaf weight adjustment directly to WLDOTN

RSWLIDOT = 0.0 !Remote sensed increased in leaf weight today
IF(WLIDOT.LT.0) THEN
RSWLIDOT = -WLIDOT
WLIDOT = 0.0
WLDOTN = WLDOTN + RSWLIDOT
ENDIF
!End Change


WLDOT = WLDOTN - SLDOT - WLIDOT - WLFDOT - NRUSLF/0.16 - CRUSLF



! ShutMob is amount of leaf mass lost due to N and C mobilization
! A positive value represents leaf mass lost. (kg/ha)
ShutMob = (NRUSLF/0.16 + CRUSLF) * 10. !kg/ha
Expand Down Expand Up @@ -732,23 +754,33 @@ C-----------------------------------------------------------------------
C-----------------------------------------------------------------------
C Leaf nitrogen senescence and pest damage loss
C-----------------------------------------------------------------------
! senesc. + pest + freeze
! senesc. + pest + freeze
NLOFF = (SLNDOT + WLIDOT + WLFDOT) * (PCNL/100.) +
& (SLDOT-SLNDOT) * PROLFF * 0.16
NLPEST = NLPEST + WLIDOT * PCNL/100.

IF (NLOFF. LT. 0.0) THEN
NLOFF = 0.0
ENDIF

C-----------------------------------------------------------------------
C Net growth rate of nitrogen in the leaves
C-----------------------------------------------------------------------

NLDOT = NGRLF - NLOFF - NRUSLF
IF (WTLF > 1.E-4) THEN
NLDOT = NLDOT + NADLF *
& (1. - MIN(1.0,(SLDOT + WLIDOT + WLFDOT) / WTLF))
ENDIF

C** WDB 8/14/23
C Add leaf N if remote sensing adjusts LAI up
IF(RSWLIDOT.GT.0) THEN
NLDOT = NLDOT + RSWLIDOT * PCNL/100
ENDIF
c** end changes


C-----------------------------------------------------------------------
C Stem nitrogen senescence and pest damage loss
C-----------------------------------------------------------------------
Expand All @@ -769,6 +801,7 @@ C-----------------------------------------------------------------------
& (1. - MIN(1.0,(SSDOT + WSIDOT) / STMWT))
ENDIF


C-----------------------------------------------------------------------
C Root nitrogen senescence and pest damage loss
C-----------------------------------------------------------------------
Expand Down Expand Up @@ -825,8 +858,8 @@ C-----------------------------------------------------------------------
IF ((NLDOT < 0.0) .AND. (ABS(NLDOT) > WTNLF)) THEN
NLDOT = - WTNLF
ENDIF
WTNLF = WTNLF + NLDOT


WTNLF = WTNLF + NLDOT
C-----------------------------------------------------------------------
C Total nitrogen in the stems
C-----------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion Plant/CROPGRO/VEGGR.for
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ C-----------------------------------------------------------------------
NSTRES = XNSTRES * 0.5 + PNSTRES * 0.5

! FRRT = ATOP * (1.0 - (MIN(TURFAC,NSTRES)))*(1.0-FRRT) + FRRT

!Fraction of carbon to go to roots

FRRT = ATOP * (1.0 - (MIN(TURFAC, NSTRES, PStres2))) *
& (1.0 - FRRT) + FRRT
C-----------------------------------------------------------------------
Expand Down Expand Up @@ -290,7 +293,7 @@ C-----------------------------------------------------------------------
VGRDEM = PGAVL / AGRVG
WLDOTN = FRLF * VGRDEM
WSDOTN = FRSTM * VGRDEM
WRDOTN = FRRT * VGRDEM
WRDOTN = FRRT * VGRDEM !New Root Growth today
C-----------------------------------------------------------------------
C Compute maximum N required for tissue growth
C-----------------------------------------------------------------------
Expand Down
12 changes: 7 additions & 5 deletions Plant/Generic-Pest/PEST.for
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ C Plant Variables
C Photosynthesis Variables
REAL TPSR, PPSR, CASM, ASMDOT
REAL PGAVL
C** WDB 1/2022 Added Target LAI from remote sensing observations (TLAI)
REAL TLAI

! Redundant with SAVE stmt earlier
! SAVE CASM, CRLV, CRLF, CRTM
Expand Down Expand Up @@ -184,7 +186,7 @@ C-----------------------------------------------------------------------
& PL, PLTPOP, PNO, RTWT, SLA, STMWT, TOPWT, !Input
& TSDNOL, TSDNOM, TSDNOS, TSDWTL, TSDWTM, TSDWTS, !Input
& TSHNOL, TSHNOM, TSHNOS, TSHWTL, TSHWTM, TSHWTS, !Input
& VSTAGE, WTLF, !Input
& TLAI, VSTAGE, WTLF, !Input
& NSDDL, NSDDM, NSDDS, NSHDL, NSHDM, NSHDS, !Input/Output
& PPLTD, TLFAD, TLFMD, TRTLV, !Input/Output
& WRTMD, WSDDL, WSDDM, WSDDS, !Input/Output
Expand Down Expand Up @@ -219,7 +221,7 @@ C-----------------------------------------------------------------------
CALL VEGDM(SEASINIT,
& AREALF, CLW, CSW, PCLMT, PCSTMD, PDLA, PLFAD, !Input
& PLFMD, PSTMD, PVSTGD, SLA, SLDOT, SSDOT, !Input
& STMWT, TDLA, VSTGD, WLFDOT, WSTMD, WTLF, !Input
& STMWT, TDLA, TLAI,VSTGD, WLFDOT, WSTMD, WTLF, !Input
& TLFAD, TLFMD, VSTAGE, WLIDOT, !Input/Output
& CLAI, CLFM, CSTEM, DISLA, DISLAP, !Output
& LAIDOT, WSIDOT) !Output
Expand Down Expand Up @@ -259,7 +261,7 @@ C-----------------------------------------------------------------------
& PL, PLTPOP, PNO, RTWT, SLA, STMWT, TOPWT, !Input
& TSDNOL, TSDNOM, TSDNOS, TSDWTL, TSDWTM, TSDWTS, !Input
& TSHNOL, TSHNOM, TSHNOS, TSHWTL, TSHWTM, TSHWTS, !Input
& VSTAGE, WTLF, !Input
& TLAI, VSTAGE, WTLF, !Input
& NSDDL, NSDDM, NSDDS, NSHDL, NSHDM, NSHDS, !Input/Output
& PPLTD, TLFAD, TLFMD, TRTLV, !Input/Output
& WRTMD, WSDDL, WSDDM, WSDDS, !Input/Output
Expand Down Expand Up @@ -289,7 +291,7 @@ C-----------------------------------------------------------------------
CALL VEGDM(RATE,
& AREALF, CLW, CSW, PCLMT, PCSTMD, PDLA, PLFAD, !Input
& PLFMD, PSTMD, PVSTGD, SLA, SLDOT, SSDOT, !Input
& STMWT, TDLA, VSTGD, WLFDOT, WSTMD, WTLF, !Input
& STMWT, TDLA, TLAI,VSTGD, WLFDOT, WSTMD, WTLF, !Input
& TLFAD, TLFMD, VSTAGE, WLIDOT, !Input/Output
& CLAI, CLFM, CSTEM, DISLA, DISLAP, !Output
& LAIDOT, WSIDOT) !Output
Expand Down Expand Up @@ -338,7 +340,7 @@ C-----------------------------------------------------------------------
CALL VEGDM(INTEGR,
& AREALF, CLW, CSW, PCLMT, PCSTMD, PDLA, PLFAD, !Input
& PLFMD, PSTMD, PVSTGD, SLA, SLDOT, SSDOT, !Input
& STMWT, TDLA, VSTGD, WLFDOT, WSTMD, WTLF, !Input
& STMWT, TDLA, TLAI,VSTGD, WLFDOT, WSTMD, WTLF, !Input
& TLFAD, TLFMD, VSTAGE, WLIDOT, !Input/Output
& CLAI, CLFM, CSTEM, DISLA, DISLAP, !Output
& LAIDOT, WSIDOT) !Output
Expand Down
Loading