GEOS-Chem v7-04-10

From Geos-chem
Jump to: navigation, search

Previous issues now resolved in GEOS-Chem v7-04-10

NaN's in smvgear.f

NOTE: Routine smvgear.F is slated for removal from GEOS-Chem v11-01 once the new FlexChem solver is implemented.

Lok Lamsal wrote:

I ran into a problem while running GEOS-4, version v7-04-09, at 2x2.5. The simulation stops on 15th July 2006 with different error messages on two of our machines tuque and beret. One of the error messages on tuque is like this:
 sum of rrate =  Infinity
 SMVGEAR: CNEW is NaN!
 Species index :            1
 Grid Box      :          121          15           1
 STOP in smvgear.f!
     - CLEANUP: deallocating arrays now...
forrtl: severe (174): SIGSEGV, segmentation fault occurred
And on beret the message is like this:
     - CLEANUP: deallocating arrays now...
 forrtl: severe (174): SIGSEGV, segmentation fault occurred
 Image              PC                Routine            Line
 Source
 geos_4_nv          400000000059EA10  Unknown               Unknown
 Unknown
 libguide.so        200000000039C1A0  Unknown               Unknown
 Unknown
 etc.
The message which is repeated in either case is like this:
 SMVGEAR: DELT= 9.96E-16 TOO LOW DEC YFAC. KBLK, KTLOOP, NCS, TIME, TIMREMAIN, YFAC, EPS =
Could you suggest me what the problem could be? Just to inform you: while trying to figure out the problem, I noticed from Bastien that he did not have problem on that day with version v7-04-10, which stopped on September 13 2006.

Bob Yantosca replied:

I think there is a division by zero somewhere that is causing SMVGEAR to choke. It could be a couple of things:
(1) Make sure that in your In a6_read_mod.f (routine READ_A6) you have the following code to prevent Q from going to zero. This can make logarithms blow up in other places in the code:


         !--------------------------------
         ! Q: 6-h avg specific humidity
         ! (GEOS-4 only)
         !--------------------------------
         CASE ( 'Q' )
            READ( IU_A6, IOSTAT=IOS ) XYMD, XHMS, Q3
            IF ( IOS /= 0 ) CALL IOERROR( IOS, IU_A6, 'read_a6:16' )
    
            IF ( CHECK_TIME( XYMD, XHMS, NYMD, NHMS ) ) THEN
               IF ( PRESENT( Q ) ) CALL TRANSFER_3D( Q3, Q )
               NFOUND = NFOUND + 1
    
               ! NOTE: Now set negative Q to a small positive #
               ! instead of zero, so as not to blow up logarithms
               ! (bmy, 9/8/06)
               WHERE ( Q < 0d0 ) Q = 1d-32
            ENDIF
(2) In fvdas_convect_mod.f, make SMALLEST a smaller number (i.e. 1d-60):
   !=================================================================
   ! MODULE VARIABLES
   !=================================================================
    
   ! Variables
   INTEGER            :: LIMCNV              ! Constants
   LOGICAL, PARAMETER :: RLXCLM   = .TRUE.
   REAL*8,  PARAMETER :: CMFTAU   = 3600.d0
   REAL*8,  PARAMETER :: EPS      = 1.0d-13       
   REAL*8,  PARAMETER :: GRAV     = 9.8d0
   !-------------------------------------------------------
   ! Prior to 12/19/06:
   ! Make SMALLEST smaller (bmy, 12/19/06)
   !REAL*8,  PARAMETER :: SMALLEST = 1.0d-32
   !-------------------------------------------------------
   REAL*8,  PARAMETER :: SMALLEST = 1.0d-60
   REAL*8,  PARAMETER :: TINYALT  = 1.0d-36           
   REAL*8,  PARAMETER :: TINYNUM  = 2*SMALLEST
(3) In "fvdas_convect_mod.f", avoid division by zero in routine CONVTRAN:
            IF ( CDIFR > 1.d-6 ) THEN
    
               ! If the two layers differ significantly.
               ! use a geometric averaging procedure
               CABV = MAX( CMIX(I,KM1), MAXC*TINYNUM, SMALLEST )
               CBEL = MAX( CMIX(I,K),   MAXC*TINYNUM, SMALLEST )
 !-----------------------------------------------------------------
 !  Prior to 12/19/06:
 ! Avoid division by zero (bmy, 12/19/06)
 !                  CHAT(I,K) = LOG( CABV / CBEL)
 !     &                       /   ( CABV - CBEL)
 !     &                       *     CABV * CBEL
 !-----------------------------------------------------------------
    
               ! If CABV-CBEL is zero then set CHAT=SMALLEST
               ! so that we avoid div by zero (bmy, 12/19/06)
               IF ( ABS( CABV - CBEL ) > 0d0 ) THEN
                  CHAT(I,K) = LOG( CABV / CBEL )
  &                         /    ( CABV - CBEL )
  &                         *      CABV * CBEL
               ELSE
                  CHAT(I,K) = SMALLEST
               ENDIF
    
            ELSE                           
               ! Small diff, so just arithmetic mean
               CHAT(I,K) = 0.5d0 * ( CMIX(I,K) + CMIX(I,KM1) )
            ENDIF
(4) Also I had to rewrite the parallel DO loops in the routine HACK_CONV since this was causing some kind of a memory fault.
You may just want to get the most recent version of fvdas_convect_mod.f, which has all of these fixes installed. See:
 ftp ftp.as.harvard.edu
 cd pub/geos-chem/patches/v7-04-10
 get fvdas_convect_mod.f
So I would recommend trying to implement these fixes and see if this solves your problem.

--Bob Y. 16:50, 7 May 2009 (EDT)