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 14592 for NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/OCE/SBC/sbc_phy.F90 – NEMO

Ignore:
Timestamp:
2021-03-05T17:03:57+01:00 (3 years ago)
Author:
gsamson
Message:

sbc_phy:

  • 2 new functions:
    • pres_temp: compute air pressure from air temperature and surface pressure
    • theta_exner: compute air/surface potential temperature following a dry adiabatic transformation
  • 3 modified functions:
    • Ri_bulk: use potential SST instead of SST + some simplifications TBD
    • bulk_formula: pass "rhoa" variable as input argument instead of calculing it with the old "gamma_moist" function inside the routine
    • update_qnsol_tau: pass "rhoa" variable as input argument to pass it to "bulk_formula" function
  • global small cleaning/cosmetics

sbcblk_algo_{ecmwf,coare3p?}: "rhoa" variable updated for CS/WL options and passed as input argument to "update_qnsol_tau" function

sbcblk & sbcabl:
add calls to "pres_temp" & "theta_exner" functions to compute air & surface potential temperatures (over both ocean and sea-ice) before computing sensible heat flux
special attention needed to check if CS/WL increment is properly applied

ticket #2632

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/ticket2632_r14588_theta_sbcblk/src/OCE/SBC/sbc_phy.F90

    r14110 r14592  
    2323 
    2424   IMPLICIT NONE 
    25    !PRIVATE 
    26    PUBLIC !! Haleluja that was the solution 
     25   PUBLIC !! Haleluja that was the solution for AGRIF 
    2726 
    2827   INTEGER , PARAMETER, PUBLIC  :: nb_iter0 = 5 ! Default number of itterations in bulk-param algorithms (can be overriden b.m.o `nb_iter` optional argument) 
    2928 
    3029   !!  (mainly removed from sbcblk.F90) 
    31    REAL(wp), PARAMETER, PUBLIC :: rCp_dry = 1005.0_wp   !: Specic heat of dry air, constant pressure      [J/K/kg] 
    32    REAL(wp), PARAMETER, PUBLIC :: rCp_vap = 1860.0_wp   !: Specic heat of water vapor, constant pressure  [J/K/kg] 
    33    REAL(wp), PARAMETER, PUBLIC :: R_dry   = 287.05_wp   !: Specific gas constant for dry air              [J/K/kg] 
    34    REAL(wp), PARAMETER, PUBLIC :: R_vap   = 461.495_wp  !: Specific gas constant for water vapor          [J/K/kg] 
    35    REAL(wp), PARAMETER, PUBLIC :: reps0   = R_dry/R_vap !: ratio of gas constant for dry air and water vapor => ~ 0.622 
    36    REAL(wp), PARAMETER, PUBLIC :: rctv0   = R_vap/R_dry - 1._wp  !: for virtual temperature (== (1-eps)/eps) => ~ 0.608 
    37    REAL(wp), PARAMETER, PUBLIC :: rCp_air = 1000.5_wp   !: specific heat of air (only used for ice fluxes now...) 
    38    REAL(wp), PARAMETER, PUBLIC :: albo    = 0.066_wp    !: ocean albedo assumed to be constant 
     30   REAL(wp), PARAMETER, PUBLIC :: rCp_dry = 1005.0_wp             !: Specic heat of dry air, constant pressure       [J/K/kg] 
     31   REAL(wp), PARAMETER, PUBLIC :: rCp_vap = 1860.0_wp             !: Specic heat of water vapor, constant pressure   [J/K/kg] 
     32   REAL(wp), PARAMETER, PUBLIC :: R_dry   = 287.05_wp             !: Specific gas constant for dry air               [J/K/kg] 
     33   REAL(wp), PARAMETER, PUBLIC :: R_vap   = 461.495_wp            !: Specific gas constant for water vapor           [J/K/kg] 
     34   REAL(wp), PARAMETER, PUBLIC :: reps0   = R_dry/R_vap           !: ratio of gas constant for dry air and water vapor => ~ 0.622 
     35   REAL(wp), PARAMETER, PUBLIC :: rctv0   = R_vap/R_dry - 1._wp   !: for virtual temperature (== (1-eps)/eps) => ~ 0.608 
     36   REAL(wp), PARAMETER, PUBLIC :: rCp_air = 1000.5_wp             !: specific heat of air (only used for ice fluxes now...) 
     37   REAL(wp), PARAMETER, PUBLIC :: albo    = 0.066_wp              !: ocean albedo assumed to be constant 
     38   REAL(wp), PARAMETER, PUBLIC :: R_gas   = 8.314510_wp           !: Universal molar gas constant                    [J/mol/K]  
     39   REAL(wp), PARAMETER, PUBLIC :: rmm_dryair = 28.9647e-3_wp      !: dry air molar mass / molecular weight           [kg/mol] 
     40   REAL(wp), PARAMETER, PUBLIC :: rmm_water  = 18.0153e-3_wp      !: water   molar mass / molecular weight           [kg/mol] 
     41   REAL(wp), PARAMETER, PUBLIC :: rmm_ratio  = rmm_water / rmm_dryair 
     42   REAL(wp), PARAMETER, PUBLIC :: rgamma_dry = R_gas / ( rmm_dryair * rCp_dry )  !: Poisson constant for dry air 
     43   REAL(wp), PARAMETER, PUBLIC :: rpref      = 1.e5_wp            !: reference air pressure for exner function       [Pa] 
    3944   ! 
    4045   REAL(wp), PARAMETER, PUBLIC :: rho0_a  = 1.2_wp      !: Approx. of density of air                       [kg/m^3] 
     
    8388   END INTERFACE virt_temp 
    8489 
     90   INTERFACE pres_temp 
     91      MODULE PROCEDURE pres_temp_vctr, pres_temp_sclr 
     92   END INTERFACE pres_temp 
     93 
     94   INTERFACE theta_exner 
     95      MODULE PROCEDURE theta_exner_vctr, theta_exner_sclr 
     96   END INTERFACE theta_exner 
     97 
    8598   INTERFACE visc_air 
    8699      MODULE PROCEDURE visc_air_vctr, visc_air_sclr 
     
    98111      MODULE PROCEDURE e_sat_ice_vctr, e_sat_ice_sclr 
    99112   END INTERFACE e_sat_ice 
     113 
    100114   INTERFACE de_sat_dt_ice 
    101115      MODULE PROCEDURE de_sat_dt_ice_vctr, de_sat_dt_ice_sclr 
     
    148162 
    149163   PUBLIC virt_temp 
     164   PUBLIC pres_temp 
     165   PUBLIC theta_exner 
    150166   PUBLIC rho_air 
    151167   PUBLIC visc_air 
     
    158174   PUBLIC q_air_rh 
    159175   PUBLIC dq_sat_dt_ice 
    160    !: 
     176   ! 
    161177   PUBLIC update_qnsol_tau 
    162178   PUBLIC alpha_sw 
     
    205221      ! 
    206222   END FUNCTION virt_temp_sclr 
    207    !! 
     223 
    208224   FUNCTION virt_temp_vctr( pta, pqa ) 
     225 
    209226      REAL(wp), DIMENSION(jpi,jpj)             :: virt_temp_vctr !: virtual temperature [K] 
    210227      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pta !: absolute or potential air temperature [K] 
    211228      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pqa !: specific humidity of air   [kg/kg] 
     229 
    212230      virt_temp_vctr(:,:) = pta(:,:) * (1._wp + rctv0*pqa(:,:)) 
     231 
    213232   END FUNCTION virt_temp_vctr 
    214    !=============================================================================================== 
     233 
     234 
     235   FUNCTION pres_temp_sclr( pqspe, pslp, pz, ptpot, pta, l_ice ) 
     236 
     237      !!------------------------------------------------------------------------------- 
     238      !!                           ***  FUNCTION pres_temp  *** 
     239      !! 
     240      !! ** Purpose : compute air pressure using barometric equation 
     241      !!              from either potential or absolute air temperature 
     242      !! ** Author: G. Samson, Feb 2021 
     243      !!------------------------------------------------------------------------------- 
     244 
     245      REAL(wp)                          :: pres_temp_sclr    ! air pressure              [Pa] 
     246      REAL(wp), INTENT(in )             :: pqspe             ! air specific humidity     [kg/kg] 
     247      REAL(wp), INTENT(in )             :: pslp              ! sea-level pressure        [Pa] 
     248      REAL(wp), INTENT(in )             :: pz                ! height above surface      [m] 
     249      REAL(wp), INTENT(in )  , OPTIONAL :: ptpot             ! air potential temperature [K] 
     250      REAL(wp), INTENT(inout), OPTIONAL :: pta               ! air absolute temperature  [K] 
     251      REAL(wp)                          :: ztpot, zta, zpa, zxm, zmask, zqsat 
     252      INTEGER                           :: it, niter = 3     ! iteration indice and number 
     253      LOGICAL , INTENT(in)   , OPTIONAL :: l_ice             ! sea-ice presence 
     254      LOGICAL                           :: lice              ! sea-ice presence 
     255 
     256      IF( PRESENT(ptpot) ) THEN 
     257        zmask = 1._wp 
     258        ztpot = ptpot 
     259      ELSE 
     260        zmask = 0._wp  
     261        zta   = pta 
     262      ENDIF 
     263 
     264      lice = .FALSE. 
     265      IF( PRESENT(l_ice) ) lice = l_ice 
     266 
     267      zpa = pslp              ! air pressure first guess [Pa] 
     268      DO it = 1, niter 
     269         zta   = ztpot * ( zpa / rpref )**rgamma_dry * zmask + (1._wp - zmask) * zta 
     270         zqsat = q_sat( zta, zpa, l_ice=lice )                                   ! saturation specific humidity [kg/kg] 
     271         zxm   = (1._wp - pqspe/zqsat) * rmm_dryair + pqspe/zqsat * rmm_water    ! moist air molar mass [kg/mol] 
     272         zpa   = pslp * EXP( -grav * zxm * pz / ( R_gas * zta ) ) 
     273      END DO 
     274 
     275      pres_temp_sclr = zpa 
     276      IF(( PRESENT(pta) ).AND.( PRESENT(ptpot) )) pta = zta 
     277 
     278   END FUNCTION pres_temp_sclr 
     279 
     280 
     281   FUNCTION pres_temp_vctr( pqspe, pslp, pz, ptpot, pta, l_ice ) 
     282 
     283      !!------------------------------------------------------------------------------- 
     284      !!                           ***  FUNCTION pres_temp  *** 
     285      !! 
     286      !! ** Purpose : compute air pressure using barometric equation 
     287      !!              from either potential or absolute air temperature 
     288      !! ** Author: G. Samson, Feb 2021 
     289      !!------------------------------------------------------------------------------- 
     290 
     291      REAL(wp), DIMENSION(jpi,jpj)                          :: pres_temp_vctr    ! air pressure              [Pa] 
     292      REAL(wp), DIMENSION(jpi,jpj), INTENT(in )             :: pqspe             ! air specific humidity     [kg/kg] 
     293      REAL(wp), DIMENSION(jpi,jpj), INTENT(in )             :: pslp              ! sea-level pressure        [Pa] 
     294      REAL(wp),                     INTENT(in )             :: pz                ! height above surface      [m] 
     295      REAL(wp), DIMENSION(jpi,jpj), INTENT(in )  , OPTIONAL :: ptpot             ! air potential temperature [K] 
     296      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout), OPTIONAL :: pta               ! air absolute temperature  [K] 
     297      INTEGER                                               :: ji, jj            ! loop indices 
     298      LOGICAL                     , INTENT(in)   , OPTIONAL :: l_ice             ! sea-ice presence 
     299      LOGICAL                                               :: lice              ! sea-ice presence 
     300  
     301      lice = .FALSE. 
     302      IF( PRESENT(l_ice) ) lice = l_ice 
     303 
     304      IF( PRESENT(ptpot) ) THEN 
     305         DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     306            pres_temp_vctr(ji,jj) = pres_temp_sclr( pqspe(ji,jj), pslp(ji,jj), pz, ptpot=ptpot(ji,jj), pta=pta(ji,jj), l_ice=lice ) 
     307         END_2D 
     308      ELSE 
     309         DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     310            pres_temp_vctr(ji,jj) = pres_temp_sclr( pqspe(ji,jj), pslp(ji,jj), pz, pta=pta(ji,jj), l_ice=lice ) 
     311         END_2D 
     312      ENDIF 
     313 
     314   END FUNCTION pres_temp_vctr 
     315 
     316 
     317   FUNCTION theta_exner_sclr( pta, ppa ) 
     318 
     319      !!------------------------------------------------------------------------------- 
     320      !!                           ***  FUNCTION theta_exner  *** 
     321      !! 
     322      !! ** Purpose : compute air/surface potential temperature from absolute temperature 
     323      !!              and pressure using Exner function 
     324      !! ** Author: G. Samson, Feb 2021 
     325      !!------------------------------------------------------------------------------- 
     326 
     327      REAL(wp)             :: theta_exner_sclr   ! air/surface potential temperature [K] 
     328      REAL(wp), INTENT(in) :: pta                ! air/surface absolute temperature  [K] 
     329      REAL(wp), INTENT(in) :: ppa                ! air/surface pressure              [Pa] 
     330       
     331      theta_exner_sclr = pta * ( rpref / ppa ) ** rgamma_dry 
     332 
     333   END FUNCTION theta_exner_sclr 
     334 
     335   FUNCTION theta_exner_vctr( pta, ppa ) 
     336 
     337      !!------------------------------------------------------------------------------- 
     338      !!                           ***  FUNCTION theta_exner  *** 
     339      !! 
     340      !! ** Purpose : compute air/surface potential temperature from absolute temperature 
     341      !!              and pressure using Exner function 
     342      !! ** Author: G. Samson, Feb 2021 
     343      !!------------------------------------------------------------------------------- 
     344 
     345      REAL(wp), DIMENSION(jpi,jpj)             :: theta_exner_vctr   ! air/surface potential temperature [K] 
     346      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pta                ! air/surface absolute temperature  [K] 
     347      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ppa                ! air/surface pressure              [Pa] 
     348      INTEGER                                  :: ji, jj             ! loop indices 
     349 
     350      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     351         theta_exner_vctr(ji,jj) = theta_exner_sclr( pta(ji,jj), ppa(ji,jj) ) 
     352      END_2D 
     353 
     354   END FUNCTION theta_exner_vctr 
    215355 
    216356 
     
    228368      REAL(wp), DIMENSION(jpi,jpj)             ::   rho_air_vctr   ! density of moist air   [kg/m^3] 
    229369      !!------------------------------------------------------------------------------- 
     370 
    230371      rho_air_vctr = MAX( ppa / (R_dry*ptak * ( 1._wp + rctv0*pqa )) , 0.8_wp ) 
     372 
    231373   END FUNCTION rho_air_vctr 
    232374 
     
    245387      !!------------------------------------------------------------------------------- 
    246388      rho_air_sclr = MAX( ppa / (R_dry*ptak * ( 1._wp + rctv0*pqa )) , 0.8_wp ) 
     389 
    247390   END FUNCTION rho_air_sclr 
    248  
    249  
    250391 
    251392 
     
    269410 
    270411   FUNCTION visc_air_vctr(ptak) 
     412 
    271413      REAL(wp), DIMENSION(jpi,jpj)             ::   visc_air_vctr   ! kinetic viscosity (m^2/s) 
    272414      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   ptak       ! air temperature in (K) 
    273415      INTEGER  ::   ji, jj      ! dummy loop indices 
    274       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    275       visc_air_vctr(ji,jj) = visc_air_sclr( ptak(ji,jj) ) 
    276       END_2D 
     416 
     417      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     418         visc_air_vctr(ji,jj) = visc_air_sclr( ptak(ji,jj) ) 
     419      END_2D 
     420 
    277421   END FUNCTION visc_air_vctr 
    278422 
     
    319463      !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://github.com/brodeau/aerobulk/) 
    320464      !!------------------------------------------------------------------------------- 
    321       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqa      ! air specific humidity         [kg/kg] 
     465      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqa           ! air specific humidity         [kg/kg] 
    322466      REAL(wp), DIMENSION(jpi,jpj)             ::   cp_air_vctr   ! specific heat of moist air   [J/K/kg] 
    323467      !!------------------------------------------------------------------------------- 
     468 
    324469      cp_air_vctr = rCp_dry + rCp_vap * pqa 
     470 
    325471   END FUNCTION cp_air_vctr 
    326472 
     
    336482      REAL(wp)             :: cp_air_sclr   ! specific heat of moist air   [J/K/kg] 
    337483      !!------------------------------------------------------------------------------- 
     484 
    338485      cp_air_sclr = rCp_dry + rCp_vap * pqa 
     486 
    339487   END FUNCTION cp_air_sclr 
    340488 
    341489 
    342  
    343    !=============================================================================================== 
    344490   FUNCTION gamma_moist_sclr( ptak, pqa ) 
    345491      !!---------------------------------------------------------------------------------- 
     
    366512      !! 
    367513   END FUNCTION gamma_moist_sclr 
    368    !! 
     514 
    369515   FUNCTION gamma_moist_vctr( ptak, pqa ) 
     516 
    370517      REAL(wp), DIMENSION(jpi,jpj)             ::   gamma_moist_vctr 
    371518      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   ptak 
    372519      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqa 
    373520      INTEGER  :: ji, jj 
    374       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    375       gamma_moist_vctr(ji,jj) = gamma_moist_sclr( ptak(ji,jj), pqa(ji,jj) ) 
    376       END_2D 
     521 
     522      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     523         gamma_moist_vctr(ji,jj) = gamma_moist_sclr( ptak(ji,jj), pqa(ji,jj) ) 
     524      END_2D 
     525 
    377526   END FUNCTION gamma_moist_vctr 
    378    !=============================================================================================== 
    379527 
    380528 
     
    399547      ! 
    400548      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    401       ! 
    402       zqa = (1._wp + rctv0*pqa(ji,jj)) 
    403       ! 
    404       ! The main concern is to know whether, the vertical turbulent flux of virtual temperature, < u' theta_v' > is estimated with: 
    405       !  a/  -u* [ theta* (1 + 0.61 q) + 0.61 theta q* ] => this is the one that seems correct! chose this one! 
    406       !                      or 
    407       !  b/  -u* [ theta*              + 0.61 theta q* ] 
    408       ! 
    409       One_on_L(ji,jj) = grav*vkarmn*( pts(ji,jj)*zqa + rctv0*ptha(ji,jj)*pqs(ji,jj) ) & 
    410          &               / MAX( pus(ji,jj)*pus(ji,jj)*ptha(ji,jj)*zqa , 1.E-9_wp ) 
    411       ! 
     549         zqa = (1._wp + rctv0*pqa(ji,jj)) 
     550         ! 
     551         ! The main concern is to know whether, the vertical turbulent flux of virtual temperature, < u' theta_v' > is estimated with: 
     552         !  a/  -u* [ theta* (1 + 0.61 q) + 0.61 theta q* ] => this is the one that seems correct! chose this one! 
     553         !                      or 
     554         !  b/  -u* [ theta*              + 0.61 theta q* ] 
     555         ! 
     556         One_on_L(ji,jj) = grav*vkarmn*( pts(ji,jj)*zqa + rctv0*ptha(ji,jj)*pqs(ji,jj) ) & 
     557            &               / MAX( pus(ji,jj)*pus(ji,jj)*ptha(ji,jj)*zqa , 1.E-9_wp ) 
    412558      END_2D 
    413559      ! 
     
    417563 
    418564 
    419    !=============================================================================================== 
    420565   FUNCTION Ri_bulk_sclr( pz, psst, ptha, pssq, pqa, pub,  pta_layer, pqa_layer ) 
    421566      !!---------------------------------------------------------------------------------- 
     
    428573      REAL(wp)             :: Ri_bulk_sclr 
    429574      REAL(wp), INTENT(in) :: pz    ! height above the sea (aka "delta z")  [m] 
    430       REAL(wp), INTENT(in) :: psst  ! SST                                   [K] 
     575      REAL(wp), INTENT(in) :: psst  ! potential SST                         [K] 
    431576      REAL(wp), INTENT(in) :: ptha  ! pot. air temp. at height "pz"         [K] 
    432577      REAL(wp), INTENT(in) :: pssq  ! 0.98*q_sat(SST)                   [kg/kg] 
     
    438583      LOGICAL  :: l_ptqa_l_prvd = .FALSE. 
    439584      REAL(wp) :: zqa, zta, zgamma, zdthv, ztv, zsstv  ! local scalars 
     585      REAL(wp) :: ztptv 
    440586      !!------------------------------------------------------------------- 
    441587      IF( PRESENT(pta_layer) .AND. PRESENT(pqa_layer) ) l_ptqa_l_prvd=.TRUE. 
    442588      ! 
    443       zsstv = virt_temp_sclr( psst, pssq )          ! virtual SST (absolute==potential because z=0!) 
    444       ! 
    445       zdthv = virt_temp_sclr( ptha, pqa  ) - zsstv  ! air-sea delta of "virtual potential temperature" 
    446       ! 
    447       !! ztv: estimate of the ABSOLUTE virtual temp. within the layer 
    448       IF( l_ptqa_l_prvd ) THEN 
    449          ztv = virt_temp_sclr( pta_layer, pqa_layer ) 
    450       ELSE 
    451          zqa = 0.5_wp*( pqa  + pssq )                             ! ~ mean q within the layer... 
    452          zta = 0.5_wp*( psst + ptha - gamma_moist(ptha, zqa)*pz ) ! ~ mean absolute temperature of air within the layer 
    453          zta = 0.5_wp*( psst + ptha - gamma_moist( zta, zqa)*pz ) ! ~ mean absolute temperature of air within the layer 
    454          zgamma =  gamma_moist(zta, zqa)                          ! Adiabatic lapse-rate for moist air within the layer 
    455          ztv = 0.5_wp*( zsstv + virt_temp_sclr( ptha-zgamma*pz, pqa ) ) 
    456       END IF 
    457       ! 
    458       Ri_bulk_sclr = grav*zdthv*pz / ( ztv*pub*pub )      ! the usual definition of Ri_bulk_sclr 
     589      zsstv = virt_temp_sclr( psst, pssq )   ! virtual potential SST 
     590      ztptv = virt_temp_sclr( ptha, pqa  )   ! virtual potential air temperature 
     591      zdthv = ztptv - zsstv                  ! air-sea delta of "virtual potential temperature" 
     592      ! 
     593      Ri_bulk_sclr = grav * zdthv * pz / ( ztptv * pub * pub )      ! the usual definition of Ri_bulk_sclr 
    459594      ! 
    460595   END FUNCTION Ri_bulk_sclr 
    461    !! 
     596 
    462597   FUNCTION Ri_bulk_vctr( pz, psst, ptha, pssq, pqa, pub,  pta_layer, pqa_layer ) 
     598 
    463599      REAL(wp), DIMENSION(jpi,jpj)             :: Ri_bulk_vctr 
    464600      REAL(wp)                    , INTENT(in) :: pz    ! height above the sea (aka "delta z")  [m] 
     
    473609      LOGICAL  :: l_ptqa_l_prvd = .FALSE. 
    474610      INTEGER  ::   ji, jj 
     611 
    475612      IF( PRESENT(pta_layer) .AND. PRESENT(pqa_layer) ) l_ptqa_l_prvd=.TRUE. 
    476613      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    477       IF( l_ptqa_l_prvd ) THEN 
    478          Ri_bulk_vctr(ji,jj) = Ri_bulk_sclr( pz, psst(ji,jj), ptha(ji,jj), pssq(ji,jj), pqa(ji,jj), pub(ji,jj), & 
    479             &                                pta_layer=pta_layer(ji,jj ),  pqa_layer=pqa_layer(ji,jj ) ) 
    480       ELSE 
    481          Ri_bulk_vctr(ji,jj) = Ri_bulk_sclr( pz, psst(ji,jj), ptha(ji,jj), pssq(ji,jj), pqa(ji,jj), pub(ji,jj) ) 
    482       END IF 
    483       END_2D 
     614         IF( l_ptqa_l_prvd ) THEN  !!GS: "IF" inside loop needs to be removed 
     615            Ri_bulk_vctr(ji,jj) = Ri_bulk_sclr( pz, psst(ji,jj), ptha(ji,jj), pssq(ji,jj), pqa(ji,jj), pub(ji,jj), & 
     616               &                                pta_layer=pta_layer(ji,jj ),  pqa_layer=pqa_layer(ji,jj ) ) 
     617         ELSE 
     618            Ri_bulk_vctr(ji,jj) = Ri_bulk_sclr( pz, psst(ji,jj), ptha(ji,jj), pssq(ji,jj), pqa(ji,jj), pub(ji,jj) ) 
     619         END IF 
     620      END_2D 
     621 
    484622   END FUNCTION Ri_bulk_vctr 
    485    !=============================================================================================== 
    486  
    487    !=============================================================================================== 
     623 
     624 
    488625   FUNCTION e_sat_sclr( ptak ) 
    489626      !!---------------------------------------------------------------------------------- 
     
    510647      ! 
    511648   END FUNCTION e_sat_sclr 
    512    !! 
     649 
    513650   FUNCTION e_sat_vctr(ptak) 
    514651      REAL(wp), DIMENSION(jpi,jpj)             :: e_sat_vctr !: vapour pressure at saturation  [Pa] 
     
    519656      END_2D 
    520657   END FUNCTION e_sat_vctr 
    521    !=============================================================================================== 
    522  
    523    !=============================================================================================== 
     658 
     659 
    524660   FUNCTION e_sat_ice_sclr(ptak) 
    525661      !!--------------------------------------------------------------------------------- 
     
    537673      !! 
    538674      e_sat_ice_sclr = 100._wp * 10._wp**zle 
     675    
    539676   END FUNCTION e_sat_ice_sclr 
    540    !! 
     677 
    541678   FUNCTION e_sat_ice_vctr(ptak) 
    542679      !! Same as "e_sat" but over ice rather than water! 
     
    546683      !!---------------------------------------------------------------------------------- 
    547684      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    548       e_sat_ice_vctr(ji,jj) = e_sat_ice_sclr( ptak(ji,jj) ) 
    549       END_2D 
     685         e_sat_ice_vctr(ji,jj) = e_sat_ice_sclr( ptak(ji,jj) ) 
     686      END_2D 
     687 
    550688   END FUNCTION e_sat_ice_vctr 
    551    !! 
     689 
     690 
    552691   FUNCTION de_sat_dt_ice_sclr(ptak) 
    553692      !!--------------------------------------------------------------------------------- 
     
    567706      de_sat_dt_ice_sclr = LOG(10._wp) * zde * e_sat_ice_sclr(zta) 
    568707   END FUNCTION de_sat_dt_ice_sclr 
    569    !! 
     708 
    570709   FUNCTION de_sat_dt_ice_vctr(ptak) 
    571710      !! Same as "e_sat" but over ice rather than water! 
     
    575714      !!---------------------------------------------------------------------------------- 
    576715      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    577       de_sat_dt_ice_vctr(ji,jj) = de_sat_dt_ice_sclr( ptak(ji,jj) ) 
    578       END_2D 
     716         de_sat_dt_ice_vctr(ji,jj) = de_sat_dt_ice_sclr( ptak(ji,jj) ) 
     717      END_2D 
     718 
    579719   END FUNCTION de_sat_dt_ice_vctr 
    580720 
    581721 
    582  
    583    !=============================================================================================== 
    584  
    585    !=============================================================================================== 
    586722   FUNCTION q_sat_sclr( pta, ppa,  l_ice ) 
    587723      !!--------------------------------------------------------------------------------- 
     
    607743      END IF 
    608744      q_sat_sclr = reps0*ze_s/(ppa - (1._wp - reps0)*ze_s) 
     745 
    609746   END FUNCTION q_sat_sclr 
    610    !! 
     747 
    611748   FUNCTION q_sat_vctr( pta, ppa,  l_ice ) 
     749 
    612750      REAL(wp), DIMENSION(jpi,jpj) :: q_sat_vctr 
    613751      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pta  !: absolute temperature of air [K] 
     
    620758      IF( PRESENT(l_ice) ) lice = l_ice 
    621759      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    622       q_sat_vctr(ji,jj) = q_sat_sclr( pta(ji,jj) , ppa(ji,jj), l_ice=lice ) 
    623       END_2D 
     760         q_sat_vctr(ji,jj) = q_sat_sclr( pta(ji,jj) , ppa(ji,jj), l_ice=lice ) 
     761      END_2D 
     762 
    624763   END FUNCTION q_sat_vctr 
    625    !=============================================================================================== 
    626  
    627  
    628    !=============================================================================================== 
     764 
     765 
    629766   FUNCTION dq_sat_dt_ice_sclr( pta, ppa ) 
    630767      !!--------------------------------------------------------------------------------- 
     
    647784      ! 
    648785   END FUNCTION dq_sat_dt_ice_sclr 
    649    !! 
     786 
    650787   FUNCTION dq_sat_dt_ice_vctr( pta, ppa ) 
     788 
    651789      REAL(wp), DIMENSION(jpi,jpj) :: dq_sat_dt_ice_vctr 
    652790      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pta  !: absolute temperature of air [K] 
     
    655793      !!---------------------------------------------------------------------------------- 
    656794      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    657       dq_sat_dt_ice_vctr(ji,jj) = dq_sat_dt_ice_sclr( pta(ji,jj) , ppa(ji,jj) ) 
    658       END_2D 
     795         dq_sat_dt_ice_vctr(ji,jj) = dq_sat_dt_ice_sclr( pta(ji,jj) , ppa(ji,jj) ) 
     796      END_2D 
     797 
    659798   END FUNCTION dq_sat_dt_ice_vctr 
    660    !=============================================================================================== 
    661  
    662  
    663    !=============================================================================================== 
     799 
     800 
    664801   FUNCTION q_air_rh(prha, ptak, ppa) 
    665802      !!---------------------------------------------------------------------------------- 
     
    678815      ! 
    679816      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    680       ze = prha(ji,jj)*e_sat_sclr(ptak(ji,jj)) 
    681       q_air_rh(ji,jj) = ze*reps0/(ppa(ji,jj) - (1. - reps0)*ze) 
     817         ze = prha(ji,jj)*e_sat_sclr(ptak(ji,jj)) 
     818         q_air_rh(ji,jj) = ze*reps0/(ppa(ji,jj) - (1. - reps0)*ze) 
    682819      END_2D 
    683820      ! 
     
    685822 
    686823 
    687    SUBROUTINE UPDATE_QNSOL_TAU( pzu, pTs, pqs, pTa, pqa, pust, ptst, pqst, pwnd, pUb, ppa, prlw, & 
     824   SUBROUTINE UPDATE_QNSOL_TAU( pzu, pTs, pqs, pTa, pqa, pust, ptst, pqst, pwnd, pUb, ppa, prlw, prhoa, & 
    688825      &                         pQns, pTau,  & 
    689826      &                         Qlat) 
     
    705842      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: ppa ! sea-level atmospheric pressure [Pa] 
    706843      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: prlw ! downwelling longwave radiative flux [W/m^2] 
     844      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: prhoa ! air density [kg/m3] 
    707845      ! 
    708846      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) :: pQns ! non-solar heat flux to the ocean aka "Qlat + Qsen + Qlw" [W/m^2]] 
     
    715853      !!---------------------------------------------------------------------------------- 
    716854      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    717       zdt = pTa(ji,jj) - pTs(ji,jj) ;  zdt = SIGN( MAX(ABS(zdt),1.E-6_wp), zdt ) 
    718       zdq = pqa(ji,jj) - pqs(ji,jj) ;  zdq = SIGN( MAX(ABS(zdq),1.E-9_wp), zdq ) 
    719       zz0 = pust(ji,jj)/pUb(ji,jj) 
    720       zCd = zz0*zz0 
    721       zCh = zz0*ptst(ji,jj)/zdt 
    722       zCe = zz0*pqst(ji,jj)/zdq 
    723  
    724       CALL BULK_FORMULA( pzu, pTs(ji,jj), pqs(ji,jj), pTa(ji,jj), pqa(ji,jj), zCd, zCh, zCe, & 
    725          &              pwnd(ji,jj), pUb(ji,jj), ppa(ji,jj), & 
    726          &              pTau(ji,jj), zQsen, zQlat ) 
    727  
    728       zQlw = qlw_net_sclr( prlw(ji,jj), pTs(ji,jj) ) ! Net longwave flux 
    729  
    730       pQns(ji,jj) = zQlat + zQsen + zQlw 
    731  
    732       IF( PRESENT(Qlat) ) Qlat(ji,jj) = zQlat 
    733       END_2D 
     855 
     856         zdt = pTa(ji,jj) - pTs(ji,jj) ;  zdt = SIGN( MAX(ABS(zdt),1.E-6_wp), zdt ) 
     857         zdq = pqa(ji,jj) - pqs(ji,jj) ;  zdq = SIGN( MAX(ABS(zdq),1.E-9_wp), zdq ) 
     858         zz0 = pust(ji,jj)/pUb(ji,jj) 
     859         zCd = zz0*zz0 
     860         zCh = zz0*ptst(ji,jj)/zdt 
     861         zCe = zz0*pqst(ji,jj)/zdq 
     862 
     863         CALL BULK_FORMULA( pzu, pTs(ji,jj), pqs(ji,jj), pTa(ji,jj), pqa(ji,jj), zCd, zCh, zCe, & 
     864            &              pwnd(ji,jj), pUb(ji,jj), ppa(ji,jj), prhoa(ji,jj), & 
     865            &              pTau(ji,jj), zQsen, zQlat ) 
     866 
     867         zQlw = qlw_net_sclr( prlw(ji,jj), pTs(ji,jj) ) ! Net longwave flux 
     868 
     869         pQns(ji,jj) = zQlat + zQsen + zQlw 
     870 
     871         IF( PRESENT(Qlat) ) Qlat(ji,jj) = zQlat 
     872 
     873      END_2D 
     874 
    734875   END SUBROUTINE UPDATE_QNSOL_TAU 
    735876 
     
    737878   SUBROUTINE BULK_FORMULA_SCLR( pzu, pTs, pqs, pTa, pqa, & 
    738879      &                          pCd, pCh, pCe,           & 
    739       &                          pwnd, pUb, ppa,         & 
     880      &                          pwnd, pUb, ppa, prhoa,   & 
    740881      &                          pTau, pQsen, pQlat,      & 
    741       &                          pEvap, prhoa, pfact_evap ) 
    742       !!---------------------------------------------------------------------------------- 
    743       REAL(wp),                     INTENT(in)  :: pzu  ! height above the sea-level where all this takes place (normally 10m) 
    744       REAL(wp), INTENT(in)  :: pTs  ! water temperature at the air-sea interface [K] 
    745       REAL(wp), INTENT(in)  :: pqs  ! satur. spec. hum. at T=pTs   [kg/kg] 
    746       REAL(wp), INTENT(in)  :: pTa  ! potential air temperature at z=pzu [K] 
    747       REAL(wp), INTENT(in)  :: pqa  ! specific humidity at z=pzu [kg/kg] 
     882      &                          pEvap, pfact_evap        ) 
     883      !!---------------------------------------------------------------------------------- 
     884      REAL(wp), INTENT(in)  :: pzu   ! height above the sea-level where all this takes place (normally 10m) 
     885      REAL(wp), INTENT(in)  :: pTs   ! water temperature at the air-sea interface [K] 
     886      REAL(wp), INTENT(in)  :: pqs   ! satur. spec. hum. at T=pTs   [kg/kg] 
     887      REAL(wp), INTENT(in)  :: pTa   ! potential air temperature at z=pzu [K] 
     888      REAL(wp), INTENT(in)  :: pqa   ! specific humidity at z=pzu [kg/kg] 
    748889      REAL(wp), INTENT(in)  :: pCd 
    749890      REAL(wp), INTENT(in)  :: pCh 
    750891      REAL(wp), INTENT(in)  :: pCe 
    751       REAL(wp), INTENT(in)  :: pwnd ! wind speed module at z=pzu [m/s] 
    752       REAL(wp), INTENT(in)  :: pUb  ! bulk wind speed at z=pzu (inc. pot. effect of gustiness etc) [m/s] 
    753       REAL(wp), INTENT(in)  :: ppa ! sea-level atmospheric pressure [Pa] 
     892      REAL(wp), INTENT(in)  :: pwnd  ! wind speed module at z=pzu [m/s] 
     893      REAL(wp), INTENT(in)  :: pUb   ! bulk wind speed at z=pzu (inc. pot. effect of gustiness etc) [m/s] 
     894      REAL(wp), INTENT(in)  :: ppa   ! sea-level atmospheric pressure [Pa] 
     895      REAL(wp), INTENT(in)  :: prhoa ! Air density at z=pzu [kg/m^3] 
    754896      !! 
    755897      REAL(wp), INTENT(out) :: pTau  ! module of the wind stress [N/m^2] 
     
    758900      !! 
    759901      REAL(wp), INTENT(out), OPTIONAL :: pEvap ! Evaporation [kg/m^2/s] 
    760       REAL(wp), INTENT(out), OPTIONAL :: prhoa ! Air density at z=pzu [kg/m^3] 
    761902      REAL(wp), INTENT(in) , OPTIONAL :: pfact_evap  ! ABOMINATION: corrective factor for evaporation (doing this against my will! /laurent) 
    762903      !! 
     
    767908      IF( PRESENT(pfact_evap) ) zfact_evap = pfact_evap 
    768909 
    769       !! Need ztaa, absolute temperature at pzu (formula to estimate rho_air needs absolute temperature, not the potential temperature "pTa") 
    770       ztaa = pTa ! first guess... 
    771       DO jq = 1, 4 
    772          zgamma = gamma_moist( 0.5*(ztaa+pTs) , pqa )  !#LB: why not "0.5*(pqs+pqa)" rather then "pqa" ??? 
    773          ztaa = pTa - zgamma*pzu   ! Absolute temp. is slightly colder... 
    774       END DO 
    775       zrho = rho_air(ztaa, pqa, ppa) 
    776       zrho = rho_air(ztaa, pqa, ppa-zrho*grav*pzu) ! taking into account that we are pzu m above the sea level where SLP is given! 
    777  
    778       zUrho = pUb*MAX(zrho, 1._wp)     ! rho*U10 
     910      zUrho = pUb*MAX(prhoa, 1._wp)     ! rho*U10 
    779911 
    780912      pTau = zUrho * pCd * pwnd ! Wind stress module 
     
    785917 
    786918      IF( PRESENT(pEvap) ) pEvap = - zfact_evap * zevap 
    787       IF( PRESENT(prhoa) ) prhoa = zrho 
    788919 
    789920   END SUBROUTINE BULK_FORMULA_SCLR 
    790    !! 
     921 
    791922   SUBROUTINE BULK_FORMULA_VCTR( pzu, pTs, pqs, pTa, pqa, & 
    792923      &                          pCd, pCh, pCe,           & 
    793       &                          pwnd, pUb, ppa,         & 
     924      &                          pwnd, pUb, ppa, prhoa,   & 
    794925      &                          pTau, pQsen, pQlat,      & 
    795       &                          pEvap, prhoa, pfact_evap ) 
    796       !!---------------------------------------------------------------------------------- 
    797       REAL(wp),                     INTENT(in)  :: pzu  ! height above the sea-level where all this takes place (normally 10m) 
    798       REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pTs  ! water temperature at the air-sea interface [K] 
    799       REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pqs  ! satur. spec. hum. at T=pTs   [kg/kg] 
    800       REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pTa  ! potential air temperature at z=pzu [K] 
    801       REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pqa  ! specific humidity at z=pzu [kg/kg] 
     926      &                          pEvap, pfact_evap ) 
     927      !!---------------------------------------------------------------------------------- 
     928      REAL(wp),                     INTENT(in)  :: pzu   ! height above the sea-level where all this takes place (normally 10m) 
     929      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pTs   ! water temperature at the air-sea interface [K] 
     930      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pqs   ! satur. spec. hum. at T=pTs   [kg/kg] 
     931      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pTa   ! potential air temperature at z=pzu [K] 
     932      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pqa   ! specific humidity at z=pzu [kg/kg] 
    802933      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pCd 
    803934      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pCh 
    804935      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pCe 
    805       REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pwnd ! wind speed module at z=pzu [m/s] 
    806       REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pUb  ! bulk wind speed at z=pzu (inc. pot. effect of gustiness etc) [m/s] 
    807       REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: ppa ! sea-level atmospheric pressure [Pa] 
     936      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pwnd  ! wind speed module at z=pzu [m/s] 
     937      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: pUb   ! bulk wind speed at z=pzu (inc. pot. effect of gustiness etc) [m/s] 
     938      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: ppa   ! sea-level atmospheric pressure [Pa] 
     939      REAL(wp), DIMENSION(jpi,jpj), INTENT(in)  :: prhoa ! Air density at z=pzu [kg/m^3]  
    808940      !! 
    809941      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) :: pTau  ! module of the wind stress [N/m^2] 
     
    812944      !! 
    813945      REAL(wp), DIMENSION(jpi,jpj), INTENT(out), OPTIONAL :: pEvap ! Evaporation [kg/m^2/s] 
    814       REAL(wp), DIMENSION(jpi,jpj), INTENT(out), OPTIONAL :: prhoa ! Air density at z=pzu [kg/m^3] 
    815946      REAL(wp),                     INTENT(in) , OPTIONAL :: pfact_evap  ! ABOMINATION: corrective factor for evaporation (doing this against my will! /laurent) 
    816947      !! 
     
    823954      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    824955 
    825       CALL BULK_FORMULA_SCLR( pzu, pTs(ji,jj), pqs(ji,jj), pTa(ji,jj), pqa(ji,jj), & 
    826          &                    pCd(ji,jj), pCh(ji,jj), pCe(ji,jj),                  & 
    827          &                    pwnd(ji,jj), pUb(ji,jj), ppa(ji,jj),                & 
    828          &                    pTau(ji,jj), pQsen(ji,jj), pQlat(ji,jj),             & 
    829          &                    pEvap=zevap, prhoa=zrho, pfact_evap=zfact_evap       ) 
    830  
    831       IF( PRESENT(pEvap) ) pEvap(ji,jj) = zevap 
    832       IF( PRESENT(prhoa) ) prhoa(ji,jj) = zrho 
    833       END_2D 
     956         CALL BULK_FORMULA_SCLR( pzu, pTs(ji,jj), pqs(ji,jj), pTa(ji,jj), pqa(ji,jj), & 
     957            &                    pCd(ji,jj), pCh(ji,jj), pCe(ji,jj),                  & 
     958            &                    pwnd(ji,jj), pUb(ji,jj), ppa(ji,jj), prhoa(ji,jj),   & 
     959            &                    pTau(ji,jj), pQsen(ji,jj), pQlat(ji,jj),             & 
     960            &                    pEvap=zevap, pfact_evap=zfact_evap                   ) 
     961 
     962         IF( PRESENT(pEvap) ) pEvap(ji,jj) = zevap 
     963      END_2D 
     964 
    834965   END SUBROUTINE BULK_FORMULA_VCTR 
    835966 
     
    847978      !!---------------------------------------------------------------------------------- 
    848979      alpha_sw_vctr = 2.1e-5_wp * MAX(psst(:,:)-rt0 + 3.2_wp, 0._wp)**0.79 
     980 
    849981   END FUNCTION alpha_sw_vctr 
    850982 
     
    861993      !!---------------------------------------------------------------------------------- 
    862994      alpha_sw_sclr = 2.1e-5_wp * MAX(psst-rt0 + 3.2_wp, 0._wp)**0.79 
     995 
    863996   END FUNCTION alpha_sw_sclr 
    864997 
    865998 
    866    !=============================================================================================== 
    867999   FUNCTION qlw_net_sclr( pdwlw, pts,  l_ice ) 
    8681000      !!--------------------------------------------------------------------------------- 
     
    8871019      zt2 = pts*pts 
    8881020      qlw_net_sclr = zemiss*( pdwlw - stefan*zt2*zt2)  ! zemiss used both as the IR albedo and IR emissivity... 
     1021 
    8891022   END FUNCTION qlw_net_sclr 
    890    !! 
     1023 
    8911024   FUNCTION qlw_net_vctr( pdwlw, pts,  l_ice ) 
     1025 
    8921026      REAL(wp), DIMENSION(jpi,jpj) :: qlw_net_vctr 
    8931027      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pdwlw !: downwelling longwave (aka infrared, aka thermal) radiation [W/m^2] 
     
    9001034      IF( PRESENT(l_ice) ) lice = l_ice 
    9011035      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    902       qlw_net_vctr(ji,jj) = qlw_net_sclr( pdwlw(ji,jj) , pts(ji,jj), l_ice=lice ) 
    903       END_2D 
     1036         qlw_net_vctr(ji,jj) = qlw_net_sclr( pdwlw(ji,jj) , pts(ji,jj), l_ice=lice ) 
     1037      END_2D 
     1038 
    9041039   END FUNCTION qlw_net_vctr 
    905    !=============================================================================================== 
     1040 
    9061041 
    9071042   FUNCTION z0_from_Cd( pzu, pCd,  ppsi ) 
     1043 
    9081044      REAL(wp), DIMENSION(jpi,jpj) :: z0_from_Cd        !: roughness length [m] 
    9091045      REAL(wp)                    , INTENT(in) :: pzu   !: reference height zu [m] 
     
    9211057         z0_from_Cd = pzu * EXP( - vkarmn/SQRT(pCd(:,:)) )            !LB: ok, double-checked! 
    9221058      END IF 
     1059 
    9231060   END FUNCTION z0_from_Cd 
    9241061 
     1062 
    9251063   FUNCTION Cd_from_z0( pzu, pz0,  ppsi ) 
     1064 
    9261065      REAL(wp), DIMENSION(jpi,jpj) :: Cd_from_z0        !: (neutral or non-neutral) drag coefficient [] 
    9271066      REAL(wp)                    , INTENT(in) :: pzu   !: reference height zu [m] 
     
    9401079      END IF 
    9411080      Cd_from_z0 = vkarmn2 * Cd_from_z0 * Cd_from_z0 
     1081 
    9421082   END FUNCTION Cd_from_z0 
    9431083 
     
    9651105      ! 
    9661106   END FUNCTION f_m_louis_sclr 
    967    !! 
     1107 
    9681108   FUNCTION f_m_louis_vctr( pzu, pRib, pCdn, pz0 ) 
     1109 
    9691110      REAL(wp), DIMENSION(jpi,jpj)             :: f_m_louis_vctr 
    9701111      REAL(wp),                     INTENT(in) :: pzu 
     
    9731114      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pz0 
    9741115      INTEGER  :: ji, jj 
    975       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    976       f_m_louis_vctr(ji,jj) = f_m_louis_sclr( pzu, pRib(ji,jj), pCdn(ji,jj), pz0(ji,jj) ) 
    977       END_2D 
     1116 
     1117      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     1118         f_m_louis_vctr(ji,jj) = f_m_louis_sclr( pzu, pRib(ji,jj), pCdn(ji,jj), pz0(ji,jj) ) 
     1119      END_2D 
     1120 
    9781121   END FUNCTION f_m_louis_vctr 
    9791122 
     
    10011144      ! 
    10021145   END FUNCTION f_h_louis_sclr 
    1003    !! 
     1146 
    10041147   FUNCTION f_h_louis_vctr( pzu, pRib, pChn, pz0 ) 
     1148 
    10051149      REAL(wp), DIMENSION(jpi,jpj)             :: f_h_louis_vctr 
    10061150      REAL(wp),                     INTENT(in) :: pzu 
     
    10091153      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pz0 
    10101154      INTEGER  :: ji, jj 
    1011       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    1012       f_h_louis_vctr(ji,jj) = f_h_louis_sclr( pzu, pRib(ji,jj), pChn(ji,jj), pz0(ji,jj) ) 
    1013       END_2D 
     1155 
     1156      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     1157         f_h_louis_vctr(ji,jj) = f_h_louis_sclr( pzu, pRib(ji,jj), pChn(ji,jj), pz0(ji,jj) ) 
     1158      END_2D 
     1159 
    10141160   END FUNCTION f_h_louis_vctr 
     1161 
    10151162 
    10161163   FUNCTION UN10_from_ustar( pzu, pUzu, pus, ppsi ) 
     
    11231270 
    11241271 
    1125    !!====================================================================== 
     1272 
    11261273END MODULE sbc_phy 
Note: See TracChangeset for help on using the changeset viewer.