lpmorenoc / dssat-csm-os

DSSAT Cropping System Model
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Eliminate READS.out for CSYCA model? #16

Closed lpmorenoc closed 3 years ago

lpmorenoc commented 4 years ago

This file is generated even when IDETL = 0 (zero). This is not ideal for multiple simulations (e.g. HiPerGator). Currently @fabiooliveira72 is looking for options to edit/modify the code:

YCA_Runinit.f90 Line: 261-266 Code:


  CALL Getlun('READS.OUT',fnumrea)
                    ! Close and re-open Reads file
                    CLOSE (FNUMREA, STATUS = 'DELETE')
OPEN (UNIT = FNUMREA,FILE = 'READS.OUT', STATUS = 'NEW', ACTION = 'READWRITE')
                    WRITE(fnumrea,*)' '
                    WRITE(fnumrea,*)' File closed and re-opened to avoid generating huge file’

Description: This code is just getting the unit number (FNUMREA), after that the file is deleted if exists and a new one is reopened. Just one message is written in this subroutine nothing else. Similar previous file code.

Note that, first it is just creating the READS.OUT file and then the subroutines below write the outputs in the file:

CSREADS.for Line: There are 138 lines using READS.OUT file.

The following subroutines are used as utilities for the CSCER,CSCAS,CSCRP and CSYCA models.

Subroutine: XREADT Code:

      IF (FNUMFLAG.NE.'Y')THEN
        CALL Getlun('READS.OUT',fnumrea)
        CALL GETLUN('FILETMP',FILENUM)
        INQUIRE (FILE='READS.OUT',OPENED=fopen)
        IF (.NOT.fopen) OPEN(UNIT=fnumrea,FILE='READS.OUT')
        FNUMFLAG = 'Y'
      ENDIF

WRITE(fnumrea,*)’ '
            WRITE(fnumrea,*)'FILE ',FILENAME(1:FILELEN)
            WRITE(fnumrea,*)' TREATMENT: ‘,COL1 

Description: This pieces of code open the READS.OUT and use as debbuging file writing some variables values.

Subroutine: AREADT Code:

    IF (FNUMFLAG.NE.'Y')THEN
        CALL Getlun('READS.OUT',fnumrea)
        INQUIRE (FILE='READS.OUT',OPENED=fopen)
        IF (.NOT.fopen) OPEN(UNIT=fnumrea,FILE='READS.OUT')
        FNUMFLAG = 'Y'
      ENDIF

  ! Read abbreviation file
            WRITE(fnumrea,*)’ '
            WRITE(fnumrea,*)' Reading abbrev file: ',abvfile(1:55)

Description: This pieces of code open the READS.OUT and use as debbuging file writing some variables values.

Subroutine: CUREADT Code:

      IF (FNUMFLAG.NE.'Y')THEN
        CALL Getlun('READS.OUT',fnumrea)
        INQUIRE (FILE='READS.OUT',OPENED=fopen)
        IF (.NOT.fopen) OPEN(UNIT=fnumrea,FILE='READS.OUT')
        FNUMFLAG = 'Y'
      ENDIF

        ! WRITE(FNUMREA,*) 'CODE,TXTO ',CODE,TXTO

Description: This pieces of code open the READS.OUT and use as debbuging. The part that writes in READS.OUT is commented.

Subroutine: CUREADT Code:

   IF (FNUMFLAG.NE.'Y')THEN
        CALL Getlun('READS.OUT',fnumrea)
        INQUIRE (FILE='READS.OUT',OPENED=fopen)
        IF (.NOT.fopen) OPEN(UNIT=fnumrea,FILE='READS.OUT')
        FNUMFLAG = 'Y'
      ENDIF

Description: This pieces of code open the READS.OUT and use as debbuging file. This subroutine never writes in the output file.

Subroutine: SPREADT Code:

   IF (FNUMFLAG.NE.'Y')THEN
        CALL Getlun('READS.OUT',fnumrea)
        CALL GETLUN('FILETMP',FILENUM)
        INQUIRE (FILE='READS.OUT',OPENED=fopen)
        IF (.NOT.fopen) OPEN(UNIT=fnumrea,FILE='READS.OUT')
        FNUMFLAG = 'Y'
      ENDIF

  WRITE(fnumrea,*)' '
      WRITE(fnumrea,*)'FILE ',SPDIRFLE(1:FILELEN)
      DO TVI3=1,DATANUM
        WRITE(fnumrea,'(I6,A2,A60)')tvi3,'  ',datarray(TVI3)(1:60)
      ENDDO

Description: This pieces of code open the READS.OUT and use as debbuging file writing some variables values.

Subroutine: SLREADT Code:

     IF (FNUMFLAG.NE.'Y')THEN
        CALL Getlun('READS.OUT',fnumrea)
        CALL GETLUN('FILETMP',FILENUM)
        INQUIRE (FILE='READS.OUT',OPENED=fopen)
        IF (.NOT.fopen) OPEN(UNIT=fnumrea,FILE='READS.OUT')
        FNUMFLAG = 'Y'
      ENDIF

      WRITE(fnumrea,*)' '
      WRITE(fnumrea,*)' SOIL FILENAME ',SLDIRFLE(1:60)
      WRITE(fnumrea,*)' SOIL CODE     ',SLCODE

Description: This pieces of code open the READS.OUT and use as debbuging file writing some variables values.

Subroutine: SMREADT Code:

      IF (FNUMFLAG.NE.'Y')THEN
        CALL Getlun('READS.OUT',fnumrea)
        INQUIRE (FILE='READS.OUT',OPENED=fopen)
        IF (.NOT.fopen) OPEN(UNIT=fnumrea,FILE='READS.OUT')
        FNUMFLAG = 'Y'
      ENDIF
       ! WRITE(FNUMREA,*) 'CODE,TXTO ',CODE,TXTO

Description: This pieces of code open the READS.OUT and use as debbuging. The part that writes in READS.OUT is commented.

lpmorenoc commented 3 years ago

Done by @fabiooliveira72 https://github.com/DSSAT/dssat-csm-os/pull/51