Skip to content

Commit

Permalink
Merge pull request #319 from fabiooliveira72/canegro-n
Browse files Browse the repository at this point in the history
Updates for Sugarcane CANEGRO
  • Loading branch information
fabiooliveira72 committed May 9, 2023
2 parents ab42970 + f307efc commit 37f17e0
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 219 deletions.
160 changes: 81 additions & 79 deletions Plant/CANEGRO-Sugarcane/SC_CCOUT.for
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ c - Aerial dry mass (t/ha)
c - Stalk dry mass (t/ha)
c - Sucrose mass (t/ha)
c :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

! FO 05-09-2023 Commented out CMDMD and RDMD because of need to
! remove output files.
c :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SUBROUTINE SC_CCOUT(CONTROL,
& BADMD, SMDMD, SUCMD, IRRAMT, RAIN, ! Canegro inputs
& CMDMD, SWDF1, TMIN, LGDMD, LDDMD, RDMD, SMFMD,
& SWDF1, TMIN, LGDMD, LDDMD, SMFMD,
& PAR, Fi, EP, ES)

c ***************************************************************
Expand All @@ -36,8 +37,9 @@ c CMDMD is cellulose DM.
c LGDMD, LDDMD are green tops DM and trash DM
c RDMD is root dry mass
REAL, INTENT(IN) :: BADMD, SMDMD, SUCMD, IRRAMT, RAIN,
& CMDMD, SWDF1, TMIN, LGDMD, LDDMD, RDMD, PAR, Fi, EP, ES,
& SWDF1, TMIN, LGDMD, LDDMD, PAR, Fi, EP, ES,
& SMFMD
! REAL, INTENT(IN) :: CMDMD, RDMD

c Local state variables
c :::::::::::::::::::::
Expand Down Expand Up @@ -67,13 +69,13 @@ c Days to 80% canopy cover
INTEGER COUNTER

c The file unit number for the summary output file.
INTEGER CCOUT
! INTEGER CCOUT
c Filename
CHARACTER*20 OFILE
! CHARACTER*20 OFILE
c Does the file exist, is this the first run?:
LOGICAL FILE_EXISTS !, FIRST
! LOGICAL FILE_EXISTS !, FIRST
c Error status:
INTEGER ERRNUM
! INTEGER ERRNUM

c ===============================================================
c RUN INITIALISATION
Expand All @@ -95,57 +97,57 @@ c Write a file header
c Open growth aspects output file:
c ::::::::::::::::::::::::::::::::
c Set file name:
OFILE = 'CCSUMMRY.OUT'

c Get file unit number:
CALL GETLUN('CCSUMMRY', CCOUT)

c Check that the file exists:
FILE_EXISTS = .FALSE.
INQUIRE(FILE=OFILE, EXIST=FILE_EXISTS)

c Open the file
IF (FILE_EXISTS) THEN
c In append mode if the file already exists
OPEN (UNIT=CCOUT, FILE=OFILE, STATUS='OLD',
& IOSTAT=ERRNUM, POSITION='APPEND')
ELSE
c A new file if not existing
OPEN (UNIT=CCOUT, FILE=OFILE, STATUS='NEW',
& IOSTAT = ERRNUM)
WRITE(CCOUT,'("*CLIMATE CHANGE SUMMARY OUTPUT FILE")')
WRITE(CCOUT,'("! IRRC - Cumulative irrigation (mm)")')
WRITE(CCOUT,'("! PRCM - Cumulative rainfall (mm)")')
WRITE(CCOUT,'("! FDAYS - # frost days (TMIN < 1.5°C)")')
WRITE(CCOUT,'("! SDAYS - # stress days (SWDF1 < 0.05)")')
WRITE(CCOUT,'("! D80Fi - # days to 80% canopy cover")')
WRITE(CCOUT,'("! SMFMH - Fresh cane yield WM (t/ha)")')
WRITE(CCOUT,'("! BADMH - Aerial DM (t/ha)")')
WRITE(CCOUT,'("! SMDMH - Stalk DM (t/ha)")')
WRITE(CCOUT,'("! SUCMH - Sucrose mass (t/ha)")')
WRITE(CCOUT,'("! FBDMH - Total fibre DM (t/ha)")')
WRITE(CCOUT,'("! CMDMH - Cellulosic DM (t/ha)")')
WRITE(CCOUT,'("! LGDMH - Green tops DM (t/ha)")')
WRITE(CCOUT,'("! LDDMH - Trash DM (t/ha)")')
WRITE(CCOUT,'("! RDMH - Roots DM (t/ha)")')
WRITE(CCOUT,'("! WSPH - avg. SWDF1 water stress")')
WRITE(CCOUT,'("! AvgFi - avg. frac. int. of PAR")')
WRITE(CCOUT,'("! IPARC - Intercepted PAR (MJ/m2)")')
WRITE(CCOUT,'("! EPCM - Cumulative transpiration (mm)")')
WRITE(CCOUT,'("! ETCM - Cumulative evapo-transp. (mm)")')
WRITE(CCOUT,'("! BADMRUE - Aerial dry mass [PA]RUE (g/MJ)")')
WRITE(CCOUT,'("! BADMWUE - Aerl. DM WUE (t/100 mm ET)")')
WRITE(CCOUT,'("! SMDMWUE - Stlk. DM WUE (t/100 mm ET)")')
WRITE(CCOUT,'("! SMFMWUE - St Fresh Mass WUE (t/100 mm ET)")')
WRITE(CCOUT,'("")')
c Write column headings
WRITE(CCOUT, '(A8, 1H , A4, 1H , A5, 1H , 23(A8, 1H ))')
& '@EXPCODE', 'TRNO', 'RUNNO', 'IRRC', 'PRCM','FDAYS',
& 'SDAYS','D80Fi','SMFMH','BADMH', 'SMDMH', 'SUCMH', 'FBDMH',
& 'CMDMH', 'LGDMH', 'LDDMH', 'RDMH', 'WSPH', 'AVGFI','IPARC',
& 'EPCM','ETCM', 'BADMRUE', 'BADMWUE', 'SMDMWUE', 'SMFMWUE'
ENDIF

! OFILE = 'CCSUMMRY.OUT'
!
!c Get file unit number:
! CALL GETLUN('CCSUMMRY', CCOUT)
!
!c Check that the file exists:
! FILE_EXISTS = .FALSE.
! INQUIRE(FILE=OFILE, EXIST=FILE_EXISTS)
!
!c Open the file
! IF (FILE_EXISTS) THEN
!c In append mode if the file already exists
! OPEN (UNIT=CCOUT, FILE=OFILE, STATUS='OLD',
! & IOSTAT=ERRNUM, POSITION='APPEND')
! ELSE
!c A new file if not existing
! OPEN (UNIT=CCOUT, FILE=OFILE, STATUS='NEW',
! & IOSTAT = ERRNUM)
! WRITE(CCOUT,'("*CLIMATE CHANGE SUMMARY OUTPUT FILE")')
! WRITE(CCOUT,'("! IRRC - Cumulative irrigation (mm)")')
! WRITE(CCOUT,'("! PRCM - Cumulative rainfall (mm)")')
! WRITE(CCOUT,'("! FDAYS - # frost days (TMIN < 1.5°C)")')
! WRITE(CCOUT,'("! SDAYS - # stress days (SWDF1 < 0.05)")')
! WRITE(CCOUT,'("! D80Fi - # days to 80% canopy cover")')
! WRITE(CCOUT,'("! SMFMH - Fresh cane yield WM (t/ha)")')
! WRITE(CCOUT,'("! BADMH - Aerial DM (t/ha)")')
! WRITE(CCOUT,'("! SMDMH - Stalk DM (t/ha)")')
! WRITE(CCOUT,'("! SUCMH - Sucrose mass (t/ha)")')
! WRITE(CCOUT,'("! FBDMH - Total fibre DM (t/ha)")')
! WRITE(CCOUT,'("! CMDMH - Cellulosic DM (t/ha)")')
! WRITE(CCOUT,'("! LGDMH - Green tops DM (t/ha)")')
! WRITE(CCOUT,'("! LDDMH - Trash DM (t/ha)")')
! WRITE(CCOUT,'("! RDMH - Roots DM (t/ha)")')
! WRITE(CCOUT,'("! WSPH - avg. SWDF1 water stress")')
! WRITE(CCOUT,'("! AvgFi - avg. frac. int. of PAR")')
! WRITE(CCOUT,'("! IPARC - Intercepted PAR (MJ/m2)")')
! WRITE(CCOUT,'("! EPCM - Cumulative transpiration (mm)")')
! WRITE(CCOUT,'("! ETCM - Cumulative evapo-transp. (mm)")')
! WRITE(CCOUT,'("! BADMRUE - Aerial dry mass [PA]RUE (g/MJ)")')
! WRITE(CCOUT,'("! BADMWUE - Aerl. DM WUE (t/100 mm ET)")')
! WRITE(CCOUT,'("! SMDMWUE - Stlk. DM WUE (t/100 mm ET)")')
! WRITE(CCOUT,'("! SMFMWUE - St Fresh Mass WUE (t/100 mm ET)")')
! WRITE(CCOUT,'("")')
!c Write column headings
! WRITE(CCOUT, '(A8, 1H , A4, 1H , A5, 1H , 23(A8, 1H ))')
! & '@EXPCODE', 'TRNO', 'RUNNO', 'IRRC', 'PRCM','FDAYS',
! & 'SDAYS','D80Fi','SMFMH','BADMH', 'SMDMH', 'SUCMH', 'FBDMH',
! & 'CMDMH', 'LGDMH', 'LDDMH', 'RDMH', 'WSPH', 'AVGFI','IPARC',
! & 'EPCM','ETCM', 'BADMRUE', 'BADMWUE', 'SMDMWUE', 'SMFMWUE'
! ENDIF
!
c Initialised total irrigation to 0.0
IRR_TOT = 0.0
RAIN_TOT = 0.0
Expand Down Expand Up @@ -219,27 +221,27 @@ c Recalculate Bio-physical variables to output
ENDIF

c Write summary data to file.
WRITE(CCOUT, '(A8, 1H , I4, 1H , I5, 1H , ' //
! Irrigation and rainfall
& '2(F8.0, 1H ), '//
! Frost and stress days, days to 80% Fi
& '3(I8, 1H ), ' //
! Biomass variables
& '9(F8.1, 1H ), ' //
! SDWF1, AvgFi, IPARC, EPC, ETC
& '2(F8.2, 1H ), 3(F8.0, 1H ),' //
! RUE and WUE
& '4(F8.3, 1H ))')
& Control%FILEX, Control%TRTNUM, Control%RUN,
& IRR_TOT, RAIN_TOT,
& FROST_DAYS, STRESS_DAYS, DAYS80Fi, SMFMD,
& BADMD, SMDMD, SUCMD, FIBDM, CMDMD, LGDMD, LDDMD, RDMD,
& SWDF1_TOT / (1.0*COUNTER), AvgFi, IPARC, EPC, ETC,
& BADMD*100.0 / IPARC, cBADMD, cSMDMD, cSMFMD

c Close the output file
CLOSE(UNIT=CCOUT)

! WRITE(CCOUT, '(A8, 1H , I4, 1H , I5, 1H , ' //
! ! Irrigation and rainfall
! & '2(F8.0, 1H ), '//
! ! Frost and stress days, days to 80% Fi
! & '3(I8, 1H ), ' //
! ! Biomass variables
! & '9(F8.1, 1H ), ' //
! ! SDWF1, AvgFi, IPARC, EPC, ETC
! & '2(F8.2, 1H ), 3(F8.0, 1H ),' //
! ! RUE and WUE
! & '4(F8.3, 1H ))')
! & Control%FILEX, Control%TRTNUM, Control%RUN,
! & IRR_TOT, RAIN_TOT,
! & FROST_DAYS, STRESS_DAYS, DAYS80Fi, SMFMD,
! & BADMD, SMDMD, SUCMD, FIBDM, CMDMD, LGDMD, LDDMD, RDMD,
! & SWDF1_TOT / (1.0*COUNTER), AvgFi, IPARC, EPC, ETC,
! & BADMD*100.0 / IPARC, cBADMD, cSMDMD, cSMFMD
!
!c Close the output file
! CLOSE(UNIT=CCOUT)
!
c End of DYNAMIC conditional statement
ENDIF

Expand Down
14 changes: 7 additions & 7 deletions Plant/CANEGRO-Sugarcane/SC_CNGRO.for
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@ c :::::::::::::::::::::::::::::::::

c Call the climate change summary output file subroutine (module).
CALL SC_CCOUT(CONTROL, Part%AERLDM, Part%STKDM, Part%SUCMAS,
& IRRAMT, Weather%RAIN, CELLSE_DM, WaterBal%SWDF1, TMIN,
& Part%TOPDM, Out%TRASDM, Out%ROOTDM, Part%STKWM, Out%PAR,
& IRRAMT, Weather%RAIN, WaterBal%SWDF1, TMIN,
& Part%TOPDM, Out%TRASDM, Part%STKWM, Out%PAR,
& Growth%Li, EP, ES)

c Call the climate change summary output file subroutine (module).
Expand Down Expand Up @@ -1113,9 +1113,9 @@ c :::::::::::::::::::::::
& CONTROL, STGDOY, HUBaseEm, Growth%LI)

c Call the climate change summary output file subroutine (module).
CALL SC_CCOUT(CONTROL, Part%AERLDM, Part%STKDM, Part%SUCMAS,
& IRRAMT, Weather%RAIN, CELLSE_DM, WaterBal%SWDF1, TMIN,
& Part%TOPDM, Out%TRASDM, Out%ROOTDM, Part%STKWM, Out%PAR,
CALL SC_CCOUT(CONTROL, Part%AERLDM, Part%STKDM, Part%SUCMAS,
& IRRAMT, Weather%RAIN, WaterBal%SWDF1, TMIN,
& Part%TOPDM, Out%TRASDM, Part%STKWM, Out%PAR,
& Growth%Li, EP, ES)


Expand Down Expand Up @@ -1216,8 +1216,8 @@ c in this subroutine (for now)

c Call the climate change summary output file subroutine (module).
CALL SC_CCOUT(CONTROL, Part%AERLDM, Part%STKDM, Part%SUCMAS,
& IRRAMT, Weather%RAIN, CELLSE_DM, WaterBal%SWDF1, TMIN,
& Part%TOPDM, Out%TRASDM, Out%ROOTDM, Part%STKWM, Out%PAR,
& IRRAMT, Weather%RAIN, WaterBal%SWDF1, TMIN,
& Part%TOPDM, Out%TRASDM, Part%STKWM, Out%PAR,
& Growth%Li, EP, ES)


Expand Down
Loading

0 comments on commit 37f17e0

Please sign in to comment.