New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 3764 for branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcdcy.F90 – NEMO

Ignore:
Timestamp:
2013-01-23T15:33:04+01:00 (11 years ago)
Author:
smasson
Message:

dev_MERGE_2012: report bugfixes done in the trunk from r3555 to r3763 into dev_MERGE_2012

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcdcy.F90

    r3651 r3764  
    105105         rcc(:,:) = zconvrad * glamt(:,:) - rpi 
    106106         ! time of midday 
    107          rtmd(:,:) = 0.5 - glamt(:,:) / 360. 
    108          rtmd(:,:) = MOD( (rtmd(:,:) + 1.), 1. ) 
     107         rtmd(:,:) = 0.5_wp - glamt(:,:) / 360._wp 
     108         rtmd(:,:) = MOD( (rtmd(:,:) + 1._wp) , 1._wp) 
    109109      ENDIF 
    110110 
     
    121121         zdsws = REAL(11 + nday_year, wp) 
    122122         ! declination of the earths orbit 
    123          zdecrad = (-23.5 * zconvrad) * COS( zdsws * ztwopi / REAL(nyear_len(1),wp) ) 
     123         zdecrad = (-23.5_wp * zconvrad) * COS( zdsws * ztwopi / REAL(nyear_len(1),wp) ) 
    124124         ! Compute A and B needed to compute the time integral of the diurnal cycle 
    125125 
     
    138138         DO jj = 1, jpj 
    139139            DO ji = 1, jpi 
    140                IF ( ABS(rab(ji,jj)) < 1 ) THEN         ! day duration is less than 24h 
     140               IF ( ABS(rab(ji,jj)) < 1._wp ) THEN         ! day duration is less than 24h 
    141141         ! When is it night? 
    142142                  ztx = zinvtwopi * (ACOS(rab(ji,jj)) - rcc(ji,jj)) 
    143143                  ztest = -rbb(ji,jj) * SIN( rcc(ji,jj) + ztwopi * ztx ) 
    144144         ! is it dawn or dusk? 
    145                   IF ( ztest > 0 ) THEN 
     145                  IF ( ztest > 0._wp ) THEN 
    146146                     rdawn(ji,jj) = ztx 
    147147                     rdusk(ji,jj) = rtmd(ji,jj) + ( rtmd(ji,jj) - rdawn(ji,jj) ) 
     
    151151                  ENDIF 
    152152               ELSE 
    153                   rdawn(ji,jj) = rtmd(ji,jj) + 0.5 
     153                  rdawn(ji,jj) = rtmd(ji,jj) + 0.5_wp 
    154154                  rdusk(ji,jj) = rdawn(ji,jj) 
    155155               ENDIF 
     
    158158         rdawn(:,:) = MOD( (rdawn(:,:) + 1._wp), 1._wp ) 
    159159         rdusk(:,:) = MOD( (rdusk(:,:) + 1._wp), 1._wp ) 
    160          !     2.2 Compute the scalling function: 
    161          !         S* = the inverse of the time integral of the diurnal cycle from dawm to dusk 
     160         !     2.2 Compute the scaling function: 
     161         !         S* = the inverse of the time integral of the diurnal cycle from dawn to dusk 
     162         !         Avoid possible infinite scaling factor, associated with very short daylight 
     163         !         periods, by ignoring periods less than 1/1000th of a day (ticket #1040) 
    162164         DO jj = 1, jpj 
    163165            DO ji = 1, jpi 
    164                IF ( ABS(rab(ji,jj)) < 1 ) THEN         ! day duration is less than 24h 
     166               IF ( ABS(rab(ji,jj)) < 1._wp ) THEN         ! day duration is less than 24h 
     167                  rscal(ji,jj) = 0.0_wp 
    165168                  IF ( rdawn(ji,jj) < rdusk(ji,jj) ) THEN      ! day time in one part 
    166                      rscal(ji,jj) = fintegral(rdawn(ji,jj), rdusk(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    167                      rscal(ji,jj) = 1. / rscal(ji,jj) 
     169                     IF( (rdusk(ji,jj) - rdawn(ji,jj) ) .ge. 0.001_wp ) THEN 
     170                       rscal(ji,jj) = fintegral(rdawn(ji,jj), rdusk(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     171                       rscal(ji,jj) = 1._wp / rscal(ji,jj) 
     172                     ENDIF 
    168173                  ELSE                                         ! day time in two parts 
    169                      rscal(ji,jj) = fintegral(0., rdusk(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))   & 
    170                         &         + fintegral(rdawn(ji,jj), 1., raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    171                      rscal(ji,jj) = 1. / rscal(ji,jj) 
     174                     IF( (rdusk(ji,jj) + (1._wp - rdawn(ji,jj)) ) .ge. 0.001_wp ) THEN 
     175                       rscal(ji,jj) = fintegral(0._wp, rdusk(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))   & 
     176                          &         + fintegral(rdawn(ji,jj), 1._wp, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     177                       rscal(ji,jj) = 1. / rscal(ji,jj) 
     178                     ENDIF 
    172179                  ENDIF 
    173180               ELSE 
    174181                  IF ( raa(ji,jj) > rbb(ji,jj) ) THEN         ! 24h day 
    175                      rscal(ji,jj) = fintegral(0., 1., raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    176                      rscal(ji,jj) = 1. / rscal(ji,jj) 
     182                     rscal(ji,jj) = fintegral(0._wp, 1._wp, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     183                     rscal(ji,jj) = 1._wp / rscal(ji,jj) 
    177184                  ELSE                                          ! No day 
    178                      rscal(ji,jj) = 0.e0 
     185                     rscal(ji,jj) = 0.0_wp 
    179186                  ENDIF 
    180187               ENDIF 
     
    193200         DO ji = 1, jpi 
    194201            ztmpm = 0.0 
    195             IF( ABS(rab(ji,jj)) < 1 ) THEN         ! day duration is less than 24h 
     202            IF( ABS(rab(ji,jj)) < 1. ) THEN         ! day duration is less than 24h 
    196203               ! 
    197204               IF( rdawn(ji,jj) < rdusk(ji,jj) ) THEN       ! day time in one part 
     
    227234                  ! 
    228235               ELSE                                         ! No day 
    229                   zqsrout(ji,jj) = 0.e0 
     236                  zqsrout(ji,jj) = 0.0_wp 
    230237                  imask_night(ji,jj) = 1 
    231238               ENDIF 
Note: See TracChangeset for help on using the changeset viewer.