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 2188 for branches/dev_r2174_DCY – NEMO

Ignore:
Timestamp:
2010-10-08T10:32:36+02:00 (14 years ago)
Author:
smasson
Message:

code review but GM for dev_r2174_DCY

Location:
branches/dev_r2174_DCY/NEMO/OPA_SRC/SBC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/dev_r2174_DCY/NEMO/OPA_SRC/SBC/sbcblk_core.F90

    r2187 r2188  
    1212   !!            3.0  !  2006-06  (G. Madec) sbc rewritting    
    1313   !!            3.2  !  2009-04  (B. Lemaire)  Introduce iom_put 
     14   !!            3.3  !  2010-10  (S. Masson)  add diurnal cycle 
    1415   !!---------------------------------------------------------------------- 
    1516 
     
    2627   USE fldread         ! read input fields 
    2728   USE sbc_oce         ! Surface boundary condition: ocean fields 
    28    USE sbcdcy          ! surface forcing: diurnal cycle 
     29   USE sbcdcy          ! surface boundary condition: diurnal cycle 
    2930   USE iom             ! I/O manager library 
    3031   USE in_out_manager  ! I/O manager 
     
    3536   USE sbc_ice         ! Surface boundary condition: ice fields 
    3637#endif 
    37  
    3838 
    3939   IMPLICIT NONE 
     
    6363   REAL(wp), PARAMETER ::   Cice =    1.63e-3     ! transfer coefficient over ice 
    6464 
    65    !                                !!* Namelist namsbc_core : CORE bulk parameters 
    66    LOGICAL  ::   ln_2m     = .FALSE.     ! logical flag for height of air temp. and hum 
    67    LOGICAL  ::   ln_taudif = .FALSE.     ! logical flag to use the "mean of stress module - module of mean stress" data 
    68    REAL(wp) ::   rn_pfac   = 1.          ! multiplication factor for precipitation 
     65   !                                  !!* Namelist namsbc_core : CORE bulk parameters 
     66   LOGICAL  ::   ln_2m     = .FALSE.   ! logical flag for height of air temp. and hum 
     67   LOGICAL  ::   ln_taudif = .FALSE.   ! logical flag to use the "mean of stress module - module of mean stress" data 
     68   REAL(wp) ::   rn_pfac   = 1.        ! multiplication factor for precipitation 
    6969 
    7070   !! * Substitutions 
     
    7272#  include "vectopt_loop_substitute.h90" 
    7373   !!---------------------------------------------------------------------- 
    74    !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
     74   !! NEMO/OPA 3.3 , NEMO-consortium (2010)  
    7575   !! $Id$ 
    7676   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    7777   !!---------------------------------------------------------------------- 
    78  
    7978CONTAINS 
    8079 
     
    145144         sn_tdif = FLD_N( 'taudif'  ,    24     ,  'taudif'  ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
    146145         ! 
    147          REWIND( numnam )                    ! ... read in namlist namsbc_core 
     146         REWIND( numnam )                          ! read in namlist namsbc_core 
    148147         READ  ( numnam, namsbc_core ) 
    149          ! 
    150          ! do we plan to use ln_dm2dc with non-daily forcing? 
    151          IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   & 
     148         !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing? 
     149         IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   &  
    152150            &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' )  
    153151         IF( ln_dm2dc .AND. sn_qsr%ln_tint ) THEN 
     
    156154            sn_qsr%ln_tint = .false. 
    157155         ENDIF 
    158          ! 
    159          ! store namelist information in an array 
     156         !                                         ! store namelist information in an array 
    160157         slf_i(jp_wndi) = sn_wndi   ;   slf_i(jp_wndj) = sn_wndj 
    161158         slf_i(jp_qsr ) = sn_qsr    ;   slf_i(jp_qlw ) = sn_qlw 
     
    163160         slf_i(jp_prec) = sn_prec   ;   slf_i(jp_snow) = sn_snow 
    164161         slf_i(jp_tdif) = sn_tdif 
    165          ! 
    166          ! do we use HF tau information? 
    167          lhftau = ln_taudif 
     162         !                  
     163         lhftau = ln_taudif                        ! do we use HF tau information? 
    168164         jfld = jpfld - COUNT( (/.NOT. lhftau/) ) 
    169165         ! 
    170          ! set sf structure 
    171          ALLOCATE( sf(jfld), STAT=ierror ) 
     166         ALLOCATE( sf(jfld), STAT=ierror )         ! set sf structure 
    172167         IF( ierror > 0 ) THEN 
    173168            CALL ctl_stop( 'sbc_blk_core: unable to allocate sf structure' )   ;   RETURN 
     
    177172            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,2) ) 
    178173         END DO 
    179          ! 
    180          ! fill sf with slf_i and control print 
     174         !                                         ! fill sf with slf_i and control print 
    181175         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_core', 'flux formulation for ocean surface boundary condition', 'namsbc_core' ) 
    182176         ! 
    183177      ENDIF 
    184178 
    185       CALL fld_read( kt, nn_fsbc, sf )                   ! input fields provided at the current time-step 
    186  
    187       IF( ln_dm2dc )   CALL sbc_dcy( kt , sf(jp_qsr)%fnow )   ! modify sf(jp_qsr)%fnow for diurnal cycle 
     179                       CALL fld_read( kt, nn_fsbc, sf )        ! input fields provided at the current time-step 
     180 
     181      IF( ln_dm2dc )   CALL sbc_dcy ( kt , sf(jp_qsr)%fnow )   ! modify now Qsr to include the diurnal cycle 
    188182 
    189183#if defined key_lim3 
    190       tatm_ice(:,:) = sf(jp_tair)%fnow(:,:) 
     184      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:)                    ! LIM3: make Tair available in sea-ice 
    191185#endif 
    192  
    193       IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN 
    194           CALL blk_oce_core( sf, sst_m, ssu_m, ssv_m )   ! compute the surface ocean fluxes using CLIO bulk formulea 
    195       ENDIF 
    196       !                                                  ! using CORE bulk formulea 
     186      !                                                        ! surface ocean fluxes computed with CLIO bulk formulea 
     187      IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( sf, sst_m, ssu_m, ssv_m ) 
     188      ! 
    197189   END SUBROUTINE sbc_blk_core 
    198190    
  • branches/dev_r2174_DCY/NEMO/OPA_SRC/SBC/sbcdcy.F90

    r2187 r2188  
    44   !! Ocean forcing:  compute the diurnal cycle 
    55   !!====================================================================== 
    6    !! History : 8.2  !  2005-02  (D. Bernie)  Original code 
    7    !!           9.0  !  2006-02  (S. Masson, G. Madec)  adaptation to OPA9 
    8    !!           3.1  !  2009-07  (J.M. Molines)  adaptation to nemo3.1 
     6   !! History : OPA  !  2005-02  (D. Bernie)  Original code 
     7   !!   NEMO    2.0  !  2006-02  (S. Masson, G. Madec)  adaptation to NEMO 
     8   !!           3.1  !  2009-07  (J.M. Molines)  adaptation to v3.1 
    99   !!---------------------------------------------------------------------- 
    1010 
     
    2020   IMPLICIT NONE 
    2121   PRIVATE 
    22    INTEGER                      ::   idayqsr                                            ! day when parameters were computed 
    23    REAL(wp), DIMENSION(jpi,jpj) ::   zaaa, zbbb, zccc, zab, ztmd, zdawn, zdusk, zscal   ! parameters to compute the diurnal cycle 
    24    REAL(wp), DIMENSION(jpi,jpj) ::   qsr_daily                                          ! to hold daily mean QSR 
     22   INTEGER                      ::   nday_qsr                    ! day when parameters were computed 
     23   REAL(wp), DIMENSION(jpi,jpj) ::   raa , rbb  , rcc  , rab     ! parameters used to compute the diurnal cycle 
     24   REAL(wp), DIMENSION(jpi,jpj) ::   rtmd, rdawn, rdusk, rscal   !     -       -         -           -      - 
     25   REAL(wp), DIMENSION(jpi,jpj) ::   qsr_daily                   ! to hold daily mean QSR 
    2526   
    26    PUBLIC sbc_dcy       ! routine called by sbc 
    27  
    28    !!---------------------------------------------------------------------- 
    29    !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
     27   PUBLIC   sbc_dcy     ! routine called by sbc 
     28 
     29   !!---------------------------------------------------------------------- 
     30   !! NEMO/OPA 3.3 , NEMO-consortium (2010)  
    3031   !! $Id$  
    3132   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    3233   !!---------------------------------------------------------------------- 
    33  
    3434CONTAINS 
    3535 
     
    4040      !! ** Purpose : introduce a diurnal cycle of qsr from daily values 
    4141      !! 
    42       !! ** Method  : see Appendix A of  
    43       !!              Bernie, DJ, Guilyardi, E, Madec, G, Slingo, JM and Woolnough, SJ 
    44       !!              Impact of resolving the diurnal cycle in an ocean--atmosphere GCM. Part 1: a diurnally forced OGCM 
    45       !!              Climate Dynamics 29:6, 575-590 (2007) 
     42      !! ** Method  : see Appendix A of Bernie et al. 2007. 
    4643      !! 
    4744      !! ** Action  : redistribute daily QSR on each time step following the diurnal cycle 
     45      !! 
     46      !! reference  : Bernie, DJ, E Guilyardi, G Madec, JM Slingo, and SJ Woolnough, 2007 
     47      !!              Impact of resolving the diurnal cycle in an ocean--atmosphere GCM.  
     48      !!              Part 1: a diurnally forced OGCM. Climate Dynamics 29:6, 575-590. 
    4849      !!---------------------------------------------------------------------- 
    49       INTEGER,                      INTENT( in    ) ::   kt     ! ocean time-step index 
    50       REAL(wp), DIMENSION(jpi,jpj), INTENT( inout ) ::   pqsr   ! QSR flux with diurnal cycle 
    51       !! 
    52       INTEGER  ::   ji, jj                                      ! dummy loop indices 
    53       REAL(wp) ::   fintegral, pt1, pt2, paaa, pbbb, pccc       !  
     50      INTEGER,                      INTENT(in   ) ::   kt     ! ocean time-step index 
     51      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   pqsr   ! QSR flux with diurnal cycle 
     52      !! 
     53      INTEGER  ::   ji, jj                                    ! dummy loop indices 
    5454      REAL(wp) ::   ztwopi, zinvtwopi, zconvrad  
    5555      REAL(wp) ::   zlo, zup, zlousd, zupusd 
    5656      REAL(wp) ::   zdsws, zdecrad, ztx 
    5757      REAL(wp) ::   ztmp, ztmp1, ztmp2, ztest 
    58       !!--------------------------------------------------------------------- 
    59  
    60       !---------------------------------------------------------------------- 
    61       ! statement functions 
    62  
    63       fintegral(pt1, pt2, paaa, pbbb, pccc) =                           & 
     58      !---------------------------statement functions------------------------ 
     59      REAL(wp) ::   fintegral, pt1, pt2, paaa, pbbb, pccc     ! dummy statement function arguments 
     60      fintegral( pt1, pt2, paaa, pbbb, pccc ) =                         & 
    6461         &   paaa * pt2 + zinvtwopi * pbbb * SIN(pccc + ztwopi * pt2)   & 
    6562         & - paaa * pt1 - zinvtwopi * pbbb * SIN(pccc + ztwopi * pt1) 
    66       !---------------------------------------------------------------------- 
     63      !!--------------------------------------------------------------------- 
    6764 
    6865      ! Initialization 
     
    7774 
    7875      !                                           
    79       IF (kt == nit000) THEN                     
    80          ! 
     76      IF( kt == nit000 ) THEN       ! first time step only                
    8177         IF(lwp) THEN 
    8278            WRITE(numout,*) 
     
    8581            WRITE(numout,*) 
    8682         ENDIF 
    87          idayqsr = 0 
    88          ! Compute C needed to compute the time integral of the diurnal cycle 
    89          zccc(:,:) = zconvrad * glamt(:,:) - rpi 
     83         nday_qsr = 0 
     84         ! Compute rcc needed to compute the time integral of the diurnal cycle 
     85         rcc(:,:) = zconvrad * glamt(:,:) - rpi 
    9086         ! time of midday 
    91          ztmd(:,:) = 0.5 - glamt(:,:) / 360. 
    92          ztmd(:,:) = MOD((ztmd(:,:) + 1.), 1.) 
     87         rtmd(:,:) = 0.5 - glamt(:,:) / 360. 
     88         rtmd(:,:) = MOD( (rtmd(:,:) + 1.), 1. ) 
    9389      ENDIF 
    9490 
     
    9995 
    10096      ! nday is the number of days since the beginning of the current month  
    101       IF( idayqsr /= nday ) THEN  
     97      IF( nday_qsr /= nday ) THEN  
    10298         ! save the day of the year and the daily mean of qsr 
    103          idayqsr = nday  
     99         nday_qsr = nday  
    104100         ! number of days since the previous winter solstice (supposed to be always 21 December)          
    105101         zdsws = 11 + nday_year 
     
    113109            DO ji = 1, jpi 
    114110               ztmp = zconvrad * gphit(ji,jj) 
    115                zaaa(ji,jj) = SIN(ztmp) * SIN(zdecrad) 
    116                zbbb(ji,jj) = COS(ztmp) * COS(zdecrad) 
     111               raa(ji,jj) = SIN( ztmp ) * SIN( zdecrad ) 
     112               rbb(ji,jj) = COS( ztmp ) * COS( zdecrad ) 
    117113            END DO   
    118114         END DO   
     
    120116         ! Compute the time of dawn and dusk 
    121117 
    122          ! zab to test if the day time is equal to 0, less than 24h of full day         
    123          zab(:,:) = -zaaa(:,:) / zbbb(:,:) 
     118         ! rab to test if the day time is equal to 0, less than 24h of full day         
     119         rab(:,:) = -raa(:,:) / rbb(:,:) 
    124120         DO jj = 1, jpj 
    125121            DO ji = 1, jpi 
    126                IF ( ABS(zab(ji,jj)) < 1 ) THEN 
    127          ! day duration is less than 24h 
     122               IF ( ABS(rab(ji,jj)) < 1 ) THEN         ! day duration is less than 24h 
    128123         ! When is it night? 
    129                   ztx = zinvtwopi * (ACOS(zab(ji,jj)) - zccc(ji,jj)) 
    130                   ztest = -zbbb(ji,jj) * SIN( zccc(ji,jj) + ztwopi * ztx ) 
     124                  ztx = zinvtwopi * (ACOS(rab(ji,jj)) - rcc(ji,jj)) 
     125                  ztest = -rbb(ji,jj) * SIN( rcc(ji,jj) + ztwopi * ztx ) 
    131126         ! is it dawn or dusk? 
    132127                  IF ( ztest > 0 ) THEN 
    133                      zdawn(ji,jj) = ztx 
    134                      zdusk(ji,jj) = ztmd(ji,jj) + ( ztmd(ji,jj) - zdawn(ji,jj) ) 
     128                     rdawn(ji,jj) = ztx 
     129                     rdusk(ji,jj) = rtmd(ji,jj) + ( rtmd(ji,jj) - rdawn(ji,jj) ) 
    135130                  ELSE 
    136                      zdusk(ji,jj) = ztx 
    137                      zdawn(ji,jj) = ztmd(ji,jj) - ( zdusk(ji,jj) - ztmd(ji,jj) ) 
     131                     rdusk(ji,jj) = ztx 
     132                     rdawn(ji,jj) = rtmd(ji,jj) - ( rdusk(ji,jj) - rtmd(ji,jj) ) 
    138133                  ENDIF 
    139134               ELSE 
    140                   zdawn(ji,jj) = ztmd(ji,jj) + 0.5 
    141                   zdusk(ji,jj) = zdawn(ji,jj) 
     135                  rdawn(ji,jj) = rtmd(ji,jj) + 0.5 
     136                  rdusk(ji,jj) = rdawn(ji,jj) 
    142137               ENDIF 
    143138             END DO   
    144139         END DO   
    145          zdawn(:,:) = MOD((zdawn(:,:) + 1.), 1.) 
    146          zdusk(:,:) = MOD((zdusk(:,:) + 1.), 1.) 
     140         rdawn(:,:) = MOD((rdawn(:,:) + 1.), 1.) 
     141         rdusk(:,:) = MOD((rdusk(:,:) + 1.), 1.) 
    147142 
    148143 
    149144         !     2.2 Compute the scalling function: 
    150145         !         S* = the inverse of the time integral of the diurnal cycle from dawm to dusk 
    151  
    152146         DO jj = 1, jpj 
    153147            DO ji = 1, jpi 
    154                IF ( ABS(zab(ji,jj)) < 1 ) THEN 
    155          ! day duration is less than 24h 
    156                   IF ( zdawn(ji,jj) < zdusk(ji,jj) ) THEN 
    157          ! day time in one part 
    158                      zscal(ji,jj) = fintegral(zdawn(ji,jj), zdusk(ji,jj), zaaa(ji,jj), zbbb(ji,jj), zccc(ji,jj))  
    159                      zscal(ji,jj) = 1. / zscal(ji,jj) 
    160                   ELSE 
    161          ! day time in two parts 
    162                      zscal(ji,jj) = fintegral(0., zdusk(ji,jj), zaaa(ji,jj), zbbb(ji,jj), zccc(ji,jj))   & 
    163                         &         + fintegral(zdawn(ji,jj), 1., zaaa(ji,jj), zbbb(ji,jj), zccc(ji,jj))  
    164                      zscal(ji,jj) = 1. / zscal(ji,jj) 
     148               IF ( ABS(rab(ji,jj)) < 1 ) THEN         ! day duration is less than 24h 
     149                  IF ( rdawn(ji,jj) < rdusk(ji,jj) ) THEN      ! day time in one part 
     150                     rscal(ji,jj) = fintegral(rdawn(ji,jj), rdusk(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     151                     rscal(ji,jj) = 1. / rscal(ji,jj) 
     152                  ELSE                                         ! day time in two parts 
     153                     rscal(ji,jj) = fintegral(0., rdusk(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))   & 
     154                        &         + fintegral(rdawn(ji,jj), 1., raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     155                     rscal(ji,jj) = 1. / rscal(ji,jj) 
    165156                  ENDIF 
    166157               ELSE 
    167                   IF ( zaaa(ji,jj) > zbbb(ji,jj) ) THEN 
    168          ! 24h day 
    169                      zscal(ji,jj) = fintegral(0., 1., zaaa(ji,jj), zbbb(ji,jj), zccc(ji,jj))  
    170                      zscal(ji,jj) = 1. / zscal(ji,jj) 
    171                   ELSE 
    172          ! No day 
    173                      zscal(ji,jj) = 0. 
     158                  IF ( raa(ji,jj) > rbb(ji,jj) ) THEN         ! 24h day 
     159                     rscal(ji,jj) = fintegral(0., 1., raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     160                     rscal(ji,jj) = 1. / rscal(ji,jj) 
     161                  ELSE                                          ! No day 
     162                     rscal(ji,jj) = 0.e0 
    174163                  ENDIF 
    175164               ENDIF 
     
    178167         ! 
    179168         ztmp = rday / rdt 
    180          zscal(:,:) = zscal(:,:) * ztmp 
     169         rscal(:,:) = rscal(:,:) * ztmp 
    181170 
    182171      ENDIF  
    183172 
    184          !     3. compute qsr with the diurnal cycle 
    185          !     ----------------------- 
     173         !     3. update qsr with the diurnal cycle 
     174         !     ------------------------------------ 
    186175 
    187176      DO jj = 1, jpj 
    188177         DO ji = 1, jpi 
    189             IF ( ABS(zab(ji,jj)) < 1 ) THEN 
    190          ! day duration is less than 24h 
    191                   IF ( zdawn(ji,jj) < zdusk(ji,jj) ) THEN 
    192          ! day time in one part 
    193                      zlousd = MAX(zlo, zdawn(ji,jj)) 
    194                      zlousd = MIN(zlousd, zup) 
    195                      zupusd = MIN(zup, zdusk(ji,jj)) 
    196                      zupusd = MAX(zupusd, zlo) 
    197                      ztmp = fintegral(zlousd, zupusd, zaaa(ji,jj), zbbb(ji,jj), zccc(ji,jj))  
    198                      pqsr(ji,jj) = qsr_daily(ji,jj) * ztmp * zscal(ji,jj) 
    199                   ELSE 
    200          ! day time in two parts 
    201                      zlousd = MIN(zlo, zdusk(ji,jj)) 
    202                      zupusd = MIN(zup, zdusk(ji,jj)) 
    203                      ztmp1 = fintegral(zlousd, zupusd, zaaa(ji,jj), zbbb(ji,jj), zccc(ji,jj))  
    204                      zlousd = MAX(zlo, zdawn(ji,jj)) 
    205                      zupusd = MAX(zup, zdawn(ji,jj)) 
    206                      ztmp2 = fintegral(zlousd, zupusd, zaaa(ji,jj), zbbb(ji,jj), zccc(ji,jj))  
    207                      ztmp = ztmp1 + ztmp2 
    208                      pqsr(ji,jj) = qsr_daily(ji,jj) * ztmp * zscal(ji,jj) 
    209                   ENDIF 
    210             ELSE 
    211                   IF ( zaaa(ji,jj) > zbbb(ji,jj) ) THEN 
    212          ! 24h day 
    213                      ztmp = fintegral(zlo, zup, zaaa(ji,jj), zbbb(ji,jj), zccc(ji,jj))  
    214                      pqsr(ji,jj) = qsr_daily(ji,jj) * ztmp * zscal(ji,jj) 
    215                   ELSE 
    216          ! No day 
    217                      pqsr(ji,jj) = 0. 
    218                   ENDIF 
     178            IF( ABS(rab(ji,jj)) < 1 ) THEN         ! day duration is less than 24h 
     179               ! 
     180               IF( rdawn(ji,jj) < rdusk(ji,jj) ) THEN       ! day time in one part 
     181                  zlousd = MAX(zlo, rdawn(ji,jj)) 
     182                  zlousd = MIN(zlousd, zup) 
     183                  zupusd = MIN(zup, rdusk(ji,jj)) 
     184                  zupusd = MAX(zupusd, zlo) 
     185                  ztmp = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     186                  pqsr(ji,jj) = qsr_daily(ji,jj) * ztmp * rscal(ji,jj) 
     187                  ! 
     188               ELSE                                         ! day time in two parts 
     189                  zlousd = MIN(zlo, rdusk(ji,jj)) 
     190                  zupusd = MIN(zup, rdusk(ji,jj)) 
     191                  ztmp1 = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     192                  zlousd = MAX(zlo, rdawn(ji,jj)) 
     193                  zupusd = MAX(zup, rdawn(ji,jj)) 
     194                  ztmp2 = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     195                  ztmp = ztmp1 + ztmp2 
     196                  pqsr(ji,jj) = qsr_daily(ji,jj) * ztmp * rscal(ji,jj) 
     197               ENDIF 
     198            ELSE                                   ! 24h light or 24h night 
     199               ! 
     200               IF( raa(ji,jj) > rbb(ji,jj) ) THEN         ! 24h day 
     201                  ztmp = fintegral(zlo, zup, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     202                  pqsr(ji,jj) = qsr_daily(ji,jj) * ztmp * rscal(ji,jj) 
     203                  ! 
     204               ELSE                                         ! No day 
     205                  pqsr(ji,jj) = 0.e0 
     206               ENDIF 
    219207            ENDIF 
    220208         END DO   
    221209      END DO   
    222  
     210      ! 
    223211   END SUBROUTINE sbc_dcy 
    224212 
  • branches/dev_r2174_DCY/NEMO/OPA_SRC/SBC/sbcflx.F90

    r2187 r2188  
    44   !! Ocean forcing:  momentum, heat and freshwater flux formulation 
    55   !!===================================================================== 
    6    !! History :  9.0   !  06-06  (G. Madec)  Original code 
     6   !! History :  1.0  !  2006-06  (G. Madec)  Original code 
     7   !!            3.3  !  2010-10  (S. Masson)  add diurnal cycle 
    78   !!---------------------------------------------------------------------- 
    89 
    910   !!---------------------------------------------------------------------- 
    1011   !!   namflx   : flux formulation namlist 
    11    !!   sbc_flx  : flux formulation as ocean surface boundary condition 
    12    !!              (forced mode, fluxes read in NetCDF files) 
    13    !!---------------------------------------------------------------------- 
    14    !! question diverses 
    15    !!  *   ajouter un test sur la division entier de freqh et rdttra ??? 
    16    !!  **  ajoute dans namelist: 1 year forcing files 
    17    !!                         or forcing file starts at the begining of the run 
    18    !!  *** we assume that the forcing file start and end with the previous 
    19    !!      year last record and the next year first record (useful for 
    20    !!      time interpolation, required even if no time interp???) 
    21    !!  *   ajouter un test sur la division de la frequence en pas de temps 
    22    !!  ==> daymod ajout de nsec_year = number of second since the begining of the year 
    23    !!      assumed to be 0 at 0h january the 1st (i.e. 24h december the 31) 
    24    !! 
    25    !!  *** regrouper dtatem et dtasal 
     12   !!   sbc_flx  : flux formulation as ocean surface boundary condition (forced mode, fluxes read in NetCDF files) 
    2613   !!---------------------------------------------------------------------- 
    2714   USE oce             ! ocean dynamics and tracers 
    2815   USE dom_oce         ! ocean space and time domain 
    29    USE sbc_oce         ! Surface boundary condition: ocean fields 
     16   USE sbc_oce         ! surface boundary condition: ocean fields 
     17   USE sbcdcy          ! surface boundary condition: diurnal cycle on qsr 
    3018   USE phycst          ! physical constants 
    31    USE sbcdcy          ! diurnal cycle on qsr 
    3219   USE fldread         ! read input fields 
    3320   USE iom             ! IOM library 
     
    5340#  include "vectopt_loop_substitute.h90" 
    5441   !!---------------------------------------------------------------------- 
    55    !!   OPA 9.0 , LOCEAN-IPSL (2006)  
     42   !! NEMO/OPA 3.3 , NEMO-consortium (2010)  
    5643   !! $Id$ 
    5744   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    5845   !!---------------------------------------------------------------------- 
    59  
    6046CONTAINS 
    6147 
     
    9985      NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp 
    10086      !!--------------------------------------------------------------------- 
    101       !                                         ! ====================== ! 
    102       IF( kt == nit000 ) THEN                   !  First call kt=nit000  ! 
    103          !                                      ! ====================== ! 
     87      ! 
     88      IF( kt == nit000 ) THEN                ! First call kt=nit000   
    10489         ! set file information 
    10590         cn_dir = './'        ! directory in which the model is executed 
    10691         ! ... default values (NB: frequency positive => hours, negative => months) 
    107          !              !   file    ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   ! 
    108          !              !   name    !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      ! 
    109          sn_utau = FLD_N(   'utau'  ,    24     ,  'utau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    110          sn_vtau = FLD_N(   'vtau'  ,    24     ,  'vtau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    111          sn_qtot = FLD_N(   'qtot'  ,    24     ,  'qtot'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    112          sn_qsr  = FLD_N(   'qsr'   ,    24     ,  'qsr'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    113          sn_emp  = FLD_N(   'emp'   ,    24     ,  'emp'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    114  
    115          REWIND ( numnam )               ! ... read in namlist namflx 
     92         !              !  file   ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation  ! 
     93         !              !  name   !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs     ! 
     94         sn_utau = FLD_N(  'utau' ,    24     ,  'utau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
     95         sn_vtau = FLD_N(  'vtau' ,    24     ,  'vtau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
     96         sn_qtot = FLD_N(  'qtot' ,    24     ,  'qtot'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
     97         sn_qsr  = FLD_N(  'qsr'  ,    24     ,  'qsr'     ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
     98         sn_emp  = FLD_N(  'emp'  ,    24     ,  'emp'     ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
     99         ! 
     100         REWIND ( numnam )                         ! read in namlist namflx 
    116101         READ   ( numnam, namsbc_flx )  
    117  
    118          ! do we plan to use ln_dm2dc with non-daily forcing? 
     102         ! 
     103         !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing? 
    119104         IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   & 
    120105            &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' )  
    121  
    122          ! store namelist information in an array 
     106         ! 
     107         !                                         ! store namelist information in an array 
    123108         slf_i(jp_utau) = sn_utau   ;   slf_i(jp_vtau) = sn_vtau 
    124109         slf_i(jp_qtot) = sn_qtot   ;   slf_i(jp_qsr ) = sn_qsr  
    125110         slf_i(jp_emp ) = sn_emp 
    126  
    127          ! set sf structure 
    128          ALLOCATE( sf(jpfld), STAT=ierror ) 
     111         ! 
     112         ALLOCATE( sf(jpfld), STAT=ierror )        ! set sf structure 
    129113         IF( ierror > 0 ) THEN    
    130114            CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' )   ;   RETURN   
    131115         ENDIF 
    132116         DO ji= 1, jpfld 
    133             ALLOCATE( sf(ji)%fnow(jpi,jpj) ) 
     117            ALLOCATE( sf(ji)%fnow(jpi,jpj)   ) 
    134118            ALLOCATE( sf(ji)%fdta(jpi,jpj,2) ) 
    135119         END DO 
    136  
    137  
    138          ! fill sf with slf_i and control print 
     120         !                                         ! fill sf with slf_i and control print 
    139121         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_flx', 'flux formulation for ocean surface boundary condition', 'namsbc_flx' ) 
    140122         ! 
    141123      ENDIF 
    142124 
    143       CALL fld_read( kt, nn_fsbc, sf )           ! Read input fields and provides the 
    144       !                                          ! input fields at the current time-step 
    145       IF( ln_dm2dc )   CALL sbc_dcy( kt , sf(jp_qsr)%fnow )   ! modify sf(jp_qsr)%fnow for diurnal cycle 
     125                       CALL fld_read( kt, nn_fsbc, sf )       ! input fields provided at the current time-step 
     126       
     127      IF( ln_dm2dc )   CALL sbc_dcy( kt , sf(jp_qsr)%fnow )   ! modify now Qsr to include the diurnal cycle 
    146128 
    147       IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN 
    148          ! 
    149          ! set the ocean fluxes from read fields 
     129      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN                    ! update ocean fluxes at each SBC frequency 
    150130!CDIR COLLAPSE 
    151          DO jj = 1, jpj 
     131         DO jj = 1, jpj                                           ! set the ocean fluxes from read fields 
    152132            DO ji = 1, jpi 
    153133               utau(ji,jj) = sf(jp_utau)%fnow(ji,jj) 
     
    158138            END DO 
    159139         END DO 
    160           
    161          ! module of wind stress and wind speed at T-point 
    162          zcoef = 1. / ( zrhoa * zcdrag )  
     140         !                                                        ! module of wind stress and wind speed at T-point 
     141         zcoef = 1. / ( zrhoa * zcdrag ) 
    163142!CDIR NOVERRCHK 
    164143         DO jj = 2, jpjm1 
     
    174153         CALL lbc_lnk( taum(:,:), 'T', 1. )   ;   CALL lbc_lnk( wndm(:,:), 'T', 1. ) 
    175154 
    176          ! Initialization of emps (when no ice model) 
    177          emps(:,:) = emp (:,:)  
     155         emps(:,:) = emp (:,:)                                    ! Initialization of emps (needed when no ice model) 
    178156                   
    179          ! control print (if less than 100 time-step asked) 
    180          IF( nitend-nit000 <= 100 .AND. lwp ) THEN 
     157         IF( nitend-nit000 <= 100 .AND. lwp ) THEN                ! control print (if less than 100 time-step asked) 
    181158            WRITE(numout,*)  
    182159            WRITE(numout,*) '        read daily momentum, heat and freshwater fluxes OK' 
  • branches/dev_r2174_DCY/NEMO/OPA_SRC/SBC/sbcmod.F90

    r2187 r2188  
    44   !! Surface module :  provide to the ocean its surface boundary condition 
    55   !!====================================================================== 
    6    !! History :  3.0   !  07-2006  (G. Madec)  Original code 
    7    !!             -    !  08-2008  (S. Masson, E. .... ) coupled interface 
     6   !! History :  3.0  !  2006-07  (G. Madec)  Original code 
     7   !!             -   !  2008-08  (S. Masson, E. .... ) coupled interface 
     8   !!            3.3  !  2010-10  (S. Masson)  add diurnal cycle 
    89   !!---------------------------------------------------------------------- 
    910 
     
    1213   !!   sbc            : surface ocean momentum, heat and freshwater boundary conditions 
    1314   !!---------------------------------------------------------------------- 
    14    USE oce             ! ocean dynamics and tracers 
    15    USE dom_oce         ! ocean space and time domain 
    16    USE phycst          ! physical constants 
    17  
    18    USE sbc_oce         ! Surface boundary condition: ocean fields 
    19    USE sbc_ice         ! Surface boundary condition: ice fields 
    20    USE sbcssm          ! surface boundary condition: sea-surface mean variables 
    21    USE sbcana          ! surface boundary condition: analytical formulation 
    22    USE sbcflx          ! surface boundary condition: flux formulation 
    23    USE sbcblk_clio     ! surface boundary condition: bulk formulation : CLIO 
    24    USE sbcblk_core     ! surface boundary condition: bulk formulation : CORE 
    25    USE sbcice_if       ! surface boundary condition: ice-if sea-ice model 
    26    USE sbcice_lim      ! surface boundary condition: LIM 3.0 sea-ice model 
    27    USE sbcice_lim_2    ! surface boundary condition: LIM 2.0 sea-ice model 
    28    USE sbccpl          ! surface boundary condition: coupled florulation 
     15   USE oce              ! ocean dynamics and tracers 
     16   USE dom_oce          ! ocean space and time domain 
     17   USE phycst           ! physical constants 
     18   USE sbc_oce          ! Surface boundary condition: ocean fields 
     19   USE sbc_ice          ! Surface boundary condition: ice fields 
     20   USE sbcssm           ! surface boundary condition: sea-surface mean variables 
     21   USE sbcana           ! surface boundary condition: analytical formulation 
     22   USE sbcflx           ! surface boundary condition: flux formulation 
     23   USE sbcblk_clio      ! surface boundary condition: bulk formulation : CLIO 
     24   USE sbcblk_core      ! surface boundary condition: bulk formulation : CORE 
     25   USE sbcice_if        ! surface boundary condition: ice-if sea-ice model 
     26   USE sbcice_lim       ! surface boundary condition: LIM 3.0 sea-ice model 
     27   USE sbcice_lim_2     ! surface boundary condition: LIM 2.0 sea-ice model 
     28   USE sbccpl           ! surface boundary condition: coupled florulation 
    2929   USE cpl_oasis3, ONLY:lk_cpl      ! are we in coupled mode? 
    30    USE sbcssr          ! surface boundary condition: sea surface restoring 
    31    USE sbcrnf          ! surface boundary condition: runoffs 
    32    USE sbcfwb          ! surface boundary condition: freshwater budget 
    33    USE closea          ! closed sea 
    34  
    35    USE prtctl          ! Print control                    (prt_ctl routine) 
    36    USE restart         ! ocean restart 
    37    USE iom 
    38    USE in_out_manager  ! I/O manager 
     30   USE sbcssr           ! surface boundary condition: sea surface restoring 
     31   USE sbcrnf           ! surface boundary condition: runoffs 
     32   USE sbcfwb           ! surface boundary condition: freshwater budget 
     33   USE closea           ! closed sea 
     34 
     35   USE prtctl           ! Print control                    (prt_ctl routine) 
     36   USE restart          ! ocean restart 
     37   USE iom              ! IOM library 
     38   USE in_out_manager   ! I/O manager 
    3939 
    4040   IMPLICIT NONE 
     
    4949#  include "domzgr_substitute.h90" 
    5050   !!---------------------------------------------------------------------- 
    51    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     51   !! NEMO/OPA 3.3 , NEMO-consortium (2010)  
    5252   !! $Id$ 
    5353   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    5454   !!---------------------------------------------------------------------- 
    55  
    5655CONTAINS 
    5756 
     
    6968      INTEGER ::   icpt      ! temporary integer 
    7069      !! 
    71       NAMELIST/namsbc/ nn_fsbc, ln_ana, ln_flx, ln_blk_clio, ln_blk_core, ln_cpl,   & 
    72          &             nn_ice , ln_dm2dc, ln_rnf, ln_ssr, nn_fwb, nn_ico_cpl 
     70      NAMELIST/namsbc/ nn_fsbc, ln_ana  , ln_flx, ln_blk_clio, ln_blk_core, ln_cpl    ,   & 
     71         &             nn_ice , ln_dm2dc, ln_rnf, ln_ssr     , nn_fwb     , nn_ico_cpl 
    7372      !!---------------------------------------------------------------------- 
    7473 
     
    7978      ENDIF 
    8079 
    81       REWIND( numnam )                   ! Read Namelist namsbc 
     80      REWIND( numnam )           ! Read Namelist namsbc 
    8281      READ  ( numnam, namsbc ) 
    8382 
    84       ! overwrite namelist parameter using CPP key information 
    85 !!gm here no overwrite, test all option via namelist change: require more incore memory 
    86 !!gm  IF( lk_sbc_cpl       ) THEN   ;   ln_cpl      = .TRUE.   ;   ELSE   ;   ln_cpl      = .FALSE.   ;   ENDIF 
    87  
    88       IF ( Agrif_Root() ) THEN 
    89         IF( lk_lim2 )            nn_ice      = 2 
    90         IF( lk_lim3 )            nn_ice      = 3 
    91       ENDIF 
    92       ! 
    93       IF( cp_cfg == 'gyre' ) THEN 
     83      !                          ! overwrite namelist parameter using CPP key information 
     84      IF( Agrif_Root() ) THEN                ! AGRIF zoom 
     85        IF( lk_lim2 )   nn_ice      = 2 
     86        IF( lk_lim3 )   nn_ice      = 3 
     87      ENDIF 
     88      IF( cp_cfg == 'gyre' ) THEN            ! GYRE configuration 
    9489          ln_ana      = .TRUE.    
    9590          nn_ice      =   0 
    9691      ENDIF 
    9792       
    98       ! Control print 
    99       IF(lwp) THEN 
     93      IF(lwp) THEN               ! Control print 
    10094         WRITE(numout,*) '        Namelist namsbc (partly overwritten with CPP key setting)' 
    10195         WRITE(numout,*) '           frequency update of sbc (and ice)             nn_fsbc     = ', nn_fsbc 
     
    116110      ENDIF 
    117111 
     112      !                          ! Checks: 
    118113      IF( .NOT. ln_rnf ) THEN                      ! no specific treatment in vicinity of river mouths  
    119114         ln_rnf_mouth  = .false.                       
     
    144139         &   CALL ctl_warn( 'diurnal cycle for qsr: the sampling of the diurnal cycle is too small...' ) 
    145140       
    146       ! Choice of the Surface Boudary Condition (set nsbc) 
     141      !                          ! Choice of the Surface Boudary Condition (set nsbc) 
    147142      icpt = 0 
    148143      IF( ln_ana          ) THEN   ;   nsbc =  1   ; icpt = icpt + 1   ;   ENDIF       ! analytical      formulation 
     
    153148      IF( cp_cfg == 'gyre') THEN   ;   nsbc =  0                       ;   ENDIF       ! GYRE analytical formulation 
    154149      IF( lk_esopa        )            nsbc = -1                                       ! esopa test, ALL formulations 
    155  
     150      ! 
    156151      IF( icpt /= 1 .AND. .NOT.lk_esopa ) THEN 
    157152         WRITE(numout,*) 
Note: See TracChangeset for help on using the changeset viewer.