geoschem / geos-chem

GEOS-Chem "Science Codebase" repository. Contains GEOS-Chem science routines, run directory generation scripts, and interface code. This repository is used as a submodule within the GCClassic and GCHP wrappers, as well as in other modeling contexts (external ESMs).
http://geos-chem.org
Other
170 stars 166 forks source link

Fortran runtime error: Bad real number in item 1 of list input #2561

Closed samanehashraf closed 2 weeks ago

samanehashraf commented 2 weeks ago

Your name

Samaneh

Your affiliation

Research Associate

What happened? What did you expect to happen?

Hi, I am trying to run GC-RRTMG (v 14.4.3) for a nested simulation (0.5° x 0.625°) of North America, but I encountered this error:

At line 210 of file /home/samaneha/projects/rrg-hayesp/samaneha/gc_05x0625_NA_merra2_fullchem_RRTMG_AMJJA2019_GFAS/CodeDir/src/GEOS-Chem/Headers/roundoff_mod.F90
Fortran runtime error: Bad real number in item 1 of list input

Error termination. Backtrace:
#0  0x150d3e5a86e2 in ???
#1  0x150d3e5a91b5 in ???
#2  0x150d3e5a9d2b in ???
#3  0x150d3e7f4e21 in ???
#4  0x150d3e7f5fcd in ???
#5  0x150d3e7f6cca in ???
#6  0x8c4c1b in __roundoff_mod_MOD_cast_and_roundoff_str2flex
    at /home/samaneha/projects/rrg-hayesp/samaneha/gc_05x0625_NA_merra2_fullchem_RRTMG_AMJJA2019_GFAS/CodeDir/src/GEOS-Chem/Headers/roundoff_mod.F90:210
#7  0x4c6611 in config_rrtmg
    at /home/samaneha/projects/rrg-hayesp/samaneha/gc_05x0625_NA_merra2_fullchem_RRTMG_AMJJA2019_GFAS/CodeDir/src/GEOS-Chem/GeosCore/input_mod.F90:2525
#8  0x4d5214 in __input_mod_MOD_read_input_file
    at /home/samaneha/projects/rrg-hayesp/samaneha/gc_05x0625_NA_merra2_fullchem_RRTMG_AMJJA2019_GFAS/CodeDir/src/GEOS-Chem/GeosCore/input_mod.F90:222
#9  0x4059f1 in geos_chem
    at /home/samaneha/projects/rrg-hayesp/samaneha/gc_05x0625_NA_merra2_fullchem_RRTMG_AMJJA2019_GFAS/CodeDir/src/GEOS-Chem/Interfaces/GCClassic/main.F90:25
#10  0x404b66 in main
    at /home/samaneha/projects/rrg-hayesp/samaneha/gc_05x0625_NA_merra2_fullchem_RRTMG_AMJJA2019_GFAS/CodeDir/src/GEOS-Chem/Interfaces/GCClassic/main.F90:32
Use online ozone?           :     T
Use ozone from met?         :     T
Use TOMS/SBUV ozone?        :     F
Photolyse nitrate aerosol?  :     T
JNITs scaling of JHNO3      :  100.000
JNIT scaling of JHNO3       :  100.000
JNIT(s) channel A (HONO)    :   66.667
JNIT(s) channel B (NO2)     :   33.333

NOTE ABOUT OVERHEAD O3 FOR FAST-JX:
 Online O3 from GEOS-Chem will be used
 to weight the O3 column within the
 chemistry grid and O3 from met or TOMS
 will be used outside the chemistry grid.

BTW I was able to run the model at 2° x 2.5° resolution without any problems. Thank you.

What are the steps to reproduce the bug?

I checked this: CodeDir/src/GEOS-Chem/Headers/ roundoff_mod.F90 and I couldn't understand what the problem was in line 210:

!------------------------------------------------------------------------------
!                  GEOS-Chem Global Chemical Transport Model                  !
!------------------------------------------------------------------------------
!BOP
!
! !MODULE: roundoff_mod.F90
!
! !DESCRIPTION: Contains routines to round floating point values to a
!  given number of decimal places.
!\\
!\\
! !INTERFACE:
!
MODULE Roundoff_Mod
!
! !USES:
!
  USE Precision_Mod

  IMPLICIT NONE
  PRIVATE
!
! !PUBLIC MEMBER FUNCTIONS:
!
  PUBLIC :: Cast_and_RoundOff
  INTERFACE Cast_and_RoundOff
     MODULE PROCEDURE Cast_and_RoundOff_Real2Dble
     MODULE PROCEDURE Cast_and_RoundOff_Str2Flex
  END INTERFACE

  PUBLIC :: Roundoff
  INTERFACE RoundOff
     MODULE PROCEDURE RoundOff_Real
     MODULE PROCEDURE RoundOff_Dble
  END INTERFACE
!
!EOP
!------------------------------------------------------------------------------
!BOC
CONTAINS
!EOC
!------------------------------------------------------------------------------
!     NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 and      !
!                  GEOS-Chem Global Chemical Transport Model                  !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: RoundOff_Real
!
! !DESCRIPTION: Rounds a number X to N decimal places of precision.
!\\
!\\
! !INTERFACE:
!
  FUNCTION RoundOff_Real( X, N ) RESULT( Y )
!
! !INPUT PARAMETERS:
!
    REAL(f4), INTENT(IN) :: X   ! Number to be rounded
    INTEGER,  INTENT(IN) :: N   ! Number of decimal places to keep
!
! !RETURN VALUE:
!
    REAL(f4)             :: Y   ! Number rounded to N decimal places
!
! !REMARKS:
!  The algorithm to round X to N decimal places is as follows:
!  (1) Multiply X by 10**(N+1)
!  (2) If X < 0, then add -5 to X; otherwise add 5 to X
!  (3) Round X to nearest integer
!  (4) Divide X by 10**(N+1)
!  (5) Truncate X to N decimal places: INT( X * 10**N ) / 10**N
!                                                                             .
!  Rounding algorithm from: Hultquist, P.F, "Numerical Methods for Engineers
!   and Computer Scientists", Benjamin/Cummings, Menlo Park CA, 1988, p. 20.
!                                                                             .
!  Truncation algorithm from: http://en.wikipedia.org/wiki/Truncation
!                                                                             .
!  The two algorithms have been merged together for efficiency.
!EOP
!------------------------------------------------------------------------------
!BOC

    ! Round and truncate X to N decimal places
    Y = INT( NINT( X*(10.0_f4**(N+1)) + SIGN( 5.0_f4, X ) ) / 10.0_f4 ) / (10.0_f4**N)

  END FUNCTION RoundOff_Real
!EOC
!------------------------------------------------------------------------------
!     NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 and      !
!                  GEOS-Chem Global Chemical Transport Model                  !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: RoundOff_Dble
!
! !DESCRIPTION: Rounds a number X to N decimal places of precision.
!\\
!\\
! !INTERFACE:
!
  FUNCTION RoundOff_Dble( X, N ) RESULT( Y )
!
! !INPUT PARAMETERS:
!
    REAL(f8), INTENT(IN) :: X   ! Number to be rounded
    INTEGER,  INTENT(IN) :: N   ! Number of decimal places to keep
!
! !RETURN VALUE:
!
    REAL(f8)             :: Y   ! Number rounded to N decimal places
!
! !REMARKS:
!  The algorithm to round X to N decimal places is as follows:
!  (1) Multiply X by 10**(N+1)
!  (2) If X < 0, then add -5 to X; otherwise add 5 to X
!  (3) Round X to nearest integer
!  (4) Divide X by 10**(N+1)
!  (5) Truncate X to N decimal places: INT( X * 10**N ) / 10**N
!                                                                             .
!  Rounding algorithm from: Hultquist, P.F, "Numerical Methods for Engineers
!   and Computer Scientists", Benjamin/Cummings, Menlo Park CA, 1988, p. 20.
!                                                                             .
!  Truncation algorithm from: http://en.wikipedia.org/wiki/Truncation
!                                                                             .
!  The two algorithms have been merged together for efficiency.
!EOP
!------------------------------------------------------------------------------
!BOC

    ! Round and truncate X to N decimal places
    Y = INT( NINT( X*(10.0_f8**(N+1)) + SIGN( 5.0_f8, X ) ) / 10.0_f8 ) / (10.0_f8**N)

  END FUNCTION RoundOff_Dble
!EOC
!------------------------------------------------------------------------------
!                  GEOS-Chem Global Chemical Transport Model                  !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: cast_and_roundoff_real2dble
!
! !DESCRIPTION: Casts a 4-byte variable to 8-byte, and then rounds off
!  to a specified number of decimal places.
!\\
!\\
! !INTERFACE:
!
  FUNCTION Cast_and_RoundOff_Real2Dble( v_real, places ) RESULT( v_dble )
!
! !INPUT PARAMETERS:
!
    REAL(f4), INTENT(IN) :: v_real   ! Input, 4-byte real
    INTEGER,  INTENT(IN) :: places   ! Keep this many decimal places
!
! !RETURN VALUE:
!
    REAL(f8)             :: v_dble   ! Output, 8-byte real
!EOP
!------------------------------------------------------------------------------
!BOC

    ! If v_real is a missing value, return with 8-byte missing value
    IF ( v_real == MISSING_REAL ) THEN
       v_dble = MISSING_DBLE
       RETURN
    ENDIF

    ! Cast to real*8 and roundoff (if the number isn't too large)
    v_dble = RoundOff( DBLE( v_real ), places )

  END FUNCTION Cast_And_RoundOff_Real2Dble
!EOC
!------------------------------------------------------------------------------
!                  GEOS-Chem Global Chemical Transport Model                  !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: cast_and_roundoff_str2flex
!
! !DESCRIPTION: Converts a string value to a flexible precision value and
!  rounds off to a specified number of places.  If the string value indicates
!  missing data, set the flex-precision value to missing data.
!\\
!\\
! !INTERFACE:
!
  FUNCTION Cast_and_RoundOff_Str2Flex( v_str, places ) RESULT( v_flex )
!
! !INPUT PARAMETERS:
!
    CHARACTER(LEN=*), INTENT(IN) :: v_str     ! String value
    INTEGER,          INTENT(IN) :: places    ! Keep this many decimal places
                                              ! -1 skips rounding off
!
! !RETURN VALUE:
!
    REAL(fp)                     :: v_flex    ! Flex precision value
!EOP
!------------------------------------------------------------------------------
!BOC
    ! If v_str is the missing data value, then assign
    ! the missing data value to v_real and return
    IF ( TRIM( v_str ) == MISSING_STR ) THEN
       v_flex = MISSING
       RETURN
    ENDIF

    ! Convert str to real, and roundoff if places > 0
    READ( *, * ) v_flex    ! <=== problem line here
    IF ( places > 0 ) THEN
       v_flex = RoundOff( v_flex, places )
    ENDIF

  END FUNCTION Cast_and_RoundOff_Str2Flex
!EOC
END MODULE Roundoff_Mod

Please attach any relevant configuration and log files.

No response

What GEOS-Chem version were you using?

14.4.3

What environment were you running GEOS-Chem on?

Local cluster

What compiler and version were you using?

?

Will you be addressing this bug yourself?

Yes

In what configuration were you running GEOS-Chem?

GCClassic

What simulation were you running?

Full chemistry

As what resolution were you running GEOS-Chem?

NA 0.5 * 0.625

What meterology fields did you use?

MERRA-2

Additional information

GC RT

yantosca commented 2 weeks ago

Thanks @samanehashraf. Could you please also attach your geoschem_config.yml and GEOS-Chem log file to this issue? I'd like to see what the inputs were.

samanehashraf commented 2 weeks ago

Sure. geoschem_config.yml.txt

yantosca commented 2 weeks ago

Ah OK, I see it now @samanehashraf. Change:

    aod_wavelengths_in_nm:
      - (440, 550, 675)

to

    aod_wavelengths_in_nm:
      - 440
      - 550
      - 675

and it should work.

samanehashraf commented 2 weeks ago

Ah OK, I see it now @samanehashraf. Change:

    aod_wavelengths_in_nm:
      - (440, 550, 675)

to

    aod_wavelengths_in_nm:
      - 440
      - 550
      - 675

and it should work.

Thank you very much! Yes, it worked.

yantosca commented 2 weeks ago

Great! I'll close out this issue. Write again if you come up against any other problems.

samanehashraf commented 2 weeks ago

Great! I'll close out this issue. Write again if you come up against any other problems.

Hi Yantosca, Unfortunately, the job was killed after one hour of running:

/localscratch/spool/slurmd/job36699127/slurm_script: line 21: 3463230 Killed ./gcclassic slurmstepd: error: Detected 1 oom_kill event in StepId=36699127.batch. Some of the step tasks have been OOM Killed

Should I increase the CPU per task?

SBATCH -N 1

SBATCH --mem-per-cpu=4G # memory (per node)

SBATCH --cpus-per-task=18 # CPU cores/threads

Requesting sufficient stack memory for GEOS-Chem

ulimit -s unlimited export OMP_STACKSIZE=500m

Set the proper # of threads for OpenMP

SLURM_CPUS_PER_TASK ensures this matches the number you set with -c above

export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK

run the compiled model

./gcclassic