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 5836 for trunk/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

Ignore:
Timestamp:
2015-10-26T15:49:40+01:00 (8 years ago)
Author:
cetlod
Message:

merge the simplification branch onto the trunk, see ticket #1612

Location:
trunk/NEMOGCM/NEMO/OPA_SRC/SBC
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90

    r5407 r5836  
    44   !! Coupled O/A : coupled ocean-atmosphere case using OASIS3-MCT 
    55   !!===================================================================== 
    6    !! History :    
    7    !!   9.0  !  04-06  (R. Redler, NEC Laboratories Europe, Germany) Original code 
    8    !!   " "  !  04-11  (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Germany) revision 
    9    !!   " "  !  04-11  (V. Gayler, MPI M&D) Grid writing 
    10    !!   " "  !  05-08  (R. Redler, W. Park) frld initialization, paral(2) revision 
    11    !!   " "  !  05-09  (R. Redler) extended to allow for communication over root only 
    12    !!   " "  !  06-01  (W. Park) modification of physical part 
    13    !!   " "  !  06-02  (R. Redler, W. Park) buffer array fix for root exchange 
    14    !!   3.4  !  11-11  (C. Harris) Changes to allow mutiple category fields 
    15    !!---------------------------------------------------------------------- 
     6   !! History :  1.0  !  2004-06  (R. Redler, NEC Laboratories Europe, Germany) Original code 
     7   !!             -   !  2004-11  (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Germany) revision 
     8   !!             -   !  2004-11  (V. Gayler, MPI M&D) Grid writing 
     9   !!            2.0  !  2005-08  (R. Redler, W. Park) frld initialization, paral(2) revision 
     10   !!             -   !  2005-09  (R. Redler) extended to allow for communication over root only 
     11   !!             -   !  2006-01  (W. Park) modification of physical part 
     12   !!             -   !  2006-02  (R. Redler, W. Park) buffer array fix for root exchange 
     13   !!            3.4  !  2011-11  (C. Harris) Changes to allow mutiple category fields 
     14   !!            3.6  !  2014-11  (S. Masson) OASIS3-MCT 
     15   !!---------------------------------------------------------------------- 
     16    
    1617   !!---------------------------------------------------------------------- 
    1718   !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3-MCT 
     
    2021   !!   cpl_init     : initialization of coupled mode communication 
    2122   !!   cpl_define   : definition of grid and fields 
    22    !!   cpl_snd     : snd out fields in coupled mode 
    23    !!   cpl_rcv     : receive fields in coupled mode 
     23   !!   cpl_snd      : snd out fields in coupled mode 
     24   !!   cpl_rcv      : receive fields in coupled mode 
    2425   !!   cpl_finalize : finalize the coupled mode communication 
    2526   !!---------------------------------------------------------------------- 
     
    99100      !! ** Method  :   OASIS3 MPI communication  
    100101      !!-------------------------------------------------------------------- 
    101       CHARACTER(len = *), INTENT(in) ::   cd_modname   ! model name as set in namcouple file 
    102       INTEGER          , INTENT(out) ::   kl_comm      ! local communicator of the model 
     102      CHARACTER(len = *), INTENT(in   ) ::   cd_modname   ! model name as set in namcouple file 
     103      INTEGER           , INTENT(  out) ::   kl_comm      ! local communicator of the model 
    103104      !!-------------------------------------------------------------------- 
    104105 
     
    163164         CALL oasis_abort ( ncomp_id, 'cpl_define', 'nsnd is larger than nmaxfld, increase nmaxfld')   ;   RETURN 
    164165      ENDIF 
    165  
    166166      ! 
    167167      ! ... Define the shape for the area that excludes the halo 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90

    r5768 r5836  
    285285               ztinta =  REAL( isecsbc - sd(jf)%nrec_b(2), wp ) / REAL( sd(jf)%nrec_a(2) - sd(jf)%nrec_b(2), wp ) 
    286286               ztintb =  1. - ztinta 
    287 !CDIR COLLAPSE 
    288287               sd(jf)%fnow(:,:,:) = ztintb * sd(jf)%fdta(:,:,:,1) + ztinta * sd(jf)%fdta(:,:,:,2) 
    289288            ELSE   ! nothing to do... 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/geo2ocean.F90

    r4162 r5836  
    195195 
    196196      DO jj = 2, jpjm1 
    197 !CDIR NOVERRCHK 
    198197         DO ji = fs_2, jpi   ! vector opt. 
    199198 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90

    r5407 r5836  
    8080   INTEGER , PUBLIC, PARAMETER ::   jp_mfs     = 6        !: MFS  bulk                     formulation 
    8181   INTEGER , PUBLIC, PARAMETER ::   jp_none    = 7        !: for OPA when doing coupling via SAS module 
    82    INTEGER , PUBLIC, PARAMETER ::   jp_esopa   = -1       !: esopa test, ALL formulations 
    8382    
    8483   !!---------------------------------------------------------------------- 
     
    200199      !!--------------------------------------------------------------------- 
    201200      zcoef = 0.5 / ( zrhoa * zcdrag )  
    202 !CDIR NOVERRCHK 
    203201      DO jj = 2, jpjm1 
    204 !CDIR NOVERRCHK 
    205202         DO ji = fs_2, fs_jpim1   ! vect. opt. 
    206203            ztx = utau(ji-1,jj  ) + utau(ji,jj)  
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcana.F90

    r4624 r5836  
    279279      ! module of wind stress and wind speed at T-point 
    280280      zcoef = 1. / ( zrhoa * zcdrag )  
    281 !CDIR NOVERRCHK 
    282281      DO jj = 2, jpjm1 
    283 !CDIR NOVERRCHK 
    284282         DO ji = fs_2, fs_jpim1   ! vect. opt. 
    285283            ztx = utau(ji-1,jj  ) + utau(ji,jj)  
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90

    r5215 r5836  
    6262      !!--------------------------------------------------------------------- 
    6363      INTEGER, INTENT(in)::   kt   ! ocean time step 
    64       !! 
     64      ! 
    6565      INTEGER            ::   ierror  ! local integer  
    6666      INTEGER            ::   ios     ! Local integer output status for namelist read 
     
    7171      NAMELIST/namsbc_apr/ cn_dir, sn_apr, ln_ref_apr, rn_pref, ln_apr_obc 
    7272      !!---------------------------------------------------------------------- 
    73       ! 
    7473      ! 
    7574      !                                         ! -------------------- ! 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90

    r5487 r5836  
    243243      !   momentum fluxes  (utau, vtau )   ! 
    244244      !------------------------------------! 
    245 !CDIR COLLAPSE 
    246245      utau(:,:) = sf(jp_utau)%fnow(:,:,1) 
    247 !CDIR COLLAPSE 
    248246      vtau(:,:) = sf(jp_vtau)%fnow(:,:,1) 
    249247 
     
    251249      !   wind stress module (taum )       ! 
    252250      !------------------------------------! 
    253 !CDIR NOVERRCHK 
    254251      DO jj = 2, jpjm1 
    255 !CDIR NOVERRCHK 
    256252         DO ji = fs_2, fs_jpim1   ! vector opt. 
    257253            ztx2 = utau(ji-1,jj  ) + utau(ji,jj) 
     
    268264      !   store the wind speed  (wndm )    ! 
    269265      !------------------------------------! 
    270 !CDIR COLLAPSE 
    271266      wndm(:,:) = sf(jp_wndm)%fnow(:,:,1) 
    272267      wndm(:,:) = wndm(:,:) * tmask(:,:,1) 
     
    281276      !   Other ocean fluxes   ! 
    282277      !------------------------! 
    283 !CDIR NOVERRCHK 
    284 !CDIR COLLAPSE 
    285278      DO jj = 1, jpj 
    286 !CDIR NOVERRCHK 
    287279         DO ji = 1, jpi 
    288280            ! 
     
    375367      zcprec = rcp /  rday     ! convert prec ( mm/day ==> m/s)  ==> W/m2 
    376368 
    377 !CDIR COLLAPSE 
    378369      emp(:,:) = zqla(:,:) / cevap                                        &   ! freshwater flux 
    379370         &     - sf(jp_prec)%fnow(:,:,1) / rday * tmask(:,:,1) 
    380371      ! 
    381 !CDIR COLLAPSE 
    382372      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                        &   ! Downward Non Solar flux 
    383373         &     - zqla(:,:)             * pst(:,:) * zcevap                &   ! remove evap.   heat content at SST in Celcius 
     
    415405 
    416406# if defined key_lim2 || defined key_lim3 
     407 
    417408   SUBROUTINE blk_ice_clio_tau 
    418409      !!--------------------------------------------------------------------------- 
     
    429420      ! 
    430421      IF( nn_timing == 1 )  CALL timing_start('blk_ice_clio_tau') 
    431  
     422      ! 
    432423      SELECT CASE( cp_ice_msh ) 
    433  
     424      ! 
    434425      CASE( 'C' )                          ! C-grid ice dynamics 
    435  
     426         ! 
    436427         zcoef  = cai / cao                         ! Change from air-sea stress to air-ice stress 
    437428         utau_ice(:,:) = zcoef * utau(:,:) 
    438429         vtau_ice(:,:) = zcoef * vtau(:,:) 
    439  
     430         ! 
    440431      CASE( 'I' )                          ! I-grid ice dynamics:  I-point (i.e. F-point lower-left corner) 
    441  
     432         ! 
    442433         zcoef  = 0.5_wp * cai / cao                ! Change from air-sea stress to air-ice stress 
    443434         DO jj = 2, jpj         ! stress from ocean U- and V-points to ice U,V point 
     
    447438            END DO 
    448439         END DO 
    449  
     440         ! 
    450441         CALL lbc_lnk( utau_ice(:,:), 'I', -1. )   ;   CALL lbc_lnk( vtau_ice(:,:), 'I', -1. )   ! I-point 
    451  
     442         ! 
    452443      END SELECT 
    453  
     444      ! 
    454445      IF(ln_ctl) THEN 
    455446         CALL prt_ctl(tab2d_1=utau_ice , clinfo1=' blk_ice_clio: utau_ice : ', tab2d_2=vtau_ice , clinfo2=' vtau_ice : ') 
    456447      ENDIF 
    457  
     448      ! 
    458449      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_clio_tau') 
    459  
     450      ! 
    460451   END SUBROUTINE blk_ice_clio_tau 
     452    
    461453#endif 
    462454 
    463455# if defined key_lim2 || defined key_lim3 
     456 
    464457   SUBROUTINE blk_ice_clio_flx(  ptsu , palb_cs, palb_os, palb ) 
    465458      !!--------------------------------------------------------------------------- 
     
    520513      !-------------------------------------------------------------------------------- 
    521514 
    522 !CDIR NOVERRCHK 
    523 !CDIR COLLAPSE 
    524515      DO jj = 1, jpj 
    525 !CDIR NOVERRCHK 
    526516         DO ji = 1, jpi 
    527517            ztatm (ji,jj) = sf(jp_tair)%fnow(ji,jj,1)                ! air temperature in Kelvins  
     
    573563 
    574564      !                                     ! ========================== ! 
    575       DO jl = 1, jpl                       !  Loop over ice categories  ! 
     565      DO jl = 1, jpl                        !  Loop over ice categories  ! 
    576566         !                                  ! ========================== ! 
    577 !CDIR NOVERRCHK 
    578 !CDIR COLLAPSE 
    579567         DO jj = 1 , jpj 
    580 !CDIR NOVERRCHK 
    581568            DO ji = 1, jpi 
    582569               !-------------------------------------------! 
     
    636623      ! ----------------------------------------------------------------------------- ! 
    637624      ! 
    638 !CDIR COLLAPSE 
    639625      qns_ice(:,:,:) = z_qlw (:,:,:) - z_qsb (:,:,:) - qla_ice (:,:,:)      ! Downward Non Solar flux 
    640 !CDIR COLLAPSE 
    641626      tprecip(:,:)   = sf(jp_prec)%fnow(:,:,1) / rday                     ! total precipitation [kg/m2/s] 
    642627      ! 
     
    644629      !    Correct the OCEAN non solar flux with the existence of solid precipitation ! 
    645630      ! ---------------=====--------------------------------------------------------- ! 
    646 !CDIR COLLAPSE 
    647631      qns(:,:) = qns(:,:)                                                           &   ! update the non-solar heat flux with: 
    648632         &     - sprecip(:,:) * lfus                                                  &   ! remove melting solid precip 
     
    782766      ! Saturated water vapour and vapour pressure 
    783767      ! ------------------------------------------ 
    784 !CDIR NOVERRCHK 
    785 !CDIR COLLAPSE 
    786768      DO jj = 1, jpj 
    787 !CDIR NOVERRCHK 
    788769         DO ji = 1, jpi 
    789770            ztamr = sf(jp_tair)%fnow(ji,jj,1) - rtt 
     
    814795      zdaycor  = 1.0 + 0.0013 * SIN( zdist ) + 0.0342 * COS( zdist ) 
    815796 
    816 !CDIR NOVERRCHK 
    817797      DO jj = 1, jpj 
    818 !CDIR NOVERRCHK 
    819798         DO ji = 1, jpi 
    820799            !  product of sine (cosine) of latitude and sine (cosine) of solar declination 
     
    837816 
    838817      ! compute and sum ocean qsr over the daylight (i.e. between sunrise and sunset) 
    839 !CDIR NOVERRCHK    
    840818      DO jt = 1, jp24 
    841819         zcoef = FLOAT( jt ) - 0.5 
    842 !CDIR NOVERRCHK      
    843 !CDIR COLLAPSE 
    844820         DO jj = 1, jpj 
    845 !CDIR NOVERRCHK 
    846821            DO ji = 1, jpi 
    847822               zlha = COS(  zlsrise(ji,jj) - zcoef * zdlha(ji,jj)  )                  ! local hour angle 
     
    862837      ! Taking into account the ellipsity of the earth orbit, the clouds AND masked if sea-ice cover > 0% 
    863838      zcoef1 = srgamma * zdaycor / ( 2. * rpi ) 
    864 !CDIR COLLAPSE 
    865839      DO jj = 1, jpj 
    866840         DO ji = 1, jpi 
     
    920894      ! Saturated water vapour and vapour pressure 
    921895      ! ------------------------------------------ 
    922 !CDIR NOVERRCHK 
    923 !CDIR COLLAPSE 
    924896      DO jj = 1, jpj 
    925 !CDIR NOVERRCHK 
    926897         DO ji = 1, jpi            
    927898            ztamr = sf(jp_tair)%fnow(ji,jj,1) - rtt            
     
    952923      zdaycor  = 1.0 + 0.0013 * SIN( zdist ) + 0.0342 * COS( zdist ) 
    953924 
    954 !CDIR NOVERRCHK 
    955925      DO jj = 1, jpj 
    956 !CDIR NOVERRCHK 
    957926         DO ji = 1, jpi 
    958927            !  product of sine (cosine) of latitude and sine (cosine) of solar declination 
     
    979948      DO jl = 1, ijpl      !  loop over ice categories  ! 
    980949         !                 !----------------------------!  
    981 !CDIR NOVERRCHK    
    982950         DO jt = 1, jp24    
    983951            zcoef = FLOAT( jt ) - 0.5 
    984 !CDIR NOVERRCHK      
    985 !CDIR COLLAPSE 
    986952            DO jj = 1, jpj 
    987 !CDIR NOVERRCHK 
    988953               DO ji = 1, jpi 
    989954                  zlha = COS(  zlsrise(ji,jj) - zcoef * zdlha(ji,jj)  )                  ! local hour angle 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_mfs.F90

    r5215 r5836  
    251251         ! for basin budget and cooerence 
    252252         !-------------------------------------------------- 
    253 !CDIR COLLAPSE 
    254            emp (:,:) = evap(:,:) - sf(jp_prec)%fnow(:,:,1) * tmask(:,:,1) 
    255 !CDIR COLLAPSE 
     253         emp(:,:) = evap(:,:) - sf(jp_prec)%fnow(:,:,1) * tmask(:,:,1) 
    256254 
    257255         CALL iom_put( "qlw_oce",   qbw  )                 ! output downward longwave heat over the ocean 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90

    r5487 r5836  
    931931         ! => need to be done only when otx1 was changed 
    932932         IF( llnewtx ) THEN 
    933 !CDIR NOVERRCHK 
    934933            DO jj = 2, jpjm1 
    935 !CDIR NOVERRCHK 
    936934               DO ji = fs_2, fs_jpim1   ! vect. opt. 
    937935                  zzx = frcv(jpr_otx1)%z3(ji-1,jj  ,1) + frcv(jpr_otx1)%z3(ji,jj,1) 
     
    961959         IF( llnewtau ) THEN  
    962960            zcoef = 1. / ( zrhoa * zcdrag )  
    963 !CDIR NOVERRCHK 
    964961            DO jj = 1, jpj 
    965 !CDIR NOVERRCHK 
    966962               DO ji = 1, jpi  
    967963                  frcv(jpr_w10m)%z3(ji,jj,1) = SQRT( frcv(jpr_taum)%z3(ji,jj,1) * zcoef ) 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90

    r4990 r5836  
    131131         ELSE                  ;   qsr(:,:) =          sf(jp_qsr)%fnow(:,:,1) 
    132132         ENDIF 
    133 !CDIR COLLAPSE 
    134133         DO jj = 1, jpj                                           ! set the ocean fluxes from read fields 
    135134            DO ji = 1, jpi 
     
    145144         !                                                        ! module of wind stress and wind speed at T-point 
    146145         zcoef = 1. / ( zrhoa * zcdrag ) 
    147 !CDIR NOVERRCHK 
    148146         DO jj = 2, jpjm1 
    149 !CDIR NOVERRCHK 
    150147            DO ji = fs_2, fs_jpim1   ! vect. opt. 
    151148               ztx = utau(ji-1,jj  ) + utau(ji,jj)  
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90

    r5516 r5836  
    6767   PRIVATE 
    6868 
    69    !! * Routine accessibility 
    7069   PUBLIC cice_sbc_init   ! routine called by sbc_init 
    7170   PUBLIC cice_sbc_final  ! routine called by sbc_final 
     
    9594   !! * Substitutions 
    9695#  include "domzgr_substitute.h90" 
    97  
     96   !!---------------------------------------------------------------------- 
     97   !! NEMO/OPA 3.7 , NEMO-consortium (2015)  
    9898   !! $Id$ 
     99   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     100   !!---------------------------------------------------------------------- 
    99101CONTAINS 
    100102 
     
    154156   END SUBROUTINE sbc_ice_cice 
    155157 
    156    SUBROUTINE cice_sbc_init (ksbc) 
     158 
     159   SUBROUTINE cice_sbc_init( ksbc ) 
    157160      !!--------------------------------------------------------------------- 
    158161      !!                    ***  ROUTINE cice_sbc_init  *** 
    159162      !! ** Purpose: Initialise ice related fields for NEMO and coupling 
    160163      !! 
     164      !!--------------------------------------------------------------------- 
    161165      INTEGER, INTENT( in  ) ::   ksbc                ! surface forcing type 
    162166      REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2 
     
    289293 
    290294    
    291    SUBROUTINE cice_sbc_in (kt, ksbc) 
     295   SUBROUTINE cice_sbc_in( kt, ksbc ) 
    292296      !!--------------------------------------------------------------------- 
    293297      !!                    ***  ROUTINE cice_sbc_in  *** 
     
    296300      INTEGER, INTENT(in   ) ::   kt   ! ocean time step 
    297301      INTEGER, INTENT(in   ) ::   ksbc ! surface forcing type 
    298  
     302      ! 
    299303      INTEGER  ::   ji, jj, jl                   ! dummy loop indices       
    300304      REAL(wp), DIMENSION(:,:), POINTER :: ztmp, zpice 
     
    490494! x comp and y comp of sea surface slope (on F points) 
    491495! T point to F point 
    492       DO jj=1,jpjm1 
    493          DO ji=1,jpim1 
    494             ztmp(ji,jj)=0.5 * (  (zpice(ji+1,jj  )-zpice(ji,jj  ))/e1u(ji,jj  )   & 
    495                                + (zpice(ji+1,jj+1)-zpice(ji,jj+1))/e1u(ji,jj+1) ) &  
    496                             *  fmask(ji,jj,1) 
    497          ENDDO 
    498       ENDDO 
    499       CALL nemo2cice(ztmp,ss_tltx,'F', -1. ) 
     496      DO jj = 1, jpjm1 
     497         DO ji = 1, jpim1 
     498            ztmp(ji,jj)=0.5 * (  (zpice(ji+1,jj  )-zpice(ji,jj  )) * r1_e1u(ji,jj  )    & 
     499               &               + (zpice(ji+1,jj+1)-zpice(ji,jj+1)) * r1_e1u(ji,jj+1)  ) * fmask(ji,jj,1) 
     500         END DO 
     501      END DO 
     502      CALL nemo2cice( ztmp,ss_tltx,'F', -1. ) 
    500503 
    501504! T point to F point 
    502       DO jj=1,jpjm1 
    503          DO ji=1,jpim1 
    504             ztmp(ji,jj)=0.5 * (  (zpice(ji  ,jj+1)-zpice(ji  ,jj))/e2v(ji  ,jj)   & 
    505                                + (zpice(ji+1,jj+1)-zpice(ji+1,jj))/e2v(ji+1,jj) ) & 
    506                             *  fmask(ji,jj,1) 
    507          ENDDO 
    508       ENDDO 
     505      DO jj = 1, jpjm1 
     506         DO ji = 1, jpim1 
     507            ztmp(ji,jj)=0.5 * (  (zpice(ji  ,jj+1)-zpice(ji  ,jj)) * r1_e2v(ji  ,jj)    & 
     508               &               + (zpice(ji+1,jj+1)-zpice(ji+1,jj)) * r1_e2v(ji+1,jj)  ) *  fmask(ji,jj,1) 
     509         END DO 
     510      END DO 
    509511      CALL nemo2cice(ztmp,ss_tlty,'F', -1. ) 
    510512 
     
    517519 
    518520 
    519    SUBROUTINE cice_sbc_out (kt,ksbc) 
     521   SUBROUTINE cice_sbc_out( kt, ksbc ) 
    520522      !!--------------------------------------------------------------------- 
    521523      !!                    ***  ROUTINE cice_sbc_out  *** 
     
    575577! Update taum with modulus of ice-ocean stress  
    576578! strocnxT and strocnyT are not weighted by ice fraction in CICE so must be done here  
    577 taum(:,:)=(1.0-fr_i(:,:))*taum(:,:)+fr_i(:,:)*SQRT(ztmp1**2. + ztmp2**2.)  
     579taum(:,:)=(1.0-fr_i(:,:))*taum(:,:)+fr_i(:,:)*SQRT(ztmp1*ztmp1 + ztmp2*ztmp2)  
    578580 
    579581! Freshwater fluxes  
     
    888890#endif 
    889891      !!--------------------------------------------------------------------- 
    890  
    891892      CHARACTER(len=1), INTENT( in ) ::   & 
    892893          cd_type       ! nature of pn grid-point 
     
    908909 
    909910      INTEGER  ::   ji, jj, jn                      ! dummy loop indices 
     911      !!--------------------------------------------------------------------- 
    910912 
    911913!     A. Ensure all haloes are filled in NEMO field (pn) 
     
    10961098   !!   Default option           Dummy module         NO CICE sea-ice model 
    10971099   !!---------------------------------------------------------------------- 
    1098    !! $Id$ 
    10991100CONTAINS 
    11001101 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90

    r5721 r5836  
    1818   USE eosbn2          ! equation of state 
    1919   USE sbc_oce         ! surface boundary condition: ocean fields 
     20   USE zdfbfr          ! 
     21   ! 
     22   USE in_out_manager  ! I/O manager 
     23   USE iom             ! I/O manager library 
     24   USE fldread         ! read input field at current time step 
    2025   USE lbclnk          ! 
    21    USE iom             ! I/O manager library 
    22    USE in_out_manager  ! I/O manager 
    2326   USE wrk_nemo        ! Memory allocation 
    2427   USE timing          ! Timing 
    2528   USE lib_fortran     ! glob_sum 
    26    USE zdfbfr 
    27    USE fldread         ! read input field at current time step 
    28  
    29  
    3029 
    3130   IMPLICIT NONE 
    3231   PRIVATE 
    3332 
    34    PUBLIC   sbc_isf, sbc_isf_div, sbc_isf_alloc  ! routine called in sbcmod and divcur 
     33   PUBLIC   sbc_isf, sbc_isf_div, sbc_isf_alloc  ! routine called in sbcmod and divhor 
    3534 
    3635   ! public in order to be able to output then  
     
    7271#  include "domzgr_substitute.h90" 
    7372   !!---------------------------------------------------------------------- 
    74    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) 
     73   !! NEMO/OPA 3.7 , LOCEAN-IPSL (2015) 
    7574   !! $Id$ 
    7675   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    7776   !!---------------------------------------------------------------------- 
    78  
    7977CONTAINS 
    8078  
    81   SUBROUTINE sbc_isf(kt) 
    82     INTEGER, INTENT(in)          ::   kt         ! ocean time step 
    83     INTEGER                      ::   ji, jj, jk, ijkmin, inum, ierror 
    84     INTEGER                      ::   ikt, ikb   ! top and bottom level of the isf boundary layer 
    85     REAL(wp)                     ::   rmin 
    86     REAL(wp)                     ::   zhk 
    87     REAL(wp)                     ::   zt_frz, zpress 
    88     CHARACTER(len=256)           ::   cfisf , cvarzisf, cvarhisf   ! name for isf file 
    89     CHARACTER(LEN=256)           :: cnameis                     ! name of iceshelf file 
    90     CHARACTER (LEN=32)           :: cvarLeff                    ! variable name for efficient Length scale 
    91     INTEGER           ::   ios           ! Local integer output status for namelist read 
    92       ! 
     79   SUBROUTINE sbc_isf(kt) 
    9380      !!--------------------------------------------------------------------- 
     81      !!                     ***  ROUTINE sbc_isf  *** 
     82      !!--------------------------------------------------------------------- 
     83      INTEGER, INTENT(in)          ::   kt         ! ocean time step 
     84      ! 
     85      INTEGER                      ::   ji, jj, jk, ijkmin, inum, ierror 
     86      INTEGER                      ::   ikt, ikb   ! top and bottom level of the isf boundary layer 
     87      REAL(wp)                     ::   rmin 
     88      REAL(wp)                     ::   zhk 
     89      REAL(wp)                     ::   zt_frz, zpress 
     90      CHARACTER(len=256)           ::   cfisf , cvarzisf, cvarhisf   ! name for isf file 
     91      CHARACTER(LEN=256)           :: cnameis                     ! name of iceshelf file 
     92      CHARACTER (LEN=32)           :: cvarLeff                    ! variable name for efficient Length scale 
     93      INTEGER           ::   ios           ! Local integer output status for namelist read 
     94      !! 
    9495      NAMELIST/namsbc_isf/ nn_isfblk, rn_hisf_tbl, ln_divisf, ln_conserve, rn_gammat0, rn_gammas0, nn_gammablk, & 
    95                          & sn_fwfisf, sn_qisf, sn_rnfisf, sn_depmax_isf, sn_depmin_isf, sn_Leff_isf 
    96       ! 
     96         &                sn_fwfisf, sn_qisf, sn_rnfisf, sn_depmax_isf, sn_depmin_isf, sn_Leff_isf 
     97      !!--------------------------------------------------------------------- 
    9798      ! 
    9899      !                                         ! ====================== ! 
     
    107108902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in configuration namelist', lwp ) 
    108109         IF(lwm) WRITE ( numond, namsbc_isf ) 
    109  
    110110 
    111111         IF ( lwp ) WRITE(numout,*) 
     
    210210            END DO 
    211211         END DO 
    212           
     212         ! 
    213213      END IF 
    214214 
     
    298298         !  
    299299      END IF 
    300    
     300      !   
    301301  END SUBROUTINE sbc_isf 
     302 
    302303 
    303304  INTEGER FUNCTION sbc_isf_alloc() 
     
    320321  END FUNCTION 
    321322 
    322   SUBROUTINE sbc_isf_bg03(kt) 
    323    !!========================================================================== 
    324    !!                 *** SUBROUTINE sbcisf_bg03  *** 
    325    !! add net heat and fresh water flux from ice shelf melting 
    326    !! into the adjacent ocean using the parameterisation by 
    327    !! Beckmann and Goosse (2003), "A parameterization of ice shelf-ocean 
    328    !!     interaction for climate models", Ocean Modelling 5(2003) 157-170. 
    329    !!  (hereafter BG) 
    330    !!========================================================================== 
    331    !!---------------------------------------------------------------------- 
    332    !!   sbc_isf_bg03      : routine called from sbcmod 
    333    !!---------------------------------------------------------------------- 
    334    !! 
    335    !! ** Purpose   :   Add heat and fresh water fluxes due to ice shelf melting 
    336    !! ** Reference :   Beckmann et Goosse, 2003, Ocean Modelling 
    337    !! 
    338    !! History : 
    339    !!      !  06-02  (C. Wang) Original code 
    340    !!---------------------------------------------------------------------- 
    341  
    342     INTEGER, INTENT ( in ) :: kt 
    343  
     323 
     324   SUBROUTINE sbc_isf_bg03(kt) 
     325      !!========================================================================== 
     326      !!                 *** SUBROUTINE sbcisf_bg03  *** 
     327      !! add net heat and fresh water flux from ice shelf melting 
     328      !! into the adjacent ocean using the parameterisation by 
     329      !! Beckmann and Goosse (2003), "A parameterization of ice shelf-ocean 
     330      !!     interaction for climate models", Ocean Modelling 5(2003) 157-170. 
     331      !!  (hereafter BG) 
     332      !!========================================================================== 
     333      !!---------------------------------------------------------------------- 
     334      !!   sbc_isf_bg03      : routine called from sbcmod 
     335      !!---------------------------------------------------------------------- 
     336      !! 
     337      !! ** Purpose   :   Add heat and fresh water fluxes due to ice shelf melting 
     338      !! ** Reference :   Beckmann et Goosse, 2003, Ocean Modelling 
     339      !! 
     340      !! History : 
     341      !!      !  06-02  (C. Wang) Original code 
     342      !!---------------------------------------------------------------------- 
     343      INTEGER, INTENT ( in ) :: kt 
     344      ! 
    344345    INTEGER :: ji, jj, jk, jish  !temporary integer 
    345346    INTEGER :: ijkmin 
     
    385386             qisf(ji,jj) = 0._wp ; fwfisf(ji,jj) = 0._wp 
    386387          END IF 
    387        ENDDO 
    388     ENDDO 
     388       END DO 
     389    END DO 
    389390    ! 
    390391    IF( nn_timing == 1 )  CALL timing_stop('sbc_isf_bg03') 
     392      ! 
    391393  END SUBROUTINE sbc_isf_bg03 
     394 
    392395 
    393396   SUBROUTINE sbc_isf_cav( kt ) 
     
    438441      ! 
    439442      ! 
    440 !CDIR COLLAPSE 
    441443      DO jj = 1, jpj 
    442444         DO ji = 1, jpi 
     
    492494 
    493495! More complicated 3 equation thermodynamics as in MITgcm 
    494 !CDIR COLLAPSE 
    495496         DO jj = 2, jpj 
    496497            DO ji = 2, jpi 
     
    561562      ! 
    562563      IF( nn_timing == 1 )  CALL timing_stop('sbc_isf_cav') 
    563  
     564      ! 
    564565   END SUBROUTINE sbc_isf_cav 
     566 
    565567 
    566568   SUBROUTINE sbc_isf_gammats(gt, gs, zqhisf, zqwisf, ji, jj, lit ) 
     
    689691               END IF 
    690692      END IF 
    691  
     693      ! 
    692694   END SUBROUTINE 
     695 
    693696 
    694697   SUBROUTINE sbc_isf_tbl( varin, varout, cptin ) 
     
    752755      IF (cptin == 'T') CALL lbc_lnk(varout,'T',1.) 
    753756      IF (cptin == 'U' .OR. cptin == 'V') CALL lbc_lnk(varout,'T',-1.) 
    754  
     757      ! 
    755758   END SUBROUTINE sbc_isf_tbl 
    756759       
     
    819822      ! 
    820823   END SUBROUTINE sbc_isf_div 
    821                          
     824 
     825 
    822826   FUNCTION tinsitu( ptem, psal, ppress ) RESULT( pti ) 
    823827      !!---------------------------------------------------------------------- 
     
    870874      ! 
    871875   END FUNCTION tinsitu 
    872    ! 
     876 
     877 
    873878   FUNCTION fsatg( pfps, pfpt, pfphp ) 
    874879      !!---------------------------------------------------------------------- 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90

    r5643 r5836  
    2828   USE sbcdcy           ! surface boundary condition: diurnal cycle 
    2929   USE sbcssm           ! surface boundary condition: sea-surface mean variables 
    30    USE sbcapr           ! surface boundary condition: atmospheric pressure 
    3130   USE sbcana           ! surface boundary condition: analytical formulation 
    3231   USE sbcflx           ! surface boundary condition: flux formulation 
     
    133132         WRITE(numout,*) '              forced-coupled mixed formulation           ln_mixcpl   = ', ln_mixcpl 
    134133         WRITE(numout,*) '              OASIS coupling (with atm or sas)           lk_oasis    = ', lk_oasis 
    135          WRITE(numout,*) '              components of your executable              nn_components = ', nn_components 
     134         WRITE(numout,*) '              components of your executable            nn_components = ', nn_components 
    136135         WRITE(numout,*) '              Multicategory heat flux formulation (LIM3) nn_limflx   = ', nn_limflx 
    137136         WRITE(numout,*) '           Misc. options of sbc : ' 
     
    176175 
    177176      !                              ! allocate sbc arrays 
    178       IF( sbc_oce_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_oce arrays' ) 
     177      IF( sbc_oce_alloc() /= 0 )   CALL ctl_stop( 'sbc_init : unable to allocate sbc_oce arrays' ) 
    179178 
    180179      !                          ! Checks: 
    181180      IF( nn_isf .EQ. 0 ) THEN                      ! variable initialisation if no ice shelf  
    182          IF( sbc_isf_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_isf arrays' ) 
     181         IF( sbc_isf_alloc() /= 0 )   CALL ctl_stop( 'sbc_init : unable to allocate sbc_isf arrays' ) 
    183182         fwfisf  (:,:)   = 0.0_wp ; fwfisf_b  (:,:)   = 0.0_wp 
    184183         risf_tsc(:,:,:) = 0.0_wp ; risf_tsc_b(:,:,:) = 0.0_wp 
     
    224223         ENDIF 
    225224      ELSE 
    226       IF ( ln_cdgw .OR. ln_sdw  )                                         &  
    227          &   CALL ctl_stop('Not Activated Wave Module (ln_wave=F) but     & 
    228          & asked coupling with drag coefficient (ln_cdgw =T) or Stokes drift (ln_sdw=T) ') 
     225      IF ( ln_cdgw .OR. ln_sdw  )                                                           &  
     226         &   CALL ctl_stop( 'Not Activated Wave Module (ln_wave=F) but asked coupling ',    & 
     227         &                  'with drag coefficient (ln_cdgw =T) or Stokes drift (ln_sdw=T) ') 
    229228      ENDIF  
    230229      !                          ! Choice of the Surface Boudary Condition (set nsbc) 
     
    241240      IF( nn_components == jp_iam_opa )   & 
    242241         &                  THEN   ;   nsbc = jp_none    ; icpt = icpt + 1   ;   ENDIF       ! opa coupling via SAS module 
    243       IF( lk_esopa        )            nsbc = jp_esopa                                       ! esopa test, ALL formulations 
    244       ! 
    245       IF( icpt /= 1 .AND. .NOT.lk_esopa ) THEN 
    246          WRITE(numout,*) 
    247          WRITE(numout,*) '           E R R O R in setting the sbc, one and only one namelist/CPP key option ' 
    248          WRITE(numout,*) '                     must be choosen. You choose ', icpt, ' option(s)' 
    249          WRITE(numout,*) '                     We stop' 
    250          nstop = nstop + 1 
    251       ENDIF 
     242      ! 
     243      IF( icpt /= 1 )    CALL ctl_stop( 'sbc_init: choose ONE and only ONE sbc option' ) 
     244      ! 
    252245      IF(lwp) THEN 
    253246         WRITE(numout,*) 
    254          IF( nsbc == jp_esopa   )   WRITE(numout,*) '              ESOPA test All surface boundary conditions' 
    255247         IF( nsbc == jp_gyre    )   WRITE(numout,*) '              GYRE analytical formulation' 
    256248         IF( nsbc == jp_ana     )   WRITE(numout,*) '              analytical formulation' 
     
    267259      ! 
    268260      IF( lk_oasis )   CALL sbc_cpl_init (nn_ice)   ! OASIS initialisation. must be done before: (1) first time step 
    269       !                                                     !                                            (2) the use of nn_fsbc 
     261      !                                             !                                            (2) the use of nn_fsbc 
    270262 
    271263!     nn_fsbc initialization if OPA-SAS coupling via OASIS 
    272264!     sas model time step has to be declared in OASIS (mandatory) -> nn_fsbc has to be modified accordingly 
    273265      IF ( nn_components /= jp_iam_nemo ) THEN 
    274  
    275266         IF ( nn_components == jp_iam_opa ) nn_fsbc = cpl_freq('O_SFLX') / NINT(rdt) 
    276267         IF ( nn_components == jp_iam_sas ) nn_fsbc = cpl_freq('I_SFLX') / NINT(rdt) 
     
    344335      !                                            !        forcing field computation         ! 
    345336      !                                            ! ---------------------------------------- ! 
    346       ! 
    347       IF ( .NOT. lk_bdy ) then 
    348          IF( ln_apr_dyn ) CALL sbc_apr( kt )                ! atmospheric pressure provided at kt+0.5*nn_fsbc 
    349       ENDIF 
    350                                                          ! (caution called before sbc_ssm) 
    351337      ! 
    352338      IF( nn_components /= jp_iam_sas )   CALL sbc_ssm( kt )   ! ocean sea surface variables (sst_m, sss_m, ssu_m, ssv_m) 
     
    373359         IF( nn_components == jp_iam_opa ) & 
    374360                             CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   ! OPA-SAS coupling: OPA receiving fields from SAS 
    375       CASE( jp_esopa )                                 
    376                              CALL sbc_ana     ( kt )                    ! ESOPA, test ALL the formulations 
    377                              CALL sbc_gyre    ( kt )                    ! 
    378                              CALL sbc_flx     ( kt )                    ! 
    379                              CALL sbc_blk_clio( kt )                    ! 
    380                              CALL sbc_blk_core( kt )                    ! 
    381                              CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   ! 
    382361      END SELECT 
    383362 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90

    r5503 r5836  
    3131   PRIVATE 
    3232 
    33    PUBLIC   sbc_rnf       ! routine call in sbcmod module 
    34    PUBLIC   sbc_rnf_div   ! routine called in divcurl module 
    35    PUBLIC   sbc_rnf_alloc ! routine call in sbcmod module 
    36    PUBLIC   sbc_rnf_init  ! (PUBLIC for TAM) 
     33   PUBLIC   sbc_rnf       ! routine called in sbcmod module 
     34   PUBLIC   sbc_rnf_div   ! routine called in divhor module 
     35   PUBLIC   sbc_rnf_alloc ! routine called in sbcmod module 
     36   PUBLIC   sbc_rnf_init  ! routine called in sbcmod module 
     37    
    3738   !                                                     !!* namsbc_rnf namelist * 
    3839   CHARACTER(len=100)         ::   cn_dir          !: Root directory for location of rnf files 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90

    r4990 r5836  
    107107            IF( nn_sssr == 1 ) THEN                                   !* Salinity damping term (salt flux only (sfx)) 
    108108               zsrp = rn_deds / rday                                  ! from [mm/day] to [kg/m2/s] 
    109 !CDIR COLLAPSE 
    110109               DO jj = 1, jpj 
    111110                  DO ji = 1, jpi 
     
    121120               zsrp = rn_deds / rday                                  ! from [mm/day] to [kg/m2/s] 
    122121               zerp_bnd = rn_sssr_bnd / rday                          !       -              -     
    123 !CDIR COLLAPSE 
    124122               DO jj = 1, jpj 
    125123                  DO ji = 1, jpi                             
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90

    r5215 r5836  
    44   !! Wave module  
    55   !!====================================================================== 
    6    !! History :  3.3.1  !   2011-09  (Adani M)  Original code: Drag Coefficient  
    7    !!         :  3.4    !   2012-10  (Adani M)                 Stokes Drift  
     6   !! History :  3.3  !   2011-09  (Adani M)  Original code: Drag Coefficient  
     7   !!         :  3.4  !   2012-10  (Adani M)                 Stokes Drift  
    88   !!---------------------------------------------------------------------- 
    9    USE iom             ! I/O manager library 
    10    USE in_out_manager  ! I/O manager 
    11    USE lib_mpp         ! distribued memory computing library 
     9 
     10   !!---------------------------------------------------------------------- 
     11   !!   sbc_wave      : read drag coefficient from wave model in netcdf files  
     12   !!---------------------------------------------------------------------- 
     13   USE oce            !  
     14   USE sbc_oce        ! Surface boundary condition: ocean fields 
     15   USE bdy_oce        ! 
     16   USE domvvl         ! 
     17   ! 
     18   USE iom            ! I/O manager library 
     19   USE in_out_manager ! I/O manager 
     20   USE lib_mpp        ! distribued memory computing library 
    1221   USE fldread        ! read input fields 
    13    USE oce 
    14    USE sbc_oce        ! Surface boundary condition: ocean fields 
    15    USE domvvl 
    16  
    17     
    18    !!---------------------------------------------------------------------- 
    19    !!   sbc_wave       : read drag coefficient from wave model in netcdf files  
    20    !!---------------------------------------------------------------------- 
     22   USE wrk_nemo       ! 
    2123 
    2224   IMPLICIT NONE 
     
    2527   PUBLIC   sbc_wave    ! routine called in sbc_blk_core or sbc_blk_mfs 
    2628    
    27    INTEGER , PARAMETER ::   jpfld  = 3           ! maximum number of files to read for srokes drift 
    28    INTEGER , PARAMETER ::   jp_usd = 1           ! index of stokes drift  (i-component) (m/s)    at T-point 
    29    INTEGER , PARAMETER ::   jp_vsd = 2           ! index of stokes drift  (j-component) (m/s)    at T-point 
    30    INTEGER , PARAMETER ::   jp_wn  = 3           ! index of wave number                 (1/m)    at T-point 
     29   INTEGER , PARAMETER ::   jpfld  = 3   ! maximum number of files to read for srokes drift 
     30   INTEGER , PARAMETER ::   jp_usd = 1   ! index of stokes drift  (i-component) (m/s)    at T-point 
     31   INTEGER , PARAMETER ::   jp_vsd = 2   ! index of stokes drift  (j-component) (m/s)    at T-point 
     32   INTEGER , PARAMETER ::   jp_wn  = 3   ! index of wave number                 (1/m)    at T-point 
     33 
    3134   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_cd    ! structure of input fields (file informations, fields read) Drag Coefficient 
    3235   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_sd    ! structure of input fields (file informations, fields read) Stokes Drift 
    33    REAL(wp),PUBLIC,ALLOCATABLE,DIMENSION (:,:)       :: cdn_wave  
    34    REAL(wp),ALLOCATABLE,DIMENSION (:,:)              :: usd2d,vsd2d,uwavenum,vwavenum  
    35    REAL(wp),PUBLIC,ALLOCATABLE,DIMENSION (:,:,:)     :: usd3d,vsd3d,wsd3d  
     36 
     37   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION (:,:)   :: cdn_wave  
     38   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION (:,:,:) :: usd3d, vsd3d, wsd3d  
     39   REAL(wp),         ALLOCATABLE, DIMENSION (:,:)   :: usd2d, vsd2d, uwavenum, vwavenum  
    3640 
    3741   !! * Substitutions 
    3842#  include "domzgr_substitute.h90" 
     43#  include "vectopt_loop_substitute.h90" 
    3944   !!---------------------------------------------------------------------- 
    40    !! NEMO/OPA 4.0 , NEMO Consortium (2011)  
     45   !! NEMO/OPA 3.7 , NEMO Consortium (2014)  
    4146   !! $Id$ 
    4247   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    5661      !!              - Compute 3d stokes drift using monochromatic 
    5762      !! ** action  :    
    58       !!                
    5963      !!--------------------------------------------------------------------- 
    60       USE oce,  ONLY : un,vn,hdivn,rotn 
    61       USE divcur 
    62       USE wrk_nemo 
    63 #if defined key_bdy 
    64       USE bdy_oce, ONLY : bdytmask 
    65 #endif 
    66       INTEGER, INTENT( in  ) ::  kt       ! ocean time step 
    67       INTEGER                ::  ierror   ! return error code 
    68       INTEGER                ::  ifpr, jj,ji,jk  
     64      INTEGER, INTENT( in  ) ::   kt       ! ocean time step 
     65      ! 
     66      INTEGER                ::   ierror   ! return error code 
     67      INTEGER                ::   ifpr, jj,ji,jk  
    6968      INTEGER                ::   ios     ! Local integer output status for namelist read 
    70       REAL(wp),DIMENSION(:,:,:),POINTER             ::  udummy,vdummy,hdivdummy,rotdummy 
    71       REAL                                          ::  z2dt,z1_2dt 
    7269      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i     ! array of namelist informations on the fields to read 
    7370      CHARACTER(len=100)     ::  cn_dir                          ! Root directory for location of drag coefficient files 
    7471      TYPE(FLD_N)            ::  sn_cdg, sn_usd, sn_vsd, sn_wn   ! informations about the fields to be read 
    75       !!--------------------------------------------------------------------- 
     72      REAL(wp), DIMENSION(:,:,:), POINTER ::   zusd_t, zvsd_t, ze3hdiv   ! 3D workspace 
     73      !! 
    7674      NAMELIST/namsbc_wave/  sn_cdg, cn_dir, sn_usd, sn_vsd, sn_wn 
    7775      !!--------------------------------------------------------------------- 
    78  
    79       !!---------------------------------------------------------------------- 
    80       ! 
    8176      ! 
    8277      !                                         ! -------------------- ! 
     
    9287         IF(lwm) WRITE ( numond, namsbc_wave ) 
    9388         ! 
    94  
    9589         IF ( ln_cdgw ) THEN 
    9690            ALLOCATE( sf_cd(1), STAT=ierror )           !* allocate and fill sf_wave with sn_cdg 
     
    10296            ALLOCATE( cdn_wave(jpi,jpj) ) 
    10397            cdn_wave(:,:) = 0.0 
    104         ENDIF 
     98         ENDIF 
    10599         IF ( ln_sdw ) THEN 
    106100            slf_i(jp_usd) = sn_usd ; slf_i(jp_vsd) = sn_vsd; slf_i(jp_wn) = sn_wn 
     
    113107            END DO 
    114108            CALL fld_fill( sf_sd, slf_i, cn_dir, 'sbc_wave', 'Wave module ', 'namsbc_wave' ) 
    115             ALLOCATE( usd2d(jpi,jpj),vsd2d(jpi,jpj),uwavenum(jpi,jpj),vwavenum(jpi,jpj) ) 
     109            ALLOCATE( usd2d(jpi,jpj) , vsd2d(jpi,jpj) , uwavenum(jpi,jpj) , vwavenum(jpi,jpj) ) 
    116110            ALLOCATE( usd3d(jpi,jpj,jpk),vsd3d(jpi,jpj,jpk),wsd3d(jpi,jpj,jpk) ) 
    117             usd2d(:,:) = 0.0 ;  vsd2d(:,:) = 0.0 ; uwavenum(:,:) = 0.0 ; vwavenum(:,:) = 0.0 
    118             usd3d(:,:,:) = 0.0 ;vsd3d(:,:,:) = 0.0 ; wsd3d(:,:,:) = 0.0 
     111            usd3d(:,:,:) = 0._wp   ;   usd2d(:,:) = 0._wp   ;    uwavenum(:,:) = 0._wp 
     112            vsd3d(:,:,:) = 0._wp   ;   vsd2d(:,:) = 0._wp   ;    vwavenum(:,:) = 0._wp 
     113            wsd3d(:,:,:) = 0._wp 
    119114         ENDIF 
    120115      ENDIF 
     116      ! 
     117      IF ( ln_cdgw ) THEN              !==  Neutral drag coefficient  ==! 
     118         CALL fld_read( kt, nn_fsbc, sf_cd )      ! read from external forcing 
     119         cdn_wave(:,:) = sf_cd(1)%fnow(:,:,1) 
     120      ENDIF 
     121      ! 
     122      IF ( ln_sdw )  THEN              !==  Computation of the 3d Stokes Drift  ==! 
     123         ! 
     124         CALL fld_read( kt, nn_fsbc, sf_sd )    !* read drag coefficient from external forcing 
    121125         ! 
    122126         ! 
    123       IF ( ln_cdgw ) THEN 
    124          CALL fld_read( kt, nn_fsbc, sf_cd )      !* read drag coefficient from external forcing 
    125          cdn_wave(:,:) = sf_cd(1)%fnow(:,:,1) 
    126       ENDIF 
    127       IF ( ln_sdw )  THEN 
    128           CALL fld_read( kt, nn_fsbc, sf_sd )      !* read drag coefficient from external forcing 
    129  
    130          ! Interpolate wavenumber, stokes drift into the grid_V and grid_V 
    131          !------------------------------------------------- 
    132  
    133          DO jj = 1, jpjm1 
    134             DO ji = 1, jpim1 
    135                uwavenum(ji,jj)=0.5 * ( 2. - umask(ji,jj,1) ) * ( sf_sd(3)%fnow(ji,jj,1) * tmask(ji,jj,1) & 
    136                &                                + sf_sd(3)%fnow(ji+1,jj,1) * tmask(ji+1,jj,1) ) 
    137  
    138                vwavenum(ji,jj)=0.5 * ( 2. - vmask(ji,jj,1) ) * ( sf_sd(3)%fnow(ji,jj,1) * tmask(ji,jj,1) & 
    139                &                                + sf_sd(3)%fnow(ji,jj+1,1) * tmask(ji,jj+1,1) ) 
    140  
    141                usd2d(ji,jj) = 0.5 * ( 2. - umask(ji,jj,1) ) * ( sf_sd(1)%fnow(ji,jj,1) * tmask(ji,jj,1) & 
    142                &                                + sf_sd(1)%fnow(ji+1,jj,1) * tmask(ji+1,jj,1) ) 
    143  
    144                vsd2d(ji,jj) = 0.5 * ( 2. - vmask(ji,jj,1) ) * ( sf_sd(2)%fnow(ji,jj,1) * tmask(ji,jj,1) & 
    145                &                                + sf_sd(2)%fnow(ji,jj+1,1) * tmask(ji,jj+1,1) ) 
     127         CALL wrk_alloc( jpi,jpj,jpk,   zusd_t, zvsd_t, ze3hdiv ) 
     128         !                                      !* distribute it on the vertical 
     129         DO jk = 1, jpkm1 
     130            zusd_t(:,:,jk) = sf_sd(jp_usd)%fnow(:,:,1) * EXP( -2._wp * sf_sd(jp_wn)%fnow(:,:,1) * fsdept_n(:,:,jk) ) 
     131            zvsd_t(:,:,jk) = sf_sd(jp_vsd)%fnow(:,:,1) * EXP( -2._wp * sf_sd(jp_wn)%fnow(:,:,1) * fsdept_n(:,:,jk) ) 
     132         END DO 
     133         !                                      !* interpolate the stokes drift from t-point to u- and v-points 
     134         DO jk = 1, jpkm1 
     135            DO jj = 1, jpjm1 
     136               DO ji = 1, jpim1 
     137                   usd3d(ji,jj,jk) = 0.5_wp * ( zusd_t(ji  ,jj,jk) + zusd_t(ji+1,jj,jk) ) * umask(ji,jj,jk) 
     138                   vsd3d(ji,jj,jk) = 0.5_wp * ( zvsd_t(ji  ,jj,jk) + zvsd_t(ji+1,jj,jk) ) * vmask(ji,jj,jk) 
     139               END DO 
    146140            END DO 
    147141         END DO 
    148  
    149           !Computation of the 3d Stokes Drift 
    150           DO jk = 1, jpk 
    151              DO jj = 1, jpj-1 
    152                 DO ji = 1, jpi-1 
    153                    usd3d(ji,jj,jk) = usd2d(ji,jj)*exp(2.0*uwavenum(ji,jj)*(-MIN( gdept_0(ji,jj,jk) , gdept_0(ji+1,jj  ,jk)))) 
    154                    vsd3d(ji,jj,jk) = vsd2d(ji,jj)*exp(2.0*vwavenum(ji,jj)*(-MIN( gdept_0(ji,jj,jk) , gdept_0(ji  ,jj+1,jk)))) 
    155                 END DO 
    156              END DO 
    157              usd3d(jpi,:,jk) = usd2d(jpi,:)*exp( 2.0*uwavenum(jpi,:)*(-gdept_0(jpi,:,jk)) ) 
    158              vsd3d(:,jpj,jk) = vsd2d(:,jpj)*exp( 2.0*vwavenum(:,jpj)*(-gdept_0(:,jpj,jk)) ) 
    159           END DO 
    160  
    161           CALL wrk_alloc( jpi,jpj,jpk,udummy,vdummy,hdivdummy,rotdummy) 
    162            
    163           udummy(:,:,:)=un(:,:,:) 
    164           vdummy(:,:,:)=vn(:,:,:) 
    165           hdivdummy(:,:,:)=hdivn(:,:,:) 
    166           rotdummy(:,:,:)=rotn(:,:,:) 
    167           un(:,:,:)=usd3d(:,:,:) 
    168           vn(:,:,:)=vsd3d(:,:,:) 
    169           CALL div_cur(kt) 
    170       !                                           !------------------------------! 
    171       !                                           !     Now Vertical Velocity    ! 
    172       !                                           !------------------------------! 
    173           z2dt = 2._wp * rdt                              ! set time step size (Euler/Leapfrog) 
    174  
    175           z1_2dt = 1.e0 / z2dt 
    176           DO jk = jpkm1, 1, -1                             ! integrate from the bottom the hor. divergence 
    177              ! - ML - need 3 lines here because replacement of fse3t by its expression yields too long lines otherwise 
    178              wsd3d(:,:,jk) = wsd3d(:,:,jk+1) -   fse3t_n(:,:,jk) * hdivn(:,:,jk)        & 
    179                 &                      - ( fse3t_a(:,:,jk) - fse3t_b(:,:,jk) )    & 
    180                 &                         * tmask(:,:,jk) * z1_2dt 
     142         CALL lbc_lnk( usd3d(:,:,:), 'U', -1. ) 
     143         CALL lbc_lnk( vsd3d(:,:,:), 'V', -1. ) 
     144         ! 
     145         DO jk = 1, jpkm1                       !* e3t * Horizontal divergence  ==! 
     146            DO jj = 2, jpjm1 
     147               DO ji = fs_2, fs_jpim1   ! vector opt. 
     148                  ze3hdiv(ji,jj,jk) = (  e2u(ji  ,jj) * fse3u_n(ji  ,jj,jk) * usd3d(ji  ,jj,jk)     & 
     149                     &                 - e2u(ji-1,jj) * fse3u_n(ji-1,jj,jk) * usd3d(ji-1,jj,jk)     & 
     150                     &                 + e1v(ji,jj  ) * fse3v_n(ji,jj  ,jk) * vsd3d(ji,jj  ,jk)     & 
     151                     &                 - e1v(ji,jj-1) * fse3v_n(ji,jj-1,jk) * vsd3d(ji,jj-1,jk)   ) * r1_e1e2t(ji,jj) 
     152               END DO   
     153            END DO   
     154            IF( .NOT. AGRIF_Root() ) THEN 
     155               IF( nbondi ==  1 .OR. nbondi == 2 )   ze3hdiv(nlci-1,   :  ,jk) = 0._wp      ! east 
     156               IF( nbondi == -1 .OR. nbondi == 2 )   ze3hdiv(  2   ,   :  ,jk) = 0._wp      ! west 
     157               IF( nbondj ==  1 .OR. nbondj == 2 )   ze3hdiv(  :   ,nlcj-1,jk) = 0._wp      ! north 
     158               IF( nbondj == -1 .OR. nbondj == 2 )   ze3hdiv(  :   ,  2   ,jk) = 0._wp      ! south 
     159            ENDIF 
     160         END DO 
     161         CALL lbc_lnk( ze3hdiv, 'T', 1. )  
     162         ! 
     163         DO jk = jpkm1, 1, -1                   !* integrate from the bottom the e3t * hor. divergence 
     164            wsd3d(:,:,jk) = wsd3d(:,:,jk+1) - ze3hdiv(:,:,jk) 
     165         END DO 
    181166#if defined key_bdy 
    182              wsd3d(:,:,jk) = wsd3d(:,:,jk) * bdytmask(:,:) 
     167         IF( lk_bdy ) THEN 
     168            DO jk = 1, jpkm1 
     169               wsd3d(:,:,jk) = wsd3d(:,:,jk) * bdytmask(:,:) 
     170            END DO 
     171         ENDIF 
    183172#endif 
    184           END DO 
    185           hdivn(:,:,:)=hdivdummy(:,:,:) 
    186           rotn(:,:,:)=rotdummy(:,:,:) 
    187           vn(:,:,:)=vdummy(:,:,:) 
    188           un(:,:,:)=udummy(:,:,:) 
    189           CALL wrk_dealloc( jpi,jpj,jpk,udummy,vdummy,hdivdummy,rotdummy) 
     173         CALL wrk_dealloc( jpi,jpj,jpk,   zusd_t, zvsd_t, ze3hdiv ) 
     174         !  
    190175      ENDIF 
     176      ! 
    191177   END SUBROUTINE sbc_wave 
    192178       
Note: See TracChangeset for help on using the changeset viewer.