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 11963 for NEMO/branches/2019/dev_r11085_ASINTER-05_Brodeau_Advanced_Bulk/src/OCE/SBC/sbccpl.F90 – NEMO

Ignore:
Timestamp:
2019-11-26T12:08:01+01:00 (4 years ago)
Author:
laurent
Message:

More accurate comments/info, better syntax, simplifications, etc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11085_ASINTER-05_Brodeau_Advanced_Bulk/src/OCE/SBC/sbccpl.F90

    r11831 r11963  
    453453      CASE( 'conservative'  ) 
    454454         srcv( (/jpr_rain, jpr_snow, jpr_ievp, jpr_tevp/) )%laction = .TRUE. 
    455          IF ( k_ice <= 1 )  srcv(jpr_ievp)%laction = .FALSE. 
     455         IF( k_ice <= 1 )  srcv(jpr_ievp)%laction = .FALSE. 
    456456      CASE( 'oce and ice'   )   ;   srcv( (/jpr_ievp, jpr_sbpr, jpr_semp, jpr_oemp/) )%laction = .TRUE. 
    457457      CASE default              ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_emp%cldes' ) 
     
    558558      srcv(jpr_botm )%clname = 'OBotMlt' 
    559559      IF( TRIM(sn_rcv_iceflx%cldes) == 'coupled' ) THEN 
    560          IF ( TRIM( sn_rcv_iceflx%clcat ) == 'yes' ) THEN 
     560         IF( TRIM( sn_rcv_iceflx%clcat ) == 'yes' ) THEN 
    561561            srcv(jpr_topm:jpr_botm)%nct = nn_cats_cpl 
    562562         ELSE 
     
    569569      !                                                      ! ------------------------- ! 
    570570      srcv(jpr_ts_ice)%clname = 'OTsfIce'    ! needed by Met Office 
    571       IF ( TRIM( sn_rcv_ts_ice%cldes ) == 'ice' )   srcv(jpr_ts_ice)%laction = .TRUE. 
    572       IF ( TRIM( sn_rcv_ts_ice%clcat ) == 'yes' )   srcv(jpr_ts_ice)%nct     = nn_cats_cpl 
    573       IF ( TRIM( sn_rcv_emp%clcat    ) == 'yes' )   srcv(jpr_ievp)%nct       = nn_cats_cpl 
     571      IF( TRIM( sn_rcv_ts_ice%cldes ) == 'ice' )   srcv(jpr_ts_ice)%laction = .TRUE. 
     572      IF( TRIM( sn_rcv_ts_ice%clcat ) == 'yes' )   srcv(jpr_ts_ice)%nct     = nn_cats_cpl 
     573      IF( TRIM( sn_rcv_emp%clcat    ) == 'yes' )   srcv(jpr_ievp)%nct       = nn_cats_cpl 
    574574 
    575575      !                                                      ! ------------------------- ! 
     
    693693         ! for example O_Runoff received by OPA from SAS and therefore O_Runoff received by SAS from the Atmosphere 
    694694         DO jn = 1, jprcv 
    695             IF ( srcv(jn)%clname(1:1) == "O" ) srcv(jn)%clname = "S"//srcv(jn)%clname(2:LEN(srcv(jn)%clname)) 
     695            IF( srcv(jn)%clname(1:1) == "O" ) srcv(jn)%clname = "S"//srcv(jn)%clname(2:LEN(srcv(jn)%clname)) 
    696696         END DO 
    697697         ! 
     
    720720      ! =================================================== ! 
    721721      DO jn = 1, jprcv 
    722          IF ( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) ) 
     722         IF( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) ) 
    723723      END DO 
    724724      ! Allocate taum part of frcv which is used even when not received as coupling field 
    725       IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) ) 
     725      IF( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) ) 
    726726      ! Allocate w10m part of frcv which is used even when not received as coupling field 
    727       IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) ) 
     727      IF( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) ) 
    728728      ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field 
    729       IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) ) 
    730       IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) ) 
     729      IF( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) ) 
     730      IF( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) ) 
    731731      ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE. 
    732732      IF( k_ice /= 0 ) THEN 
    733          IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) ) 
    734          IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) ) 
    735       END IF 
     733         IF( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) ) 
     734         IF( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) ) 
     735      ENDIF 
    736736 
    737737      ! ================================ ! 
     
    757757      CASE( 'oce and ice' , 'weighted oce and ice' , 'oce and weighted ice' ) 
    758758         ssnd( (/jps_toce, jps_tice/) )%laction = .TRUE. 
    759          IF ( TRIM( sn_snd_temp%clcat ) == 'yes' )  ssnd(jps_tice)%nct = nn_cats_cpl 
     759         IF( TRIM( sn_snd_temp%clcat ) == 'yes' )  ssnd(jps_tice)%nct = nn_cats_cpl 
    760760      CASE( 'mixed oce-ice'                        )   ;   ssnd( jps_tmix )%laction = .TRUE. 
    761761      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_temp%cldes' ) 
     
    777777      !     1. sending mixed oce-ice albedo or 
    778778      !     2. receiving mixed oce-ice solar radiation  
    779       IF ( TRIM ( sn_snd_alb%cldes ) == 'mixed oce-ice' .OR. TRIM ( sn_rcv_qsr%cldes ) == 'mixed oce-ice' ) THEN 
     779      IF( TRIM ( sn_snd_alb%cldes ) == 'mixed oce-ice' .OR. TRIM ( sn_rcv_qsr%cldes ) == 'mixed oce-ice' ) THEN 
    780780         CALL oce_alb( zaos, zacs ) 
    781781         ! Due to lack of information on nebulosity : mean clear/overcast sky 
     
    796796         ssnd(jps_fice1)%laction = .TRUE.                 ! First-order regridded ice concentration, to be used producing atmos-to-ice fluxes (Met Office requirement) 
    797797! Currently no namelist entry to determine sending of multi-category ice fraction so use the thickness entry for now 
    798          IF ( TRIM( sn_snd_thick%clcat  ) == 'yes' ) ssnd(jps_fice)%nct  = nn_cats_cpl 
    799          IF ( TRIM( sn_snd_thick1%clcat ) == 'yes' ) ssnd(jps_fice1)%nct = nn_cats_cpl 
     798         IF( TRIM( sn_snd_thick%clcat  ) == 'yes' ) ssnd(jps_fice)%nct  = nn_cats_cpl 
     799         IF( TRIM( sn_snd_thick1%clcat ) == 'yes' ) ssnd(jps_fice1)%nct = nn_cats_cpl 
    800800      ENDIF 
    801801       
    802       IF (TRIM( sn_snd_ifrac%cldes )  == 'coupled') ssnd(jps_ficet)%laction = .TRUE.  
     802      IF(TRIM( sn_snd_ifrac%cldes )  == 'coupled') ssnd(jps_ficet)%laction = .TRUE.  
    803803 
    804804      SELECT CASE ( TRIM( sn_snd_thick%cldes ) ) 
     
    806806      CASE( 'ice and snow' )  
    807807         ssnd(jps_hice:jps_hsnw)%laction = .TRUE. 
    808          IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) THEN 
     808         IF( TRIM( sn_snd_thick%clcat ) == 'yes' ) THEN 
    809809            ssnd(jps_hice:jps_hsnw)%nct = nn_cats_cpl 
    810810         ENDIF 
    811811      CASE ( 'weighted ice and snow' )  
    812812         ssnd(jps_hice:jps_hsnw)%laction = .TRUE. 
    813          IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) ssnd(jps_hice:jps_hsnw)%nct = nn_cats_cpl 
     813         IF( TRIM( sn_snd_thick%clcat ) == 'yes' ) ssnd(jps_hice:jps_hsnw)%nct = nn_cats_cpl 
    814814      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_thick%cldes' ) 
    815815      END SELECT 
     
    828828         ssnd(jps_a_p)%laction  = .TRUE.  
    829829         ssnd(jps_ht_p)%laction = .TRUE.  
    830          IF ( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN  
     830         IF( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN  
    831831            ssnd(jps_a_p)%nct  = nn_cats_cpl  
    832832            ssnd(jps_ht_p)%nct = nn_cats_cpl  
    833833         ELSE  
    834             IF ( nn_cats_cpl > 1 ) THEN  
     834            IF( nn_cats_cpl > 1 ) THEN  
    835835               CALL ctl_stop( 'sbc_cpl_init: use weighted ice option for sn_snd_mpnd%cldes if not exchanging category fields' )  
    836836            ENDIF  
     
    839839         ssnd(jps_a_p)%laction  = .TRUE.  
    840840         ssnd(jps_ht_p)%laction = .TRUE.  
    841          IF ( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN  
     841         IF( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN  
    842842            ssnd(jps_a_p)%nct  = nn_cats_cpl   
    843843            ssnd(jps_ht_p)%nct = nn_cats_cpl   
     
    914914      CASE ( 'ice only' )  
    915915         ssnd(jps_ttilyr)%laction = .TRUE.  
    916          IF ( TRIM( sn_snd_ttilyr%clcat ) == 'yes' ) THEN  
     916         IF( TRIM( sn_snd_ttilyr%clcat ) == 'yes' ) THEN  
    917917            ssnd(jps_ttilyr)%nct = nn_cats_cpl  
    918918         ELSE  
    919             IF ( nn_cats_cpl > 1 ) THEN  
     919            IF( nn_cats_cpl > 1 ) THEN  
    920920               CALL ctl_stop( 'sbc_cpl_init: use weighted ice option for sn_snd_ttilyr%cldes if not exchanging category fields' )  
    921921            ENDIF  
     
    923923      CASE ( 'weighted ice' )  
    924924         ssnd(jps_ttilyr)%laction = .TRUE.  
    925          IF ( TRIM( sn_snd_ttilyr%clcat ) == 'yes' ) ssnd(jps_ttilyr)%nct = nn_cats_cpl  
     925         IF( TRIM( sn_snd_ttilyr%clcat ) == 'yes' ) ssnd(jps_ttilyr)%nct = nn_cats_cpl  
    926926      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_ttilyr%cldes;'//sn_snd_ttilyr%cldes )  
    927927      END SELECT  
     
    933933      CASE ( 'ice only' )  
    934934         ssnd(jps_kice)%laction = .TRUE.  
    935          IF ( TRIM( sn_snd_cond%clcat ) == 'yes' ) THEN  
     935         IF( TRIM( sn_snd_cond%clcat ) == 'yes' ) THEN  
    936936            ssnd(jps_kice)%nct = nn_cats_cpl  
    937937         ELSE  
    938             IF ( nn_cats_cpl > 1 ) THEN  
     938            IF( nn_cats_cpl > 1 ) THEN  
    939939               CALL ctl_stop( 'sbc_cpl_init: use weighted ice option for sn_snd_cond%cldes if not exchanging category fields' )  
    940940            ENDIF  
     
    942942      CASE ( 'weighted ice' )  
    943943         ssnd(jps_kice)%laction = .TRUE.  
    944          IF ( TRIM( sn_snd_cond%clcat ) == 'yes' ) ssnd(jps_kice)%nct = nn_cats_cpl  
     944         IF( TRIM( sn_snd_cond%clcat ) == 'yes' ) ssnd(jps_kice)%nct = nn_cats_cpl  
    945945      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_cond%cldes;'//sn_snd_cond%cldes )  
    946946      END SELECT  
     
    10031003         ! for example O_SSTSST sent by OPA to SAS and therefore S_SSTSST sent by SAS to the Atmosphere 
    10041004         DO jn = 1, jpsnd 
    1005             IF ( ssnd(jn)%clname(1:1) == "O" ) ssnd(jn)%clname = "S"//ssnd(jn)%clname(2:LEN(ssnd(jn)%clname)) 
     1005            IF( ssnd(jn)%clname(1:1) == "O" ) ssnd(jn)%clname = "S"//ssnd(jn)%clname(2:LEN(ssnd(jn)%clname)) 
    10061006         END DO 
    10071007         ! 
     
    10301030      CALL cpl_define(jprcv, jpsnd, nn_cplmodel) 
    10311031       
    1032       IF (ln_usecplmask) THEN  
     1032      IF(ln_usecplmask) THEN  
    10331033         xcplmask(:,:,:) = 0. 
    10341034         CALL iom_open( 'cplmask', inum ) 
     
    12661266     
    12671267          IF( kt == nit000 ) ssh_ibb(:,:) = ssh_ib(:,:)  ! correct this later (read from restart if possible)  
    1268       END IF  
     1268      ENDIF  
    12691269      ! 
    12701270      IF( ln_sdw ) THEN  ! Stokes Drift correction activated 
     
    14151415         ELSE IF( srcv(jpr_qnsmix)%laction ) THEN   ;   zqns(:,:) = frcv(jpr_qnsmix)%z3(:,:,1) 
    14161416         ELSE                                       ;   zqns(:,:) = 0._wp 
    1417          END IF 
     1417         ENDIF 
    14181418         ! update qns over the free ocean with: 
    14191419         IF( nn_components /= jp_iam_opa ) THEN 
     
    16871687      ! --- evaporation over ice (kg/m2/s) --- ! 
    16881688      DO jl=1,jpl 
    1689          IF (sn_rcv_emp%clcat == 'yes') THEN   ;   zevap_ice(:,:,jl) = frcv(jpr_ievp)%z3(:,:,jl) 
     1689         IF(sn_rcv_emp%clcat == 'yes') THEN   ;   zevap_ice(:,:,jl) = frcv(jpr_ievp)%z3(:,:,jl) 
    16901690         ELSE                                  ;   zevap_ice(:,:,jl) = frcv(jpr_ievp)%z3(:,:,1 )   ;   ENDIF 
    16911691      ENDDO 
     
    17861786      CASE( 'conservative' )     ! the required fields are directly provided 
    17871787         zqns_tot(:,:) = frcv(jpr_qnsmix)%z3(:,:,1) 
    1788          IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
     1788         IF( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
    17891789            zqns_ice(:,:,1:jpl) = frcv(jpr_qnsice)%z3(:,:,1:jpl) 
    17901790         ELSE 
     
    17951795      CASE( 'oce and ice' )      ! the total flux is computed from ocean and ice fluxes 
    17961796         zqns_tot(:,:) =  ziceld(:,:) * frcv(jpr_qnsoce)%z3(:,:,1) 
    1797          IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
     1797         IF( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
    17981798            DO jl=1,jpl 
    17991799               zqns_tot(:,:   ) = zqns_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qnsice)%z3(:,:,jl)    
     
    18971897#endif 
    18981898      ! outputs 
    1899       IF ( srcv(jpr_cal)%laction       ) CALL iom_put('hflx_cal_cea'    , - frcv(jpr_cal)%z3(:,:,1) * rLfus )                      ! latent heat from calving 
    1900       IF ( srcv(jpr_icb)%laction       ) CALL iom_put('hflx_icb_cea'    , - frcv(jpr_icb)%z3(:,:,1) * rLfus )                      ! latent heat from icebergs melting 
    1901       IF ( iom_use('hflx_rain_cea')    ) CALL iom_put('hflx_rain_cea'   , ( tprecip(:,:) - sprecip(:,:) ) * zcptrain(:,:) )        ! heat flux from rain (cell average) 
    1902       IF ( iom_use('hflx_evap_cea')    ) CALL iom_put('hflx_evap_cea'   , ( frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) & 
     1899      IF( srcv(jpr_cal)%laction       ) CALL iom_put('hflx_cal_cea'    , - frcv(jpr_cal)%z3(:,:,1) * rLfus )                      ! latent heat from calving 
     1900      IF( srcv(jpr_icb)%laction       ) CALL iom_put('hflx_icb_cea'    , - frcv(jpr_icb)%z3(:,:,1) * rLfus )                      ! latent heat from icebergs melting 
     1901      IF( iom_use('hflx_rain_cea')    ) CALL iom_put('hflx_rain_cea'   , ( tprecip(:,:) - sprecip(:,:) ) * zcptrain(:,:) )        ! heat flux from rain (cell average) 
     1902      IF( iom_use('hflx_evap_cea')    ) CALL iom_put('hflx_evap_cea'   , ( frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) & 
    19031903           &                                                              * picefr(:,:) ) * zcptn(:,:) * tmask(:,:,1) )            ! heat flux from evap (cell average) 
    1904       IF ( iom_use('hflx_snow_cea')    ) CALL iom_put('hflx_snow_cea'   , sprecip(:,:) * ( zcptsnw(:,:) - rLfus )  )               ! heat flux from snow (cell average) 
    1905       IF ( iom_use('hflx_snow_ao_cea') ) CALL iom_put('hflx_snow_ao_cea', sprecip(:,:) * ( zcptsnw(:,:) - rLfus ) & 
     1904      IF( iom_use('hflx_snow_cea')    ) CALL iom_put('hflx_snow_cea'   , sprecip(:,:) * ( zcptsnw(:,:) - rLfus )  )               ! heat flux from snow (cell average) 
     1905      IF( iom_use('hflx_snow_ao_cea') ) CALL iom_put('hflx_snow_ao_cea', sprecip(:,:) * ( zcptsnw(:,:) - rLfus ) & 
    19061906           &                                                              * ( 1._wp - zsnw(:,:) )                  )               ! heat flux from snow (over ocean) 
    1907       IF ( iom_use('hflx_snow_ai_cea') ) CALL iom_put('hflx_snow_ai_cea', sprecip(:,:) * ( zcptsnw(:,:) - rLfus ) &  
     1907      IF( iom_use('hflx_snow_ai_cea') ) CALL iom_put('hflx_snow_ai_cea', sprecip(:,:) * ( zcptsnw(:,:) - rLfus ) &  
    19081908           &                                                              *           zsnw(:,:)                    )               ! heat flux from snow (over ice) 
    19091909      ! note: hflx for runoff and iceshelf are done in sbcrnf and sbcisf resp. 
     
    19161916      CASE( 'conservative' ) 
    19171917         zqsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1) 
    1918          IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
     1918         IF( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
    19191919            zqsr_ice(:,:,1:jpl) = frcv(jpr_qsrice)%z3(:,:,1:jpl) 
    19201920         ELSE 
     
    19281928      CASE( 'oce and ice' ) 
    19291929         zqsr_tot(:,:  ) =  ziceld(:,:) * frcv(jpr_qsroce)%z3(:,:,1) 
    1930          IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
     1930         IF( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
    19311931            DO jl = 1, jpl 
    19321932               zqsr_tot(:,:   ) = zqsr_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qsrice)%z3(:,:,jl)    
     
    19841984      !                                                      ! ========================= ! 
    19851985      CASE ('coupled') 
    1986          IF ( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN 
     1986         IF( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN 
    19871987            zdqns_ice(:,:,1:jpl) = frcv(jpr_dqnsdt)%z3(:,:,1:jpl) 
    19881988         ELSE 
     
    20622062      IF( ssnd(jps_toce)%laction .OR. ssnd(jps_tice)%laction .OR. ssnd(jps_tmix)%laction ) THEN 
    20632063          
    2064          IF ( nn_components == jp_iam_opa ) THEN 
     2064         IF( nn_components == jp_iam_opa ) THEN 
    20652065            ztmp1(:,:) = tsn(:,:,1,jp_tem)   ! send temperature as it is (potential or conservative) -> use of l_useCT on the received part 
    20662066         ELSE 
     
    24672467      IF( ssnd(jps_ficet)%laction ) THEN  
    24682468         CALL cpl_snd( jps_ficet, isec, RESHAPE ( fr_i, (/jpi,jpj,1/) ), info )  
    2469       END IF  
     2469      ENDIF  
    24702470      !                                                      ! ------------------------- !  
    24712471      !                                                      !   Water levels to waves   !  
     
    24822482         ENDIF   
    24832483         CALL cpl_snd( jps_wlev  , isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )  
    2484       END IF  
     2484      ENDIF  
    24852485      ! 
    24862486      !  Fields sent by OPA to SAS when doing OPA<->SAS coupling 
Note: See TracChangeset for help on using the changeset viewer.