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 12182 – NEMO

Changeset 12182


Ignore:
Timestamp:
2019-12-11T12:38:43+01:00 (4 years ago)
Author:
davestorkey
Message:

2019/dev_r11943_MERGE_2019: Merge in dev_ASINTER-01-05_merge.

Location:
NEMO/branches/2019/dev_r11943_MERGE_2019
Files:
8 deleted
64 edited
30 copied

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/AGRIF_DEMO/EXPREF/1_namelist_cfg

    r11536 r12182  
    9393!----------------------------------------------------------------------- 
    9494   !                    !  bulk algorithm : 
    95    ln_NCAR    = .true.     ! "NCAR"      algorithm   (Large and Yeager 2008) 
    96  
     95   ln_NCAR      = .true.    ! "NCAR"      algorithm   (Large and Yeager 2008) 
     96   ln_COARE_3p0 = .false.   ! "COARE 3.0" algorithm   (Fairall et al. 2003) 
     97   ln_COARE_3p6 = .false.   ! "COARE 3.6" algorithm   (Edson et al. 2013) 
     98   ln_ECMWF     = .false.   ! "ECMWF"     algorithm   (IFS cycle 31) 
     99      ! 
     100      rn_zqt      = 10.       !  Air temperature & humidity reference height (m) 
     101      rn_zu       = 10.       !  Wind vector reference height (m) 
     102      ln_Cd_L12   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2012) 
     103      ln_Cd_L15   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2015) 
     104      rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow) 
     105      rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.) 
     106      rn_vfac     = 0.        !  multiplicative factor for ocean & ice velocity used to 
     107      !                       !  calculate the wind stress (0.=absolute or 1.=relative winds) 
     108      ln_skin_cs = .false.  !  use the cool-skin parameterization (only available in ECMWF and COARE algorithms) !LB 
     109      ln_skin_wl = .false.  !  use the warm-layer        "               "                    " 
     110      ! 
     111      ln_humi_sph = .true.     !  humidity specified below in "sn_humi" is specific humidity     [kg/kg] if .true. 
     112      ln_humi_dpt = .false.    !  humidity specified below in "sn_humi" is dew-point temperature   [K]   if .true. 
     113      ln_humi_rlh = .false.    !  humidity specified below in "sn_humi" is relative humidity       [%]   if .true. 
     114   ! 
    97115   cn_dir = './'  !  root directory for the bulk data location 
    98116   !___________!_________________________!___________________!___________!_____________!________!___________!______________________________________!__________!_______________! 
     
    108126   sn_snow     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'SNOW'    ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    109127   sn_slp      = 'slp.15JUNE2009_fill'        ,    6.        , 'SLP'     ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    110    sn_tdif     = 'taudif_core'                ,   24.        , 'taudif'  ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    111128/ 
    112129!----------------------------------------------------------------------- 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/AGRIF_DEMO/EXPREF/2_namelist_cfg

    r11536 r12182  
    8989!----------------------------------------------------------------------- 
    9090   !                    !  bulk algorithm : 
    91    ln_NCAR     = .true.    ! "NCAR"      algorithm   (Large and Yeager 2008) 
    92  
     91   ln_NCAR      = .true.    ! "NCAR"      algorithm   (Large and Yeager 2008) 
     92   ln_COARE_3p0 = .false.   ! "COARE 3.0" algorithm   (Fairall et al. 2003) 
     93   ln_COARE_3p6 = .false.   ! "COARE 3.6" algorithm   (Edson et al. 2013) 
     94   ln_ECMWF     = .false.   ! "ECMWF"     algorithm   (IFS cycle 31) 
     95      ! 
     96      rn_zqt      = 10.       !  Air temperature & humidity reference height (m) 
     97      rn_zu       = 10.       !  Wind vector reference height (m) 
     98      ln_Cd_L12   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2012) 
     99      ln_Cd_L15   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2015) 
     100      rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow) 
     101      rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.) 
     102      rn_vfac     = 0.        !  multiplicative factor for ocean & ice velocity used to 
     103      !                       !  calculate the wind stress (0.=absolute or 1.=relative winds) 
     104      ln_skin_cs = .false.  !  use the cool-skin parameterization (only available in ECMWF and COARE algorithms) !LB 
     105      ln_skin_wl = .false.  !  use the warm-layer        "               "                    " 
     106      ! 
     107      ln_humi_sph = .true.     !  humidity specified below in "sn_humi" is specific humidity     [kg/kg] if .true. 
     108      ln_humi_dpt = .false.    !  humidity specified below in "sn_humi" is dew-point temperature   [K]   if .true. 
     109      ln_humi_rlh = .false.    !  humidity specified below in "sn_humi" is relative humidity       [%]   if .true. 
     110   ! 
    93111   cn_dir      = './'      !  root directory for the bulk data location 
    94112   !___________!_________________________!___________________!___________!_____________!________!___________!______________________________________!__________!_______________! 
     
    104122   sn_snow     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'SNOW'    ,   .false.   , .true. , 'yearly'  , 'weights_core2_nordic1_bilin.nc'  , ''       , '' 
    105123   sn_slp      = 'slp.15JUNE2009_fill'        ,    6.        , 'SLP'     ,   .false.   , .true. , 'yearly'  , 'weights_core2_nordic1_bilin.nc'  , ''       , '' 
    106    sn_tdif     = 'taudif_core'                ,   24.        , 'taudif'  ,   .false.   , .true. , 'yearly'  , 'weights_core2_nordic1_bilin.nc'  , ''       , '' 
    107124 
    108125/ 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/AGRIF_DEMO/EXPREF/2_namelist_ice_ref

    r9575 r12182  
    1 link 1_namelist_ice_ref 
     1link ../../SHARED/namelist_ice_ref 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/AGRIF_DEMO/EXPREF/2_namelist_ref

    r9464 r12182  
    1 link 1_namelist_ref 
     1link ../../SHARED/namelist_ref 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/AGRIF_DEMO/EXPREF/3_namelist_cfg

    r11536 r12182  
    104104   sn_snow     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'SNOW'    ,   .false.   , .true. , 'yearly'  , 'weights_core2_nordic2_bilin.nc'     , ''       , '' 
    105105   sn_slp      = 'slp.15JUNE2009_fill'        ,    6.        , 'SLP'     ,   .false.   , .true. , 'yearly'  , 'weights_core2_nordic2_bilin.nc'     , ''       , '' 
    106    sn_tdif     = 'taudif_core'                ,   24.        , 'taudif'  ,   .false.   , .true. , 'yearly'  , 'weights_core2_nordic2_bilin.nc'     , ''       , '' 
    107106 
    108107/ 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/AGRIF_DEMO/EXPREF/namelist_cfg

    r11536 r12182  
    9393!----------------------------------------------------------------------- 
    9494   !                    !  bulk algorithm : 
    95    ln_NCAR    = .true.     ! "NCAR"      algorithm   (Large and Yeager 2008) 
    96  
     95   ln_NCAR      = .true.    ! "NCAR"      algorithm   (Large and Yeager 2008) 
     96   ln_COARE_3p0 = .false.   ! "COARE 3.0" algorithm   (Fairall et al. 2003) 
     97   ln_COARE_3p6 = .false.   ! "COARE 3.6" algorithm   (Edson et al. 2013) 
     98   ln_ECMWF     = .false.   ! "ECMWF"     algorithm   (IFS cycle 31) 
     99      ! 
     100      rn_zqt      = 10.       !  Air temperature & humidity reference height (m) 
     101      rn_zu       = 10.       !  Wind vector reference height (m) 
     102      ln_Cd_L12   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2012) 
     103      ln_Cd_L15   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2015) 
     104      rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow) 
     105      rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.) 
     106      rn_vfac     = 0.        !  multiplicative factor for ocean & ice velocity used to 
     107      !                       !  calculate the wind stress (0.=absolute or 1.=relative winds) 
     108      ln_skin_cs = .false.  !  use the cool-skin parameterization (only available in ECMWF and COARE algorithms) !LB 
     109      ln_skin_wl = .false.  !  use the warm-layer        "               "                    " 
     110      ! 
     111      ln_humi_sph = .true.     !  humidity specified below in "sn_humi" is specific humidity     [kg/kg] if .true. 
     112      ln_humi_dpt = .false.    !  humidity specified below in "sn_humi" is dew-point temperature   [K]   if .true. 
     113      ln_humi_rlh = .false.    !  humidity specified below in "sn_humi" is relative humidity       [%]   if .true. 
     114   ! 
    97115   cn_dir = './'  !  root directory for the bulk data location 
    98116   !___________!_________________________!___________________!___________!_____________!________!___________!______________________________________!__________!_______________! 
     
    108126   sn_snow     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'SNOW'    ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    109127   sn_slp      = 'slp.15JUNE2009_fill'        ,    6.        , 'SLP'     ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    110    sn_tdif     = 'taudif_core'                ,   24.        , 'taudif'  ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    111128/ 
    112129!----------------------------------------------------------------------- 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/C1D_PAPA/EXPREF/namelist_cfg

    r11536 r12182  
    159159   sn_snow     = 'forcing_C1D_PAPA'   ,  3.   , 'sososnow',   .false.    , .false. , 'yearly'  , ''  , ''   , '' 
    160160   sn_slp      = 'forcing_C1D_PAPA'   ,  3.   , 'somslpre',   .true.     , .false. , 'yearly'  , ''  , ''   , '' 
    161    sn_tdif     = 'forcing_C1D_PAPA'   , 24.   , 'taudif'  ,   .false.    , .false. , 'yearly'  , ''  , ''   , '' 
    162161 
    163162/ 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg

    r11536 r12182  
    118118   sn_snow     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'SNOW'    ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    119119   sn_slp      = 'slp.15JUNE2009_fill'        ,    6.        , 'SLP'     ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    120    sn_tdif     = 'taudif_core'                ,   24.        , 'taudif'  ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    121120/ 
    122121!----------------------------------------------------------------------- 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/ORCA2_SAS_ICE/EXPREF/namelist_cfg

    r11536 r12182  
    6464&namsbc_blk   !   namsbc_blk  generic Bulk formula                      (ln_blk =T) 
    6565!----------------------------------------------------------------------- 
    66    ln_NCAR     = .true.   ! "NCAR"      algorithm   (Large and Yeager 2008) 
    67  
     66   !                    !  bulk algorithm : 
     67   ln_NCAR      = .true.    ! "NCAR"      algorithm   (Large and Yeager 2008) 
     68   ln_COARE_3p0 = .false.   ! "COARE 3.0" algorithm   (Fairall et al. 2003) 
     69   ln_COARE_3p6 = .false.   ! "COARE 3.6" algorithm   (Edson et al. 2013) 
     70   ln_ECMWF     = .false.   ! "ECMWF"     algorithm   (IFS cycle 31) 
     71      ! 
     72      rn_zqt      = 10.       !  Air temperature & humidity reference height (m) 
     73      rn_zu       = 10.       !  Wind vector reference height (m) 
     74      ln_Cd_L12   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2012) 
     75      ln_Cd_L15   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2015) 
     76      rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow) 
     77      rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.) 
     78      rn_vfac     = 0.        !  multiplicative factor for ocean & ice velocity used to 
     79      !                       !  calculate the wind stress (0.=absolute or 1.=relative winds) 
     80      ln_skin_cs = .false.  !  use the cool-skin parameterization (only available in ECMWF and COARE algorithms) !LB 
     81      ln_skin_wl = .false.  !  use the warm-layer        "               "                    " 
     82      ! 
     83      ln_humi_sph = .true.     !  humidity specified below in "sn_humi" is specific humidity     [kg/kg] if .true. 
     84      ln_humi_dpt = .false.    !  humidity specified below in "sn_humi" is dew-point temperature   [K]   if .true. 
     85      ln_humi_rlh = .false.    !  humidity specified below in "sn_humi" is relative humidity       [%]   if .true. 
     86   ! 
    6887   cn_dir      = './'      !  root directory for the bulk data location 
    6988   !___________!_________________________!___________________!___________!_____________!________!___________!______________________________________!__________!_______________! 
     
    7998   sn_snow     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'SNOW'    ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    8099   sn_slp      = 'slp.15JUNE2009_fill'        ,    6.        , 'SLP'     ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    81    sn_tdif     = 'taudif_core'                ,   24.        , 'taudif'  ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    82100/ 
    83101!----------------------------------------------------------------------- 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/SHARED/field_def_nemo-ice.xml

    r11575 r12182  
    9292          <field id="qemp_ice"     long_name="Downward Heat Flux from E-P over ice"                                                                              unit="W/m2" /> 
    9393          <field id="albedo"       long_name="Mean albedo over sea ice and ocean"                                                                                unit=""     /> 
     94          <field id="Cd_ice"       long_name="Momentum turbulent exchange coefficient"                                                                           unit=""     /> 
     95          <field id="Ch_ice"       long_name="Heat turbulent exchange coefficient"                                                                               unit=""     /> 
    9496      
    9597     <!-- trends --> 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/SHARED/field_def_nemo-oce.xml

    r12150 r12182  
    3232   <field id="ahmt_3d"      long_name=" 3D      t-eddy viscosity coefficient"   unit="m2/s or m4/s"  grid_ref="grid_T_3D"/> 
    3333 
    34         <field id="sst"          long_name="sea surface temperature"                            standard_name="sea_surface_temperature"             unit="degC"     /> 
     34        <field id="sst"          long_name="Bulk sea surface temperature"                       standard_name="bulk_sea_surface_temperature"        unit="degC"     /> 
     35        <field id="t_skin"       long_name="Skin temperature aka SSST"                          standard_name="skin_temperature"                    unit="degC"     /> 
    3536        <field id="sst2"         long_name="square of sea surface temperature"                  standard_name="square_of_sea_surface_temperature"   unit="degC2"     > sst * sst </field > 
    3637        <field id="sstmax"       long_name="max of sea surface temperature"   field_ref="sst"   operation="maximum"                                                 /> 
     
    297298 
    298299          <!-- *_oce variables available with ln_blk_clio or ln_blk_core --> 
     300          <field id="rho_air"      long_name="Air density at 10m above sea surface"         standard_name="rho_air_10m"                                        unit="kg/m3" /> 
     301          <field id="dt_skin"      long_name="SSST-SST temperature difference"              standard_name="SSST-SST"                                             unit="K"   /> 
    299302          <field id="qlw_oce"      long_name="Longwave Downward Heat Flux over open ocean"  standard_name="surface_net_downward_longwave_flux"                 unit="W/m2"  /> 
    300303          <field id="qsb_oce"      long_name="Sensible Downward Heat Flux over open ocean"  standard_name="surface_downward_sensible_heat_flux"                unit="W/m2"  /> 
    301304          <field id="qla_oce"      long_name="Latent Downward Heat Flux over open ocean"    standard_name="surface_downward_latent_heat_flux"                  unit="W/m2"  /> 
     305          <field id="evap_oce"     long_name="Evaporation over open ocean"                  standard_name="evaporation"                                        unit="kg/m2/s" /> 
    302306          <field id="qt_oce"       long_name="total flux at ocean surface"                  standard_name="surface_downward_heat_flux_in_sea_water"            unit="W/m2"  /> 
    303307          <field id="qsr_oce"      long_name="solar heat flux at ocean surface"             standard_name="net_downward_shortwave_flux_at_sea_water_surface"   unit="W/m2"  /> 
     
    360364 
    361365      </field_group> <!-- SBC --> 
    362  
     366       
     367      <!-- ABL --> 
     368      <field_group id="ABL" > <!-- time step automaticaly defined based on nn_fsbc --> 
     369 
     370   <!-- variables available with ABL on atmospheric T grid--> 
     371   <field_group id="grid_ABL3D" grid_ref="grid_TA_3D" > 
     372          <field id="u_abl"      long_name="ABL i-horizontal velocity"     standard_name="abl_x_velocity" unit="m/s"      /> 
     373          <field id="v_abl"      long_name="ABL j-horizontal velocity"     standard_name="abl_y_velocity" unit="m/s"      /> 
     374          <field id="t_abl"      long_name="ABL potential temperature"     standard_name="abl_theta"      unit="K"        /> 
     375          <field id="q_abl"      long_name="ABL specific humidity"         standard_name="abl_qspe"       unit="kg/kg"    /> 
     376          <!-- debug (to be removed) --> 
     377          <field id="u_dta"      long_name="DTA i-horizontal velocity"     standard_name="dta_x_velocity" unit="m/s"      /> 
     378          <field id="v_dta"      long_name="DTA j-horizontal velocity"     standard_name="dta_y_velocity" unit="m/s"      /> 
     379          <field id="t_dta"      long_name="DTA potential temperature"     standard_name="dta_theta"      unit="K"        /> 
     380          <field id="q_dta"      long_name="DTA specific humidity"         standard_name="dta_qspe"       unit="kg/kg"    /> 
     381          <field id="coeft"      long_name="ABL nudging coefficient"       standard_name="coeft"          unit=""         /> 
     382          <field id="tke_abl"    long_name="ABL turbulent kinetic energy"  standard_name="abl_tke"        unit="m2/s2"    /> 
     383          <field id="avm_abl"    long_name="ABL turbulent viscosity"       standard_name="abl_avm"        unit="m2/s"     /> 
     384          <field id="avt_abl"    long_name="ABL turbulent diffusivity"     standard_name="abl_avt"        unit="m2/s"     /> 
     385          <field id="mxl_abl"    long_name="ABL mixing length"             standard_name="abl_mxl"        unit="m"        /> 
     386   </field_group> 
     387 
     388   <field_group id="grid_ABL2D" grid_ref="grid_TA_2D" > 
     389          <field id="pblh"       long_name="ABL height"                    standard_name="abl_height"     unit="m"        /> 
     390          <field id="uz1_abl"    long_name="ABL i-horizontal velocity"     standard_name="abl_x_velocity" unit="m/s"      /> 
     391          <field id="vz1_abl"    long_name="ABL j-horizontal velocity"     standard_name="abl_y_velocity" unit="m/s"      /> 
     392          <field id="uvz1_abl"   long_name="ABL wind speed module"         standard_name="abl_wind_speed" unit="m/s"       > sqrt( uz1_abl^2 + vz1_abl^2 ) </field> 
     393          <field id="tz1_abl"    long_name="ABL potential temperature"     standard_name="abl_theta"      unit="K"        /> 
     394          <field id="qz1_abl"    long_name="ABL specific humidity"         standard_name="abl_qspe"       unit="kg/kg"    /> 
     395          <field id="uz1_dta"    long_name="DTA i-horizontal velocity"     standard_name="dta_x_velocity" unit="m/s"      /> 
     396          <field id="vz1_dta"    long_name="DTA j-horizontal velocity"     standard_name="dta_y_velocity" unit="m/s"      /> 
     397          <field id="uvz1_dta"   long_name="DTA wind speed module"         standard_name="dta_wind_speed" unit="m/s"       > sqrt( uz1_dta^2 + vz1_dta^2 ) </field>  
     398          <field id="tz1_dta"    long_name="DTA potential temperature"     standard_name="dta_theta"      unit="K"        /> 
     399          <field id="qz1_dta"    long_name="DTA specific humidity"         standard_name="dta_qspe"       unit="kg/kg"    /> 
     400          <!-- debug (to be removed) --> 
     401          <field id="uz1_geo"    long_name="GEO i-horizontal velocity"     standard_name="geo_x_velocity" unit="m/s"      /> 
     402          <field id="vz1_geo"    long_name="GEO j-horizontal velocity"     standard_name="geo_y_velocity" unit="m/s"      /> 
     403          <field id="uvz1_geo"   long_name="GEO wind speed module"         standard_name="geo_wind_speed" unit="m/s"       > sqrt( uz1_geo^2 + vz1_geo^2 ) </field>  
     404   </field_group> 
     405 
     406      </field_group> <!-- ABL --> 
     407 
     408       
    363409      <!-- U grid --> 
    364410       
     
    375421        <field id="uocet"        long_name="ocean transport along i-axis times temperature (CRS)"                                               unit="degC*m/s"   grid_ref="grid_U_3D" /> 
    376422        <field id="uoces"        long_name="ocean transport along i-axis times salinity (CRS)"                                                  unit="1e-3*m/s"   grid_ref="grid_U_3D" /> 
     423        <field id="ssuww"        long_name="ocean surface wind work along i-axis"                   standard_name="surface_x_wind_work"         unit="N/m*s"                            > utau * ssu </field> 
    377424 
    378425        <!-- u-eddy diffusivity coefficients (available if ln_traldf_OFF=F) --> 
     
    429476        <field id="vocet"        long_name="ocean transport along j-axis times temperature (CRS)"                                               unit="degC*m/s"   grid_ref="grid_V_3D" /> 
    430477        <field id="voces"        long_name="ocean transport along j-axis times salinity (CRS)"                                                  unit="1e-3*m/s"   grid_ref="grid_V_3D" /> 
     478        <field id="ssvww"        long_name="ocean surface wind work along j-axis"                   standard_name="surface_y_wind_work"         unit="N/m*s"                            > vtau * ssv </field> 
    431479 
    432480        <!-- v-eddy diffusivity coefficients (available if ln_traldf_OFF=F) --> 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/SHARED/grid_def_nemo.xml

    r11536 r12182  
    5858      </grid> 
    5959 
     60       <!-- ABL grid definition --> 
     61       <grid id="grid_TA_2D"> 
     62         <domain domain_ref="grid_T" /> 
     63       </grid> 
     64       <grid id="grid_TA_3D"> 
     65         <domain domain_ref="grid_T" /> 
     66         <axis  id="ght_abl" /> 
     67       </grid> 
     68       <grid id="grid_WA_3D"> 
     69         <domain domain_ref="grid_T" /> 
     70         <axis  id="ghw_abl" /> 
     71       </grid> 
     72       <!--  --> 
     73 
    6074    </grid_definition> 
    6175     
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/SHARED/namelist_ice_ref

    r12145 r12182  
    11!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    2 !! SI3 namelist:   
     2!! SI3 Reference namelist: 
    33!!              1 - Generic parameters                 (nampar) 
    44!!              2 - Ice thickness discretization       (namitd) 
     
    6868   ln_str_H79       = .true.          !  ice strength param.: Hibler_79   => P = pstar*<h>*exp(-c_rhg*A)                       
    6969      rn_pstar      =   2.0e+04       !     ice strength thickness parameter [N/m2] 
    70       rn_crhg       =   20.0          !     ice strength conc. parameter (-) 
     70      rn_crhg       =  20.0           !     ice strength conc. parameter (-) 
    7171                   ! -- ice_rdgrft -- ! 
    7272   rn_csrdg         =   0.5           !  fraction of shearing energy contributing to ridging 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/SHARED/namelist_ref

    r12150 r12182  
    6464   ln_clobber  = .true.    !  clobber (overwrite) an existing file 
    6565   nn_chunksz  =       0   !  chunksize (bytes) for NetCDF file (works only with iom_nf90 routines) 
    66    ln_xios_read = .FALSE.  !  use XIOS to read restart file (only for a single file restart) 
     66   ln_xios_read = .false.  !  use XIOS to read restart file (only for a single file restart) 
    6767   nn_wxios = 0      !  use XIOS to write restart file 0 - no, 1 - single file output, 2 - multiple file output 
    6868/ 
     
    115115   ln_tsd_init = .false.         !  ocean initialisation 
    116116   ln_tsd_dmp  = .false.         !  T-S restoring   (see namtra_dmp) 
    117     
     117 
    118118   cn_dir      = './'      !  root directory for the T-S data location 
    119119   !___________!_________________________!___________________!___________!_____________!________!___________!__________________!__________!_______________! 
     
    202202   nn_fsbc     = 2         !  frequency of SBC module call 
    203203      !                    !  (control sea-ice & iceberg model call) 
    204                      ! Type of air-sea fluxes  
     204                     ! Type of air-sea fluxes 
    205205   ln_usr      = .false.   !  user defined formulation                  (T => check usrdef_sbc) 
    206206   ln_flx      = .false.   !  flux formulation                          (T => fill namsbc_flx ) 
    207207   ln_blk      = .false.   !  Bulk formulation                          (T => fill namsbc_blk ) 
     208   ln_abl      = .false.   !  ABL  formulation                          (T => fill namsbc_abl ) 
    208209      !              ! Type of coupling (Ocean/Ice/Atmosphere) : 
    209210   ln_cpl      = .false.   !  atmosphere coupled   formulation          ( requires key_oasis3 ) 
     
    212213      !                    !  =0 no opa-sas OASIS coupling: default single executable config. 
    213214      !                    !  =1 opa-sas OASIS coupling: multi executable config., OPA component 
    214       !                    !  =2 opa-sas OASIS coupling: multi executable config., SAS component  
     215      !                    !  =2 opa-sas OASIS coupling: multi executable config., SAS component 
    215216                     ! Sea-ice : 
    216    nn_ice      = 0         !  =0 no ice boundary condition     
     217   nn_ice      = 0         !  =0 no ice boundary condition 
    217218      !                    !  =1 use observed ice-cover                 (  => fill namsbc_iif ) 
    218219      !                    !  =2 or 3 automatically for SI3 or CICE    ("key_si3" or "key_cice") 
     
    220221   ln_ice_embd = .false.   !  =T embedded sea-ice (pressure + mass and salt exchanges) 
    221222      !                    !  =F levitating ice (no pressure, mass and salt exchanges) 
    222                      ! Misc. options of sbc :  
     223                     ! Misc. options of sbc : 
    223224   ln_traqsr   = .false.   !  Light penetration in the ocean            (T => fill namtra_qsr) 
    224225   ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave 
     
    231232   ln_wave     = .false.   !  Activate coupling with wave  (T => fill namsbc_wave) 
    232233   ln_cdgw     = .false.   !  Neutral drag coefficient read from wave model (T => ln_wave=.true. & fill namsbc_wave) 
    233    ln_sdw      = .false.   !  Read 2D Surf Stokes Drift & Computation of 3D stokes drift (T => ln_wave=.true. & fill namsbc_wave)  
     234   ln_sdw      = .false.   !  Read 2D Surf Stokes Drift & Computation of 3D stokes drift (T => ln_wave=.true. & fill namsbc_wave) 
    234235   nn_sdrift   =  0        !  Parameterization for the calculation of 3D-Stokes drift from the surface Stokes drift 
    235236      !                    !   = 0 Breivik 2015 parameterization: v_z=v_0*[exp(2*k*z)/(1-8*k*z)] 
     
    256257/ 
    257258!----------------------------------------------------------------------- 
    258 &namsbc_blk    !   namsbc_blk  generic Bulk formula                     (ln_blk =T) 
     259&namsbc_blk    !   namsbc_blk  generic Bulk formula          (ln_blk =T) 
    259260!----------------------------------------------------------------------- 
    260261   !                    !  bulk algorithm : 
    261    ln_NCAR     = .false.   ! "NCAR"      algorithm   (Large and Yeager 2008) 
     262   ln_NCAR      = .true.    ! "NCAR"      algorithm   (Large and Yeager 2008) 
    262263   ln_COARE_3p0 = .false.   ! "COARE 3.0" algorithm   (Fairall et al. 2003) 
    263    ln_COARE_3p5 = .false.   ! "COARE 3.5" algorithm   (Edson et al. 2013) 
    264    ln_ECMWF    = .false.   ! "ECMWF"     algorithm   (IFS cycle 31) 
     264   ln_COARE_3p6 = .false.   ! "COARE 3.6" algorithm   (Edson et al. 2013) 
     265   ln_ECMWF     = .false.   ! "ECMWF"     algorithm   (IFS cycle 45r1) 
    265266      ! 
    266       rn_zqt      = 10.       !  Air temperature & humidity reference height (m) 
    267       rn_zu       = 10.       !  Wind vector reference height (m) 
    268       ln_Cd_L12   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2012) 
    269       ln_Cd_L15   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2015) 
    270       ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data 
    271       rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow) 
    272       rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.) 
    273       rn_vfac     = 0.        !  multiplicative factor for ocean & ice velocity used to 
    274       !                       !  calculate the wind stress (0.=absolute or 1.=relative winds) 
    275  
     267      rn_zqt     = 10.      !  Air temperature & humidity reference height (m) 
     268      rn_zu      = 10.      !  Wind vector reference height (m) 
     269      ln_Cd_L12  = .false.  !  air-ice drags = F(ice conc.) (Lupkes et al. 2012) 
     270      ln_Cd_L15  = .false.  !  air-ice drags = F(ice conc.) (Lupkes et al. 2015) 
     271      !                     !  - module of the mean stress" data 
     272      rn_pfac    = 1.       !  multipl. factor for precipitation (total & snow) 
     273      rn_efac    = 1.       !  multipl. factor for evaporation (0. or 1.) 
     274      rn_vfac    = 0.       !  multipl. factor for ocean & ice velocity  
     275      !                     !  used to calculate the wind stress 
     276      !                     ! (0. => absolute or 1. => relative winds) 
     277      ln_skin_cs = .false.  !  use the cool-skin parameterization 
     278      ln_skin_wl = .false.  !  use the warm-layer parameterization 
     279      !                     !   ==> only available in ECMWF and COARE algorithms 
     280      ln_humi_sph = .true.  !  humidity "sn_humi" is specific humidity  [kg/kg] 
     281      ln_humi_dpt = .false. !  humidity "sn_humi" is dew-point temperature [K] 
     282      ln_humi_rlh = .false. !  humidity "sn_humi" is relative humidity     [%] 
     283   ! 
    276284   cn_dir      = './'      !  root directory for the bulk data location 
    277285   !___________!_________________________!___________________!___________!_____________!________!___________!______________________________________!__________!_______________! 
     
    284292   sn_tair     = 't_10.15JUNE2009_fill'       ,    6.        , 'T_10_MOD',   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    285293   sn_humi     = 'q_10.15JUNE2009_fill'       ,    6.        , 'Q_10_MOD',   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
     294   sn_hpgi     = 'NONE'                       ,   24.        , 'uhpg'    ,   .false.   , .false., 'monthly' , 'weights_ERAI3D_F128_2_ORCA2_bicubic', 'UG'     , '' 
     295   sn_hpgj     = 'NONE'                       ,   24.        , 'vhpg'    ,   .false.   , .false., 'monthly' , 'weights_ERAI3D_F128_2_ORCA2_bicubic', 'VG'     , '' 
    286296   sn_prec     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'PRC_MOD1',   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    287297   sn_snow     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'SNOW'    ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    288298   sn_slp      = 'slp.15JUNE2009_fill'        ,    6.        , 'SLP'     ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    289    sn_tdif     = 'taudif_core'                ,   24         , 'taudif'  ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
     299/ 
     300!----------------------------------------------------------------------- 
     301&namsbc_abl    !   Atmospheric Boundary Layer formulation           (ln_abl = T) 
     302!----------------------------------------------------------------------- 
     303   cn_dir           = './'      !  root directory for the location of the ABL grid file 
     304   cn_dom           = 'dom_cfg_abl.nc' 
     305 
     306   cn_ablrst_in     = "restart_abl"   !  suffix of abl restart name (input) 
     307   cn_ablrst_out    = "restart_abl"   !  suffix of abl restart name (output) 
     308   cn_ablrst_indir  = "."             !  directory to read   input abl restarts 
     309   cn_ablrst_outdir = "."             !  directory to write output abl restarts 
     310 
     311   ln_hpgls_frc   = .false. 
     312   ln_geos_winds  = .false. 
     313   nn_dyn_restore = 2         ! restoring option for dynamical ABL variables: = 0 no restoring 
     314                              !                                               = 1 equatorial restoring 
     315                              !                                               = 2 global restoring 
     316   rn_ldyn_min   =  4.5       !  magnitude of the nudging on ABL dynamics at the bottom of the ABL   [hour] 
     317   rn_ldyn_max   =  1.5       !  magnitude of the nudging on ABL dynamics at the top of the ABL   [hour] 
     318   rn_ltra_min   =  4.5       !  magnitude of the nudging on ABL tracers  at the bottom of the ABL   [hour] 
     319   rn_ltra_max   =  1.5       !  magnitude of the nudging on ABL tracers  at the top of the ABL   [hour] 
     320   nn_amxl       =  0         ! mixing length: = 0 Deardorff 80 length-scale 
     321                              !                = 1 length-scale based on the distance to the PBL height 
     322                              !                = 2 Bougeault & Lacarrere 89 length-scale 
     323   rn_Cm         = 0.0667     ! 0.126 in MesoNH 
     324   rn_Ct         = 0.1667     ! 0.143 in MesoNH 
     325   rn_Ce         = 0.4        ! 0.4   in MesoNH 
     326   rn_Ceps       = 0.7        ! 0.85  in MesoNH 
     327   rn_Rod        = 0.15       ! c0 in RMCA17 mixing length formulation (not yet implemented) 
     328   rn_Ric        = 0.139      !  Critical Richardson number (to compute PBL height and diffusivities) 
    290329/ 
    291330!----------------------------------------------------------------------- 
     
    381420   nn_chldta   =      0       !  RGB : Chl data (=1) or cst value (=0) 
    382421   rn_si1      =   23.0       !  2BD : longest depth of extinction 
    383     
     422 
    384423   cn_dir      = './'      !  root directory for the chlorophyl data location 
    385424   !___________!_________________________!___________________!___________!_____________!________!___________!__________________!__________!_______________! 
     
    599638!----------------------------------------------------------------------- 
    600639   ln_tide     = .false.      ! Activate tides 
    601       ln_tide_pot   = .true.                !  use tidal potential forcing 
     640      ln_tide_pot   = .false.               !  use tidal potential forcing 
    602641         ln_scal_load  = .false.               ! Use scalar approximation for 
    603642            rn_scal_load = 0.094               !     load potential 
    604643         ln_read_load  = .false.               ! Or read load potential from file 
    605644            cn_tide_load = 'tide_LOAD_grid_T.nc'  ! filename for load potential 
    606             !       
     645            ! 
    607646      ln_tide_ramp  = .false.               !  Use linear ramp for tides at startup 
    608647         rdttideramp   =    0.                 !  ramp duration in days 
     
    683722   filtide          = 'bdydta/amm12_bdytide_'   !  file name root of tidal forcing files 
    684723   ln_bdytide_2ddta = .false.                   ! 
    685    ln_bdytide_conj  = .false.                   !  
     724   ln_bdytide_conj  = .false.                   ! 
    686725/ 
    687726 
     
    710749!----------------------------------------------------------------------- 
    711750   rn_Cd0      =  1.e-3    !  drag coefficient [-] 
    712    rn_Uc0      =  0.4      !  ref. velocity [m/s] (linear drag=Cd0*Uc0)  
     751   rn_Uc0      =  0.4      !  ref. velocity [m/s] (linear drag=Cd0*Uc0) 
    713752   rn_Cdmax    =  0.1      !  drag value maximum [-] (logarithmic drag) 
    714753   rn_ke0      =  2.5e-3   !  background kinetic energy  [m2/s2] (non-linear cases) 
     
    721760!----------------------------------------------------------------------- 
    722761   rn_Cd0      =  1.e-3    !  drag coefficient [-] 
    723    rn_Uc0      =  0.4      !  ref. velocity [m/s] (linear drag=Cd0*Uc0)  
     762   rn_Uc0      =  0.4      !  ref. velocity [m/s] (linear drag=Cd0*Uc0) 
    724763   rn_Cdmax    =  0.1      !  drag value maximum [-] (logarithmic drag) 
    725764   rn_ke0      =  2.5e-3   !  background kinetic energy  [m2/s2] (non-linear cases) 
     
    788827      nn_cen_v   =  4            !  =2/4, vertical   2nd order CEN / 4th order COMPACT 
    789828   ln_traadv_fct = .false. !  FCT scheme 
    790       nn_fct_h   =  2            !  =2/4, horizontal 2nd / 4th order  
    791       nn_fct_v   =  2            !  =2/4, vertical   2nd / COMPACT 4th order  
     829      nn_fct_h   =  2            !  =2/4, horizontal 2nd / 4th order 
     830      nn_fct_v   =  2            !  =2/4, vertical   2nd / COMPACT 4th order 
    792831   ln_traadv_mus = .false. !  MUSCL scheme 
    793832      ln_mus_ups = .false.       !  use upstream scheme near river mouths 
     
    810849   ln_traldf_triad = .false.   !  iso-neutral (triad    operator) 
    811850   ! 
    812    !                       !  iso-neutral options:         
     851   !                       !  iso-neutral options: 
    813852   ln_traldf_msc   = .false.   !  Method of Stabilizing Correction      (both operators) 
    814853   rn_slpmax       =  0.01     !  slope limit                           (both operators) 
     
    820859   nn_aht_ijk_t    = 0         !  space/time variation of eddy coefficient: 
    821860      !                             !   =-20 (=-30)    read in eddy_diffusivity_2D.nc (..._3D.nc) file 
    822       !                             !   =  0           constant  
    823       !                             !   = 10 F(k)      =ldf_c1d  
    824       !                             !   = 20 F(i,j)    =ldf_c2d  
     861      !                             !   =  0           constant 
     862      !                             !   = 10 F(k)      =ldf_c1d 
     863      !                             !   = 20 F(i,j)    =ldf_c2d 
    825864      !                             !   = 21 F(i,j,t)  =Treguier et al. JPO 1997 formulation 
    826865      !                             !   = 30 F(i,j,k)  =ldf_c2d * ldf_c1d 
    827866      !                             !   = 31 F(i,j,k,t)=F(local velocity and grid-spacing) 
    828       !                        !  time invariant coefficients:  aht0 = 1/2  Ud*Ld   (lap case)  
     867      !                        !  time invariant coefficients:  aht0 = 1/2  Ud*Ld   (lap case) 
    829868      !                             !                           or   = 1/12 Ud*Ld^3 (blp case) 
    830869      rn_Ud        = 0.01           !  lateral diffusive velocity [m/s] (nn_aht_ijk_t= 0, 10, 20, 30) 
     
    852891      nn_aei_ijk_t    = 0           !  space/time variation of eddy coefficient: 
    853892      !                             !   =-20 (=-30)    read in eddy_induced_velocity_2D.nc (..._3D.nc) file 
    854       !                             !   =  0           constant  
    855       !                             !   = 10 F(k)      =ldf_c1d  
    856       !                             !   = 20 F(i,j)    =ldf_c2d  
     893      !                             !   =  0           constant 
     894      !                             !   = 10 F(k)      =ldf_c1d 
     895      !                             !   = 20 F(i,j)    =ldf_c2d 
    857896      !                             !   = 21 F(i,j,t)  =Treguier et al. JPO 1997 formulation 
    858897      !                             !   = 30 F(i,j,k)  =ldf_c2d * ldf_c1d 
    859       !                        !  time invariant coefficients:  aei0 = 1/2  Ue*Le  
     898      !                        !  time invariant coefficients:  aei0 = 1/2  Ue*Le 
    860899      rn_Ue        = 0.02           !  lateral diffusive velocity [m/s] (nn_aht_ijk_t= 0, 10, 20, 30) 
    861900      rn_Le        = 200.e+3        !  lateral diffusive length   [m]   (nn_aht_ijk_t= 0, 10) 
     
    897936   rn_lf_cutoff  =  5.0             !  cutoff frequency for low-pass filter  [days] 
    898937   rn_zdef_max   =  0.9             !  maximum fractional e3t deformation 
    899    ln_vvl_dbg    = .true.           !  debug prints    (T/F) 
     938   ln_vvl_dbg    = .false.          !  debug prints    (T/F) 
    900939/ 
    901940!----------------------------------------------------------------------- 
     
    917956   ln_dynvor_eeT = .false. !  energy conserving scheme (een using e3t) 
    918957   ln_dynvor_een = .false. !  energy & enstrophy scheme 
    919       nn_een_e3f = 0          ! =0  e3f = mi(mj(e3t))/4  
     958      nn_een_e3f = 0          ! =0  e3f = mi(mj(e3t))/4 
    920959      !                       ! =1  e3f = mi(mj(e3t))/mi(mj( tmask)) 
    921960   ln_dynvor_msk = .false. !  vorticity multiplied by fmask (=T)        ==>>> PLEASE DO NOT ACTIVATE 
     
    9621001      !                             !  =-30  read in eddy_viscosity_3D.nc file 
    9631002      !                             !  =-20  read in eddy_viscosity_2D.nc file 
    964       !                             !  =  0  constant  
     1003      !                             !  =  0  constant 
    9651004      !                             !  = 10  F(k)=c1d 
    9661005      !                             !  = 20  F(i,j)=F(grid spacing)=c2d 
     
    9681007      !                             !  = 31  F(i,j,k)=F(grid spacing and local velocity) 
    9691008      !                             !  = 32  F(i,j,k)=F(local gridscale and deformation rate) 
    970       !                        !  time invariant coefficients :  ahm = 1/2  Uv*Lv   (lap case)  
     1009      !                        !  time invariant coefficients :  ahm = 1/2  Uv*Lv   (lap case) 
    9711010      !                             !                            or  = 1/12 Uv*Lv^3 (blp case) 
    9721011      rn_Uv      = 0.1              !  lateral viscous velocity [m/s] (nn_ahm_ijk_t= 0, 10, 20, 30) 
     
    10921131                              !        = 0  constant 10 m length scale 
    10931132                              !        = 1  0.5m at the equator to 30m poleward of 40 degrees 
    1094       rn_eice     =   4       !  below sea ice: =0 ON ; =4 OFF when ice fraction > 1/4    
     1133      rn_eice     =   4       !  below sea ice: =0 ON ; =4 OFF when ice fraction > 1/4 
    10951134/ 
    10961135!----------------------------------------------------------------------- 
     
    13551394   ln_ctl = .FALSE.                 ! Toggle all report printing on/off (T/F); Ignored if sn_cfctl%l_config is T 
    13561395     sn_cfctl%l_config = .TRUE.     ! IF .true. then control which reports are written with the following 
    1357        sn_cfctl%l_runstat = .FALSE. ! switches and which areas produce reports with the proc integer settings. 
     1396       sn_cfctl%l_runstat = .TRUE. ! switches and which areas produce reports with the proc integer settings. 
    13581397       sn_cfctl%l_trcstat = .FALSE. ! The default settings for the proc integers should ensure 
    13591398       sn_cfctl%l_oceout  = .FALSE. ! that  all areas report. 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/SPITZ12/EXPREF/namelist_cfg

    r11536 r12182  
    107107   sn_snow     = 'MARv3.6-9km-Svalbard-2hourly_spitz' ,  2. ,  'snow'    ,   .true.    , .false. , 'yearly'  , 'weights_bilin', '' , '' 
    108108   sn_slp      = 'MARv3.6-9km-Svalbard-2hourly_spitz' ,  2. ,  'slp'     ,   .true.    , .false. , 'yearly'  , 'weights_bilin', '' , '' 
    109    sn_tdif     = 'MARv3.6-9km-Svalbard-2hourly_spitz' ,  2. ,  'tdif'    ,   .true.    , .false. , 'yearly'  , 'weights_bilin', '' , '' 
    110109/ 
    111110!----------------------------------------------------------------------- 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/cfgs/ref_cfgs.txt

    r12150 r12182  
    88ORCA2_SAS_ICE OCE ICE NST SAS 
    99ORCA2_ICE_PISCES OCE TOP ICE NST 
     10ORCA2_ICE_ABL OCE ICE ABL 
     11ORCA2_SAS_ICE_ABL OCE SAS ICE ABL 
     12ORCA2_ICE OCE ICE 
    1013SPITZ12 OCE ICE 
    1114WED025 OCE ICE 
     15eORCA025_ICE OCE ICE 
     16eORCA025_ICE_ABL OCE ICE ABL 
     17eORCA025_SAS_ICE_ABL OCE SAS ICE ABL 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/README.rst

    r11761 r12182  
    1 ************************** 
    2 Building the documentation 
    3 ************************** 
    41 
    5 .. todo:: 
    6  
    7  
    8  
    9 :file:`latex`    : LaTeX sources and Latexmk configuration to build reference manuals with :file:`manual_build.sh` 
    10  
    11 :file:`namelists`: Namelist blocks included in the documentation 
    12  
    13 :file:`rst`      : |RST man|_ sources and Sphinx configuration to build this guide hereby with :file:`guide_build.sh` 
    14  
    15 .. |RST man| replace:: reStructuredText (rst) 
    162 
    173.. warning:: 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/.svnignore

    r11593 r12182  
    88*.ilg 
    99*.ind 
    10 *.lo* 
     10*.lof 
     11*.log 
     12*.lot 
    1113*.maf 
    1214*.mtc* 
     
    1416*.pdf 
    1517*.toc 
    16 *.xdv 
    1718_minted-* 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/NEMO/build

    • Property svn:ignore
      •  

        old new  
        1414*.pdf 
        1515*.toc 
        16 *.xdv 
        1716_minted-* 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/NEMO/main/appendices.tex

    r11567 r12182  
    11 
    2 \subfile{../subfiles/apdx_s_coord}      %% A. Generalised vertical coordinate 
    3 \subfile{../subfiles/apdx_diff_opers}   %% B. Diffusive operators 
    4 \subfile{../subfiles/apdx_invariants}   %% C. Discrete invariants of the eqs. 
    5 \subfile{../subfiles/apdx_triads}       %% D. Isoneutral diffusion using triads 
    6 \subfile{../subfiles/apdx_DOMAINcfg}    %% E. Brief notes on DOMAINcfg 
     2\subfile{../subfiles/annex_A}             %% Generalised vertical coordinate 
     3\subfile{../subfiles/annex_B}             %% Diffusive operator 
     4\subfile{../subfiles/annex_C}             %% Discrete invariants of the eqs. 
     5\subfile{../subfiles/annex_iso}            %% Isoneutral diffusion using triads 
     6\subfile{../subfiles/annex_D}             %% Coding rules 
    77 
    88%% Not included 
     
    1010%\subfile{../subfiles/chap_DIU} 
    1111%\subfile{../subfiles/chap_conservation} 
    12 %\subfile{../subfiles/apdx_algos}   %% Notes on some on going staff 
     12%\subfile{../subfiles/annex_E}            %% Notes on some on going staff 
     13 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/NEMO/main/bibliography.bib

    r11674 r12182  
    400400} 
    401401 
    402 @article{         brodeau.barnier.ea_JPO16, 
    403   title         = "Climatologically Significant Effects of Some Approximations in the Bulk Parameterizations of Turbulent AirSea Fluxes", 
     402@article{         brodeau.barnier.ea_JPO17, 
     403  title         = "Climatologically Significant Effects of Some Approximations in the Bulk Parameterizations of Turbulent Air{\textendash}Sea Fluxes", 
    404404  pages         = "5--28", 
    405405  journal       = "Journal of Physical Oceanography", 
     
    407407  number        = "1", 
    408408  author        = "Brodeau, Laurent and Barnier, Bernard and Gulev, Sergey K. and Woods, Cian", 
    409   year          = "2016", 
     409  year          = "2017", 
    410410  month         = "jan", 
    411411  publisher     = "American Meteorological Society", 
     
    31343134  doi           = "10.1029/92jc00911" 
    31353135} 
     3136 
     3137@article{large.yeager_CD09, 
     3138author="Large, W. G. and Yeager, S. G.", 
     3139title="The Global Climatology of an Interannually Varying Air-Sea Flux Data Set", 
     3140pages = "341--364", 
     3141journal="Climate Dynamics", 
     3142volume = "33", 
     3143number = "2-3", 
     3144year="2009", 
     3145month = "aug", 
     3146publisher = "Springer Science and Business Media LLC", 
     3147doi="10.1007/s00382-008-0441-3" 
     3148} 
     3149 
     3150@book{sverdrup.johnson.ea_1942, 
     3151author = {H. U. Sverdrup and Martin W. Johnson and Richard H. Fleming}, 
     3152title = {The Oceans, Their Physics, Chemistry, and General Biology}, 
     3153publisher = {Prentice-Hall}, 
     3154address = {New York}, 
     3155year = {1942}, 
     3156pages = {1087}, 
     3157} 
     3158 
     3159@article{kraus.businger_QJRMS96, 
     3160author = "E. B. Kraus and J. A. Businger", 
     3161title = "Atmosphere-ocean interaction.", 
     3162journal="Quarterly Journal of the Royal Meteorological Society",, 
     3163year = "1996", 
     3164volume = "122", 
     3165number = "529", 
     3166pages = "324-325", 
     3167publisher = "John Wiley & Sons, Ltd", 
     3168issn = "1477-870X", 
     3169doi = "10.1002/qj.49712252914" 
     3170} 
     3171 
     3172@article{josey.gulev.ea_2013, 
     3173title = "Exchanges through the ocean surface", 
     3174journal = "Ocean Circulation and Climate - A 21st Century Perspective, Int. Geophys. Ser.", 
     3175year = "2013", 
     3176author = "S. A. Josey and S. Gulev and L. Yu", 
     3177pages = "115-140, edited by G. Siedler et al., Academic Press, Oxford", 
     3178volume = "103", 
     3179doi = "10.1016/B978-0-12-391851-2.00005-2" 
     3180} 
     3181 
     3182@article{fairall.bradley.ea_JGR96, 
     3183  year = "1996", 
     3184 journal = "Journal of Geophysical Research: Oceans", 
     3185  month = "jan", 
     3186  publisher = "American Geophysical Union", 
     3187  volume = "101", 
     3188  number = "C1", 
     3189  pages = "1295-1308", 
     3190  author = "C. W. Fairall and E. F. Bradley and J. S. Godfrey and G. A. Wick and J. B. Edson and G. S. Young", 
     3191  title = "Cool-skin and warm-layer effects on sea surface temperature", 
     3192  doi = "10.1029/95jc03190" 
     3193} 
     3194 
     3195@article{zeng.beljaars_GRL05, 
     3196  year = "2005", 
     3197  month = "jul", 
     3198  publisher = "American Geophysical Union", 
     3199  volume = "32", 
     3200  number = "14", 
     3201  author = "Xubin Zeng and Anton Beljaars", 
     3202  title = "A prognostic scheme of sea surface skin temperature for modeling and data assimilation", 
     3203  journal = "Geophysical Research Letters", 
     3204  doi = "10.1029/2005gl023030" 
     3205} 
     3206 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/NEMO/main/chapters.tex

    r11567 r12182  
    1 \subfile{../subfiles/chap_model_basics}   %% 1. 
    2 \subfile{../subfiles/chap_time_domain}    %% 2.  Time discretisation (time stepping strategy) 
    3 \subfile{../subfiles/chap_DOM}            %% 3.  Space discretisation 
    4 \subfile{../subfiles/chap_TRA}            %% 4.  Tracer advection/diffusion equation 
    5 \subfile{../subfiles/chap_DYN}            %% 5.  Dynamics : momentum equation 
    6 \subfile{../subfiles/chap_SBC}            %% 6.  Surface Boundary Conditions 
    7 \subfile{../subfiles/chap_LBC}            %% 7.  Lateral Boundary Conditions 
    8 \subfile{../subfiles/chap_LDF}            %% 8.  Lateral diffusion 
    9 \subfile{../subfiles/chap_ZDF}            %% 9.  Vertical diffusion 
    10 \subfile{../subfiles/chap_DIA}            %% 10. Outputs and Diagnostics 
    11 \subfile{../subfiles/chap_OBS}            %% 11. Observation operator 
    12 \subfile{../subfiles/chap_ASM}            %% 12. Assimilation increments 
    13 \subfile{../subfiles/chap_STO}            %% 13. Stochastic param. 
    14 \subfile{../subfiles/chap_misc}           %% 14. Miscellaneous topics 
    15 \subfile{../subfiles/chap_cfgs}           %% 15. Predefined configurations 
    16  
    17 %% Not included 
    18 %\subfile{../subfiles/chap_model_basics_zstar} 
    19 %\subfile{../subfiles/chap_DIU} 
    20 %\subfile{../subfiles/chap_conservation} 
     1\subfile{../subfiles/introduction}        %% Introduction 
     2\subfile{../subfiles/chap_model_basics} 
     3\subfile{../subfiles/chap_time_domain}    %% Time discretisation (time stepping strategy) 
     4\subfile{../subfiles/chap_DOM}            %% Space discretisation 
     5\subfile{../subfiles/chap_TRA}            %% Tracer advection/diffusion equation 
     6\subfile{../subfiles/chap_DYN}            %% Dynamics : momentum equation 
     7\subfile{../subfiles/chap_SBC}            %% Surface Boundary Conditions 
     8\subfile{../subfiles/chap_LBC}            %% Lateral Boundary Conditions 
     9\subfile{../subfiles/chap_LDF}            %% Lateral diffusion 
     10\subfile{../subfiles/chap_ZDF}            %% Vertical diffusion 
     11\subfile{../subfiles/chap_DIA}            %% Outputs and Diagnostics 
     12\subfile{../subfiles/chap_OBS}            %% Observation operator 
     13\subfile{../subfiles/chap_ASM}            %% Assimilation increments 
     14\subfile{../subfiles/chap_STO}            %% Stochastic param. 
     15\subfile{../subfiles/chap_misc}           %% Miscellaneous topics 
     16\subfile{../subfiles/chap_CONFIG}         %% Predefined configurations 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/NEMO/subfiles/chap_SBC.tex

    r11693 r12182  
    11\documentclass[../main/NEMO_manual]{subfiles} 
     2\usepackage{fontspec} 
     3\usepackage{fontawesome} 
    24 
    35\begin{document} 
     
    4547 
    4648\begin{itemize} 
    47 \item a bulk formulation (\np[=.true.]{ln_blk}{ln\_blk} with four possible bulk algorithms), 
     49\item a bulk formulation (\np[=.true.]{ln_blk}{ln\_blk}), featuring a selection of four bulk parameterization algorithms, 
    4850\item a flux formulation (\np[=.true.]{ln_flx}{ln\_flx}), 
    4951\item a coupled or mixed forced/coupled formulation (exchanges with a atmospheric model via the OASIS coupler), 
     
    504506\label{sec:SBC_flx} 
    505507 
     508% Laurent: DO NOT mix up ``bulk formulae'' (the classic equation) and the ``bulk 
     509% parameterization'' (i.e NCAR, COARE, ECMWF...) 
     510 
    506511\begin{listing} 
    507512  \nlst{namsbc_flx} 
     
    520525See \autoref{subsec:SBC_ssr} for its specification. 
    521526 
    522 %% ================================================================================================= 
     527 
     528 
     529 
     530 
     531 
     532 
     533%% ================================================================================================= 
     534\pagebreak 
     535\newpage 
    523536\section[Bulk formulation (\textit{sbcblk.F90})]{Bulk formulation (\protect\mdl{sbcblk})} 
    524537\label{sec:SBC_blk} 
     538 
     539% L. Brodeau, December 2019... % 
    525540 
    526541\begin{listing} 
     
    530545\end{listing} 
    531546 
    532 In the bulk formulation, the surface boundary condition fields are computed with bulk formulae using atmospheric fields 
    533 and ocean (and sea-ice) variables averaged over \np{nn_fsbc}{nn\_fsbc} time-step. 
    534  
    535 The atmospheric fields used depend on the bulk formulae used. 
    536 In forced mode, when a sea-ice model is used, a specific bulk formulation is used. 
    537 Therefore, different bulk formulae are used for the turbulent fluxes computation 
    538 over the ocean and over sea-ice surface. 
    539 For the ocean, four bulk formulations are available thanks to the \href{https://brodeau.github.io/aerobulk/}{Aerobulk} package (\citet{brodeau.barnier.ea_JPO16}): 
    540 the NCAR (formerly named CORE), COARE 3.0, COARE 3.5 and ECMWF bulk formulae. 
    541 The choice is made by setting to true one of the following namelist variable: 
    542  \np{ln_NCAR}{ln\_NCAR}, \np{ln_COARE_3p0}{ln\_COARE\_3p0},  \np{ln_COARE_3p5}{ln\_COARE\_3p5} and  \np{ln_ECMWF}{ln\_ECMWF}. 
    543 For sea-ice, three possibilities can be selected: 
    544 a constant transfer coefficient (1.4e-3; default value), \citet{lupkes.gryanik.ea_JGR12} (\np{ln_Cd_L12}{ln\_Cd\_L12}), and \citet{lupkes.gryanik_JGR15} (\np{ln_Cd_L15}{ln\_Cd\_L15}) parameterizations 
     547If the bulk formulation is selected (\np[=.true.]{ln_blk}{ln\_blk}), the air-sea 
     548fluxes associated with surface boundary conditions are estimated by means of the 
     549traditional \emph{bulk formulae}. As input, bulk formulae rely on a prescribed 
     550near-surface atmosphere state (typically extracted from a weather reanalysis) 
     551and the prognostic sea (-ice) surface state averaged over \np{nn_fsbc}{nn\_fsbc} 
     552time-step(s). 
     553 
     554% Turbulent air-sea fluxes are computed using the sea surface properties and 
     555% atmospheric SSVs at height $z$ above the sea surface, with the traditional 
     556% aerodynamic bulk formulae: 
     557 
     558Note: all the NEMO Fortran routines involved in the present section have been 
     559 initially developed (and are still developed in parallel) in 
     560 the \href{https://brodeau.github.io/aerobulk/}{\texttt{AeroBulk}} open-source project 
     561\citep{brodeau.barnier.ea_JPO17}. 
     562 
     563%%% Bulk formulae are this: 
     564\subsection{Bulk formulae}\label{subsec:SBC_blkform} 
     565% 
     566In NEMO, the set of equations that relate each component of the surface fluxes 
     567to the near-surface atmosphere and sea surface states writes 
     568% 
     569\begin{subequations}\label{eq_bulk} 
     570  \label{eq:SBC_bulk_form} 
     571  \begin{eqnarray} 
     572    \mathbf{\tau} &=& \rho~ C_D ~ \mathbf{U}_z  ~ U_B \\ 
     573    Q_H           &=& \rho~C_H~C_P~\big[ \theta_z - T_s \big] ~ U_B \\ 
     574    E             &=& \rho~C_E    ~\big[    q_s   - q_z \big] ~ U_B \\ 
     575    Q_L           &=& -L_v \, E \\ 
     576    % 
     577    Q_{sr}        &=& (1 - a) Q_{sw\downarrow} \\ 
     578    Q_{ir}        &=& \delta (Q_{lw\downarrow} -\sigma T_s^4) 
     579  \end{eqnarray} 
     580\end{subequations} 
     581% 
     582with 
     583   \[ \theta_z \simeq T_z+\gamma z \] 
     584   \[  q_s \simeq 0.98\,q_{sat}(T_s,p_a ) \] 
     585% 
     586from which, the the non-solar heat flux is \[ Q_{ns} = Q_L + Q_H + Q_{ir} \] 
     587% 
     588where $\mathbf{\tau}$ is the wind stress vector, $Q_H$ the sensible heat flux, 
     589$E$ the evaporation, $Q_L$ the latent heat flux, and $Q_{ir}$ the net longwave 
     590flux. 
     591% 
     592$Q_{sw\downarrow}$ and $Q_{lw\downarrow}$ are the surface downwelling shortwave 
     593and longwave radiative fluxes, respectively. 
     594% 
     595Note: a positive sign for $\mathbf{\tau}$, $Q_H$, $Q_L$, $Q_{sr}$ or $Q_{ir}$ 
     596implies a gain of the relevant quantity for the ocean, while a positive $E$ 
     597implies a freshwater loss for the ocean. 
     598% 
     599$\rho$ is the density of air. $C_D$, $C_H$ and $C_E$ are the bulk transfer 
     600coefficients for momentum, sensible heat, and moisture, respectively. 
     601% 
     602$C_P$ is the heat capacity of moist air, and $L_v$ is the latent heat of 
     603vaporization of water. 
     604% 
     605$\theta_z$, $T_z$ and $q_z$ are the potential temperature, absolute temperature, 
     606and specific humidity of air at height $z$ above the sea surface, 
     607respectively. $\gamma z$ is a temperature correction term which accounts for the 
     608adiabatic lapse rate and approximates the potential temperature at height 
     609$z$ \citep{josey.gulev.ea_2013}. 
     610% 
     611$\mathbf{U}_z$ is the wind speed vector at height $z$ above the sea surface 
     612(possibly referenced to the surface current $\mathbf{u_0}$, 
     613section \ref{s_res1}.\ref{ss_current}). 
     614% 
     615The bulk scalar wind speed, namely $U_B$, is the scalar wind speed, 
     616$|\mathbf{U}_z|$, with the potential inclusion of a gustiness contribution. 
     617% 
     618$a$ and $\delta$ are the albedo and emissivity of the sea surface, respectively.\\ 
     619% 
     620%$p_a$ is the mean sea-level pressure (SLP). 
     621% 
     622$T_s$ is the sea surface temperature. $q_s$ is the saturation specific humidity 
     623of air at temperature $T_s$; it includes a 2\% reduction to account for the 
     624presence of salt in seawater \citep{sverdrup.johnson.ea_1942,kraus.businger_QJRMS96}. 
     625Depending on the bulk parametrization used, $T_s$ can either be the temperature 
     626at the air-sea interface (skin temperature, hereafter SSST) or at typically a 
     627few tens of centimeters below the surface (bulk sea surface temperature, 
     628hereafter SST). 
     629% 
     630The SSST differs from the SST due to the contributions of two effects of 
     631opposite sign, the \emph{cool skin} and \emph{warm layer} (hereafter CS and WL, 
     632respectively, see section\,\ref{subsec:SBC_skin}). 
     633% 
     634Technically, when the ECMWF or COARE* bulk parametrizations are selected 
     635(\np[=.true.]{ln_ECMWF}{ln\_ECMWF} or \np[=.true.]{ln_COARE*}{ln\_COARE\*}), 
     636$T_s$ is the SSST, as opposed to the NCAR bulk parametrization 
     637(\np[=.true.]{ln_NCAR}{ln\_NCAR}) for which $T_s$ is the bulk SST (\ie~temperature 
     638at first T-point level). 
     639 
     640For more details on all these aspects the reader is invited to refer 
     641to \citet{brodeau.barnier.ea_JPO17}. 
     642 
     643 
     644 
     645\subsection{Bulk parametrizations}\label{subsec:SBC_blk_ocean} 
     646%%%\label{subsec:SBC_param} 
     647 
     648Accuracy of the estimate of surface turbulent fluxes by means of bulk formulae 
     649strongly relies on that of the bulk transfer coefficients: $C_D$, $C_H$ and 
     650$C_E$. They are estimated with what we refer to as a \emph{bulk 
     651parametrization} algorithm. When relevant, these algorithms also perform the 
     652height adjustment of humidity and temperature to the wind reference measurement 
     653height (from \np{rn_zqt}{rn\_zqt} to \np{rn_zu}{rn\_zu}). 
     654 
     655 
     656 
     657For the open ocean, four bulk parametrization algorithms are available in NEMO: 
     658\begin{itemize} 
     659\item NCAR, formerly known as CORE, \citep{large.yeager_rpt04,large.yeager_CD09} 
     660\item COARE 3.0 \citep{fairall.bradley.ea_JC03} 
     661\item COARE 3.6 \citep{edson.jampana.ea_JPO13} 
     662\item ECMWF (IFS documentation, cy45) 
     663\end{itemize} 
     664 
     665 
     666With respect to version 3, the principal advances in version 3.6 of the COARE 
     667bulk parametrization are built around improvements in the representation of the 
     668effects of waves on 
     669fluxes \citep{edson.jampana.ea_JPO13,brodeau.barnier.ea_JPO17}. This includes 
     670improved relationships of surface roughness, and whitecap fraction on wave 
     671parameters. It is therefore recommended to chose version 3.6 over 3. 
     672 
     673 
     674 
     675 
     676\subsection{Cool-skin and warm-layer parametrizations}\label{subsec:SBC_skin} 
     677%\subsection[Cool-skin and warm-layer parameterizations 
     678%(\forcode{ln_skin_cs} \& \forcode{ln_skin_wl})]{Cool-skin and warm-layer parameterizations (\protect\np{ln_skin_cs}{ln\_skin\_cs} \& \np{ln_skin_wl}{ln\_skin\_wl})} 
     679%\label{subsec:SBC_skin} 
     680% 
     681As opposed to the NCAR bulk parametrization, more advanced bulk 
     682parametrizations such as COARE3.x and ECMWF are meant to be used with the skin 
     683temperature $T_s$ rather than the bulk SST (which, in NEMO is the temperature at 
     684the first T-point level, see section\,\ref{subsec:SBC_blkform}). 
     685% 
     686As such, the relevant cool-skin and warm-layer parametrization must be 
     687activated through \np[=T]{ln_skin_cs}{ln\_skin\_cs} 
     688and \np[=T]{ln_skin_wl}{ln\_skin\_wl} to use COARE3.x or ECMWF in a consistent 
     689way. 
     690 
     691\texttt{\#LB: ADD BLBLA ABOUT THE TWO CS/WL PARAMETRIZATIONS (ECMWF and COARE) !!!} 
     692 
     693For the cool-skin scheme parametrization COARE and ECMWF algorithms share the same 
     694basis: \citet{fairall.bradley.ea_JGR96}. With some minor updates based 
     695on \citet{zeng.beljaars_GRL05} for ECMWF, and \citet{fairall.ea_19} for COARE 
     6963.6. 
     697 
     698For the warm-layer scheme, ECMWF is based on \citet{zeng.beljaars_GRL05} with a 
     699recent update from \citet{takaya.bidlot.ea_JGR10} (consideration of the 
     700turbulence input from Langmuir circulation). 
     701 
     702Importantly, COARE warm-layer scheme \citep{fairall.ea_19} includes a prognostic 
     703equation for the thickness of the warm-layer, while it is considered as constant 
     704in the ECWMF algorithm. 
     705 
     706 
     707\subsection{Appropriate use of each bulk parametrization} 
     708 
     709\subsubsection{NCAR} 
     710 
     711NCAR bulk parametrizations (formerly known as CORE) is meant to be used with the 
     712CORE II atmospheric forcing \citep{large.yeager_CD09}. The expected sea surface 
     713temperature is the bulk SST. Hence the following namelist parameters must be 
     714set: 
     715% 
     716\begin{verbatim} 
     717  ... 
     718  ln_NCAR    = .true. 
     719  ... 
     720  rn_zqt     = 10.     ! Air temperature & humidity reference height (m) 
     721  rn_zu      = 10.     ! Wind vector reference height (m) 
     722  ... 
     723  ln_skin_cs = .false. ! use the cool-skin parameterization 
     724  ln_skin_wl = .false. ! use the warm-layer parameterization 
     725  ... 
     726  ln_humi_sph = .true. ! humidity "sn_humi" is specific humidity  [kg/kg] 
     727\end{verbatim} 
     728 
     729 
     730\subsubsection{ECMWF} 
     731% 
     732With an atmospheric forcing based on a reanalysis of the ECMWF, such as the 
     733Drakkar Forcing Set \citep{brodeau.barnier.ea_OM10}, we strongly recommend to 
     734use the ECMWF bulk parametrizations with the cool-skin and warm-layer 
     735parametrizations activated. In ECMWF reanalyzes, since air temperature and 
     736humidity are provided at the 2\,m height, and given that the humidity is 
     737distributed as the dew-point temperature, the namelist must be tuned as follows: 
     738% 
     739\begin{verbatim} 
     740  ... 
     741  ln_ECMWF   = .true. 
     742  ...      
     743  rn_zqt     =  2.     ! Air temperature & humidity reference height (m) 
     744  rn_zu      = 10.     ! Wind vector reference height (m) 
     745  ... 
     746  ln_skin_cs = .true. ! use the cool-skin parameterization 
     747  ln_skin_wl = .true. ! use the warm-layer parameterization 
     748  ... 
     749  ln_humi_dpt = .true. !  humidity "sn_humi" is dew-point temperature [K] 
     750  ... 
     751\end{verbatim} 
     752% 
     753Note: when \np{ln_ECMWF}{ln\_ECMWF} is selected, the selection 
     754of \np{ln_skin_cs}{ln\_skin\_cs} and \np{ln_skin_wl}{ln\_skin\_wl} implicitly 
     755triggers the use of the ECMWF cool-skin and warm-layer parametrizations, 
     756respectively (found in \textit{sbcblk\_skin\_ecmwf.F90}). 
     757 
     758 
     759\subsubsection{COARE 3.x} 
     760% 
     761Since the ECMWF parametrization is largely based on the COARE* parametrization, 
     762the two algorithms are very similar in terms of structure and closure 
     763approach. As such, the namelist tuning for COARE 3.x is identical to that of 
     764ECMWF: 
     765% 
     766\begin{verbatim} 
     767  ... 
     768  ln_COARE3p6 = .true. 
     769  ...      
     770  ln_skin_cs = .true. ! use the cool-skin parameterization 
     771  ln_skin_wl = .true. ! use the warm-layer parameterization 
     772  ... 
     773\end{verbatim} 
     774 
     775Note: when \np[=T]{ln_COARE3p0}{ln\_COARE3p0} is selected, the selection 
     776of \np{ln_skin_cs}{ln\_skin\_cs} and \np{ln_skin_wl}{ln\_skin\_wl} implicitly 
     777triggers the use of the COARE cool-skin and warm-layer parametrizations, 
     778respectively (found in \textit{sbcblk\_skin\_coare.F90}). 
     779 
     780 
     781%lulu 
     782 
     783 
     784 
     785% In a typical bulk algorithm, the BTCs under neutral stability conditions are 
     786% defined using \emph{in-situ} flux measurements while their dependence on the 
     787% stability is accounted through the \emph{Monin-Obukhov Similarity Theory} and 
     788% the \emph{flux-profile} relationships \citep[\eg{}][]{Paulson_1970}. BTCs are 
     789% functions of the wind speed and the near-surface stability of the atmospheric 
     790% surface layer (hereafter ASL), and hence, depend on $U_B$, $T_s$, $T_z$, $q_s$ 
     791% and $q_z$. 
     792 
     793 
     794 
     795\subsection{Prescribed near-surface atmospheric state} 
     796 
     797The atmospheric fields used depend on the bulk formulae used.  In forced mode, 
     798when a sea-ice model is used, a specific bulk formulation is used.  Therefore, 
     799different bulk formulae are used for the turbulent fluxes computation over the 
     800ocean and over sea-ice surface. 
     801% 
     802 
     803%The choice is made by setting to true one of the following namelist 
     804%variable: \np{ln_NCAR}{ln\_NCAR}, \np{ln_COARE_3p0}{ln\_COARE\_3p0}, \np{ln_COARE_3p6}{ln\_COARE\_3p6} 
     805%and \np{ln_ECMWF}{ln\_ECMWF}.  
    545806 
    546807Common options are defined through the \nam{sbc_blk}{sbc\_blk} namelist variables. 
     
    553814    Variable description                 & Model variable & Units              & point \\ 
    554815    \hline 
    555     i-component of the 10m air velocity  & utau           & $m.s^{-1}$         & T     \\ 
     816    i-component of the 10m air velocity  & wndi           & $m.s^{-1}$         & T     \\ 
    556817    \hline 
    557     j-component of the 10m air velocity  & vtau           & $m.s^{-1}$         & T     \\ 
     818    j-component of the 10m air velocity  & wndj           & $m.s^{-1}$         & T     \\ 
    558819    \hline 
    559     10m air temperature                  & tair           & \r{}$K$            & T     \\ 
     820    10m air temperature                  & tair           & $K$               & T     \\ 
    560821    \hline 
    561     Specific humidity                    & humi           & \%                 & T     \\ 
     822    Specific humidity                    & humi           & $-$               & T     \\ 
     823    Relative humidity                    & ~              & $\%$              & T     \\ 
     824    Dew-point temperature                & ~              & $K$               & T     \\     
    562825    \hline 
    563     Incoming long wave radiation         & qlw            & $W.m^{-2}$         & T     \\ 
     826    Downwelling longwave radiation       & qlw            & $W.m^{-2}$         & T     \\ 
    564827    \hline 
    565     Incoming short wave radiation        & qsr            & $W.m^{-2}$         & T     \\ 
     828    Downwelling shortwave radiation      & qsr            & $W.m^{-2}$         & T     \\ 
    566829    \hline 
    567830    Total precipitation (liquid + solid) & precip         & $Kg.m^{-2}.s^{-1}$ & T     \\ 
     
    584847 
    585848\np{cn_dir}{cn\_dir} is the directory of location of bulk files 
    586 \np{ln_taudif}{ln\_taudif} is the flag to specify if we use Hight Frequency (HF) tau information (.true.) or not (.false.) 
     849%\np{ln_taudif}{ln\_taudif} is the flag to specify if we use High Frequency (HF) tau information (.true.) or not (.false.) 
    587850\np{rn_zqt}{rn\_zqt}: is the height of humidity and temperature measurements (m) 
    588851\np{rn_zu}{rn\_zu}: is the height of wind measurements (m) 
     
    595858Its range must be between zero and one, and it is recommended to set it to 0 at low-resolution (ORCA2 configuration). 
    596859 
    597 As for the flux formulation, information about the input data required by the model is provided in 
     860As for the flux parametrization, information about the input data required by the model is provided in 
    598861the namsbc\_blk namelist (see \autoref{subsec:SBC_fldread}). 
    599862 
    600 %% ================================================================================================= 
    601 \subsection[Ocean-Atmosphere Bulk formulae (\textit{sbcblk\_algo\_coare.F90, sbcblk\_algo\_coare3p5.F90, sbcblk\_algo\_ecmwf.F90, sbcblk\_algo\_ncar.F90})]{Ocean-Atmosphere Bulk formulae (\mdl{sbcblk\_algo\_coare}, \mdl{sbcblk\_algo\_coare3p5}, \mdl{sbcblk\_algo\_ecmwf}, \mdl{sbcblk\_algo\_ncar})} 
    602 \label{subsec:SBC_blk_ocean} 
    603  
    604 Four different bulk algorithms are available to compute surface turbulent momentum and heat fluxes over the ocean. 
    605 COARE 3.0, COARE 3.5 and ECMWF schemes mainly differ by their roughness lenghts computation and consequently 
    606 their neutral transfer coefficients relationships with neutral wind. 
    607 \begin{itemize} 
    608 \item NCAR (\np[=.true.]{ln_NCAR}{ln\_NCAR}): The NCAR bulk formulae have been developed by \citet{large.yeager_rpt04}. 
    609   They have been designed to handle the NCAR forcing, a mixture of NCEP reanalysis and satellite data. 
    610   They use an inertial dissipative method to compute the turbulent transfer coefficients 
    611   (momentum, sensible heat and evaporation) from the 10m wind speed, air temperature and specific humidity. 
    612   This \citet{large.yeager_rpt04} dataset is available through 
    613   the \href{http://nomads.gfdl.noaa.gov/nomads/forms/mom4/NCAR.html}{GFDL web site}. 
    614   Note that substituting ERA40 to NCEP reanalysis fields does not require changes in the bulk formulea themself. 
    615   This is the so-called DRAKKAR Forcing Set (DFS) \citep{brodeau.barnier.ea_OM10}. 
    616 \item COARE 3.0 (\np[=.true.]{ln_COARE_3p0}{ln\_COARE\_3p0}): See \citet{fairall.bradley.ea_JC03} for more details 
    617 \item COARE 3.5 (\np[=.true.]{ln_COARE_3p5}{ln\_COARE\_3p5}): See \citet{edson.jampana.ea_JPO13} for more details 
    618 \item ECMWF (\np[=.true.]{ln_ECMWF}{ln\_ECMWF}): Based on \href{https://www.ecmwf.int/node/9221}{IFS (Cy31)} implementation and documentation. 
    619   Surface roughness lengths needed for the Obukhov length are computed following \citet{beljaars_QJRMS95}. 
    620 \end{itemize} 
     863 
     864\subsubsection{Air humidity} 
     865 
     866Air humidity can be provided as three different parameters: specific humidity 
     867[kg/kg], relative humidity [\%], or dew-point temperature [K] (LINK to namelist 
     868parameters)... 
     869 
     870 
     871~\\ 
     872 
     873 
     874 
     875 
     876 
     877 
     878 
     879 
     880 
     881 
     882%% ================================================================================================= 
     883%\subsection[Ocean-Atmosphere Bulk formulae (\textit{sbcblk\_algo\_coare3p0.F90, sbcblk\_algo\_coare3p6.F90, %sbcblk\_algo\_ecmwf.F90, sbcblk\_algo\_ncar.F90})]{Ocean-Atmosphere Bulk formulae (\mdl{sbcblk\_algo\_coare3p0}, %\mdl{sbcblk\_algo\_coare3p6}, \mdl{sbcblk\_algo\_ecmwf}, \mdl{sbcblk\_algo\_ncar})} 
     884%\label{subsec:SBC_blk_ocean} 
     885 
     886%Four different bulk algorithms are available to compute surface turbulent momentum and heat fluxes over the ocean. 
     887%COARE 3.0, COARE 3.6 and ECMWF schemes mainly differ by their roughness lenghts computation and consequently 
     888%their neutral transfer coefficients relationships with neutral wind. 
     889%\begin{itemize} 
     890%\item NCAR (\np[=.true.]{ln_NCAR}{ln\_NCAR}): The NCAR bulk formulae have been developed by \citet{large.yeager_rpt04}. 
     891%  They have been designed to handle the NCAR forcing, a mixture of NCEP reanalysis and satellite data. 
     892%  They use an inertial dissipative method to compute the turbulent transfer coefficients 
     893%  (momentum, sensible heat and evaporation) from the 10m wind speed, air temperature and specific humidity. 
     894%  This \citet{large.yeager_rpt04} dataset is available through 
     895%  the \href{http://nomads.gfdl.noaa.gov/nomads/forms/mom4/NCAR.html}{GFDL web site}. 
     896%  Note that substituting ERA40 to NCEP reanalysis fields does not require changes in the bulk formulea themself. 
     897%  This is the so-called DRAKKAR Forcing Set (DFS) \citep{brodeau.barnier.ea_OM10}. 
     898%\item COARE 3.0 (\np[=.true.]{ln_COARE_3p0}{ln\_COARE\_3p0}): See \citet{fairall.bradley.ea_JC03} for more details 
     899%\item COARE 3.6 (\np[=.true.]{ln_COARE_3p6}{ln\_COARE\_3p6}): See \citet{edson.jampana.ea_JPO13} for more details 
     900%\item ECMWF (\np[=.true.]{ln_ECMWF}{ln\_ECMWF}): Based on \href{https://www.ecmwf.int/node/9204}{IFS (Cy40r1)} %implementation and documentation. 
     901%  Surface roughness lengths needed for the Obukhov length are computed 
     902%  following \citet{beljaars_QJRMS95}. 
     903%\end{itemize} 
    621904 
    622905%% ================================================================================================= 
    623906\subsection{Ice-Atmosphere Bulk formulae} 
    624907\label{subsec:SBC_blk_ice} 
     908 
     909 
     910\texttt{\#out\_of\_place:} 
     911 For sea-ice, three possibilities can be selected: 
     912a constant transfer coefficient (1.4e-3; default 
     913value), \citet{lupkes.gryanik.ea_JGR12} (\np{ln_Cd_L12}{ln\_Cd\_L12}), 
     914and \citet{lupkes.gryanik_JGR15} (\np{ln_Cd_L15}{ln\_Cd\_L15}) parameterizations 
     915\texttt{\#out\_of\_place.} 
     916 
     917 
     918 
    625919 
    626920Surface turbulent fluxes between sea-ice and the atmosphere can be computed in three different ways: 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/SI3/build

    • Property svn:ignore
      •  

        old new  
        1414*.pdf 
        1515*.toc 
        16 *.xdv 
        1716_minted-* 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/SI3/main/chapters.tex

    r11537 r12182  
    11\subfile{../subfiles/todolist} 
     2 
     3\subfile{../subfiles/introduction}               % Introduction 
    24 
    35\subfile{../subfiles/chap_model_basics} 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/TOP/build

    • Property svn:ignore
      •  

        old new  
        1414*.pdf 
        1515*.toc 
        16 *.xdv 
        1716_minted-* 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/TOP/main/chapters.tex

    r11591 r12182  
     1\subfile{../subfiles/introduction} 
    12\subfile{../subfiles/model_description} 
    23\subfile{../subfiles/model_setup} 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global

    • Property svn:ignore set to
      *.aux
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global/document.tex

    r11693 r12182  
    11 
    2 %% ================================================================================================= 
    3 %% Template structure for reference manuals 
    4 %% ================================================================================================= 
     2%% ============================================================================== 
     3%% Template structure for reference manual 
     4%% ============================================================================== 
    55 
    66%% NEMO release version 
    7 \def \version{trunk} 
     7\def \version{4.0rc~} 
    88 
    99%% Preamble 
    10 %% ================================================================================================= 
     10%% ============================================================================== 
    1111 
    1212%% Document layout 
    13 \documentclass[fontsize = 10pt, twoside, abstract]{scrreprt} 
     13\documentclass[draft]{scrreprt} 
    1414 
    15 %% Load manual configuration 
    16 \input{../../global/prologue} 
     15%% Load the configuration of the manual 
     16\input{../main/definitions} 
     17 
     18%% Load global *.tex files 
     19\input{../../global/preamble} 
     20 
     21\dominitoc 
     22 
     23%% Launch the creation of the indexes 
     24\input{../../global/indexes} 
     25 
    1726 
    1827%% End of common preamble between main and sub-files 
    1928%% Override custom cmds for full manual compilation 
    20 \newcommand{\subinc}[1]{#1} 
    21 \newcommand{\subexc}[1]{} 
     29\newcommand{\onlyinsubfile}[1]{#1} 
     30\newcommand{\notinsubfile}[1]{} 
    2231 
    2332\begin{document} 
    2433 
    25 \renewcommand{\subinc}[1]{} 
    26 \renewcommand{\subexc}[1]{#1} 
     34\renewcommand{\onlyinsubfile}[1]{} 
     35\renewcommand{\notinsubfile}[1]{#1} 
     36 
     37\renewcommand{\biblio}{} 
     38\renewcommand{\pindex}{} 
    2739 
    2840 
    2941%% Frontmatter 
    30 %% ================================================================================================= 
     42%% ============================================================================== 
    3143 
    32 \pagenumbering{gobble}   %% Disable page numbering temporarily 
     44\pagenumbering{gobble} 
    3345 
    3446%% Title page 
    3547\input{../../global/frontpage} 
    3648 
    37 %% Footer for introductory parts (no header by cleaning default) 
    38 \ofoot[]{\engine\ Reference Manual} \ifoot[]{\pagemark} 
     49\maketitle 
     50\emptythanks 
    3951 
    4052%% Information page (2nd page) 
    4153\input{../../global/info_page} 
    4254 
    43 \listoffigures 
    44 \listoflistings 
    45 \listoftables 
    46  
    47 \clearpage 
    48  
     55%% Foreword 
     56%\frontmatter   %% Chapter numbering off and Roman numerals for page numbers 
    4957\pagenumbering{roman} 
    50 \ofoot[]{\engine\ Reference Manual} \ifoot[]{\pagemark} 
    51  
    52 \input{introduction} 
     58\input{foreword} 
    5359 
    5460%% Table of Contents 
    5561\tableofcontents 
     62\listoffigures 
     63\listoftables 
     64\listoflistings 
    5665 
    5766\clearpage 
     67%\end{document} 
    5868 
    5969 
    6070%% Mainmatter 
    61 %% ================================================================================================= 
     71%% ============================================================================== 
    6272 
    63 %% Headings for document body 
     73%\mainmatter   %% Chapter numbering on, page numbering is reset with Arabic numerals 
    6474\pagenumbering{arabic} 
    65 \lohead{Chap.\ \thechapter\ \leftmark} \rehead{Sect.\ \thesection\ \rightmark} 
    66 \ifoot[]{Page\ \pagemark\ of \pageref*{LastPage}} 
    6775 
    6876\include{chapters} 
     
    7078 
    7179%% Appendix 
    72 %% ================================================================================================= 
     80%% ============================================================================== 
    7381 
    74 \appendix   %% Chapter numbering with letters by now 
    75 \lohead{Apdx\ \thechapter\ \leftmark} 
     82%% Chapter numbering is reset with letters now 
     83\appendix    
     84 
    7685\include{appendices} 
    77  
    78 %% Append coding rules for every manual 
    79 \input{../../global/coding_rules} 
    8086 
    8187 
    8288%% Backmatter 
    83 %% ================================================================================================= 
     89%% ============================================================================== 
    8490 
    85 %% Bibliography and indexes 
    86 \input{../../global/epilogue} 
     91%\backmatter   %% Chapter numbering off 
     92 
     93%% Bibliography 
     94\phantomsection 
     95\addcontentsline{toc}{chapter}{Bibliography} 
     96\bibliography{../main/bibliography} 
     97 
     98%% Index 
     99\clearpage 
     100\phantomsection 
     101\addcontentsline{toc}{chapter}{Indexes} 
     102\printindex[keys] 
     103\printindex[modules] 
     104\printindex[blocks] 
     105\printindex[parameters] 
     106\printindex[subroutines] 
    87107 
    88108\end{document} 
     109 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global/frontpage.tex

    r11688 r12182  
    11 
    2 \begin{titlepage} 
    3 %  \newgeometry{hmargin = 1.5cm, vmargin = 3cm} 
    4   \setlength{\parindent}{0pt} 
     2\title{\heading} 
     3\author{\firstauthor \and \secondauthor\thanks{\protect\input{thanks}}} 
     4\date{\today} 
    55 
     6\pretitle{ 
    67  \begin{center} 
    7     \begin{minipage}{0.3\textwidth} 
    8       \includegraphics[height=1.5cm]{logos/NEMO_grey} 
    9     \end{minipage}\begin{minipage}{0.6\textwidth} 
    10       \begin{center} 
    11       \Large\slshape 
    12       \textbf{N}ucleus for \textbf{E}uropean \textbf{M}odelling of the \textbf{O}cean \\ 
    13       \medskip 
    14       \hyperref[resources]{\textcolor{black}{ 
    15           \faWordpress \hspace{0.75cm} \faCodeFork      \hspace{0.75cm} 
    16           \faGithub    \hspace{0.75cm} \faCloudDownload \hspace{0.75cm} \faEnvelope 
    17         } 
    18       } 
    19       \end{center} 
    20     \end{minipage} 
     8\begin{figure}[H] 
     9  \begin{minipage}[c]{0.35\textwidth} 
     10    \href{http://www.nemo-ocean.eu}{\includegraphics[width=0.7\textwidth]{logos/NEMO_grey}} 
     11  \end{minipage} 
     12  \hfill 
     13  \begin{minipage}[c]{0.65\textwidth} 
     14    \centering 
     15    \large{\em{{N}ucleus for {E}uropean {M}odelling of the {O}cean}} 
     16  \end{minipage} 
     17\end{figure} 
     18\vfill 
     19    \Huge 
     20} 
     21\posttitle{\par\end{center}\vskip 0.5em} 
     22\preauthor{\begin{center}\Large\lineskip0.5em\begin{tabular}[t]{c}} 
     23\postauthor{\end{tabular}\par\end{center}} 
     24\predate{ 
     25  \vfill 
     26  \begin{center} 
     27    \large Version \version --- 
     28} 
     29\postdate{ 
     30    \par~\\ 
     31    \href{http://doi.org/10.5281/zenodo.\zid}{\includegraphics{{badges/zenodo.\zid}.pdf}} 
    2132  \end{center} 
     33  \vfill 
     34  \begin{center} 
     35    \href{http://www.cmcc.it}{          \includegraphics[height=0.055\textheight]{logos/CMCC}} 
     36    \hspace{0.5em} 
     37    \href{http://www.cnrs.fr}{          \includegraphics[height=0.055\textheight]{logos/CNRS}} 
     38    \hspace{0.9em} 
     39    \href{http://www.mercator-ocean.fr}{\includegraphics[height=0.055\textheight]{logos/MOI} } 
     40    \hspace{0.45em} 
     41    \href{http://www.metoffice.gov.uk}{ \includegraphics[height=0.055\textheight]{logos/UKMO}} 
     42    \hspace{0.5em} 
     43    \href{http://nerc.ukri.org}{        \includegraphics[height=0.055\textheight]{logos/NERC}} \\ 
     44    \large{{\em{C}ommunity \hspace{1.5em} {O}cean \hspace{1.5em} {M}odel}} 
     45  \end{center} 
     46} 
    2247 
    23   \spacetop 
    24   \textcolor{white}{\fontsize{0.8cm}{0.8cm}\selectfont\textbf{\heading}} 
    25   \ifdef{\subheading}{ 
    26     \medskip 
    27     \par 
    28     \textcolor{white}{\Huge \subheading} 
    29   }{} 
    30   \spacedown 
     48\thanksmarkseries{fnsymbol} 
    3149 
    32   \begin{center} 
    33     \LARGE Version \version\ -\ \today \\ 
    34     \medskip 
    35     \href{http://doi.org/10.5281/zenodo.\zid}{ \includegraphics{badges/zenodo.\zid} } 
    36   \end{center} 
    37  
    38   \vfill 
    39  
    40   \begin{minipage}{\authorswidth} 
    41     \raggedleft 
    42     \input{authors} 
    43   \end{minipage}\hspace{15pt}\begin{minipage}{0.02\linewidth} 
    44     \rule{1pt}{\rulelenght} 
    45   \end{minipage}\hspace{ 5pt}\begin{minipage}{\abstractwidth} 
    46     \begin{abstract} 
    47       \input{abstract} 
    48     \end{abstract} 
    49   \end{minipage} 
    50  
    51   \vfill 
    52  
    53   \begin{center} 
    54     \Large 
    55     \href{http://www.cmcc.it          }{ \includegraphics[height=1cm]{logos/CMCC} } \hspace{0.25cm} 
    56     \href{http://www.cnrs.fr          }{ \includegraphics[height=1cm]{logos/CNRS} } \hspace{0.25cm} 
    57     \href{http://www.mercator-ocean.fr}{ \includegraphics[height=1cm]{logos/MOI}  } \hspace{0.25cm} 
    58     \href{http://www.metoffice.gov.uk }{ \includegraphics[height=1cm]{logos/UKMO} } \hspace{0.25cm} 
    59     \href{http://nerc.ukri.org        }{ \includegraphics[height=1cm]{logos/NERC} } \\ 
    60     \medskip 
    61     \slshape 
    62     {C}ommunity \hspace{1.5em} {O}cean \hspace{1.5em} {M}odel \\ 
    63   \end{center} 
    64  
    65 \end{titlepage} 
    66  
    67 \restoregeometry 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global/highlighting.tex

    r11572 r12182  
    22%% ============================================================================== 
    33 
    4 \usepackage[outputdir=../build, chapter, newfloat]{minted} 
     4\usepackage[outputdir=../build]{minted} 
    55 
    66%% Global highlighting style 
    77\definecolor{bg}{HTML}{f8f8f8} 
    88\usemintedstyle{emacs} 
    9 \setminted{bgcolor=bg, fontsize=\scriptsize, breaklines} 
     9\setminted{bgcolor=bg, fontsize=\scriptsize, breaklines, frame=leftline} 
    1010\setminted[xml]{style=borland} %% Specific per language 
    1111 
     
    2222 
    2323%% File 
    24 \newmintedfile[forfile]{fortran}{} 
     24\newmintedfile[forfile]{fortran}{}   % \forfile{../namelists/nam...} 
    2525 
    2626%% Inline 
    27 \newmintinline[forcode]{fortran}{bgcolor=, fontsize=auto}   % \forcode{...} 
    28 \newmintinline[xmlcode]{xml}{    bgcolor=, fontsize=auto}   % \xmlcode{...} 
    29 \newmintinline[snippet]{console}{bgcolor=, fontsize=auto}   % \snippet{...} 
     27\newmintinline[forcode]{fortran}{fontsize=auto, frame=lines}   % \forcode{...} 
     28\newmintinline[xmlcode]{xml}{    fontsize=auto, frame=lines}   % \xmlcode{...} 
     29\newmintinline[snippet]{console}{fontsize=auto, frame=lines}   % \snippet{...} 
    3030 
    3131%% Namelists inclusion 
    3232\newcommand{\nlst}[1]{\forfile{../../../namelists/#1}} 
     33 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global/index.ist

    r11584 r12182  
    11headings_flag 1 
    2 heading_prefix "\\medskip\\hfill\\textnormal{" 
    3 heading_suffix "}\\hfill\\smallskip\n" 
     2heading_prefix "{\\medskip\\hfill\\large\\textsf{\\textbf{" 
     3heading_suffix "}}\\hfill}\\medskip\\nopagebreak\n" 
     4 
    45delim_0 "\\dotfill~" 
     6delim_1 "\\dotfill~" 
     7delim_2 "\\dotfill~" 
     8 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global/info_page.tex

    r11515 r12182  
    22\thispagestyle{plain} 
    33 
    4 %% ================================================================ 
    5 %% Disclaimer 
    6 %% ================================================================ 
     4% ================================================================ 
     5% Disclaimer 
     6% ================================================================ 
    77\subsubsection*{Disclaimer} 
    88 
    99Like all components of the modelling framework, 
    10 the \engine\ core engine is developed under the \href{http://www.cecill.info}{CECILL license}, 
    11 which is a French adaptation of the GNU GPL (\textbf{G}eneral \textbf{P}ublic \textbf{L}icense). 
     10the \engine~core engine is developed under the \href{http://www.cecill.info}{CECILL license}, 
     11which is a French adaptation of the GNU GPL (General Public License). 
    1212Anyone may use it freely for research purposes, and is encouraged to 
    13 communicate back to the development team its own developments and improvements. 
     13communicate back to the NEMO team its own developments and improvements. 
    1414 
    1515The model and the present document have been made available as a service to the community. 
     
    1818Users are encouraged to bring them to our attention. 
    1919 
    20 The authors assume no responsibility for problems, errors, or incorrect usage of \NEMO. 
     20The authors assume no responsibility for problems, errors, or incorrect usage of NEMO. 
    2121 
    22 %% ================================================================ 
    23 %% External resources 
    24 %% ================================================================ 
     22% ================================================================ 
     23% External resources 
     24% ================================================================ 
    2525\subsubsection*{Other resources} 
    26 \label{resources} 
    2726 
    2827Additional information can be found on: 
    2928\begin{itemize} 
    30 \item \faWordpress\ the \href{http://www.nemo-ocean.eu}{website} of the project detailing several 
     29\item the \href{http://www.nemo-ocean.eu}{website} of the project detailing several 
    3130  associated applications and an exhaustive users bibliography 
    32 \item \faCodeFork\ the \href{http://forge.ipsl.jussieu.fr/nemo}{development platform} of 
    33   the model with the code repository for the shared reference and some main resources 
    34   (wiki, ticket system, forums, \ldots) \\ 
    35   \faGithub\ the \href{http://github.com/NEMO-ocean/NEMO-examples} 
    36   {repository of the demonstration cases} for research or training 
    37 \item \faCloudDownload\ the \href{http://zenodo.org/communities/nemo-ocean}{online archive} 
    38   delivering the publications issued by the consortium (manuals, reports, datasets, \ldots) 
    39 \item \faEnvelope\ two mailing lists: 
     31\item the \href{http://forge.ipsl.jussieu.fr/nemo}{development platform} of the model with 
     32  the code repository and some main resources (wiki, ticket system, forums, \ldots) 
     33\item the \href{http://zenodo.org/communities/nemo-ocean}{online archive} 
     34  delivering the publications issued by the consortium 
     35\item two mailing lists: 
    4036  the \href{http://listes.ipsl.fr/sympa/info/nemo-newsletter}{newsletter} for 
    4137  top-down communications from the project 
     
    4541\end{itemize} 
    4642 
    47 %% ================================================================ 
    48 %% Citation 
    49 %% ================================================================ 
     43% ================================================================ 
     44% Citation 
     45% ================================================================ 
    5046\subsubsection*{Citation} 
    5147 
    5248Reference for papers and other publications is as follows: 
    5349 
    54 \medskip 
     50\vspace{0.5cm} 
    5551 
    56 \begin{sloppypar} 
    57   ``{\bfseries \heading}\ifdef{\subheading}{ -- \subheading}{}'', 
    58   {\em Scientific Notes of Climate Modelling Center}, \textbf{\ipslnum} --- ISSN 1288-1619, 
    59   Institut Pierre-Simon Laplace (IPSL), 
    60   \href{https://doi.org/10.5281/zenodo.\zid}{doi:10.5281/zenodo.\zid} 
    61 \end{sloppypar} 
     52%% \sloppy: workaround for breaking DOI URL 
     53\sloppy 
     54``{\bfseries \heading}'',  
     55\firstauthor and \secondauthor,  
     56{\em Scientific Notes of Climate Modelling Center}, \textbf{\ipslnum} --- ISSN 1288-1619,  
     57Institut Pierre-Simon Laplace (IPSL),  
     58\href{https://doi.org/10.5281/zenodo.\zid}{doi:10.5281/zenodo.\zid} 
    6259 
    6360\begin{figure}[b] 
    64   \begin{minipage}[c]{0.7\textwidth} 
    65     \small 
    66     \ttfamily{ 
    67       Scientific Notes of Climate Modelling Center \\ 
    68       ISSN 1288-1619                               \\ 
     61  \begin{minipage}[c]{0.72\textwidth} 
     62    \small\ttfamily{Scientific Notes of Climate Modelling Center \\ 
     63      ISSN 1288-1619                                             \\ 
    6964      Institut Pierre-Simon Laplace (IPSL) 
    7065    } 
     
    7570  \end{minipage} 
    7671\end{figure} 
     72 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global/new_cmds.tex

    r11693 r12182  
    22%% ============================================================================== 
    33 
    4 %% Same slanted font for NEMO and its core engines 
    5 \newcommand{\NEMO  }{\textsl{NEMO}} 
    6 \newcommand{\OPA   }{\textsl{OPA}} 
    7 \newcommand{\SIcube}{\textsl{SI$^3$}} 
    8 \newcommand{\TOP   }{\textsl{TOP}} 
    9 \newcommand{\PISCES}{\textsl{PISCES}} 
    10 \newcommand{\NEMOVAR}{\textsl{NEMOVAR}} 
     4%% Include references and index for compilation of single subfile  
     5\newcommand{\mtoc}{\minitoc} 
     6\newcommand{\biblio}{\bibliography{../main/bibliography}} 
     7\newcommand{\pindex}{\printindex} 
    118 
    12 %% Links for external components 
    13 \newcommand{\AGRIF}{\href{http://agrif.imag.fr}{AGRIF}} 
    14 \newcommand{\CICE }{\href{http://github.com/CICE-Consortium/CICE}{CICE}} 
    15 \newcommand{\OASIS}{\href{http://portal.enes.org/oasis}{OASIS}} 
    16 \newcommand{\XIOS }{\href{http://forge.ipsl.jussieu.fr/ioserver}{XIOS}} 
    17  
    18 %% Fortran in small capitals 
    19 \newcommand{\fortran}{\textsc{Fortran}} 
    20 \newcommand{\fninety}{\textsc{Fortran 90}} 
     9%% NEMO and Fortran in small capitals 
     10\newcommand{\NEMO}{\textsc{nemo}~} 
     11\newcommand{\fortran}{\textsc{Fortran}~} 
     12\newcommand{\fninety}{\textsc{Fortran 90}~} 
    2113 
    2214%% Common aliases 
     
    2618\newcommand{\ztilde}{\ensuremath{\tilde z}} 
    2719\newcommand{\stilde}{\ensuremath{\tilde s}} 
    28 \newcommand{\ie}{\ensuremath{i.e.}} 
    29 \newcommand{\eg}{\ensuremath{e.g.}} 
     20\newcommand{\ie}{\ensuremath{i.e.}~} 
     21\newcommand{\eg}{\ensuremath{e.g.}~} 
    3022 
    3123%% Inline maths 
     
    3325\newcommand{\rdt}{\Delta t} 
    3426 
    35 %% Gurvan's comments 
    36 \newcommand{\cmtgm}[1]{} 
     27%% Text env. for Gurvan 
     28\newcommand{\gmcomment}[1]{} 
    3729 
    3830%% Maths 
    3931\newcommand{\lt}{\left} 
    4032\newcommand{\rt}{\right} 
    41 \newcommand{\vect}[1]{\ensuremath{ \mathbf{#1} }} 
     33\newcommand{\vect}[1]{\ensuremath{\mathbf{#1}}} 
    4234\newcommand{\pd}[2][]{\ensuremath{\frac{\partial #1}{\partial #2}}} 
    4335 
    44 %% Convert chapter/section headings to lowercase 
    45 \renewcommand{\chaptermark}[1]{\markboth{#1}{}} 
    46 \renewcommand{\sectionmark}[1]{\markright{#1}{}} 
    47  
    48 %% Retrieve month name 
    49 \renewcommand{\today}{ 
    50   \ifcase \month\or January\or February\or March\or 
    51                     April\or   May\or      June\or 
    52                     July\or    August\or   September\or 
    53                     October\or November\or December 
    54   \fi, \number \year 
    55 } 
    56  
    57 %% Link to orcid profile 
    58 \newcommand{\orcid}[1]{\href{http://orcid.org/#1}{\textcolor{orcidcolor}\aiOrcidSquare}} 
    59  
    60 %% Workaround for \listoffigures 
    61 \DeclareRobustCommand{\triad}[6][]{\ensuremath{ {}_{#2}^{#3} { \mathbb{#4}_{#1} }_{#5}^{\,#6} }} 
    62  
    63 %% New command for ToC 
    64 \newcommand{\chaptertoc}[1][Table of contents]{% 
    65   \thispagestyle{empty} 
    66   \etocsettocstyle{\addsec*{#1}}{}% 
    67   \localtableofcontents% 
    68   \vfill 
    69 } 
     36%% Workaround for issue with \listoffigures 
     37\DeclareRobustCommand{\triad}[6][]{\ensuremath{{}_{#2}^{#3}{\mathbb{#4}_{#1}}_{#5}^{\,#6}}} 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global/packages.tex

    r11702 r12182  
    33%% ============================================================================== 
    44 
    5 %% 'hyperref' pkg is loaded at the end of the preamble for higher compatibility 
     5\usepackage{natbib}                      %% bib 
     6\usepackage{caption}                     %% caption 
     7\usepackage{xcolor}                      %% color 
     8\usepackage{times}                       %% font 
     9\usepackage{enumitem}                    %% list 
     10\usepackage{amsmath}                     %% maths 
     11%\usepackage{fancyhdr}                    %% page 
     12\usepackage{minitoc}                     %% toc 
     13\usepackage{subfiles}                    %% subdocs 
     14\usepackage{draftwatermark}              %% watermark 
     15\usepackage{titling}                     %% titlepage 
    616 
    7 %% KOMA-script 
    8 \usepackage[footsepline=0.25pt, headsepline=0.25pt]{scrlayer-scrpage} 
    9  
    10 %% customization (layout, header/footer styles & contents, background) 
    11 \usepackage{draftwatermark} 
    12 \usepackage[margin = 2cm]{geometry} 
    13 \usepackage[pages = some]{background}   %% 'some' for title page 
    14 \usepackage[Bjornstrup]{fncychap} 
    15  
    16 %% Fonts 
    17 \usepackage{fontspec} 
    18 %% Issue with fontawesome pkg: path to FontAwesome.otf has to be hard-coded 
    19 \defaultfontfeatures{ 
    20     Path = /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/fontawesome/ 
    21 } 
    22 \usepackage{academicons, fontawesome, newtxtext} 
    23  
    24 %% Formatting 
    25 \usepackage[inline]{enumitem} 
    26 \usepackage{etoc, tabularx, xcolor} 
    27  
    28 %% Graphics 
    29 \usepackage{caption, graphicx, grffile} 
    30  
    31 %% Labels 
    32 \usepackage{lastpage, natbib} 
    33  
    34 %% Mathematics 
    35 \usepackage{amsmath, amssymb, mathtools} 
    36  
    37 %% Versatility 
    38 \usepackage{subfiles} 
     17%% Extensions in bundle package 
     18\usepackage{amssymb, graphicx, tabularx, textcomp} 
     19\usepackage[utf8]{inputenc}              %% input encoding 
    3920 
    4021%% Configuration 
    41 \graphicspath{ {../../../} {../figures/} } 
     22\graphicspath{ {../../figures/} {../../figures/\engine/} } 
     23%\captionsetup{margin=10pt, font={small}, labelsep=colon, labelfont={bf}} 
     24\renewcommand{\bibfont}{\small} 
     25%\renewcommand{\bibsep}{3pt} 
    4226 
    43 %% Missing utmr8a font 
    44 \usepackage{times} 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/latex/global/styles.tex

    r11687 r12182  
    33%% ============================================================================== 
    44 
    5 %% Colors 
    6 \setmanualcolor 
    7 \colorlet{manualcolorshaded}{manualcolor!60} 
    8 \definecolor{orcidcolor}{HTML}{A6CE39} 
     5%\pagestyle{fancy} 
     6\bibliographystyle{../../global/ametsoc} 
     7\renewcommand{\bibpreamble}{\begin{multicols}{2}} 
     8\renewcommand{\bibpostamble}{\end{multicols}} 
     9 
     10%% Additional fonts 
     11\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it} 
    912 
    1013%% Page layout 
    11 \pagestyle{scrheadings} 
    12 \addtokomafont{pagehead}{  \sffamily              } 
    13 \addtokomafont{pagefoot}{  \sffamily \footnotesize} 
    14 \addtokomafont{pagenumber}{\sffamily \slshape     } 
    15 \addtokomafont{chapter}{\color{white}} 
    16 \ohead{} \ofoot{}   %% Clear defaults 
     14%\fancyhf{} 
     15%\fancyhead[LE,RO]{\bfseries\thepage} 
     16%\fancyhead[LO]{\bfseries\hspace{-0em}\rightmark} 
     17%\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} 
     18%\fancyhead[RE]{\bfseries\leftmark} 
     19%\renewcommand{\chaptermark}[1]{\markboth{#1}{}} 
     20%\renewcommand{\headrulewidth}{0.5pt} 
     21%\renewcommand{\footrulewidth}{0pt  } 
     22%\addtolength{\headheight}{2.6pt} 
    1723 
    18 %% Caption 
    19 \captionsetup{font = footnotesize, justification = justified} 
    20  
    21 %% Footnote 
    22 \renewcommand{\thefootnote}{\fnsymbol{footnote}} 
    23  
    24 %% Bibliography 
    25 \bibliographystyle{../../global/ametsoc} 
    26 \renewcommand{\bibfont}{\small} 
    27 \renewcommand{\bibpreamble }{\begin{multicols}{2}} 
    28 \renewcommand{\bibpostamble}{  \end{multicols}   } 
    2924 
    3025%% Catcodes 
    31 \makeatletter 
     26%\makeatletter 
     27%\def\LigneVerticale{\vrule height 5cm depth 2cm\hspace{0.1cm}\relax} 
     28%\def\LignesVerticales{\let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV} 
     29%\def\GrosCarreAvecUnChiffre#1{ 
     30%  \rlap{\vrule height 0.8cm width 1cm depth 0.2cm} 
     31%  \rlap{\hbox to 1cm{\hss\mbox{\color{white} #1}\hss}} 
     32%  \vrule height 0pt width 1cm depth 0pt 
     33%} 
     34%\def\@makechapterhead#1{ 
     35%  \hbox{ 
     36%     \huge\LignesVerticales\hspace{-0.5cm} 
     37%     \GrosCarreAvecUnChiffre{\thechapter}\hspace{0.2cm} 
     38%     \hbox{#1} 
     39%  } 
     40%  \par\vskip 
     41%1cm 
     42%} 
     43%\def\@makeschapterhead#1{ 
     44%  \hbox{ 
     45%     \huge\LignesVerticales 
     46%     \hbox{#1} 
     47%  } 
     48%  \par\vskip 
     49%2cm 
     50%} 
     51%\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else 
     52%  \hbox{} 
     53%  \vspace*{\fill} 
     54%  \vspace{\fill} 
     55%  \thispagestyle{empty} 
     56%  \newpage 
     57%  \if@twocolumn\hbox{}\newpage\fi\fi\fi} 
     58%\def\@seccntformat#1{\protect\makebox[0pt][r]{\csname the#1\endcsname\quad}} 
     59%\makeatother 
    3260 
    33 %% Prevent error with tikz and namelist inclusion 
    34 \global\let\tikz@ensure@dollar@catcode=\relax 
    3561 
    36 %% First page 
    37 \backgroundsetup{ 
    38   firstpage = true, 
    39   scale = 1, angle = 0, opacity = 1, 
    40   contents = { 
    41     \begin{tikzpicture}[remember picture, overlay] 
    42       \path [fill = manualcolor] (-0.5\paperwidth, 7) rectangle (0.5\paperwidth, 10); 
    43     \end{tikzpicture} 
    44   } 
    45 } 
    46  
    47 %% Apply engine color for chapter headings: tweaking snippets from fncychap.sty 
    48 \renewcommand{\DOCH}{% 
    49   \settowidth{\py}{\CNoV\thechapter} 
    50   \addtolength{\py}{-10pt}      % Amount of space by which the 
    51 %                                  % number is shifted right 
    52   \fboxsep=0pt% 
    53   \colorbox{manualcolor}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}% 
    54   \kern-\py\raise20pt% 
    55   \hbox{\color{manualcolorshaded}\CNoV\thechapter}\\% 
    56 } 
    57 \renewcommand{\DOTI}[1]{% 
    58   \nointerlineskip\raggedright% 
    59   \fboxsep=\myhi% 
    60   \vskip-1ex% 
    61   \colorbox{manualcolor}{\parbox[t]{\mylen}{\color{white}\CTV\FmTi{#1}}}\par\nobreak% 
    62   \vskip 40\p@% 
    63 } 
    64 \renewcommand{\DOTIS}[1]{% 
    65   \fboxsep=0pt 
    66   \colorbox{manualcolor}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\% 
    67   \nointerlineskip\raggedright% 
    68   \fboxsep=\myhi% 
    69   \vskip-1ex% Remove white 1pt line 
    70   \colorbox{manualcolor}{\parbox[t]{\mylen}{\color{white}\CTV\FmTi{#1}}}\par\nobreak% 
    71   \vskip 40\p@% 
    72 } 
    73  
    74 %% Temporary fix 
    75 \def\set@curr@file#1{% 
    76   \begingroup 
    77     \escapechar\m@ne 
    78     \xdef\@curr@file{\expandafter\string\csname #1\endcsname}% 
    79   \endgroup 
    80 } 
    81 \def\quote@name#1{"\quote@@name#1\@gobble""} 
    82 \def\quote@@name#1"{#1\quote@@name} 
    83 \def\unquote@name#1{\quote@@name#1\@gobble"} 
    84  
    85 \makeatother 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/doc/namelists/namsbc_blk

    r11703 r12182  
    11!----------------------------------------------------------------------- 
    2 &namsbc_blk    !   namsbc_blk  generic Bulk formula                     (ln_blk =T) 
     2&namsbc_blk    !   namsbc_blk  generic Bulk formula          (ln_blk =T) 
    33!----------------------------------------------------------------------- 
    44   !                    !  bulk algorithm : 
    5    ln_NCAR     = .false.   ! "NCAR"      algorithm   (Large and Yeager 2008) 
     5   ln_NCAR      = .true.    ! "NCAR"      algorithm   (Large and Yeager 2008) 
    66   ln_COARE_3p0 = .false.   ! "COARE 3.0" algorithm   (Fairall et al. 2003) 
    7    ln_COARE_3p5 = .false.   ! "COARE 3.5" algorithm   (Edson et al. 2013) 
    8    ln_ECMWF    = .false.   ! "ECMWF"     algorithm   (IFS cycle 31) 
     7   ln_COARE_3p6 = .false.   ! "COARE 3.6" algorithm   (Edson et al. 2013) 
     8   ln_ECMWF     = .false.   ! "ECMWF"     algorithm   (IFS cycle 45r1) 
    99      ! 
    10       rn_zqt      = 10.       !  Air temperature & humidity reference height (m) 
    11       rn_zu       = 10.       !  Wind vector reference height (m) 
    12       ln_Cd_L12   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2012) 
    13       ln_Cd_L15   = .false.   !  air-ice drags = F(ice concentration) (Lupkes et al. 2015) 
    14       ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data 
    15       rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow) 
    16       rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.) 
    17       rn_vfac     = 0.        !  multiplicative factor for ocean & ice velocity used to 
    18       !                       !  calculate the wind stress (0.=absolute or 1.=relative winds) 
    19  
     10      rn_zqt     = 10.      !  Air temperature & humidity reference height (m) 
     11      rn_zu      = 10.      !  Wind vector reference height (m) 
     12      ln_Cd_L12  = .false.  !  air-ice drags = F(ice conc.) (Lupkes et al. 2012) 
     13      ln_Cd_L15  = .false.  !  air-ice drags = F(ice conc.) (Lupkes et al. 2015) 
     14      !                     !  - module of the mean stress" data 
     15      rn_pfac    = 1.       !  multipl. factor for precipitation (total & snow) 
     16      rn_efac    = 1.       !  multipl. factor for evaporation (0. or 1.) 
     17      rn_vfac    = 0.       !  multipl. factor for ocean & ice velocity  
     18      !                     !  used to calculate the wind stress 
     19      !                     ! (0. => absolute or 1. => relative winds) 
     20      ln_skin_cs = .false.  !  use the cool-skin parameterization 
     21      ln_skin_wl = .false.  !  use the warm-layer parameterization 
     22      !                     !   ==> only available in ECMWF and COARE algorithms 
     23      ln_humi_sph = .true.  !  humidity "sn_humi" is specific humidity  [kg/kg] 
     24      ln_humi_dpt = .false. !  humidity "sn_humi" is dew-point temperature [K] 
     25      ln_humi_rlh = .false. !  humidity "sn_humi" is relative humidity     [%] 
     26   ! 
    2027   cn_dir      = './'      !  root directory for the bulk data location 
    2128   !___________!_________________________!___________________!___________!_____________!________!___________!______________________________________!__________!_______________! 
     
    2835   sn_tair     = 't_10.15JUNE2009_fill'       ,    6.        , 'T_10_MOD',   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    2936   sn_humi     = 'q_10.15JUNE2009_fill'       ,    6.        , 'Q_10_MOD',   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
     37   sn_hpgi     = 'NONE'                       ,   24.        , 'uhpg'    ,   .false.   , .false., 'monthly' , 'weights_ERAI3D_F128_2_ORCA2_bicubic', 'UG'     , '' 
     38   sn_hpgj     = 'NONE'                       ,   24.        , 'vhpg'    ,   .false.   , .false., 'monthly' , 'weights_ERAI3D_F128_2_ORCA2_bicubic', 'VG'     , '' 
    3039   sn_prec     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'PRC_MOD1',   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    3140   sn_snow     = 'ncar_precip.15JUNE2009_fill',   -1.        , 'SNOW'    ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    3241   sn_slp      = 'slp.15JUNE2009_fill'        ,    6.        , 'SLP'     ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    33    sn_tdif     = 'taudif_core'                ,   24         , 'taudif'  ,   .false.   , .true. , 'yearly'  , 'weights_core_orca2_bilinear_noc.nc' , ''       , '' 
    3442/ 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icesbc.F90

    r11960 r12182  
    2727   USE lbclnk         ! lateral boundary conditions (or mpp links) 
    2828   USE timing         ! Timing 
     29   USE fldread        !!GS: needed by agrif 
    2930 
    3031   IMPLICIT NONE 
     
    7172      SELECT CASE( ksbc ) 
    7273         CASE( jp_usr     )   ;    CALL usrdef_sbc_ice_tau( kt )                 ! user defined formulation 
    73          CASE( jp_blk     )   ;    CALL blk_ice_tau                              ! Bulk         formulation 
     74         CASE( jp_blk     )   ;    CALL blk_ice_1( sf(jp_wndi)%fnow(:,:,1), sf(jp_wndj)%fnow(:,:,1),   & 
     75            &                                      sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1),   & 
     76            &                                      sf(jp_slp )%fnow(:,:,1), u_ice, v_ice, tm_su    ,   &   ! inputs 
     77            &                                      putaui = utau_ice, pvtaui = vtau_ice            )       ! outputs                              
     78 !        CASE( jp_abl     )    utau_ice & vtau_ice are computed in ablmod 
    7479         CASE( jp_purecpl )   ;    CALL sbc_cpl_ice_tau( utau_ice , vtau_ice )   ! Coupled      formulation 
    7580      END SELECT 
     
    143148      CASE( jp_usr )              !--- user defined formulation 
    144149                                  CALL usrdef_sbc_ice_flx( kt, h_s, h_i ) 
    145       CASE( jp_blk )              !--- bulk formulation 
    146                                   CALL blk_ice_flx    ( t_su, h_s, h_i, alb_ice )    !  
     150      CASE( jp_blk, jp_abl )  !--- bulk formulation & ABL formulation 
     151                                  CALL blk_ice_2    ( t_su, h_s, h_i, alb_ice, sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1),    & 
     152            &                                           sf(jp_slp)%fnow(:,:,1), sf(jp_qlw)%fnow(:,:,1), sf(jp_prec)%fnow(:,:,1), sf(jp_snow)%fnow(:,:,1) )    !  
    147153         IF( ln_mixcpl        )   CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su, phs=h_s, phi=h_i ) 
    148154         IF( nn_flxdist /= -1 )   CALL ice_flx_dist   ( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_flxdist ) 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/ICE/icevar.F90

    r11732 r12182  
    115115      ! 
    116116      ato_i(:,:) = 1._wp - at_i(:,:)         ! open water fraction   
    117  
     117      ! 
     118      !!GS: tm_su always needed by ABL over sea-ice 
     119      ALLOCATE( z1_at_i(jpi,jpj) ) 
     120      WHERE( at_i(:,:) > epsi20 )   ;   z1_at_i(:,:) = 1._wp / at_i(:,:) 
     121      ELSEWHERE                     ;   z1_at_i(:,:) = 0._wp 
     122      END WHERE 
     123      tm_su(:,:) = SUM( t_su(:,:,:) * a_i(:,:,:) , dim=3 ) * z1_at_i(:,:) 
     124      WHERE( at_i(:,:)<=epsi20 ) tm_su(:,:) = rt0 
     125      ! 
    118126      ! The following fields are calculated for diagnostics and outputs only 
    119127      ! ==> Do not use them for other purposes 
    120128      IF( kn > 1 ) THEN 
    121129         ! 
    122          ALLOCATE( z1_at_i(jpi,jpj) , z1_vt_i(jpi,jpj) , z1_vt_s(jpi,jpj) ) 
    123          WHERE( at_i(:,:) > epsi20 )   ;   z1_at_i(:,:) = 1._wp / at_i(:,:) 
    124          ELSEWHERE                     ;   z1_at_i(:,:) = 0._wp 
    125          END WHERE 
     130         ALLOCATE( z1_vt_i(jpi,jpj) , z1_vt_s(jpi,jpj) ) 
    126131         WHERE( vt_i(:,:) > epsi20 )   ;   z1_vt_i(:,:) = 1._wp / vt_i(:,:) 
    127132         ELSEWHERE                     ;   z1_vt_i(:,:) = 0._wp 
     
    136141         !          
    137142         !                          ! mean temperature (K), salinity and age 
    138          tm_su(:,:) = SUM( t_su(:,:,:) * a_i(:,:,:) , dim=3 ) * z1_at_i(:,:) 
    139143         tm_si(:,:) = SUM( t_si(:,:,:) * a_i(:,:,:) , dim=3 ) * z1_at_i(:,:) 
    140144         om_i (:,:) = SUM( oa_i(:,:,:)              , dim=3 ) * z1_at_i(:,:) 
     
    154158         !                           ! put rt0 where there is no ice 
    155159         WHERE( at_i(:,:)<=epsi20 ) 
    156             tm_su(:,:) = rt0 
    157160            tm_si(:,:) = rt0 
    158161            tm_i (:,:) = rt0 
     
    165168         END WHERE          
    166169         ! 
    167          DEALLOCATE( z1_at_i , z1_vt_i , z1_vt_s ) 
     170         DEALLOCATE( z1_vt_i , z1_vt_s ) 
    168171         ! 
    169172      ENDIF 
     173      ! 
     174      DEALLOCATE( z1_at_i ) 
    170175      ! 
    171176   END SUBROUTINE ice_var_agg 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/DIA/diawri.F90

    r12150 r12182  
    2828   USE isf_oce 
    2929   USE isfcpl 
     30   USE abl            ! abl variables in case ln_abl = .true. 
    3031   USE dom_oce        ! ocean space and time domain 
    3132   USE phycst         ! physical constants 
     
    6869   PUBLIC   dia_wri_state 
    6970   PUBLIC   dia_wri_alloc           ! Called by nemogcm module 
    70  
     71#if ! defined key_iomput    
     72   PUBLIC   dia_wri_alloc_abl       ! Called by sbcabl  module (if ln_abl = .true.) 
     73#endif 
    7174   INTEGER ::   nid_T, nz_T, nh_T, ndim_T, ndim_hT   ! grid_T file 
    7275   INTEGER ::          nb_T              , ndim_bT   ! grid_T file 
     
    7477   INTEGER ::   nid_V, nz_V, nh_V, ndim_V, ndim_hV   ! grid_V file 
    7578   INTEGER ::   nid_W, nz_W, nh_W                    ! grid_W file 
     79   INTEGER ::   nid_A, nz_A, nh_A, ndim_A, ndim_hA   ! grid_ABL file    
    7680   INTEGER ::   ndex(1)                              ! ??? 
    7781   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hT, ndex_hU, ndex_hV 
     82   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hA, ndex_A ! ABL 
    7883   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_T, ndex_U, ndex_V 
    7984   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_bT 
     
    417422         &      ndex_hV(jpi*jpj) , ndex_V(jpi*jpj*jpk) , STAT=ierr(1) ) 
    418423         ! 
    419       dia_wri_alloc = MAXVAL(ierr) 
     424     dia_wri_alloc = MAXVAL(ierr) 
    420425      CALL mpp_sum( 'diawri', dia_wri_alloc ) 
    421426      ! 
    422427   END FUNCTION dia_wri_alloc 
     428  
     429   INTEGER FUNCTION dia_wri_alloc_abl() 
     430      !!---------------------------------------------------------------------- 
     431     ALLOCATE(   ndex_hA(jpi*jpj), ndex_A (jpi*jpj*jpkam1), STAT=dia_wri_alloc_abl) 
     432      CALL mpp_sum( 'diawri', dia_wri_alloc_abl ) 
     433      ! 
     434   END FUNCTION dia_wri_alloc_abl 
    423435 
    424436    
     
    444456      INTEGER  ::   ierr                                     ! error code return from allocation 
    445457      INTEGER  ::   iimi, iima, ipk, it, itmod, ijmi, ijma   ! local integers 
     458      INTEGER  ::   ipka                                     ! ABL 
    446459      INTEGER  ::   jn, ierror                               ! local integers 
    447460      REAL(wp) ::   zsto, zout, zmax, zjulian                ! local scalars 
     
    449462      REAL(wp), DIMENSION(jpi,jpj)   :: zw2d       ! 2D workspace 
    450463      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zw3d       ! 3D workspace 
     464      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zw3d_abl   ! ABL 3D workspace 
    451465      !!---------------------------------------------------------------------- 
    452466      ! 
     
    482496      ijmi = 1      ;      ijma = jpj 
    483497      ipk = jpk 
     498      IF(ln_abl) ipka = jpkam1 
    484499 
    485500      ! define time axis 
     
    584599            &          "m", ipk, gdepw_1d, nz_W, "down" ) 
    585600 
     601         IF( ln_abl ) THEN  
     602         ! Define the ABL grid FILE ( nid_A ) 
     603            CALL dia_nam( clhstnam, nn_write, 'grid_ABL' ) 
     604            IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam    ! filename 
     605            CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit 
     606               &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       & 
     607               &          nit000-1, zjulian, rdt, nh_A, nid_A, domain_id=nidom, snc4chunks=snc4set ) 
     608            CALL histvert( nid_A, "ght_abl", "Vertical T levels",      &  ! Vertical grid: gdept 
     609               &           "m", ipka, ght_abl(2:jpka), nz_A, "up" ) 
     610            !                                                            ! Index of ocean points 
     611         ALLOCATE( zw3d_abl(jpi,jpj,ipka) )  
     612         zw3d_abl(:,:,:) = 1._wp  
     613         CALL wheneq( jpi*jpj*ipka, zw3d_abl, 1, 1., ndex_A , ndim_A  )      ! volume 
     614            CALL wheneq( jpi*jpj     , zw3d_abl, 1, 1., ndex_hA, ndim_hA )      ! surface 
     615         DEALLOCATE(zw3d_abl) 
     616         ENDIF 
    586617 
    587618         ! Declare all the output fields as NETCDF variables 
     
    633664         CALL histdef( nid_T, "sowindsp", "wind speed at 10m"                  , "m/s"    ,   &  ! wndm 
    634665            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    635 ! 
     666         ! 
     667         IF( ln_abl ) THEN 
     668            CALL histdef( nid_A, "t_abl", "Potential Temperature"     , "K"        ,       &  ! t_abl 
     669               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout ) 
     670            CALL histdef( nid_A, "q_abl", "Humidity"                  , "kg/kg"    ,       &  ! q_abl 
     671               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     672            CALL histdef( nid_A, "u_abl", "Atmospheric U-wind   "     , "m/s"        ,     &  ! u_abl 
     673               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout ) 
     674            CALL histdef( nid_A, "v_abl", "Atmospheric V-wind   "     , "m/s"    ,         &  ! v_abl 
     675               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     676            CALL histdef( nid_A, "tke_abl", "Atmospheric TKE   "     , "m2/s2"    ,        &  ! tke_abl 
     677               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     678            CALL histdef( nid_A, "avm_abl", "Atmospheric turbulent viscosity", "m2/s"   ,  &  ! avm_abl 
     679               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     680            CALL histdef( nid_A, "avt_abl", "Atmospheric turbulent diffusivity", "m2/s2",  &  ! avt_abl 
     681               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     682            CALL histdef( nid_A, "pblh", "Atmospheric boundary layer height "  , "m",      &  ! pblh 
     683               &          jpi, jpj, nh_A,  1  , 1, 1   , -99 , 32, clop, zsto, zout )                  
     684#if defined key_si3 
     685            CALL histdef( nid_A, "oce_frac", "Fraction of open ocean"  , " ",      &  ! ato_i 
     686               &          jpi, jpj, nh_A,  1  , 1, 1   , -99 , 32, clop, zsto, zout ) 
     687#endif 
     688            CALL histend( nid_A, snc4chunks=snc4set ) 
     689         ENDIF 
     690         ! 
    636691         IF( ln_icebergs ) THEN 
    637692            CALL histdef( nid_T, "calving"             , "calving mass input"                       , "kg/s"   , & 
     
    791846      CALL histwrite( nid_T, "soicecov", it, fr_i          , ndim_hT, ndex_hT )   ! ice fraction    
    792847      CALL histwrite( nid_T, "sowindsp", it, wndm          , ndim_hT, ndex_hT )   ! wind speed    
    793 ! 
     848      ! 
     849      IF( ln_abl ) THEN  
     850         ALLOCATE( zw3d_abl(jpi,jpj,jpka) ) 
     851         IF( ln_mskland )   THEN  
     852            DO jk=1,jpka 
     853               zw3d_abl(:,:,jk) = tmask(:,:,1) 
     854            END DO        
     855         ELSE 
     856            zw3d_abl(:,:,:) = 1._wp      
     857         ENDIF        
     858         CALL histwrite( nid_A,  "pblh"   , it, pblh(:,:)                  *zw3d_abl(:,:,1     ), ndim_hA, ndex_hA )   ! pblh  
     859         CALL histwrite( nid_A,  "u_abl"  , it, u_abl   (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! u_abl 
     860         CALL histwrite( nid_A,  "v_abl"  , it, v_abl   (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! v_abl 
     861         CALL histwrite( nid_A,  "t_abl"  , it, tq_abl  (:,:,2:jpka,nt_n,1)*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! t_abl 
     862         CALL histwrite( nid_A,  "q_abl"  , it, tq_abl  (:,:,2:jpka,nt_n,2)*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! q_abl        
     863         CALL histwrite( nid_A,  "tke_abl", it, tke_abl (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! tke_abl 
     864         CALL histwrite( nid_A,  "avm_abl", it, avm_abl (:,:,2:jpka       )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! avm_abl 
     865         CALL histwrite( nid_A,  "avt_abl", it, avt_abl (:,:,2:jpka       )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! avt_abl  
     866#if defined key_si3 
     867         CALL histwrite( nid_A,  "oce_frac"   , it, ato_i(:,:)                                  , ndim_hA, ndex_hA )   ! ato_i 
     868#endif 
     869         DEALLOCATE(zw3d_abl) 
     870      ENDIF 
     871      ! 
    794872      IF( ln_icebergs ) THEN 
    795873         ! 
     
    861939         CALL histclo( nid_V ) 
    862940         CALL histclo( nid_W ) 
     941         IF(ln_abl) CALL histclo( nid_A ) 
    863942      ENDIF 
    864943      ! 
     
    883962      INTEGER           , INTENT( in ) ::   Kmm              ! time level index 
    884963      CHARACTER (len=* ), INTENT( in ) ::   cdfile_name      ! name of the file created 
    885       REAL(wp), DIMENSION(jpi,jpj,jpk) :: zisfdebug 
    886964      !! 
    887965      INTEGER :: inum, jk 
     
    9551033         CALL iom_rstput( 0, 0, inum, 'sdvecrtz', wsd            )    ! now StokesDrift k-velocity 
    9561034      ENDIF 
     1035      IF ( ln_abl ) THEN 
     1036         CALL iom_rstput ( 0, 0, inum, "uz1_abl",   u_abl(:,:,2,nt_a  ) )   ! now first level i-wind 
     1037         CALL iom_rstput ( 0, 0, inum, "vz1_abl",   v_abl(:,:,2,nt_a  ) )   ! now first level j-wind 
     1038         CALL iom_rstput ( 0, 0, inum, "tz1_abl",  tq_abl(:,:,2,nt_a,1) )   ! now first level temperature 
     1039         CALL iom_rstput ( 0, 0, inum, "qz1_abl",  tq_abl(:,:,2,nt_a,2) )   ! now first level humidity 
     1040      ENDIF 
    9571041  
    9581042#if defined key_si3 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/IOM/in_out_manager.F90

    r11960 r12182  
    8787   LOGICAL ::   lrst_oce              !: logical to control the oce restart write  
    8888   LOGICAL ::   lrst_ice              !: logical to control the ice restart write  
     89   LOGICAL ::   lrst_abl              !: logical to control the abl restart write  
    8990   INTEGER ::   numror = 0            !: logical unit for ocean restart (read). Init to 0 is needed for SAS (in daymod.F90) 
    9091   INTEGER ::   numrir                !: logical unit for ice   restart (read) 
     92   INTEGER ::   numrar                !: logical unit for abl   restart (read) 
    9193   INTEGER ::   numrow                !: logical unit for ocean restart (write) 
    9294   INTEGER ::   numriw                !: logical unit for ice   restart (write) 
     95   INTEGER ::   numraw                !: logical unit for abl   restart (write) 
    9396   INTEGER ::   nrst_lst              !: number of restart to output next 
    9497 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/IOM/iom.F90

    r12150 r12182  
    2929   USE lib_mpp           ! MPP library 
    3030#if defined key_iomput 
    31    USE sbc_oce  , ONLY :   nn_fsbc         ! ocean space and time domain 
     31   USE sbc_oce  , ONLY :   nn_fsbc, ght_abl, ghw_abl, e3t_abl, e3w_abl, jpka, jpkam1 
    3232   USE icb_oce  , ONLY :   nclasses, class_num       !  !: iceberg classes 
    3333#if defined key_si3 
     
    111111      ! 
    112112      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zt_bnds, zw_bnds 
     113      REAL(wp), DIMENSION(2,jpkam1)         :: za_bnds   ! ABL vertical boundaries 
    113114      LOGICAL ::   ll_tmppatch = .TRUE.    !: seb: patch before we remove periodicity 
    114115      INTEGER ::   nldi_save, nlei_save    !:      and close boundaries in output files 
     
    194195      ! vertical grid definition 
    195196      IF(.NOT.llrst_context) THEN 
    196           CALL iom_set_axis_attr( "deptht",  paxis = gdept_1d ) 
    197           CALL iom_set_axis_attr( "depthu",  paxis = gdept_1d ) 
    198           CALL iom_set_axis_attr( "depthv",  paxis = gdept_1d ) 
    199           CALL iom_set_axis_attr( "depthw",  paxis = gdepw_1d ) 
    200  
     197          CALL iom_set_axis_attr(  "deptht", paxis = gdept_1d ) 
     198          CALL iom_set_axis_attr(  "depthu", paxis = gdept_1d ) 
     199          CALL iom_set_axis_attr(  "depthv", paxis = gdept_1d ) 
     200          CALL iom_set_axis_attr(  "depthw", paxis = gdepw_1d ) 
     201 
     202          ! ABL 
     203          IF( .NOT. ALLOCATED(ght_abl) ) THEN   ! force definition for xml files (xios)  
     204             ALLOCATE( ght_abl(jpka), ghw_abl(jpka), e3t_abl(jpka), e3w_abl(jpka) )   ! default allocation needed by iom 
     205             ght_abl(:) = -1._wp   ;   ghw_abl(:) = -1._wp 
     206             e3t_abl(:) = -1._wp   ;   e3w_abl(:) = -1._wp 
     207          ENDIF 
     208          CALL iom_set_axis_attr( "ght_abl", ght_abl(2:jpka) ) 
     209          CALL iom_set_axis_attr( "ghw_abl", ghw_abl(2:jpka) ) 
     210           
    201211          ! Add vertical grid bounds 
    202212          jkmin = MIN(2,jpk)  ! in case jpk=1 (i.e. sas2D) 
     
    207217          zw_bnds(2,1:jpkm1  ) = gdepw_1d(jkmin:jpk) 
    208218          zw_bnds(2,jpk:     ) = gdepw_1d(jpk) + e3t_1d(jpk) 
    209           CALL iom_set_axis_attr( "deptht", bounds=zw_bnds ) 
    210           CALL iom_set_axis_attr( "depthu", bounds=zw_bnds ) 
    211           CALL iom_set_axis_attr( "depthv", bounds=zw_bnds ) 
    212           CALL iom_set_axis_attr( "depthw", bounds=zt_bnds ) 
     219          CALL iom_set_axis_attr(  "deptht", bounds=zw_bnds ) 
     220          CALL iom_set_axis_attr(  "depthu", bounds=zw_bnds ) 
     221          CALL iom_set_axis_attr(  "depthv", bounds=zw_bnds ) 
     222          CALL iom_set_axis_attr(  "depthw", bounds=zt_bnds ) 
     223 
     224          ! ABL 
     225          za_bnds(1,:) = ghw_abl(1:jpkam1) 
     226          za_bnds(2,:) = ghw_abl(2:jpka  ) 
     227          CALL iom_set_axis_attr( "ght_abl", bounds=za_bnds ) 
     228          za_bnds(1,:) = ght_abl(2:jpka  ) 
     229          za_bnds(2,:) = ght_abl(2:jpka  ) + e3w_abl(2:jpka) 
     230          CALL iom_set_axis_attr( "ghw_abl", bounds=za_bnds ) 
     231 
    213232          CALL iom_set_axis_attr( "nfloat", (/ (REAL(ji,wp), ji=1,jpnfl) /) ) 
    214233# if defined key_si3 
     
    682701      clname   = trim(cdname) 
    683702      IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN 
    684 !FUS         iln    = INDEX(clname,'/')  
    685          iln    = INDEX(clname,'/',BACK=.true.)  ! FUS: to insert the nest index at the right location within the string, the last / has to be found (search from the right to left) 
     703         iln    = INDEX(clname,'/')  
    686704         cltmpn = clname(1:iln) 
    687705         clname = clname(iln+1:LEN_TRIM(clname)) 
     
    11281146            WRITE(cldmspc , fmt='(i1)') idmspc 
    11291147            ! 
    1130             IF(     idmspc <  irankpv ) THEN  
    1131                CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension',   & 
    1132                   &                         'it is impossible to read a '//clrankpv//'D array from this file...' ) 
    1133             ELSEIF( idmspc == irankpv ) THEN 
     1148            !!GS: we consider 2D data as 3D data with vertical dim size = 1 
     1149            !IF(     idmspc <  irankpv ) THEN  
     1150            !   CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension',   & 
     1151            !      &                         'it is impossible to read a '//clrankpv//'D array from this file...' ) 
     1152            !ELSEIF( idmspc == irankpv ) THEN 
     1153            IF( idmspc == irankpv ) THEN 
    11341154               IF( PRESENT(pv_r1d) .AND. idom /= jpdom_unknown )   & 
    11351155                  &   CALL ctl_stop( TRIM(clinfo), 'case not coded...You must use jpdom_unknown' ) 
     
    19291949      ! 
    19301950      INTEGER :: ji, jj, jn, ni, nj 
    1931       INTEGER :: icnr, jcnr                                    ! Offset such that the vertex coordinate (i+icnr,j+jcnr) 
    1932       !                                                        ! represents the bottom-left corner of cell (i,j) 
     1951      INTEGER :: icnr, jcnr                             ! Offset such that the vertex coordinate (i+icnr,j+jcnr) 
     1952      !                                                 ! represents the bottom-left corner of cell (i,j) 
    19331953      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: z_bnds      ! Lat/lon coordinates of the vertices of cell (i,j) 
    19341954      REAL(wp), ALLOCATABLE, DIMENSION(:,:)     :: z_fld       ! Working array to determine where to rotate cells 
     
    21012121      f_op%timestep = nn_fsbc  ;  f_of%timestep =  0  ; CALL iom_set_field_attr('SBC'             , freq_op=f_op, freq_offset=f_of) 
    21022122      f_op%timestep = nn_fsbc  ;  f_of%timestep =  0  ; CALL iom_set_field_attr('SBC_scalar'      , freq_op=f_op, freq_offset=f_of) 
    2103       f_op%timestep = 1        ;  f_of%timestep =  0  ; CALL iom_set_field_attr('ptrc_T'          , freq_op=f_op, freq_offset=f_of) 
    2104       f_op%timestep = 1        ;  f_of%timestep =  0  ; CALL iom_set_field_attr('diad_T'          , freq_op=f_op, freq_offset=f_of) 
     2123      f_op%timestep = nn_fsbc  ;  f_of%timestep =  0  ; CALL iom_set_field_attr('ABL'             , freq_op=f_op, freq_offset=f_of) 
    21052124 
    21062125      ! output file names (attribut: name) 
     
    22272246      CHARACTER(LEN=20)  ::   clfreq 
    22282247      CHARACTER(LEN=20)  ::   cldate 
    2229       CHARACTER(LEN=256) ::   cltmpn                 !FUS needed for correct path with AGRIF 
    2230       INTEGER            ::   iln                    !FUS needed for correct path with AGRIF 
    22312248      INTEGER            ::   idx 
    22322249      INTEGER            ::   jn 
     
    23112328            END DO 
    23122329            ! 
    2313 !FUS            IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 
    2314 !FUS see comment line 700  
    2315             IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' ) THEN 
    2316              iln    = INDEX(clname,'/',BACK=.true.) 
    2317              cltmpn = clname(1:iln) 
    2318              clname = clname(iln+1:LEN_TRIM(clname)) 
    2319              clname = TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname) 
    2320             ENDIF 
    2321 !FUS  
     2330            IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 
    23222331            IF( jn == 1 )   CALL iom_set_file_attr( cdid, name        = clname ) 
    23232332            IF( jn == 2 )   CALL iom_set_file_attr( cdid, name_suffix = clname ) 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/IOM/iom_nf90.F90

    r11536 r12182  
    1919   !!---------------------------------------------------------------------- 
    2020   USE dom_oce         ! ocean space and time domain 
     21   USE sbc_oce, ONLY: jpka, ght_abl ! abl vertical level number and height 
    2122   USE lbclnk          ! lateal boundary condition / mpp exchanges 
    2223   USE iom_def         ! iom variables definitions 
     
    5657      LOGICAL                , INTENT(in   )           ::   ldok        ! check the existence  
    5758      INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar     ! domain parameters:  
    58       INTEGER                , INTENT(in   ), OPTIONAL ::   kdlev       ! size of the third dimension 
     59      INTEGER                , INTENT(in   ), OPTIONAL ::   kdlev       ! size of the ice/abl third dimension 
    5960 
    6061      CHARACTER(LEN=256) ::   clinfo           ! info character 
     
    6970      INTEGER            ::   ihdf5            ! local variable for retrieval of value for NF90_HDF5 
    7071      LOGICAL            ::   llclobber        ! local definition of ln_clobber 
    71       INTEGER            ::   ilevels           ! vertical levels 
     72      INTEGER            ::   ilevels          ! vertical levels 
    7273      !--------------------------------------------------------------------- 
    7374      ! 
     
    7677      ! 
    7778      !                 !number of vertical levels 
    78       IF( PRESENT(kdlev) ) THEN   ;   ilevels = kdlev    ! use input value (useful for sea-ice) 
    79       ELSE                        ;   ilevels = jpk      ! by default jpk 
     79      IF( PRESENT(kdlev) )   THEN   ;   ilevels = kdlev    ! use input value (useful for sea-ice and abl) 
     80      ELSE                          ;   ilevels = jpk      ! by default jpk 
    8081      ENDIF 
    8182      ! 
     
    126127            CALL iom_nf90_check(NF90_DEF_DIM( if90id,            'x',   kdompar(1,1), idmy ), clinfo) 
    127128            CALL iom_nf90_check(NF90_DEF_DIM( if90id,            'y',   kdompar(2,1), idmy ), clinfo) 
    128             CALL iom_nf90_check(NF90_DEF_DIM( if90id,      'nav_lev',            jpk, idmy ), clinfo) 
    129             CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'time_counter', NF90_UNLIMITED, idmy ), clinfo) 
    130             IF( PRESENT(kdlev) )   & 
    131                CALL iom_nf90_check(NF90_DEF_DIM( if90id,    'numcat',          kdlev, idmy ), clinfo) 
     129            IF( PRESENT(kdlev) ) THEN 
     130              IF( kdlev == jpka ) THEN 
     131                 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'nav_lev',          kdlev, idmy ), clinfo) 
     132                 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'time_counter', NF90_UNLIMITED, idmy ), clinfo) 
     133              ELSE 
     134                 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'nav_lev',            jpk, idmy ), clinfo) 
     135                 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'time_counter', NF90_UNLIMITED, idmy ), clinfo) 
     136                 CALL iom_nf90_check(NF90_DEF_DIM( if90id,  'numcat',          kdlev, idmy ), clinfo) 
     137              ENDIF 
     138            ELSE 
     139               CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'nav_lev',            jpk, idmy ), clinfo) 
     140               CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'time_counter', NF90_UNLIMITED, idmy ), clinfo) 
     141            ENDIF 
    132142            ! global attributes 
    133143            CALL iom_nf90_check(NF90_PUT_ATT( if90id, NF90_GLOBAL, 'DOMAIN_number_total'   , jpnij              ), clinfo) 
     
    196206      CHARACTER(len=*)     , INTENT(in   )           ::   cdvar    ! name of the variable 
    197207      INTEGER              , INTENT(in   )           ::   kiv   !  
    198       INTEGER, DIMENSION(:), INTENT(  out), OPTIONAL ::   kdimsz   ! size of the dimensions 
    199       INTEGER,               INTENT(  out), OPTIONAL ::   kndims   ! size of the dimensions 
     208      INTEGER, DIMENSION(:), INTENT(  out), OPTIONAL ::   kdimsz   ! size of each dimension 
     209      INTEGER              , INTENT(  out), OPTIONAL ::   kndims   ! number of dimensions 
    200210      LOGICAL              , INTENT(  out), OPTIONAL ::   lduld    ! true if the last dimension is unlimited (time) 
    201211      ! 
     
    584594         IF(     PRESENT(pv_r0d) ) THEN   ;   idims = 0 
    585595         ELSEIF( PRESENT(pv_r1d) ) THEN 
    586             IF( SIZE(pv_r1d,1) == jpk ) THEN   ;   idim3 = 3 
    587             ELSE                               ;   idim3 = 5 
     596            IF(( SIZE(pv_r1d,1) == jpk ).OR.( SIZE(pv_r1d,1) == jpka )) THEN   ;   idim3 = 3 
     597            ELSE                                                               ;   idim3 = 5 
    588598            ENDIF 
    589599                                              idims = 2   ;   idimid(1:idims) = (/idim3,4/) 
    590600         ELSEIF( PRESENT(pv_r2d) ) THEN   ;   idims = 3   ;   idimid(1:idims) = (/1,2  ,4/) 
    591601         ELSEIF( PRESENT(pv_r3d) ) THEN 
    592             IF( SIZE(pv_r3d,3) == jpk ) THEN   ;   idim3 = 3 
    593             ELSE                               ;   idim3 = 5 
     602            IF(( SIZE(pv_r3d,3) == jpk ).OR.( SIZE(pv_r3d,3) == jpka )) THEN   ;   idim3 = 3 
     603            ELSE                                                               ;   idim3 = 5 
    594604            ENDIF 
    595605                                              idims = 4   ;   idimid(1:idims) = (/1,2,idim3,4/) 
     
    674684               CALL iom_nf90_check( NF90_PUT_VAR  ( if90id, idmy, gphit(ix1:ix2, iy1:iy2) ), clinfo ) 
    675685               CALL iom_nf90_check( NF90_INQ_VARID( if90id, 'nav_lev'     , idmy ), clinfo ) 
    676                CALL iom_nf90_check( NF90_PUT_VAR  ( if90id, idmy, gdept_1d       ), clinfo ) 
     686               IF (iom_file(kiomid)%nlev == jpka) THEN   ;   CALL iom_nf90_check( NF90_PUT_VAR  ( if90id, idmy,  ght_abl), clinfo ) 
     687               ELSE                                      ;   CALL iom_nf90_check( NF90_PUT_VAR  ( if90id, idmy, gdept_1d), clinfo ) 
     688               ENDIF 
    677689               IF( NF90_INQ_VARID( if90id, 'numcat', idmy ) == nf90_noerr ) THEN 
    678690                  CALL iom_nf90_check( NF90_PUT_VAR  ( if90id, idmy, (/ (idlv, idlv = 1,iom_file(kiomid)%nlev) /)), clinfo ) 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/OBS/obs_averg_h2d.F90

    r10425 r12182  
    5252   SUBROUTINE obs_avg_h2d_init( kpk, kpk2, kmaxifp, kmaxjfp, k2dint, plam,  pphi, & 
    5353      &                         pglam, pgphi, pglamf, pgphif, pmask, plamscl, pphiscl, lindegrees, & 
    54       &                         pweig, pobsmask, iminpoints ) 
     54      &                         pweig, iminpoints ) 
    5555      !!----------------------------------------------------------------------- 
    5656      !! 
     
    9898      REAL(KIND=wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(OUT) ::  & 
    9999         & pweig                ! Weights for averaging 
    100       REAL(KIND=wp), DIMENSION(kpk2), INTENT(OUT) ::  & 
    101          & pobsmask             ! Vertical mask for observations 
    102100      INTEGER, INTENT(IN), OPTIONAL :: & 
    103101         & iminpoints           ! Reject point which is not surrounded 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/OBS/obs_oper.F90

    r10068 r12182  
    342342            CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,     & 
    343343               &                   zglam2(:,:,iobs), zgphi2(:,:,iobs), & 
    344                &                   zmask2(:,:,1,iobs), zweig2, zmsk_2 ) 
     344               &                   zmask2(:,:,1,iobs), zweig2, zmsk_2) 
    345345  
    346346         ENDIF 
     
    924924               &                   zglamf(:,:,iobs), zgphif(:,:,iobs), & 
    925925               &                   zmask(:,:,iobs), plamscl, pphiscl, & 
    926                &                   lindegrees, zweig, zobsmask ) 
     926               &                   lindegrees, zweig ) 
    927927 
    928928            ! Average the model SST to the observation footprint 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/cpl_oasis3.F90

    r10582 r12182  
    114114      !------------------------------------------------------------------ 
    115115      CALL oasis_init_comp ( ncomp_id, TRIM(cd_modname), nerror ) 
    116       IF ( nerror /= OASIS_Ok ) & 
     116      IF( nerror /= OASIS_Ok ) & 
    117117         CALL oasis_abort (ncomp_id, 'cpl_init', 'Failure in oasis_init_comp') 
    118118 
     
    122122 
    123123      CALL oasis_get_localcomm ( kl_comm, nerror ) 
    124       IF ( nerror /= OASIS_Ok ) & 
     124      IF( nerror /= OASIS_Ok ) & 
    125125         CALL oasis_abort (ncomp_id, 'cpl_init','Failure in oasis_get_localcomm' ) 
    126126      ! 
     
    149149 
    150150      ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define 
    151       IF ( ltmp_wapatch ) THEN 
     151      IF( ltmp_wapatch ) THEN 
    152152         nldi_save = nldi   ;   nlei_save = nlei 
    153153         nldj_save = nldj   ;   nlej_save = nlej 
     
    217217      ! 
    218218      DO ji = 1, ksnd 
    219          IF ( ssnd(ji)%laction ) THEN 
     219         IF( ssnd(ji)%laction ) THEN 
    220220 
    221221            IF( ssnd(ji)%nct > nmaxcat ) THEN 
     
    228228               DO jm = 1, kcplmodel 
    229229 
    230                   IF ( ssnd(ji)%nct .GT. 1 ) THEN 
     230                  IF( ssnd(ji)%nct .GT. 1 ) THEN 
    231231                     WRITE(cli2,'(i2.2)') jc 
    232232                     zclname = TRIM(ssnd(ji)%clname)//'_cat'//cli2 
     
    234234                     zclname = ssnd(ji)%clname 
    235235                  ENDIF 
    236                   IF ( kcplmodel  > 1 ) THEN 
     236                  IF( kcplmodel  > 1 ) THEN 
    237237                     WRITE(cli2,'(i2.2)') jm 
    238238                     zclname = 'model'//cli2//'_'//TRIM(zclname) 
     
    241241                  IF( agrif_fixed() /= 0 ) THEN  
    242242                     zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname) 
    243                   END IF 
     243                  ENDIF 
    244244#endif 
    245245                  IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_Out 
    246246                  CALL oasis_def_var (ssnd(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 1 /),   & 
    247247                     &                OASIS_Out          , ishape , OASIS_REAL, nerror ) 
    248                   IF ( nerror /= OASIS_Ok ) THEN 
     248                  IF( nerror /= OASIS_Ok ) THEN 
    249249                     WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname) 
    250250                     CALL oasis_abort ( ssnd(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' ) 
     
    262262      ! 
    263263      DO ji = 1, krcv 
    264          IF ( srcv(ji)%laction ) THEN  
     264         IF( srcv(ji)%laction ) THEN  
    265265             
    266266            IF( srcv(ji)%nct > nmaxcat ) THEN 
     
    273273               DO jm = 1, kcplmodel 
    274274                   
    275                   IF ( srcv(ji)%nct .GT. 1 ) THEN 
     275                  IF( srcv(ji)%nct .GT. 1 ) THEN 
    276276                     WRITE(cli2,'(i2.2)') jc 
    277277                     zclname = TRIM(srcv(ji)%clname)//'_cat'//cli2 
     
    279279                     zclname = srcv(ji)%clname 
    280280                  ENDIF 
    281                   IF ( kcplmodel  > 1 ) THEN 
     281                  IF( kcplmodel  > 1 ) THEN 
    282282                     WRITE(cli2,'(i2.2)') jm 
    283283                     zclname = 'model'//cli2//'_'//TRIM(zclname) 
     
    286286                  IF( agrif_fixed() /= 0 ) THEN  
    287287                     zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname) 
    288                   END IF 
     288                  ENDIF 
    289289#endif 
    290290                  IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_In 
    291291                  CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 1 /),   & 
    292292                     &                OASIS_In           , ishape , OASIS_REAL, nerror ) 
    293                   IF ( nerror /= OASIS_Ok ) THEN 
     293                  IF( nerror /= OASIS_Ok ) THEN 
    294294                     WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname) 
    295295                     CALL oasis_abort ( srcv(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' ) 
     
    310310      IF( nerror /= OASIS_Ok )   CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in oasis_enddef') 
    311311      ! 
    312       IF ( ltmp_wapatch ) THEN 
     312      IF( ltmp_wapatch ) THEN 
    313313         nldi = nldi_save   ;   nlei = nlei_save 
    314314         nldj = nldj_save   ;   nlej = nlej_save 
     
    332332      !!-------------------------------------------------------------------- 
    333333      ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define 
    334       IF ( ltmp_wapatch ) THEN 
     334      IF( ltmp_wapatch ) THEN 
    335335         nldi_save = nldi   ;   nlei_save = nlei 
    336336         nldj_save = nldj   ;   nlej_save = nlej 
     
    349349               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(nldi:nlei, nldj:nlej,jc), kinfo ) 
    350350                
    351                IF ( ln_ctl ) THEN         
    352                   IF ( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   & 
     351               IF( ln_ctl ) THEN         
     352                  IF( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   & 
    353353                     & kinfo == OASIS_SentOut  .OR. kinfo == OASIS_ToRestOut ) THEN 
    354354                     WRITE(numout,*) '****************' 
     
    368368         ENDDO 
    369369      ENDDO 
    370       IF ( ltmp_wapatch ) THEN 
     370      IF( ltmp_wapatch ) THEN 
    371371         nldi = nldi_save   ;   nlei = nlei_save 
    372372         nldj = nldj_save   ;   nlej = nlej_save 
     
    393393      !!-------------------------------------------------------------------- 
    394394      ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define 
    395       IF ( ltmp_wapatch ) THEN 
     395      IF( ltmp_wapatch ) THEN 
    396396         nldi_save = nldi   ;   nlei_save = nlei 
    397397         nldj_save = nldj   ;   nlej_save = nlej 
     
    403403      ! 
    404404      DO jc = 1, srcv(kid)%nct 
    405          IF ( ltmp_wapatch ) THEN 
     405         IF( ltmp_wapatch ) THEN 
    406406            IF( nimpp           ==      1 ) nldi = 1 
    407407            IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi 
     
    420420                  &        kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut 
    421421                
    422                IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm) 
     422               IF( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm) 
    423423                
    424                IF ( llaction ) THEN 
     424               IF( llaction ) THEN 
    425425                   
    426426                  kinfo = OASIS_Rcv 
     
    432432                  ENDIF 
    433433                   
    434                   IF ( ln_ctl ) THEN         
     434                  IF( ln_ctl ) THEN         
    435435                     WRITE(numout,*) '****************' 
    436436                     WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname 
     
    450450         ENDDO 
    451451 
    452          IF ( ltmp_wapatch ) THEN 
     452         IF( ltmp_wapatch ) THEN 
    453453            nldi = nldi_save   ;   nlei = nlei_save 
    454454            nldj = nldj_save   ;   nlej = nlej_save 
     
    483483      ! 
    484484      DO ji = 1, nsnd 
    485          IF (ssnd(ji)%laction ) THEN 
     485         IF(ssnd(ji)%laction ) THEN 
    486486            DO jm = 1, ncplmodel 
    487487               IF( ssnd(ji)%nid(1,jm) /= -1 ) THEN 
     
    495495      ENDDO 
    496496      DO ji = 1, nrcv 
    497          IF (srcv(ji)%laction ) THEN 
     497         IF(srcv(ji)%laction ) THEN 
    498498            DO jm = 1, ncplmodel 
    499499               IF( srcv(ji)%nid(1,jm) /= -1 ) THEN 
     
    529529      ! 
    530530      DEALLOCATE( exfld ) 
    531       IF (nstop == 0) THEN 
     531      IF(nstop == 0) THEN 
    532532         CALL oasis_terminate( nerror )          
    533533      ELSE 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/cyclone.F90

    r10068 r12182  
    137137            zhemi = SIGN( 1. , zrlat ) 
    138138            zinfl = 15.* rad                             ! clim inflow angle in Tropical Cyclones 
    139          IF ( vortex == 0 ) THEN 
     139         IF( vortex == 0 ) THEN 
    140140 
    141141            ! Vortex Holland reconstruct wind at each lon-lat position 
     
    157157                     &              + COS( zrlat ) * COS( zzrgphi ) * COS( zzrglam ) ) 
    158158 
    159                  IF (zdist < zrout2) THEN ! calculation of wind only to a given max radius 
     159                 IF(zdist < zrout2) THEN ! calculation of wind only to a given max radius 
    160160                  ! shape of the wind profile 
    161161                  zztmp = ( zrmw / ( zdist + 1.e-12 ) )**zb 
    162162                  zztmp =  zvmax * SQRT( zztmp * EXP(1. - zztmp) )     
    163163 
    164                   IF (zdist > zrout1) THEN ! bring to zero between r_out1 and r_out2 
     164                  IF(zdist > zrout1) THEN ! bring to zero between r_out1 and r_out2 
    165165                     zztmp = zztmp * ( (zrout2-zdist)*1.e-6 ) 
    166166                  ENDIF 
    167167 
    168168                  ! !!! KILL EQ WINDS 
    169                   ! IF (SIGN( 1. , zrlat ) /= zhemi) THEN 
     169                  ! IF(SIGN( 1. , zrlat ) /= zhemi) THEN 
    170170                  !    zztmp = 0.                              ! winds in other hemisphere 
    171                   !    IF (ABS(gphit(ji,jj)) <= 5.) zztmp=0.   ! kill between 5N-5S 
    172                   ! ENDIF 
    173                   ! IF (ABS(gphit(ji,jj)) <= 10. .and. ABS(gphit(ji,jj)) > 5.) THEN 
     171                  !    IF(ABS(gphit(ji,jj)) <= 5.) zztmp=0.   ! kill between 5N-5S 
     172                  ! ENDIF 
     173                  ! IF(ABS(gphit(ji,jj)) <= 10. .and. ABS(gphit(ji,jj)) > 5.) THEN 
    174174                  !    zztmp = zztmp * ( 1./5. * (ABS(gphit(ji,jj)) - 5.) )  
    175175                  !    !linear to zero between 10 and 5 
     
    177177                  ! !!! / KILL EQ 
    178178 
    179                   IF (ABS(gphit(ji,jj)) >= 55.) zztmp = 0. ! kill weak spurious winds at high latitude 
     179                  IF(ABS(gphit(ji,jj)) >= 55.) zztmp = 0. ! kill weak spurious winds at high latitude 
    180180 
    181181                  zwnd_t =   COS( zinfl ) * zztmp     
     
    196196            END DO 
    197197          
    198          ELSE IF ( vortex == 1 ) THEN 
     198         ELSE IF( vortex == 1 ) THEN 
    199199 
    200200            ! Vortex Willoughby reconstruct wind at each lon-lat position 
     
    206206            zn   =   2.1340 + 0.0077*zvmax - 0.4522*LOG(zrmw/1000.) - 0.0038*ABS( ztct(jtc,jp_lat) )             
    207207            zA   =   0.5913 + 0.0029*zvmax - 0.1361*LOG(zrmw/1000.) - 0.0042*ABS( ztct(jtc,jp_lat) )   
    208             IF (zA < 0) THEN  
     208            IF(zA < 0) THEN  
    209209               zA=0 
    210210            ENDIF            
     
    218218                     &              + COS( zrlat ) * COS( zzrgphi ) * COS( zzrglam ) ) 
    219219 
    220                  IF (zdist < zrout2) THEN ! calculation of wind only to a given max radius 
     220                 IF(zdist < zrout2) THEN ! calculation of wind only to a given max radius 
    221221                
    222222                  ! shape of the wind profile                      
    223                   IF (zdist <= zrmw) THEN     ! inside the Radius of Maximum Wind 
     223                  IF(zdist <= zrmw) THEN     ! inside the Radius of Maximum Wind 
    224224                     zztmp  = zvmax * (zdist/zrmw)**zn 
    225225                  ELSE  
     
    227227                  ENDIF 
    228228 
    229                   IF (zdist > zrout1) THEN ! bring to zero between r_out1 and r_out2 
     229                  IF(zdist > zrout1) THEN ! bring to zero between r_out1 and r_out2 
    230230                     zztmp = zztmp * ( (zrout2-zdist)*1.e-6 ) 
    231231                  ENDIF 
    232232 
    233233                  ! !!! KILL EQ WINDS 
    234                   ! IF (SIGN( 1. , zrlat ) /= zhemi) THEN 
     234                  ! IF(SIGN( 1. , zrlat ) /= zhemi) THEN 
    235235                  !    zztmp = 0.                              ! winds in other hemisphere 
    236                   !    IF (ABS(gphit(ji,jj)) <= 5.) zztmp=0.   ! kill between 5N-5S 
    237                   ! ENDIF 
    238                   ! IF (ABS(gphit(ji,jj)) <= 10. .and. ABS(gphit(ji,jj)) > 5.) THEN 
     236                  !    IF(ABS(gphit(ji,jj)) <= 5.) zztmp=0.   ! kill between 5N-5S 
     237                  ! ENDIF 
     238                  ! IF(ABS(gphit(ji,jj)) <= 10. .and. ABS(gphit(ji,jj)) > 5.) THEN 
    239239                  !    zztmp = zztmp * ( 1./5. * (ABS(gphit(ji,jj)) - 5.) )  
    240240                  !    !linear to zero between 10 and 5 
     
    242242                  ! !!! / KILL EQ 
    243243 
    244                   IF (ABS(gphit(ji,jj)) >= 55.) zztmp = 0. ! kill weak spurious winds at high latitude 
     244                  IF(ABS(gphit(ji,jj)) >= 55.) zztmp = 0. ! kill weak spurious winds at high latitude 
    245245 
    246246                  zwnd_t =   COS( zinfl ) * zztmp     
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/fldread.F90

    r11949 r12182  
    168168      IF( PRESENT(kit) )   ll_firstcall = ll_firstcall .and. kit == 1 
    169169 
    170       IF ( nn_components == jp_iam_sas ) THEN   ;   it_offset = nn_fsbc 
     170      IF( nn_components == jp_iam_sas ) THEN   ;   it_offset = nn_fsbc 
    171171      ELSE                                      ;   it_offset = 0 
    172172      ENDIF 
     
    391391         ENDIF 
    392392         ! 
    393          IF ( sdjf%cltype(1:4) == 'week' ) THEN 
     393         IF( sdjf%cltype(1:4) == 'week' ) THEN 
    394394            isec_week = isec_week + ksec_week( sdjf%cltype(6:8) )   ! second since the beginning of the week 
    395395            llprevmth = isec_week > nsec_month                      ! longer time since the beginning of the week than the month 
     
    466466      ENDIF 
    467467      ! 
    468       IF ( nn_components == jp_iam_sas ) THEN   ;   it_offset = nn_fsbc 
     468      IF( nn_components == jp_iam_sas ) THEN   ;   it_offset = nn_fsbc 
    469469      ELSE                                      ;   it_offset = 0 
    470470      ENDIF 
     
    659659            ENDIF 
    660660         CASE DEFAULT 
    661             IF (lk_c1d .AND. lmoor ) THEN 
     661            IF(lk_c1d .AND. lmoor ) THEN 
    662662               IF( sdjf%ln_tint ) THEN 
    663663                  CALL iom_get( sdjf%num, jpdom_unknown, sdjf%clvar, sdjf%fdta(2,2,:,2), sdjf%nrec_a(1) ) 
     
    10741074         imonth = kmonth 
    10751075         iday = kday 
    1076          IF ( sdjf%cltype(1:4) == 'week' ) THEN             ! find the day of the beginning of the week 
     1076         IF( sdjf%cltype(1:4) == 'week' ) THEN             ! find the day of the beginning of the week 
    10771077            isec_week = ksec_week( sdjf%cltype(6:8) )- (86400 * 8 )   
    10781078            llprevmth  = isec_week > nsec_month             ! longer time since beginning of the week than the month 
     
    10831083         ENDIF 
    10841084      ELSE                                                  ! use current day values 
    1085          IF ( sdjf%cltype(1:4) == 'week' ) THEN             ! find the day of the beginning of the week 
     1085         IF( sdjf%cltype(1:4) == 'week' ) THEN             ! find the day of the beginning of the week 
    10861086            isec_week  = ksec_week( sdjf%cltype(6:8) )      ! second since the beginning of the week 
    10871087            llprevmth  = isec_week > nsec_month             ! longer time since beginning of the week than the month 
     
    13211321 
    13221322      !! get dimensions 
    1323       IF ( SIZE(sd%fnow, 3) > 1 ) THEN 
     1323      !!GS: we consider 2D data as 3D data with vertical dim size = 1 
     1324      !IF( SIZE(sd%fnow, 3) > 1 ) THEN 
     1325      IF( SIZE(sd%fnow, 3) > 0 ) THEN 
    13241326         ALLOCATE( ddims(4) ) 
    13251327      ELSE 
     
    13341336 
    13351337      CALL iom_open ( sd%wgtname, inum )   ! interpolation weights 
    1336       IF ( inum > 0 ) THEN 
     1338      IF( inum > 0 ) THEN 
    13371339 
    13381340         !! determine whether we have an east-west cyclic grid 
     
    16431645          
    16441646         ref_wgts(kw)%fly_dta(:,:,:) = 0.0 
    1645          SELECT CASE( SIZE(ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:),3) ) 
    1646          CASE(1) 
    1647               CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,1), nrec, rec1, recn) 
    1648          CASE DEFAULT 
     1647         !!GS: we consider 2D data as 3D data with vertical dim size = 1  
     1648         !SELECT CASE( SIZE(ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:),3) ) 
     1649         !CASE(1) 
     1650         !     CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,1), nrec, rec1, recn) 
     1651         !CASE DEFAULT 
    16491652              CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:), nrec, rec1, recn) 
    1650          END SELECT  
     1653         !END SELECT  
    16511654      ENDIF 
    16521655       
     
    16661669      END DO 
    16671670 
    1668       IF (ref_wgts(kw)%numwgt .EQ. 16) THEN 
     1671      IF(ref_wgts(kw)%numwgt .EQ. 16) THEN 
    16691672 
    16701673        !! fix up halo points that we couldnt read from file 
     
    16921695           IF( jpi1 == 2 ) THEN 
    16931696              rec1(1) = ref_wgts(kw)%ddims(1) - ref_wgts(kw)%overlap 
    1694               SELECT CASE( SIZE( ref_wgts(kw)%col(:,jpj1:jpj2,:),3) ) 
    1695               CASE(1) 
    1696                    CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,1), nrec, rec1, recn) 
    1697               CASE DEFAULT 
     1697              !!GS: we consider 2D data as 3D data with vertical dim size = 1 
     1698              !SELECT CASE( SIZE( ref_wgts(kw)%col(:,jpj1:jpj2,:),3) ) 
     1699              !CASE(1) 
     1700              !     CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,1), nrec, rec1, recn) 
     1701              !CASE DEFAULT 
    16981702                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,:), nrec, rec1, recn) 
    1699               END SELECT       
     1703              !END SELECT       
    17001704              ref_wgts(kw)%fly_dta(jpi1-1,jpj1:jpj2,:) = ref_wgts(kw)%col(1,jpj1:jpj2,:) 
    17011705           ENDIF 
    17021706           IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN 
    17031707              rec1(1) = 1 + ref_wgts(kw)%overlap 
    1704               SELECT CASE( SIZE( ref_wgts(kw)%col(:,jpj1:jpj2,:),3) ) 
    1705               CASE(1) 
    1706                    CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,1), nrec, rec1, recn) 
    1707               CASE DEFAULT 
     1708              !!GS: we consider 2D data as 3D data with vertical dim size = 1 
     1709              !SELECT CASE( SIZE( ref_wgts(kw)%col(:,jpj1:jpj2,:),3) ) 
     1710              !CASE(1) 
     1711              !     CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,1), nrec, rec1, recn) 
     1712              !CASE DEFAULT 
    17081713                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col(:,jpj1:jpj2,:), nrec, rec1, recn) 
    1709               END SELECT 
     1714              !END SELECT 
    17101715              ref_wgts(kw)%fly_dta(jpi2+1,jpj1:jpj2,:) = ref_wgts(kw)%col(1,jpj1:jpj2,:) 
    17111716           ENDIF 
     
    17491754         END DO 
    17501755         ! 
    1751       END IF 
     1756      ENDIF 
    17521757      ! 
    17531758   END SUBROUTINE fld_interp 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbc_oce.F90

    r12150 r12182  
    1111   !!            4.0  ! 2012-05  (C. Rousset) add attenuation coef for use in ice model  
    1212   !!            4.0  ! 2016-06  (L. Brodeau) new unified bulk routine (based on AeroBulk) 
     13   !!            4.0  ! 2019-03  (F. Lemarié, G. Samson) add compatibility with ABL mode     
    1314   !!---------------------------------------------------------------------- 
    1415 
     
    3435   LOGICAL , PUBLIC ::   ln_flx         !: flux      formulation 
    3536   LOGICAL , PUBLIC ::   ln_blk         !: bulk formulation 
     37   LOGICAL , PUBLIC ::   ln_abl         !: Atmospheric boundary layer model 
    3638#if defined key_oasis3 
    3739   LOGICAL , PUBLIC ::   lk_oasis = .TRUE.  !: OASIS used 
     
    7678   INTEGER , PUBLIC, PARAMETER ::   jp_flx     = 2        !: flux                          formulation 
    7779   INTEGER , PUBLIC, PARAMETER ::   jp_blk     = 3        !: bulk                          formulation 
    78    INTEGER , PUBLIC, PARAMETER ::   jp_purecpl = 4        !: Pure ocean-atmosphere Coupled formulation 
    79    INTEGER , PUBLIC, PARAMETER ::   jp_none    = 5        !: for OPA when doing coupling via SAS module 
     80   INTEGER , PUBLIC, PARAMETER ::   jp_abl     = 4        !: Atmospheric boundary layer    formulation 
     81   INTEGER , PUBLIC, PARAMETER ::   jp_purecpl = 5        !: Pure ocean-atmosphere Coupled formulation 
     82   INTEGER , PUBLIC, PARAMETER ::   jp_none    = 6        !: for OPA when doing coupling via SAS module 
    8083    
    8184   !!---------------------------------------------------------------------- 
     
    106109   INTEGER , PUBLIC ::  ncpl_qsr_freq            !: qsr coupling frequency per days from atmosphere 
    107110   ! 
    108    LOGICAL , PUBLIC ::   lhftau = .FALSE.        !: HF tau used in TKE: mean(stress module) - module(mean stress) 
    109111   !!                                   !!   now    ! before   !! 
    110112   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   utau   , utau_b   !: sea surface i-stress (ocean referential)     [N/m2] 
    111113   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   vtau   , vtau_b   !: sea surface j-stress (ocean referential)     [N/m2] 
    112114   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   taum              !: module of sea surface stress (at T-point)    [N/m2]  
    113    !! wndm is used onmpute surface gases exchanges in ice-free ocean or leads 
     115   !! wndm is used compute surface gases exchanges in ice-free ocean or leads 
    114116   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wndm              !: wind speed module at T-point (=|U10m-Uoce|)  [m/s] 
     117   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rhoa              !: air density at "rn_zu" m above the sea       [kg/m3] !LB 
    115118   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr               !: sea heat flux:     solar                     [W/m2] 
    116119   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qns    , qns_b    !: sea heat flux: non solar                     [W/m2] 
     
    134137   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: xcplmask          !: coupling mask for ln_mixcpl (warning: allocated in sbccpl) 
    135138 
     139   !!--------------------------------------------------------------------- 
     140   !! ABL Vertical Domain size   
     141   !!--------------------------------------------------------------------- 
     142   INTEGER , PUBLIC            ::   jpka   = 2     !: ABL number of vertical levels (default definition) 
     143   INTEGER , PUBLIC            ::   jpkam1 = 1     !: jpka-1 
     144   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   ght_abl, ghw_abl          !: ABL geopotential height (needed for iom) 
     145   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   e3t_abl, e3w_abl          !: ABL vertical scale factors (needed for iom) 
     146 
    136147   !!---------------------------------------------------------------------- 
    137148   !!                     Sea Surface Mean fields 
     
    164175      ! 
    165176      ALLOCATE( utau(jpi,jpj) , utau_b(jpi,jpj) , taum(jpi,jpj) ,     & 
    166          &      vtau(jpi,jpj) , vtau_b(jpi,jpj) , wndm(jpi,jpj) , STAT=ierr(1) )  
     177         &      vtau(jpi,jpj) , vtau_b(jpi,jpj) , wndm(jpi,jpj) , rhoa(jpi,jpj) , STAT=ierr(1) )  
    167178         ! 
    168179      ALLOCATE( qns_tot(jpi,jpj) , qns  (jpi,jpj) , qns_b(jpi,jpj),        & 
     
    179190         &      ssu_m  (jpi,jpj) , sst_m(jpi,jpj) , frq_m(jpi,jpj) ,      & 
    180191         &      ssv_m  (jpi,jpj) , sss_m(jpi,jpj) , ssh_m(jpi,jpj) , STAT=ierr(4) ) 
    181          ! 
     192      ! 
    182193      ALLOCATE( e3t_m(jpi,jpj) , STAT=ierr(5) ) 
    183          ! 
     194      ! 
    184195      sbc_oce_alloc = MAXVAL( ierr ) 
    185196      CALL mpp_sum ( 'sbc_oce', sbc_oce_alloc ) 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcapr.F90

    r11960 r12182  
    101101      ! 
    102102      !                                            !* control check 
    103       IF ( ln_apr_obc  ) THEN 
     103      IF( ln_apr_obc  ) THEN 
    104104         IF(lwp) WRITE(numout,*) '         Inverse barometer added to OBC ssh data' 
    105105      ENDIF 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcblk.F90

    r11960 r12182  
    1515   !!            3.7  !  2014-06  (L. Brodeau)  simplification and optimization of CORE bulk 
    1616   !!            4.0  !  2016-06  (L. Brodeau)  sbcblk_core becomes sbcblk and is not restricted to the CORE algorithm anymore 
    17    !!                 !                        ==> based on AeroBulk (http://aerobulk.sourceforge.net/) 
     17   !!                 !                        ==> based on AeroBulk (https://github.com/brodeau/aerobulk/) 
    1818   !!            4.0  !  2016-10  (G. Madec)  introduce a sbc_blk_init routine 
    19    !!            4.0  !  2016-10  (M. Vancoppenolle)  Introduce conduction flux emulator (M. Vancoppenolle)  
     19   !!            4.0  !  2016-10  (M. Vancoppenolle)  Introduce conduction flux emulator (M. Vancoppenolle) 
     20   !!            4.0  !  2019-03  (F. Lemarié & G. Samson)  add ABL compatibility (ln_abl=TRUE) 
    2021   !!---------------------------------------------------------------------- 
    2122 
     
    2324   !!   sbc_blk_init  : initialisation of the chosen bulk formulation as ocean surface boundary condition 
    2425   !!   sbc_blk       : bulk formulation as ocean surface boundary condition 
    25    !!   blk_oce       : computes momentum, heat and freshwater fluxes over ocean 
    26    !!   rho_air       : density of (moist) air (depends on T_air, q_air and SLP 
    27    !!   cp_air        : specific heat of (moist) air (depends spec. hum. q_air) 
    28    !!   q_sat         : saturation humidity as a function of SLP and temperature 
    29    !!   L_vap         : latent heat of vaporization of water as a function of temperature 
    30    !!             sea-ice case only :  
    31    !!   blk_ice_tau   : provide the air-ice stress 
    32    !!   blk_ice_flx   : provide the heat and mass fluxes at air-ice interface 
     26   !!   blk_oce_1     : computes pieces of momentum, heat and freshwater fluxes over ocean for ABL model  (ln_abl=TRUE) 
     27   !!   blk_oce_2     : finalizes momentum, heat and freshwater fluxes computation over ocean after the ABL step  (ln_abl=TRUE) 
     28   !!             sea-ice case only : 
     29   !!   blk_ice_1   : provide the air-ice stress 
     30   !!   blk_ice_2   : provide the heat and mass fluxes at air-ice interface 
    3331   !!   blk_ice_qcn   : provide ice surface temperature and snow/ice conduction flux (emulating conduction flux) 
    3432   !!   Cdn10_Lupkes2012 : Lupkes et al. (2012) air-ice drag 
    35    !!   Cdn10_Lupkes2015 : Lupkes et al. (2015) air-ice drag  
     33   !!   Cdn10_Lupkes2015 : Lupkes et al. (2015) air-ice drag 
    3634   !!---------------------------------------------------------------------- 
    3735   USE oce            ! ocean dynamics and tracers 
     
    4644   USE lib_fortran    ! to use key_nosignedzero 
    4745#if defined key_si3 
    48    USE ice     , ONLY :   u_ice, v_ice, jpl, a_i_b, at_i_b, t_su, rn_cnd_s, hfx_err_dif 
     46   USE ice     , ONLY :   jpl, a_i_b, at_i_b, rn_cnd_s, hfx_err_dif 
    4947   USE icethd_dh      ! for CALL ice_thd_snwblow 
    5048#endif 
    51    USE sbcblk_algo_ncar     ! => turb_ncar     : NCAR - CORE (Large & Yeager, 2009)  
    52    USE sbcblk_algo_coare    ! => turb_coare    : COAREv3.0 (Fairall et al. 2003)  
    53    USE sbcblk_algo_coare3p5 ! => turb_coare3p5 : COAREv3.5 (Edson et al. 2013) 
    54    USE sbcblk_algo_ecmwf    ! => turb_ecmwf    : ECMWF (IFS cycle 31)  
     49   USE sbcblk_algo_ncar     ! => turb_ncar     : NCAR - CORE (Large & Yeager, 2009) 
     50   USE sbcblk_algo_coare3p0 ! => turb_coare3p0 : COAREv3.0 (Fairall et al. 2003) 
     51   USE sbcblk_algo_coare3p6 ! => turb_coare3p6 : COAREv3.6 (Fairall et al. 2018 + Edson et al. 2013) 
     52   USE sbcblk_algo_ecmwf    ! => turb_ecmwf    : ECMWF (IFS cycle 45r1) 
    5553   ! 
    5654   USE iom            ! I/O manager library 
     
    6058   USE prtctl         ! Print control 
    6159 
     60   USE sbcblk_phy     ! a catalog of functions for physical/meteorological parameters in the marine boundary layer, rho_air, q_sat, etc... 
     61 
     62 
    6263   IMPLICIT NONE 
    6364   PRIVATE 
     
    6566   PUBLIC   sbc_blk_init  ! called in sbcmod 
    6667   PUBLIC   sbc_blk       ! called in sbcmod 
     68   PUBLIC   blk_oce_1     ! called in sbcabl 
     69   PUBLIC   blk_oce_2     ! called in sbcabl 
    6770#if defined key_si3 
    68    PUBLIC   blk_ice_tau   ! routine called in icesbc 
    69    PUBLIC   blk_ice_flx   ! routine called in icesbc 
     71   PUBLIC   blk_ice_   ! routine called in icesbc 
     72   PUBLIC   blk_ice_   ! routine called in icesbc 
    7073   PUBLIC   blk_ice_qcn   ! routine called in icesbc 
    71 #endif  
    72  
    73 !!Lolo: should ultimately be moved in the module with all physical constants ? 
    74 !!gm  : In principle, yes. 
    75    REAL(wp), PARAMETER ::   Cp_dry = 1005.0       !: Specic heat of dry air, constant pressure      [J/K/kg] 
    76    REAL(wp), PARAMETER ::   Cp_vap = 1860.0       !: Specic heat of water vapor, constant pressure  [J/K/kg] 
    77    REAL(wp), PARAMETER ::   R_dry = 287.05_wp     !: Specific gas constant for dry air              [J/K/kg] 
    78    REAL(wp), PARAMETER ::   R_vap = 461.495_wp    !: Specific gas constant for water vapor          [J/K/kg] 
    79    REAL(wp), PARAMETER ::   reps0 = R_dry/R_vap   !: ratio of gas constant for dry air and water vapor => ~ 0.622 
    80    REAL(wp), PARAMETER ::   rctv0 = R_vap/R_dry   !: for virtual temperature (== (1-eps)/eps) => ~ 0.608 
    81  
    82    INTEGER , PARAMETER ::   jpfld   =10           ! maximum number of files to read 
    83    INTEGER , PARAMETER ::   jp_wndi = 1           ! index of 10m wind velocity (i-component) (m/s)    at T-point 
    84    INTEGER , PARAMETER ::   jp_wndj = 2           ! index of 10m wind velocity (j-component) (m/s)    at T-point 
    85    INTEGER , PARAMETER ::   jp_tair = 3           ! index of 10m air temperature             (Kelvin) 
    86    INTEGER , PARAMETER ::   jp_humi = 4           ! index of specific humidity               ( % ) 
    87    INTEGER , PARAMETER ::   jp_qsr  = 5           ! index of solar heat                      (W/m2) 
    88    INTEGER , PARAMETER ::   jp_qlw  = 6           ! index of Long wave                       (W/m2) 
    89    INTEGER , PARAMETER ::   jp_prec = 7           ! index of total precipitation (rain+snow) (Kg/m2/s) 
    90    INTEGER , PARAMETER ::   jp_snow = 8           ! index of snow (solid prcipitation)       (kg/m2/s) 
    91    INTEGER , PARAMETER ::   jp_slp  = 9           ! index of sea level pressure              (Pa) 
    92    INTEGER , PARAMETER ::   jp_tdif =10           ! index of tau diff associated to HF tau   (N/m2)   at T-point 
    93  
    94    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read) 
    95  
    96    !                                             !!! Bulk parameters 
    97    REAL(wp), PARAMETER ::   cpa    = 1000.5         ! specific heat of air (only used for ice fluxes now...) 
    98    REAL(wp), PARAMETER ::   Ls     =    2.839e6     ! latent heat of sublimation 
    99    REAL(wp), PARAMETER ::   Stef   =    5.67e-8     ! Stefan Boltzmann constant 
    100    REAL(wp), PARAMETER ::   Cd_ice =    1.4e-3      ! transfer coefficient over ice 
    101    REAL(wp), PARAMETER ::   albo   =    0.066       ! ocean albedo assumed to be constant 
    102    ! 
     74#endif 
     75 
     76   INTEGER , PUBLIC            ::   jpfld         ! maximum number of files to read 
     77   INTEGER , PUBLIC, PARAMETER ::   jp_wndi = 1   ! index of 10m wind velocity (i-component) (m/s)    at T-point 
     78   INTEGER , PUBLIC, PARAMETER ::   jp_wndj = 2   ! index of 10m wind velocity (j-component) (m/s)    at T-point 
     79   INTEGER , PUBLIC, PARAMETER ::   jp_tair = 3   ! index of 10m air temperature             (Kelvin) 
     80   INTEGER , PUBLIC, PARAMETER ::   jp_humi = 4   ! index of specific humidity               ( % ) 
     81   INTEGER , PUBLIC, PARAMETER ::   jp_qsr  = 5   ! index of solar heat                      (W/m2) 
     82   INTEGER , PUBLIC, PARAMETER ::   jp_qlw  = 6   ! index of Long wave                       (W/m2) 
     83   INTEGER , PUBLIC, PARAMETER ::   jp_prec = 7   ! index of total precipitation (rain+snow) (Kg/m2/s) 
     84   INTEGER , PUBLIC, PARAMETER ::   jp_snow = 8   ! index of snow (solid prcipitation)       (kg/m2/s) 
     85   INTEGER , PUBLIC, PARAMETER ::   jp_slp  = 9   ! index of sea level pressure              (Pa) 
     86   INTEGER , PUBLIC, PARAMETER ::   jp_hpgi =10   ! index of ABL geostrophic wind or hpg (i-component) (m/s) at T-point 
     87   INTEGER , PUBLIC, PARAMETER ::   jp_hpgj =11   ! index of ABL geostrophic wind or hpg (j-component) (m/s) at T-point 
     88 
     89   TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input atmospheric fields (file informations, fields read) 
     90 
    10391   !                           !!* Namelist namsbc_blk : bulk parameters 
    10492   LOGICAL  ::   ln_NCAR        ! "NCAR"      algorithm   (Large and Yeager 2008) 
    10593   LOGICAL  ::   ln_COARE_3p0   ! "COARE 3.0" algorithm   (Fairall et al. 2003) 
    106    LOGICAL  ::   ln_COARE_3p5   ! "COARE 3.5" algorithm   (Edson et al. 2013) 
    107    LOGICAL  ::   ln_ECMWF       ! "ECMWF"     algorithm   (IFS cycle 31) 
     94   LOGICAL  ::   ln_COARE_3p6   ! "COARE 3.6" algorithm   (Edson et al. 2013) 
     95   LOGICAL  ::   ln_ECMWF       ! "ECMWF"     algorithm   (IFS cycle 45r1) 
    10896   ! 
    109    LOGICAL  ::   ln_taudif      ! logical flag to use the "mean of stress module - module of mean stress" data 
    110    REAL(wp) ::   rn_pfac        ! multiplication factor for precipitation 
    111    REAL(wp) ::   rn_efac        ! multiplication factor for evaporation 
    112    REAL(wp) ::   rn_vfac        ! multiplication factor for ice/ocean velocity in the calculation of wind stress 
    113    REAL(wp) ::   rn_zqt         ! z(q,t) : height of humidity and temperature measurements 
    114    REAL(wp) ::   rn_zu          ! z(u)   : height of wind measurements 
    115 !!gm ref namelist initialize it so remove the setting to false below 
    116    LOGICAL  ::   ln_Cd_L12 = .FALSE. !  Modify the drag ice-atm depending on ice concentration (from Lupkes et al. JGR2012) 
    117    LOGICAL  ::   ln_Cd_L15 = .FALSE. !  Modify the drag ice-atm depending on ice concentration (from Lupkes et al. JGR2015) 
     97   LOGICAL  ::   ln_Cd_L12      ! ice-atm drag = F( ice concentration )                        (Lupkes et al. JGR2012) 
     98   LOGICAL  ::   ln_Cd_L15      ! ice-atm drag = F( ice concentration, atmospheric stability ) (Lupkes et al. JGR2015) 
    11899   ! 
    119    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   Cd_atm                    ! transfer coefficient for momentum      (tau) 
    120    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   Ch_atm                    ! transfer coefficient for sensible heat (Q_sens) 
    121    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   Ce_atm                    ! tansfert coefficient for evaporation   (Q_lat) 
    122    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   t_zu                      ! air temperature at wind speed height (needed by Lupkes 2015 bulk scheme) 
    123    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   q_zu                      ! air spec. hum.  at wind speed height (needed by Lupkes 2015 bulk scheme) 
    124    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   cdn_oce, chn_oce, cen_oce ! needed by Lupkes 2015 bulk scheme 
     100   REAL(wp)         ::   rn_pfac   ! multiplication factor for precipitation 
     101   REAL(wp), PUBLIC ::   rn_efac   ! multiplication factor for evaporation 
     102   REAL(wp), PUBLIC ::   rn_vfac   ! multiplication factor for ice/ocean velocity in the calculation of wind stress 
     103   REAL(wp)         ::   rn_zqt    ! z(q,t) : height of humidity and temperature measurements 
     104   REAL(wp)         ::   rn_zu     ! z(u)   : height of wind measurements 
     105   ! 
     106   REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   Cd_ice , Ch_ice , Ce_ice   ! transfert coefficients over ice 
     107   REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   Cdn_oce, Chn_oce, Cen_oce  ! neutral coeffs over ocean (L15 bulk scheme) 
     108   REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   t_zu, q_zu                 ! air temp. and spec. hum. at wind speed height (L15 bulk scheme) 
     109 
     110   LOGICAL  ::   ln_skin_cs     ! use the cool-skin (only available in ECMWF and COARE algorithms) !LB 
     111   LOGICAL  ::   ln_skin_wl     ! use the warm-layer parameterization (only available in ECMWF and COARE algorithms) !LB 
     112   LOGICAL  ::   ln_humi_sph    ! humidity read in files ("sn_humi") is specific humidity [kg/kg] if .true. !LB 
     113   LOGICAL  ::   ln_humi_dpt    ! humidity read in files ("sn_humi") is dew-point temperature [K] if .true. !LB 
     114   LOGICAL  ::   ln_humi_rlh    ! humidity read in files ("sn_humi") is relative humidity     [%] if .true. !LB 
     115   ! 
     116   INTEGER  ::   nhumi          ! choice of the bulk algorithm 
     117   !                            ! associated indices: 
     118   INTEGER, PARAMETER :: np_humi_sph = 1 
     119   INTEGER, PARAMETER :: np_humi_dpt = 2 
     120   INTEGER, PARAMETER :: np_humi_rlh = 3 
    125121 
    126122   INTEGER  ::   nblk           ! choice of the bulk algorithm 
     
    128124   INTEGER, PARAMETER ::   np_NCAR      = 1   ! "NCAR" algorithm        (Large and Yeager 2008) 
    129125   INTEGER, PARAMETER ::   np_COARE_3p0 = 2   ! "COARE 3.0" algorithm   (Fairall et al. 2003) 
    130    INTEGER, PARAMETER ::   np_COARE_3p5 = 3   ! "COARE 3.5" algorithm   (Edson et al. 2013) 
    131    INTEGER, PARAMETER ::   np_ECMWF     = 4   ! "ECMWF" algorithm       (IFS cycle 31) 
     126   INTEGER, PARAMETER ::   np_COARE_3p6 = 3   ! "COARE 3.6" algorithm   (Edson et al. 2013) 
     127   INTEGER, PARAMETER ::   np_ECMWF     = 4   ! "ECMWF" algorithm       (IFS cycle 45r1) 
    132128 
    133129   !! * Substitutions 
     
    144140      !!             ***  ROUTINE sbc_blk_alloc *** 
    145141      !!------------------------------------------------------------------- 
    146       ALLOCATE( Cd_atm (jpi,jpj), Ch_atm (jpi,jpj), Ce_atm (jpi,jpj), t_zu(jpi,jpj), q_zu(jpi,jpj), & 
    147          &      cdn_oce(jpi,jpj), chn_oce(jpi,jpj), cen_oce(jpi,jpj), STAT=sbc_blk_alloc ) 
     142      ALLOCATE( t_zu(jpi,jpj)   , q_zu(jpi,jpj)   ,                                      & 
     143         &      Cdn_oce(jpi,jpj), Chn_oce(jpi,jpj), Cen_oce(jpi,jpj),                    & 
     144         &      Cd_ice (jpi,jpj), Ch_ice (jpi,jpj), Ce_ice (jpi,jpj), STAT=sbc_blk_alloc ) 
    148145      ! 
    149146      CALL mpp_sum ( 'sbcblk', sbc_blk_alloc ) 
     
    158155      !! ** Purpose :   choose and initialize a bulk formulae formulation 
    159156      !! 
    160       !! ** Method  :  
     157      !! ** Method  : 
    161158      !! 
    162159      !!---------------------------------------------------------------------- 
    163       INTEGER  ::   ifpr, jfld            ! dummy loop indice and argument 
     160      INTEGER  ::   jfpr                  ! dummy loop indice and argument 
    164161      INTEGER  ::   ios, ierror, ioptio   ! Local integer 
    165162      !! 
    166163      CHARACTER(len=100)            ::   cn_dir                ! Root directory for location of atmospheric forcing files 
    167       TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i                 ! array of namelist informations on the fields to read 
     164      TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) ::   slf_i        ! array of namelist informations on the fields to read 
    168165      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_humi, sn_qsr       ! informations about the fields to be read 
    169166      TYPE(FLD_N) ::   sn_qlw , sn_tair, sn_prec, sn_snow      !       "                        " 
    170       TYPE(FLD_N) ::   sn_slp , sn_tdif                        !       "                        " 
     167      TYPE(FLD_N) ::   sn_slp , sn_hpgi, sn_hpgj               !       "                        " 
    171168      NAMELIST/namsbc_blk/ sn_wndi, sn_wndj, sn_humi, sn_qsr, sn_qlw ,                &   ! input fields 
    172          &                 sn_tair, sn_prec, sn_snow, sn_slp, sn_tdif,                & 
    173          &                 ln_NCAR, ln_COARE_3p0, ln_COARE_3p5, ln_ECMWF,             &   ! bulk algorithm 
    174          &                 cn_dir , ln_taudif, rn_zqt, rn_zu,                         &  
    175          &                 rn_pfac, rn_efac, rn_vfac, ln_Cd_L12, ln_Cd_L15 
     169         &                 sn_tair, sn_prec, sn_snow, sn_slp, sn_hpgi, sn_hpgj,       & 
     170         &                 ln_NCAR, ln_COARE_3p0, ln_COARE_3p6, ln_ECMWF,             &   ! bulk algorithm 
     171         &                 cn_dir , rn_zqt, rn_zu,                                    & 
     172         &                 rn_pfac, rn_efac, rn_vfac, ln_Cd_L12, ln_Cd_L15,           & 
     173         &                 ln_skin_cs, ln_skin_wl, ln_humi_sph, ln_humi_dpt, ln_humi_rlh  ! cool-skin / warm-layer !LB 
    176174      !!--------------------------------------------------------------------- 
    177175      ! 
     
    179177      IF( sbc_blk_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_blk : unable to allocate standard arrays' ) 
    180178      ! 
    181       !                             !** read bulk namelist   
     179      !                             !** read bulk namelist 
    182180      READ  ( numnam_ref, namsbc_blk, IOSTAT = ios, ERR = 901) 
    183181901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_blk in reference namelist' ) 
     
    190188      !                             !** initialization of the chosen bulk formulae (+ check) 
    191189      !                                   !* select the bulk chosen in the namelist and check the choice 
    192                                                                ioptio = 0 
    193       IF( ln_NCAR      ) THEN   ;   nblk =  np_NCAR        ;   ioptio = ioptio + 1   ;   ENDIF 
    194       IF( ln_COARE_3p0 ) THEN   ;   nblk =  np_COARE_3p0   ;   ioptio = ioptio + 1   ;   ENDIF 
    195       IF( ln_COARE_3p5 ) THEN   ;   nblk =  np_COARE_3p5   ;   ioptio = ioptio + 1   ;   ENDIF 
    196       IF( ln_ECMWF     ) THEN   ;   nblk =  np_ECMWF       ;   ioptio = ioptio + 1   ;   ENDIF 
    197       ! 
     190      ioptio = 0 
     191      IF( ln_NCAR      ) THEN 
     192         nblk =  np_NCAR        ;   ioptio = ioptio + 1 
     193      ENDIF 
     194      IF( ln_COARE_3p0 ) THEN 
     195         nblk =  np_COARE_3p0   ;   ioptio = ioptio + 1 
     196      ENDIF 
     197      IF( ln_COARE_3p6 ) THEN 
     198         nblk =  np_COARE_3p6   ;   ioptio = ioptio + 1 
     199      ENDIF 
     200      IF( ln_ECMWF     ) THEN 
     201         nblk =  np_ECMWF       ;   ioptio = ioptio + 1 
     202      ENDIF 
    198203      IF( ioptio /= 1 )   CALL ctl_stop( 'sbc_blk_init: Choose one and only one bulk algorithm' ) 
     204 
     205      !                             !** initialization of the cool-skin / warm-layer parametrization 
     206      IF( ln_skin_cs .OR. ln_skin_wl ) THEN 
     207         !! Some namelist sanity tests: 
     208         IF( ln_NCAR )      & 
     209            & CALL ctl_stop( 'sbc_blk_init: Cool-skin/warm-layer param. not compatible with NCAR algorithm' ) 
     210         IF( nn_fsbc /= 1 ) & 
     211            & CALL ctl_stop( 'sbc_blk_init: Please set "nn_fsbc" to 1 when using cool-skin/warm-layer param.') 
     212      END IF 
     213 
     214      IF( ln_skin_wl ) THEN 
     215         !! Check if the frequency of downwelling solar flux input makes sense and if ln_dm2dc=T if it is daily! 
     216         IF( (sn_qsr%freqh  < 0.).OR.(sn_qsr%freqh  > 24.) ) & 
     217            & CALL ctl_stop( 'sbc_blk_init: Warm-layer param. (ln_skin_wl) not compatible with freq. of solar flux > daily' ) 
     218         IF( (sn_qsr%freqh == 24.).AND.(.NOT. ln_dm2dc) ) & 
     219            & CALL ctl_stop( 'sbc_blk_init: Please set ln_dm2dc=T for warm-layer param. (ln_skin_wl) to work properly' ) 
     220      END IF 
     221 
     222      ioptio = 0 
     223      IF( ln_humi_sph ) THEN 
     224         nhumi =  np_humi_sph    ;   ioptio = ioptio + 1 
     225      ENDIF 
     226      IF( ln_humi_dpt ) THEN 
     227         nhumi =  np_humi_dpt    ;   ioptio = ioptio + 1 
     228      ENDIF 
     229      IF( ln_humi_rlh ) THEN 
     230         nhumi =  np_humi_rlh    ;   ioptio = ioptio + 1 
     231      ENDIF 
     232      IF( ioptio /= 1 )   CALL ctl_stop( 'sbc_blk_init: Choose one and only one type of air humidity' ) 
    199233      ! 
    200234      IF( ln_dm2dc ) THEN                 !* check: diurnal cycle on Qsr 
    201235         IF( sn_qsr%freqh /= 24. )   CALL ctl_stop( 'sbc_blk_init: ln_dm2dc=T only with daily short-wave input' ) 
    202          IF( sn_qsr%ln_tint ) THEN  
     236         IF( sn_qsr%ln_tint ) THEN 
    203237            CALL ctl_warn( 'sbc_blk_init: ln_dm2dc=T daily qsr time interpolation done by sbcdcy module',   & 
    204238               &           '              ==> We force time interpolation = .false. for qsr' ) 
     
    208242      !                                   !* set the bulk structure 
    209243      !                                      !- store namelist information in an array 
     244      IF( ln_blk ) jpfld = 9 
     245      IF( ln_abl ) jpfld = 11 
     246      ALLOCATE( slf_i(jpfld) ) 
     247      ! 
    210248      slf_i(jp_wndi) = sn_wndi   ;   slf_i(jp_wndj) = sn_wndj 
    211249      slf_i(jp_qsr ) = sn_qsr    ;   slf_i(jp_qlw ) = sn_qlw 
    212250      slf_i(jp_tair) = sn_tair   ;   slf_i(jp_humi) = sn_humi 
    213251      slf_i(jp_prec) = sn_prec   ;   slf_i(jp_snow) = sn_snow 
    214       slf_i(jp_slp)  = sn_slp    ;   slf_i(jp_tdif) = sn_tdif 
    215       ! 
    216       lhftau = ln_taudif                     !- add an extra field if HF stress is used 
    217       jfld = jpfld - COUNT( (/.NOT.lhftau/) ) 
     252      slf_i(jp_slp ) = sn_slp 
     253      IF( ln_abl ) THEN 
     254         slf_i(jp_hpgi) = sn_hpgi   ;   slf_i(jp_hpgj) = sn_hpgj 
     255      END IF 
    218256      ! 
    219257      !                                      !- allocate the bulk structure 
    220       ALLOCATE( sf(jfld), STAT=ierror ) 
     258      ALLOCATE( sf(jpfld), STAT=ierror ) 
    221259      IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_blk_init: unable to allocate sf structure' ) 
    222       DO ifpr= 1, jfld 
    223          ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) ) 
    224          IF( slf_i(ifpr)%ln_tint )   ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) ) 
    225          IF( slf_i(ifpr)%freqh > 0. .AND. MOD( NINT(3600. * slf_i(ifpr)%freqh), nn_fsbc * NINT(rdt) ) /= 0 )   & 
    226             &  CALL ctl_warn( 'sbc_blk_init: sbcmod timestep rdt*nn_fsbc is NOT a submultiple of atmospheric forcing frequency.',   & 
    227             &                 '               This is not ideal. You should consider changing either rdt or nn_fsbc value...' ) 
    228  
     260      ! 
     261      DO jfpr= 1, jpfld 
     262         ! 
     263         IF( TRIM(sf(jfpr)%clrootname) == 'NOT USED' ) THEN    !--  not used field  --!   (only now allocated and set to zero) 
     264            ALLOCATE( sf(jfpr)%fnow(jpi,jpj,1) ) 
     265            sf(jfpr)%fnow(:,:,1) = 0._wp 
     266         ELSE                                                  !-- used field  --! 
     267            IF(   ln_abl    .AND.                                                      & 
     268               &    ( jfpr == jp_wndi .OR. jfpr == jp_wndj .OR. jfpr == jp_humi .OR.   & 
     269               &      jfpr == jp_hpgi .OR. jfpr == jp_hpgj .OR. jfpr == jp_tair     )  ) THEN   ! ABL: some fields are 3D input 
     270               ALLOCATE( sf(jfpr)%fnow(jpi,jpj,jpka) ) 
     271               IF( slf_i(jfpr)%ln_tint )   ALLOCATE( sf(jfpr)%fdta(jpi,jpj,jpka,2) ) 
     272            ELSE                                                                                ! others or Bulk fields are 2D fiels 
     273               ALLOCATE( sf(jfpr)%fnow(jpi,jpj,1) ) 
     274               IF( slf_i(jfpr)%ln_tint )   ALLOCATE( sf(jfpr)%fdta(jpi,jpj,1,2) ) 
     275            ENDIF 
     276            ! 
     277            IF( slf_i(jfpr)%freqh > 0. .AND. MOD( NINT(3600. * slf_i(jfpr)%freqh), nn_fsbc * NINT(rdt) ) /= 0 )   & 
     278               &  CALL ctl_warn( 'sbc_blk_init: sbcmod timestep rdt*nn_fsbc is NOT a submultiple of atmospheric forcing frequency.',   & 
     279               &                 '               This is not ideal. You should consider changing either rdt or nn_fsbc value...' ) 
     280         ENDIF 
    229281      END DO 
    230282      !                                      !- fill the bulk structure with namelist informations 
    231283      CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_init', 'surface boundary condition -- bulk formulae', 'namsbc_blk' ) 
    232284      ! 
    233       IF ( ln_wave ) THEN 
    234       !Activated wave module but neither drag nor stokes drift activated 
    235          IF ( .NOT.(ln_cdgw .OR. ln_sdw .OR. ln_tauwoc .OR. ln_stcor ) )   THEN 
     285      IF( ln_wave ) THEN 
     286         !Activated wave module but neither drag nor stokes drift activated 
     287         IF( .NOT.(ln_cdgw .OR. ln_sdw .OR. ln_tauwoc .OR. ln_stcor ) )   THEN 
    236288            CALL ctl_stop( 'STOP',  'Ask for wave coupling but ln_cdgw=F, ln_sdw=F, ln_tauwoc=F, ln_stcor=F' ) 
    237       !drag coefficient read from wave model definable only with mfs bulk formulae and core  
    238          ELSEIF (ln_cdgw .AND. .NOT. ln_NCAR )       THEN        
    239              CALL ctl_stop( 'drag coefficient read from wave model definable only with NCAR and CORE bulk formulae') 
    240          ELSEIF (ln_stcor .AND. .NOT. ln_sdw)                             THEN 
    241              CALL ctl_stop( 'Stokes-Coriolis term calculated only if activated Stokes Drift ln_sdw=T') 
     289            !drag coefficient read from wave model definable only with mfs bulk formulae and core 
     290         ELSEIF(ln_cdgw .AND. .NOT. ln_NCAR )       THEN 
     291            CALL ctl_stop( 'drag coefficient read from wave model definable only with NCAR and CORE bulk formulae') 
     292         ELSEIF(ln_stcor .AND. .NOT. ln_sdw)                             THEN 
     293            CALL ctl_stop( 'Stokes-Coriolis term calculated only if activated Stokes Drift ln_sdw=T') 
    242294         ENDIF 
    243295      ELSE 
    244       IF ( ln_cdgw .OR. ln_sdw .OR. ln_tauwoc .OR. ln_stcor )                &  
    245          &   CALL ctl_stop( 'Not Activated Wave Module (ln_wave=F) but asked coupling ',    & 
    246          &                  'with drag coefficient (ln_cdgw =T) '  ,                        & 
    247          &                  'or Stokes Drift (ln_sdw=T) ' ,                                 & 
    248          &                  'or ocean stress modification due to waves (ln_tauwoc=T) ',      &   
    249          &                  'or Stokes-Coriolis term (ln_stcori=T)'  ) 
    250       ENDIF  
    251       ! 
    252       !            
     296         IF( ln_cdgw .OR. ln_sdw .OR. ln_tauwoc .OR. ln_stcor )                & 
     297            &   CALL ctl_stop( 'Not Activated Wave Module (ln_wave=F) but asked coupling ',    & 
     298            &                  'with drag coefficient (ln_cdgw =T) '  ,                        & 
     299            &                  'or Stokes Drift (ln_sdw=T) ' ,                                 & 
     300            &                  'or ocean stress modification due to waves (ln_tauwoc=T) ',      & 
     301            &                  'or Stokes-Coriolis term (ln_stcori=T)'  ) 
     302      ENDIF 
     303      ! 
     304      IF( ln_abl ) THEN       ! ABL: read 3D fields for wind, temperature, humidity and pressure gradient 
     305         rn_zqt = ght_abl(2)          ! set the bulk altitude to ABL first level 
     306         rn_zu  = ght_abl(2) 
     307         IF(lwp) WRITE(numout,*) 
     308         IF(lwp) WRITE(numout,*) '   ABL formulation: overwrite rn_zqt & rn_zu with ABL first level altitude' 
     309      ENDIF 
     310      ! 
     311      ! set transfer coefficients to default sea-ice values 
     312      Cd_ice(:,:) = rCd_ice 
     313      Ch_ice(:,:) = rCd_ice 
     314      Ce_ice(:,:) = rCd_ice 
     315      ! 
    253316      IF(lwp) THEN                     !** Control print 
    254317         ! 
    255          WRITE(numout,*)                  !* namelist  
     318         WRITE(numout,*)                  !* namelist 
    256319         WRITE(numout,*) '   Namelist namsbc_blk (other than data information):' 
    257320         WRITE(numout,*) '      "NCAR"      algorithm   (Large and Yeager 2008)     ln_NCAR      = ', ln_NCAR 
    258321         WRITE(numout,*) '      "COARE 3.0" algorithm   (Fairall et al. 2003)       ln_COARE_3p0 = ', ln_COARE_3p0 
    259          WRITE(numout,*) '      "COARE 3.5" algorithm   (Edson et al. 2013)         ln_COARE_3p5 = ', ln_COARE_3p0 
    260          WRITE(numout,*) '      "ECMWF"     algorithm   (IFS cycle 31)              ln_ECMWF     = ', ln_ECMWF 
    261          WRITE(numout,*) '      add High freq.contribution to the stress module     ln_taudif    = ', ln_taudif 
     322         WRITE(numout,*) '      "COARE 3.6" algorithm (Fairall 2018 + Edson al 2013)ln_COARE_3p6 = ', ln_COARE_3p6 
     323         WRITE(numout,*) '      "ECMWF"     algorithm   (IFS cycle 45r1)            ln_ECMWF     = ', ln_ECMWF 
    262324         WRITE(numout,*) '      Air temperature and humidity reference height (m)   rn_zqt       = ', rn_zqt 
    263325         WRITE(numout,*) '      Wind vector reference height (m)                    rn_zu        = ', rn_zu 
     
    273335         CASE( np_NCAR      )   ;   WRITE(numout,*) '   ==>>>   "NCAR" algorithm        (Large and Yeager 2008)' 
    274336         CASE( np_COARE_3p0 )   ;   WRITE(numout,*) '   ==>>>   "COARE 3.0" algorithm   (Fairall et al. 2003)' 
    275          CASE( np_COARE_3p5 )   ;   WRITE(numout,*) '   ==>>>   "COARE 3.5" algorithm   (Edson et al. 2013)' 
    276          CASE( np_ECMWF     )   ;   WRITE(numout,*) '   ==>>>   "ECMWF" algorithm       (IFS cycle 31)' 
     337         CASE( np_COARE_3p6 )   ;   WRITE(numout,*) '   ==>>>   "COARE 3.6" algorithm (Fairall 2018+Edson et al. 2013)' 
     338         CASE( np_ECMWF     )   ;   WRITE(numout,*) '   ==>>>   "ECMWF" algorithm       (IFS cycle 45r1)' 
    277339         END SELECT 
    278340         ! 
     341         WRITE(numout,*) 
     342         WRITE(numout,*) '      use cool-skin  parameterization (SSST)  ln_skin_cs  = ', ln_skin_cs 
     343         WRITE(numout,*) '      use warm-layer parameterization (SSST)  ln_skin_wl  = ', ln_skin_wl 
     344         ! 
     345         WRITE(numout,*) 
     346         SELECT CASE( nhumi )              !* Print the choice of air humidity 
     347         CASE( np_humi_sph )   ;   WRITE(numout,*) '   ==>>>   air humidity is SPECIFIC HUMIDITY     [kg/kg]' 
     348         CASE( np_humi_dpt )   ;   WRITE(numout,*) '   ==>>>   air humidity is DEW-POINT TEMPERATURE [K]' 
     349         CASE( np_humi_rlh )   ;   WRITE(numout,*) '   ==>>>   air humidity is RELATIVE HUMIDITY     [%]' 
     350         END SELECT 
     351         ! 
    279352      ENDIF 
    280353      ! 
     
    289362      !!              (momentum, heat, freshwater and runoff) 
    290363      !! 
    291       !! ** Method  : (1) READ each fluxes in NetCDF files: 
    292       !!      the 10m wind velocity (i-component) (m/s)    at T-point 
    293       !!      the 10m wind velocity (j-component) (m/s)    at T-point 
    294       !!      the 10m or 2m specific humidity     ( % ) 
    295       !!      the solar heat                      (W/m2) 
    296       !!      the Long wave                       (W/m2) 
    297       !!      the 10m or 2m air temperature       (Kelvin) 
    298       !!      the total precipitation (rain+snow) (Kg/m2/s) 
    299       !!      the snow (solid prcipitation)       (kg/m2/s) 
    300       !!      the tau diff associated to HF tau   (N/m2)   at T-point   (ln_taudif=T) 
    301       !!              (2) CALL blk_oce 
     364      !! ** Method  : 
     365      !!              (1) READ each fluxes in NetCDF files: 
     366      !!      the wind velocity (i-component) at z=rn_zu  (m/s) at T-point 
     367      !!      the wind velocity (j-component) at z=rn_zu  (m/s) at T-point 
     368      !!      the specific humidity           at z=rn_zqt (kg/kg) 
     369      !!      the air temperature             at z=rn_zqt (Kelvin) 
     370      !!      the solar heat                              (W/m2) 
     371      !!      the Long wave                               (W/m2) 
     372      !!      the total precipitation (rain+snow)         (Kg/m2/s) 
     373      !!      the snow (solid precipitation)              (kg/m2/s) 
     374      !!      ABL dynamical forcing (i/j-components of either hpg or geostrophic winds) 
     375      !!              (2) CALL blk_oce_1 and blk_oce_2 
    302376      !! 
    303377      !!      C A U T I O N : never mask the surface stress fields 
     
    316390      !!---------------------------------------------------------------------- 
    317391      INTEGER, INTENT(in) ::   kt   ! ocean time step 
    318       !!--------------------------------------------------------------------- 
     392      !!---------------------------------------------------------------------- 
     393      REAL(wp), DIMENSION(jpi,jpj) ::   zssq, zcd_du, zsen, zevp 
     394      REAL(wp) :: ztmp 
     395      !!---------------------------------------------------------------------- 
    319396      ! 
    320397      CALL fld_read( kt, nn_fsbc, sf )             ! input fields provided at the current time-step 
    321       ! 
     398 
     399      ! Sanity/consistence test on humidity at first time step to detect potential screw-up: 
     400      IF( kt == nit000 ) THEN 
     401         WRITE(numout,*) '' 
     402#if defined key_agrif 
     403         WRITE(numout,*) ' === AGRIF => Sanity/consistence test on air humidity SKIPPED! :( ===' 
     404#else 
     405         ztmp = SUM(tmask(:,:,1)) ! number of ocean points on local proc domain 
     406         IF( ztmp > 8._wp ) THEN ! test only on proc domains with at least 8 ocean points! 
     407            ztmp = SUM(sf(jp_humi)%fnow(:,:,1)*tmask(:,:,1))/ztmp ! mean humidity over ocean on proc 
     408            SELECT CASE( nhumi ) 
     409            CASE( np_humi_sph ) ! specific humidity => expect: 0. <= something < 0.065 [kg/kg] (0.061 is saturation at 45degC !!!) 
     410               IF(  (ztmp < 0._wp) .OR. (ztmp > 0.065)  ) ztmp = -1._wp 
     411            CASE( np_humi_dpt ) ! dew-point temperature => expect: 110. <= something < 320. [K] 
     412               IF( (ztmp < 110._wp).OR.(ztmp > 320._wp) ) ztmp = -1._wp 
     413            CASE( np_humi_rlh ) ! relative humidity => expect: 0. <= something < 100. [%] 
     414               IF(  (ztmp < 0._wp) .OR.(ztmp > 100._wp) ) ztmp = -1._wp 
     415            END SELECT 
     416            IF(ztmp < 0._wp) THEN 
     417               WRITE(numout,'("   Mean humidity value found on proc #",i5.5," is: ",f)') narea, ztmp 
     418               CALL ctl_stop( 'STOP', 'Something is wrong with air humidity!!!', & 
     419                  &   ' ==> check the unit in your input files'       , & 
     420                  &   ' ==> check consistence of namelist choice: specific? relative? dew-point?', & 
     421                  &   ' ==> ln_humi_sph -> [kg/kg] | ln_humi_rlh -> [%] | ln_humi_dpt -> [K] !!!' ) 
     422            END IF 
     423         END IF 
     424         WRITE(numout,*) ' === Sanity/consistence test on air humidity sucessfuly passed! ===' 
     425#endif 
     426         WRITE(numout,*) '' 
     427      END IF !IF( kt == nit000 ) 
    322428      !                                            ! compute the surface ocean fluxes using bulk formulea 
    323       IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce( kt, sf, sst_m, ssu_m, ssv_m ) 
    324  
     429      IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN 
     430         CALL blk_oce_1( kt, sf(jp_wndi)%fnow(:,:,1), sf(jp_wndj)%fnow(:,:,1),   &   !   <<= in 
     431            &                sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1),   &   !   <<= in 
     432            &                sf(jp_slp )%fnow(:,:,1), sst_m, ssu_m, ssv_m,       &   !   <<= in 
     433            &                sf(jp_qsr )%fnow(:,:,1), sf(jp_qlw )%fnow(:,:,1),   &   !   <<= in (wl/cs) 
     434            &                zssq, zcd_du, zsen, zevp )                              !   =>> out 
     435 
     436         CALL blk_oce_2(     sf(jp_tair)%fnow(:,:,1), sf(jp_qsr )%fnow(:,:,1),   &   !   <<= in 
     437            &                sf(jp_qlw )%fnow(:,:,1), sf(jp_prec)%fnow(:,:,1),   &   !   <<= in 
     438            &                sf(jp_snow)%fnow(:,:,1), sst_m,                     &   !   <<= in 
     439            &                zsen, zevp )                                            !   <=> in out 
     440      ENDIF 
     441      ! 
    325442#if defined key_cice 
    326443      IF( MOD( kt - 1, nn_fsbc ) == 0 )   THEN 
    327444         qlw_ice(:,:,1)   = sf(jp_qlw )%fnow(:,:,1) 
    328          IF( ln_dm2dc ) THEN ; qsr_ice(:,:,1) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) 
    329          ELSE                ; qsr_ice(:,:,1) =          sf(jp_qsr)%fnow(:,:,1)  
    330          ENDIF  
     445         IF( ln_dm2dc ) THEN 
     446            qsr_ice(:,:,1) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) 
     447         ELSE 
     448            qsr_ice(:,:,1) =          sf(jp_qsr)%fnow(:,:,1) 
     449         ENDIF 
    331450         tatm_ice(:,:)    = sf(jp_tair)%fnow(:,:,1) 
    332          qatm_ice(:,:)    = sf(jp_humi)%fnow(:,:,1) 
     451 
     452         SELECT CASE( nhumi ) 
     453         CASE( np_humi_sph ) 
     454            qatm_ice(:,:) =           sf(jp_humi)%fnow(:,:,1) 
     455         CASE( np_humi_dpt ) 
     456            qatm_ice(:,:) = q_sat(    sf(jp_humi)%fnow(:,:,1), sf(jp_slp)%fnow(:,:,1) ) 
     457         CASE( np_humi_rlh ) 
     458            qatm_ice(:,:) = q_air_rh( 0.01_wp*sf(jp_humi)%fnow(:,:,1), sf(jp_tair)%fnow(:,:,1), sf(jp_slp)%fnow(:,:,1)) !LB: 0.01 => RH is % percent in file 
     459         END SELECT 
     460 
    333461         tprecip(:,:)     = sf(jp_prec)%fnow(:,:,1) * rn_pfac 
    334462         sprecip(:,:)     = sf(jp_snow)%fnow(:,:,1) * rn_pfac 
     
    341469 
    342470 
    343    SUBROUTINE blk_oce( kt, sf, pst, pu, pv ) 
    344       !!--------------------------------------------------------------------- 
    345       !!                     ***  ROUTINE blk_oce  *** 
    346       !! 
    347       !! ** Purpose :   provide the momentum, heat and freshwater fluxes at 
    348       !!      the ocean surface at each time step 
    349       !! 
    350       !! ** Method  :   bulk formulea for the ocean using atmospheric 
    351       !!      fields read in sbc_read 
     471   SUBROUTINE blk_oce_1( kt, pwndi, pwndj , ptair, phumi, &  ! inp 
     472      &              pslp , pst   , pu   , pv,    &  ! inp 
     473      &              pqsr , pqlw  ,               &  ! inp 
     474      &              pssq , pcd_du, psen , pevp   )  ! out 
     475      !!--------------------------------------------------------------------- 
     476      !!                     ***  ROUTINE blk_oce_1  *** 
     477      !! 
     478      !! ** Purpose :   if ln_blk=T, computes surface momentum, heat and freshwater fluxes 
     479      !!                if ln_abl=T, computes Cd x |U|, Ch x |U|, Ce x |U| for ABL integration 
     480      !! 
     481      !! ** Method  :   bulk formulae using atmospheric fields from : 
     482      !!                if ln_blk=T, atmospheric fields read in sbc_read 
     483      !!                if ln_abl=T, the ABL model at previous time-step 
     484      !! 
     485      !! ** Outputs : - pssq    : surface humidity used to compute latent heat flux (kg/kg) 
     486      !!              - pcd_du  : Cd x |dU| at T-points  (m/s) 
     487      !!              - psen    : Ch x |dU| at T-points  (m/s) 
     488      !!              - pevp    : Ce x |dU| at T-points  (m/s) 
     489      !!--------------------------------------------------------------------- 
     490      INTEGER , INTENT(in   )                 ::   kt     ! time step index 
     491      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pwndi  ! atmospheric wind at U-point              [m/s] 
     492      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pwndj  ! atmospheric wind at V-point              [m/s] 
     493      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   phumi  ! specific humidity at T-points            [kg/kg] 
     494      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   ptair  ! potential temperature at T-points        [Kelvin] 
     495      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pslp   ! sea-level pressure                       [Pa] 
     496      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pst    ! surface temperature                      [Celcius] 
     497      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pu     ! surface current at U-point (i-component) [m/s] 
     498      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pv     ! surface current at V-point (j-component) [m/s] 
     499      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pqsr   ! 
     500      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pqlw   ! 
     501      REAL(wp), INTENT(  out), DIMENSION(:,:) ::   pssq   ! specific humidity at pst                 [kg/kg] 
     502      REAL(wp), INTENT(  out), DIMENSION(:,:) ::   pcd_du ! Cd x |dU| at T-points                    [m/s] 
     503      REAL(wp), INTENT(  out), DIMENSION(:,:) ::   psen   ! Ch x |dU| at T-points                    [m/s] 
     504      REAL(wp), INTENT(  out), DIMENSION(:,:) ::   pevp   ! Ce x |dU| at T-points                    [m/s] 
     505      ! 
     506      INTEGER  ::   ji, jj               ! dummy loop indices 
     507      REAL(wp) ::   zztmp                ! local variable 
     508      REAL(wp), DIMENSION(jpi,jpj) ::   zwnd_i, zwnd_j    ! wind speed components at T-point 
     509      REAL(wp), DIMENSION(jpi,jpj) ::   zst               ! surface temperature in Kelvin 
     510      REAL(wp), DIMENSION(jpi,jpj) ::   zU_zu             ! bulk wind speed at height zu  [m/s] 
     511      REAL(wp), DIMENSION(jpi,jpj) ::   ztpot             ! potential temperature of air at z=rn_zqt [K] 
     512      REAL(wp), DIMENSION(jpi,jpj) ::   zqair             ! specific humidity     of air at z=rn_zqt [kg/kg] 
     513      REAL(wp), DIMENSION(jpi,jpj) ::   zcd_oce           ! momentum transfert coefficient over ocean 
     514      REAL(wp), DIMENSION(jpi,jpj) ::   zch_oce           ! sensible heat transfert coefficient over ocean 
     515      REAL(wp), DIMENSION(jpi,jpj) ::   zce_oce           ! latent   heat transfert coefficient over ocean 
     516      REAL(wp), DIMENSION(jpi,jpj) ::   zqla              ! latent heat flux 
     517      REAL(wp), DIMENSION(jpi,jpj) ::   zztmp1, zztmp2 
     518      !!--------------------------------------------------------------------- 
     519      ! 
     520      ! local scalars ( place there for vector optimisation purposes) 
     521      zst(:,:) = pst(:,:) + rt0      ! convert SST from Celcius to Kelvin (and set minimum value far above 0 K) 
     522 
     523      ! ----------------------------------------------------------------------------- ! 
     524      !      0   Wind components and module at T-point relative to the moving ocean   ! 
     525      ! ----------------------------------------------------------------------------- ! 
     526 
     527      ! ... components ( U10m - U_oce ) at T-point (unmasked) 
     528#if defined key_cyclone 
     529      zwnd_i(:,:) = 0._wp 
     530      zwnd_j(:,:) = 0._wp 
     531      CALL wnd_cyc( kt, zwnd_i, zwnd_j )    ! add analytical tropical cyclone (Vincent et al. JGR 2012) 
     532      DO jj = 2, jpjm1 
     533         DO ji = fs_2, fs_jpim1   ! vect. opt. 
     534            pwndi(ji,jj) = pwndi(ji,jj) + zwnd_i(ji,jj) 
     535            pwndj(ji,jj) = pwndj(ji,jj) + zwnd_j(ji,jj) 
     536         END DO 
     537      END DO 
     538#endif 
     539      DO jj = 2, jpjm1 
     540         DO ji = fs_2, fs_jpim1   ! vect. opt. 
     541            zwnd_i(ji,jj) = (  pwndi(ji,jj) - rn_vfac * 0.5 * ( pu(ji-1,jj  ) + pu(ji,jj) )  ) 
     542            zwnd_j(ji,jj) = (  pwndj(ji,jj) - rn_vfac * 0.5 * ( pv(ji  ,jj-1) + pv(ji,jj) )  ) 
     543         END DO 
     544      END DO 
     545      CALL lbc_lnk_multi( 'sbcblk', zwnd_i, 'T', -1., zwnd_j, 'T', -1. ) 
     546      ! ... scalar wind ( = | U10m - U_oce | ) at T-point (masked) 
     547      wndm(:,:) = SQRT(  zwnd_i(:,:) * zwnd_i(:,:)   & 
     548         &             + zwnd_j(:,:) * zwnd_j(:,:)  ) * tmask(:,:,1) 
     549 
     550      ! ----------------------------------------------------------------------------- ! 
     551      !      I   Solar FLUX                                                           ! 
     552      ! ----------------------------------------------------------------------------- ! 
     553 
     554      ! ocean albedo assumed to be constant + modify now Qsr to include the diurnal cycle                    ! Short Wave 
     555      zztmp = 1. - albo 
     556      IF( ln_dm2dc ) THEN 
     557         qsr(:,:) = zztmp * sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(:,:,1) 
     558      ELSE 
     559         qsr(:,:) = zztmp *          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1) 
     560      ENDIF 
     561 
     562 
     563      ! ----------------------------------------------------------------------------- ! 
     564      !     II   Turbulent FLUXES                                                     ! 
     565      ! ----------------------------------------------------------------------------- ! 
     566 
     567      ! specific humidity at SST 
     568      pssq(:,:) = rdct_qsat_salt * q_sat( zst(:,:), pslp(:,:) ) 
     569 
     570      IF( ln_skin_cs .OR. ln_skin_wl ) THEN 
     571         zztmp1(:,:) = zst(:,:) 
     572         zztmp2(:,:) = pssq(:,:) 
     573      ENDIF 
     574 
     575      ! specific humidity of air at "rn_zqt" m above the sea 
     576      SELECT CASE( nhumi ) 
     577      CASE( np_humi_sph ) 
     578         zqair(:,:) = phumi(:,:)      ! what we read in file is already a spec. humidity! 
     579      CASE( np_humi_dpt ) 
     580         !IF(lwp) WRITE(numout,*) ' *** blk_oce => computing q_air out of d_air and slp !' !LBrm 
     581         zqair(:,:) = q_sat( phumi(:,:), pslp(:,:) ) 
     582      CASE( np_humi_rlh ) 
     583         !IF(lwp) WRITE(numout,*) ' *** blk_oce => computing q_air out of RH, t_air and slp !' !LBrm 
     584         zqair(:,:) = q_air_rh( 0.01_wp*phumi(:,:), ptair(:,:), pslp(:,:) ) !LB: 0.01 => RH is % percent in file 
     585      END SELECT 
     586      ! 
     587      ! potential temperature of air at "rn_zqt" m above the sea 
     588      IF( ln_abl ) THEN 
     589         ztpot = ptair(:,:) 
     590      ELSE 
     591         ! Estimate of potential temperature at z=rn_zqt, based on adiabatic lapse-rate 
     592         !    (see Josey, Gulev & Yu, 2013) / doi=10.1016/B978-0-12-391851-2.00005-2 
     593         !    (since reanalysis products provide T at z, not theta !) 
     594         !#LB: because AGRIF hates functions that return something else than a scalar, need to 
     595         !     use scalar version of gamma_moist() ... 
     596         DO jj = 1, jpj 
     597            DO ji = 1, jpi 
     598               ztpot(ji,jj) = ptair(ji,jj) + gamma_moist( ptair(ji,jj), zqair(ji,jj) ) * rn_zqt 
     599            END DO 
     600         END DO 
     601      ENDIF 
     602 
     603 
     604 
     605      !! Time to call the user-selected bulk parameterization for 
     606      !!  ==  transfer coefficients  ==!   Cd, Ch, Ce at T-point, and more... 
     607      SELECT CASE( nblk ) 
     608 
     609      CASE( np_NCAR      ) 
     610         CALL turb_ncar    ( rn_zqt, rn_zu, zst, ztpot, pssq, zqair, wndm,                              & 
     611            &                zcd_oce, zch_oce, zce_oce, t_zu, q_zu, zU_zu, cdn_oce, chn_oce, cen_oce ) 
     612 
     613      CASE( np_COARE_3p0 ) 
     614         CALL turb_coare3p0 ( kt, rn_zqt, rn_zu, zst, ztpot, pssq, zqair, wndm, ln_skin_cs, ln_skin_wl, & 
     615            &                zcd_oce, zch_oce, zce_oce, t_zu, q_zu, zU_zu, cdn_oce, chn_oce, cen_oce,   & 
     616            &                Qsw=qsr(:,:), rad_lw=pqlw(:,:), slp=pslp(:,:) ) 
     617 
     618      CASE( np_COARE_3p6 ) 
     619         CALL turb_coare3p6 ( kt, rn_zqt, rn_zu, zst, ztpot, pssq, zqair, wndm, ln_skin_cs, ln_skin_wl, & 
     620            &                zcd_oce, zch_oce, zce_oce, t_zu, q_zu, zU_zu, cdn_oce, chn_oce, cen_oce,   & 
     621            &                Qsw=qsr(:,:), rad_lw=pqlw(:,:), slp=pslp(:,:) ) 
     622 
     623      CASE( np_ECMWF     ) 
     624         CALL turb_ecmwf   ( kt, rn_zqt, rn_zu, zst, ztpot, pssq, zqair, wndm, ln_skin_cs, ln_skin_wl,  & 
     625            &                zcd_oce, zch_oce, zce_oce, t_zu, q_zu, zU_zu, cdn_oce, chn_oce, cen_oce,   & 
     626            &                Qsw=qsr(:,:), rad_lw=pqlw(:,:), slp=pslp(:,:) ) 
     627 
     628      CASE DEFAULT 
     629         CALL ctl_stop( 'STOP', 'sbc_oce: non-existing bulk formula selected' ) 
     630 
     631      END SELECT 
     632 
     633      IF( ln_skin_cs .OR. ln_skin_wl ) THEN 
     634         !! In the presence of sea-ice we forget about the cool-skin/warm-layer update of zst and pssq: 
     635         WHERE ( fr_i < 0.001_wp ) 
     636            ! zst and pssq have been updated by cool-skin/warm-layer scheme and we keep it!!! 
     637            zst(:,:)  =  zst(:,:)*tmask(:,:,1) 
     638            pssq(:,:) = pssq(:,:)*tmask(:,:,1) 
     639         ELSEWHERE 
     640            ! we forget about the update... 
     641            zst(:,:)  = zztmp1(:,:) !#LB: using what we backed up before skin-algo 
     642            pssq(:,:) = zztmp2(:,:) !#LB:  "   "   " 
     643         END WHERE 
     644      END IF 
     645 
     646      !!      CALL iom_put( "Cd_oce", zcd_oce)  ! output value of pure ocean-atm. transfer coef. 
     647      !!      CALL iom_put( "Ch_oce", zch_oce)  ! output value of pure ocean-atm. transfer coef. 
     648 
     649      IF( ABS(rn_zu - rn_zqt) < 0.1_wp ) THEN 
     650         !! If zu == zt, then ensuring once for all that: 
     651         t_zu(:,:) = ztpot(:,:) 
     652         q_zu(:,:) = zqair(:,:) 
     653      ENDIF 
     654 
     655 
     656      !  Turbulent fluxes over ocean  => BULK_FORMULA @ sbcblk_phy.F90 
     657      ! ------------------------------------------------------------- 
     658 
     659      IF( ln_abl ) THEN         !==  ABL formulation  ==!   multiplication by rho_air and turbulent fluxes computation done in ablstp 
     660         !! FL do we need this multiplication by tmask ... ??? 
     661         DO jj = 1, jpj 
     662            DO ji = 1, jpi 
     663               zztmp = zU_zu(ji,jj) !* tmask(ji,jj,1) 
     664               wndm(ji,jj)   = zztmp                   ! Store zU_zu in wndm to compute ustar2 in ablmod 
     665               pcd_du(ji,jj) = zztmp * zcd_oce(ji,jj) 
     666               psen(ji,jj)   = zztmp * zch_oce(ji,jj) 
     667               pevp(ji,jj)   = zztmp * zce_oce(ji,jj) 
     668            END DO 
     669         END DO 
     670      ELSE                      !==  BLK formulation  ==!   turbulent fluxes computation 
     671         CALL BULK_FORMULA( rn_zu, zst(:,:), pssq(:,:), t_zu(:,:), q_zu(:,:), & 
     672            &               zcd_oce(:,:), zch_oce(:,:), zce_oce(:,:),         & 
     673            &               wndm(:,:), zU_zu(:,:), pslp(:,:),                 & 
     674            &               taum(:,:), psen(:,:), zqla(:,:),                  & 
     675            &               pEvap=pevp(:,:), prhoa=rhoa(:,:) ) 
     676 
     677         zqla(:,:) = zqla(:,:) * tmask(:,:,1) 
     678         psen(:,:) = psen(:,:) * tmask(:,:,1) 
     679         taum(:,:) = taum(:,:) * tmask(:,:,1) 
     680         pevp(:,:) = pevp(:,:) * tmask(:,:,1) 
     681 
     682         ! Tau i and j component on T-grid points, using array "zcd_oce" as a temporary array... 
     683         zcd_oce = 0._wp 
     684         WHERE ( wndm > 0._wp ) zcd_oce = taum / wndm 
     685         zwnd_i = zcd_oce * zwnd_i 
     686         zwnd_j = zcd_oce * zwnd_j 
     687 
     688         CALL iom_put( "taum_oce", taum )   ! output wind stress module 
     689 
     690         ! ... utau, vtau at U- and V_points, resp. 
     691         !     Note the use of 0.5*(2-umask) in order to unmask the stress along coastlines 
     692         !     Note the use of MAX(tmask(i,j),tmask(i+1,j) is to mask tau over ice shelves 
     693         DO jj = 1, jpjm1 
     694            DO ji = 1, fs_jpim1 
     695               utau(ji,jj) = 0.5 * ( 2. - umask(ji,jj,1) ) * ( zwnd_i(ji,jj) + zwnd_i(ji+1,jj  ) ) & 
     696                  &          * MAX(tmask(ji,jj,1),tmask(ji+1,jj,1)) 
     697               vtau(ji,jj) = 0.5 * ( 2. - vmask(ji,jj,1) ) * ( zwnd_j(ji,jj) + zwnd_j(ji  ,jj+1) ) & 
     698                  &          * MAX(tmask(ji,jj,1),tmask(ji,jj+1,1)) 
     699            END DO 
     700         END DO 
     701         CALL lbc_lnk_multi( 'sbcblk', utau, 'U', -1., vtau, 'V', -1. ) 
     702 
     703         IF(ln_ctl) THEN 
     704            CALL prt_ctl( tab2d_1=wndm  , clinfo1=' blk_oce_1: wndm   : ') 
     705            CALL prt_ctl( tab2d_1=utau  , clinfo1=' blk_oce_1: utau   : ', mask1=umask,   & 
     706               &          tab2d_2=vtau  , clinfo2='            vtau   : ', mask2=vmask ) 
     707         ENDIF 
     708         ! 
     709      ENDIF 
     710      ! 
     711      IF(ln_ctl) THEN 
     712         CALL prt_ctl( tab2d_1=pevp  , clinfo1=' blk_oce_1: pevp   : ' ) 
     713         CALL prt_ctl( tab2d_1=psen  , clinfo1=' blk_oce_1: psen   : ' ) 
     714         CALL prt_ctl( tab2d_1=pssq  , clinfo1=' blk_oce_1: pssq   : ' ) 
     715      ENDIF 
     716      ! 
     717   END SUBROUTINE blk_oce_1 
     718 
     719 
     720   SUBROUTINE blk_oce_2( ptair, pqsr, pqlw, pprec,   &   ! <<= in 
     721      &          psnow, pst , psen, pevp     )   ! <<= in 
     722      !!--------------------------------------------------------------------- 
     723      !!                     ***  ROUTINE blk_oce_2  *** 
     724      !! 
     725      !! ** Purpose :   finalize the momentum, heat and freshwater fluxes computation 
     726      !!                at the ocean surface at each time step knowing Cd, Ch, Ce and 
     727      !!                atmospheric variables (from ABL or external data) 
    352728      !! 
    353729      !! ** Outputs : - utau    : i-component of the stress at U-point  (N/m2) 
     
    358734      !!              - qns     : Non Solar heat flux over the ocean    (W/m2) 
    359735      !!              - emp     : evaporation minus precipitation       (kg/m2/s) 
    360       !! 
    361       !!  ** Nota  :   sf has to be a dummy argument for AGRIF on NEC 
    362       !!--------------------------------------------------------------------- 
    363       INTEGER  , INTENT(in   )                 ::   kt    ! time step index 
    364       TYPE(fld), INTENT(inout), DIMENSION(:)   ::   sf    ! input data 
    365       REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pst   ! surface temperature                      [Celcius] 
    366       REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pu    ! surface current at U-point (i-component) [m/s] 
    367       REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pv    ! surface current at V-point (j-component) [m/s] 
     736      !!--------------------------------------------------------------------- 
     737      REAL(wp), INTENT(in), DIMENSION(:,:) ::   ptair 
     738      REAL(wp), INTENT(in), DIMENSION(:,:) ::   pqsr 
     739      REAL(wp), INTENT(in), DIMENSION(:,:) ::   pqlw 
     740      REAL(wp), INTENT(in), DIMENSION(:,:) ::   pprec 
     741      REAL(wp), INTENT(in), DIMENSION(:,:) ::   psnow 
     742      REAL(wp), INTENT(in), DIMENSION(:,:) ::   pst   ! surface temperature                      [Celcius] 
     743      REAL(wp), INTENT(in), DIMENSION(:,:) ::   psen 
     744      REAL(wp), INTENT(in), DIMENSION(:,:) ::   pevp 
    368745      ! 
    369746      INTEGER  ::   ji, jj               ! dummy loop indices 
    370       REAL(wp) ::   zztmp                ! local variable 
    371       REAL(wp), DIMENSION(jpi,jpj) ::   zwnd_i, zwnd_j    ! wind speed components at T-point 
    372       REAL(wp), DIMENSION(jpi,jpj) ::   zsq               ! specific humidity at pst 
    373       REAL(wp), DIMENSION(jpi,jpj) ::   zqlw, zqsb        ! long wave and sensible heat fluxes 
    374       REAL(wp), DIMENSION(jpi,jpj) ::   zqla, zevap       ! latent heat fluxes and evaporation 
     747      REAL(wp) ::   zztmp,zz1,zz2,zz3    ! local variable 
     748      REAL(wp), DIMENSION(jpi,jpj) ::   zqlw              ! long wave and sensible heat fluxes 
     749      REAL(wp), DIMENSION(jpi,jpj) ::   zqla              ! latent heat fluxes and evaporation 
    375750      REAL(wp), DIMENSION(jpi,jpj) ::   zst               ! surface temperature in Kelvin 
    376       REAL(wp), DIMENSION(jpi,jpj) ::   zU_zu             ! bulk wind speed at height zu  [m/s] 
    377       REAL(wp), DIMENSION(jpi,jpj) ::   ztpot             ! potential temperature of air at z=rn_zqt [K] 
    378       REAL(wp), DIMENSION(jpi,jpj) ::   zrhoa             ! density of air   [kg/m^3] 
    379751      !!--------------------------------------------------------------------- 
    380752      ! 
     
    382754      zst(:,:) = pst(:,:) + rt0      ! convert SST from Celcius to Kelvin (and set minimum value far above 0 K) 
    383755 
     756 
    384757      ! ----------------------------------------------------------------------------- ! 
    385       !      0   Wind components and module at T-point relative to the moving ocean   ! 
     758      !     III    Net longwave radiative FLUX                                        ! 
    386759      ! ----------------------------------------------------------------------------- ! 
    387760 
    388       ! ... components ( U10m - U_oce ) at T-point (unmasked) 
    389 !!gm    move zwnd_i (_j) set to zero  inside the key_cyclone ??? 
    390       zwnd_i(:,:) = 0._wp 
    391       zwnd_j(:,:) = 0._wp 
    392 #if defined key_cyclone 
    393       CALL wnd_cyc( kt, zwnd_i, zwnd_j )    ! add analytical tropical cyclone (Vincent et al. JGR 2012) 
    394       DO jj = 2, jpjm1 
    395          DO ji = fs_2, fs_jpim1   ! vect. opt. 
    396             sf(jp_wndi)%fnow(ji,jj,1) = sf(jp_wndi)%fnow(ji,jj,1) + zwnd_i(ji,jj) 
    397             sf(jp_wndj)%fnow(ji,jj,1) = sf(jp_wndj)%fnow(ji,jj,1) + zwnd_j(ji,jj) 
    398          END DO 
    399       END DO 
    400 #endif 
    401       DO jj = 2, jpjm1 
    402          DO ji = fs_2, fs_jpim1   ! vect. opt. 
    403             zwnd_i(ji,jj) = (  sf(jp_wndi)%fnow(ji,jj,1) - rn_vfac * 0.5 * ( pu(ji-1,jj  ) + pu(ji,jj) )  ) 
    404             zwnd_j(ji,jj) = (  sf(jp_wndj)%fnow(ji,jj,1) - rn_vfac * 0.5 * ( pv(ji  ,jj-1) + pv(ji,jj) )  ) 
    405          END DO 
    406       END DO 
    407       CALL lbc_lnk_multi( 'sbcblk', zwnd_i, 'T', -1., zwnd_j, 'T', -1. ) 
    408       ! ... scalar wind ( = | U10m - U_oce | ) at T-point (masked) 
    409       wndm(:,:) = SQRT(  zwnd_i(:,:) * zwnd_i(:,:)   & 
    410          &             + zwnd_j(:,:) * zwnd_j(:,:)  ) * tmask(:,:,1) 
    411  
    412       ! ----------------------------------------------------------------------------- ! 
    413       !      I   Radiative FLUXES                                                     ! 
    414       ! ----------------------------------------------------------------------------- ! 
    415  
    416       ! ocean albedo assumed to be constant + modify now Qsr to include the diurnal cycle                    ! Short Wave 
    417       zztmp = 1. - albo 
    418       IF( ln_dm2dc ) THEN   ;   qsr(:,:) = zztmp * sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(:,:,1) 
    419       ELSE                  ;   qsr(:,:) = zztmp *          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1) 
    420       ENDIF 
    421  
    422       zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave 
    423  
    424       ! ----------------------------------------------------------------------------- ! 
    425       !     II    Turbulent FLUXES                                                    ! 
    426       ! ----------------------------------------------------------------------------- ! 
    427  
    428       ! ... specific humidity at SST and IST tmask( 
    429       zsq(:,:) = 0.98 * q_sat( zst(:,:), sf(jp_slp)%fnow(:,:,1) ) 
    430       !! 
    431       !! Estimate of potential temperature at z=rn_zqt, based on adiabatic lapse-rate 
    432       !!    (see Josey, Gulev & Yu, 2013) / doi=10.1016/B978-0-12-391851-2.00005-2 
    433       !!    (since reanalysis products provide T at z, not theta !) 
    434       ztpot = sf(jp_tair)%fnow(:,:,1) + gamma_moist( sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1) ) * rn_zqt 
    435  
    436       SELECT CASE( nblk )        !==  transfer coefficients  ==!   Cd, Ch, Ce at T-point 
    437       ! 
    438       CASE( np_NCAR      )   ;   CALL turb_ncar    ( rn_zqt, rn_zu, zst, ztpot, zsq, sf(jp_humi)%fnow, wndm,   &  ! NCAR-COREv2 
    439          &                                           Cd_atm, Ch_atm, Ce_atm, t_zu, q_zu, zU_zu, cdn_oce, chn_oce, cen_oce ) 
    440       CASE( np_COARE_3p0 )   ;   CALL turb_coare   ( rn_zqt, rn_zu, zst, ztpot, zsq, sf(jp_humi)%fnow, wndm,   &  ! COARE v3.0 
    441          &                                           Cd_atm, Ch_atm, Ce_atm, t_zu, q_zu, zU_zu, cdn_oce, chn_oce, cen_oce ) 
    442       CASE( np_COARE_3p5 )   ;   CALL turb_coare3p5( rn_zqt, rn_zu, zst, ztpot, zsq, sf(jp_humi)%fnow, wndm,   &  ! COARE v3.5 
    443          &                                           Cd_atm, Ch_atm, Ce_atm, t_zu, q_zu, zU_zu, cdn_oce, chn_oce, cen_oce ) 
    444       CASE( np_ECMWF     )   ;   CALL turb_ecmwf   ( rn_zqt, rn_zu, zst, ztpot, zsq, sf(jp_humi)%fnow, wndm,   &  ! ECMWF 
    445          &                                           Cd_atm, Ch_atm, Ce_atm, t_zu, q_zu, zU_zu, cdn_oce, chn_oce, cen_oce ) 
    446       CASE DEFAULT 
    447          CALL ctl_stop( 'STOP', 'sbc_oce: non-existing bulk formula selected' ) 
    448       END SELECT 
    449  
    450       !                          ! Compute true air density : 
    451       IF( ABS(rn_zu - rn_zqt) > 0.01 ) THEN     ! At zu: (probably useless to remove zrho*grav*rn_zu from SLP...) 
    452          zrhoa(:,:) = rho_air( t_zu(:,:)              , q_zu(:,:)              , sf(jp_slp)%fnow(:,:,1) ) 
    453       ELSE                                      ! At zt: 
    454          zrhoa(:,:) = rho_air( sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1), sf(jp_slp)%fnow(:,:,1) ) 
    455       END IF 
    456  
    457 !!      CALL iom_put( "Cd_oce", Cd_atm)  ! output value of pure ocean-atm. transfer coef. 
    458 !!      CALL iom_put( "Ch_oce", Ch_atm)  ! output value of pure ocean-atm. transfer coef. 
    459  
    460       DO jj = 1, jpj             ! tau module, i and j component 
    461          DO ji = 1, jpi 
    462             zztmp = zrhoa(ji,jj)  * zU_zu(ji,jj) * Cd_atm(ji,jj)   ! using bulk wind speed 
    463             taum  (ji,jj) = zztmp * wndm  (ji,jj) 
    464             zwnd_i(ji,jj) = zztmp * zwnd_i(ji,jj) 
    465             zwnd_j(ji,jj) = zztmp * zwnd_j(ji,jj) 
    466          END DO 
    467       END DO 
    468  
    469       !                          ! add the HF tau contribution to the wind stress module 
    470       IF( lhftau )   taum(:,:) = taum(:,:) + sf(jp_tdif)%fnow(:,:,1) 
    471  
    472       CALL iom_put( "taum_oce", taum )   ! output wind stress module 
    473  
    474       ! ... utau, vtau at U- and V_points, resp. 
    475       !     Note the use of 0.5*(2-umask) in order to unmask the stress along coastlines 
    476       !     Note the use of MAX(tmask(i,j),tmask(i+1,j) is to mask tau over ice shelves 
    477       DO jj = 1, jpjm1 
    478          DO ji = 1, fs_jpim1 
    479             utau(ji,jj) = 0.5 * ( 2. - umask(ji,jj,1) ) * ( zwnd_i(ji,jj) + zwnd_i(ji+1,jj  ) ) & 
    480                &          * MAX(tmask(ji,jj,1),tmask(ji+1,jj,1)) 
    481             vtau(ji,jj) = 0.5 * ( 2. - vmask(ji,jj,1) ) * ( zwnd_j(ji,jj) + zwnd_j(ji  ,jj+1) ) & 
    482                &          * MAX(tmask(ji,jj,1),tmask(ji,jj+1,1)) 
    483          END DO 
    484       END DO 
    485       CALL lbc_lnk_multi( 'sbcblk', utau, 'U', -1., vtau, 'V', -1. ) 
     761      !! LB: now moved after Turbulent fluxes because must use the skin temperature rather that the SST 
     762      !! (zst is skin temperature if ln_skin_cs==.TRUE. .OR. ln_skin_wl==.TRUE.) 
     763      zqlw(:,:) = emiss_w * ( pqlw(:,:) - stefan*zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:) ) * tmask(:,:,1)   ! Net radiative longwave flux 
    486764 
    487765      !  Turbulent fluxes over ocean 
    488766      ! ----------------------------- 
    489767 
    490       ! zqla used as temporary array, for rho*U (common term of bulk formulae): 
    491       zqla(:,:) = zrhoa(:,:) * zU_zu(:,:) * tmask(:,:,1) 
    492  
    493       IF( ABS( rn_zu - rn_zqt) < 0.01_wp ) THEN 
    494          !! q_air and t_air are given at 10m (wind reference height) 
    495          zevap(:,:) = rn_efac*MAX( 0._wp,             zqla(:,:)*Ce_atm(:,:)*(zsq(:,:) - sf(jp_humi)%fnow(:,:,1)) ) ! Evaporation, using bulk wind speed 
    496          zqsb (:,:) = cp_air(sf(jp_humi)%fnow(:,:,1))*zqla(:,:)*Ch_atm(:,:)*(zst(:,:) - ztpot(:,:)             )   ! Sensible Heat, using bulk wind speed 
    497       ELSE 
    498          !! q_air and t_air are not given at 10m (wind reference height) 
    499          ! Values of temp. and hum. adjusted to height of wind during bulk algorithm iteration must be used!!! 
    500          zevap(:,:) = rn_efac*MAX( 0._wp,             zqla(:,:)*Ce_atm(:,:)*(zsq(:,:) - q_zu(:,:) ) ) ! Evaporation, using bulk wind speed 
    501          zqsb (:,:) = cp_air(sf(jp_humi)%fnow(:,:,1))*zqla(:,:)*Ch_atm(:,:)*(zst(:,:) - t_zu(:,:) )   ! Sensible Heat, using bulk wind speed 
    502       ENDIF 
    503  
    504       zqla(:,:) = L_vap(zst(:,:)) * zevap(:,:)     ! Latent Heat flux 
    505  
     768      ! use scalar version of L_vap() for AGRIF compatibility 
     769      DO jj = 1, jpj 
     770         DO ji = 1, jpi 
     771            zqla(ji,jj) = -1._wp * L_vap( zst(ji,jj) ) * pevp(ji,jj)    ! Latent Heat flux !!GS: possibility to add a global qla to avoid recomputation after abl update 
     772         ENDDO 
     773      ENDDO 
    506774 
    507775      IF(ln_ctl) THEN 
    508          CALL prt_ctl( tab2d_1=zqla  , clinfo1=' blk_oce: zqla   : ', tab2d_2=Ce_atm , clinfo2=' Ce_oce  : ' ) 
    509          CALL prt_ctl( tab2d_1=zqsb  , clinfo1=' blk_oce: zqsb   : ', tab2d_2=Ch_atm , clinfo2=' Ch_oce  : ' ) 
    510          CALL prt_ctl( tab2d_1=zqlw  , clinfo1=' blk_oce: zqlw   : ', tab2d_2=qsr, clinfo2=' qsr : ' ) 
    511          CALL prt_ctl( tab2d_1=zsq   , clinfo1=' blk_oce: zsq    : ', tab2d_2=zst, clinfo2=' zst : ' ) 
    512          CALL prt_ctl( tab2d_1=utau  , clinfo1=' blk_oce: utau   : ', mask1=umask,   & 
    513             &          tab2d_2=vtau  , clinfo2=           ' vtau : ', mask2=vmask ) 
    514          CALL prt_ctl( tab2d_1=wndm  , clinfo1=' blk_oce: wndm   : ') 
    515          CALL prt_ctl( tab2d_1=zst   , clinfo1=' blk_oce: zst    : ') 
     776         CALL prt_ctl( tab2d_1=zqla  , clinfo1=' blk_oce_2: zqla   : ' ) 
     777         CALL prt_ctl( tab2d_1=zqlw  , clinfo1=' blk_oce_2: zqlw   : ', tab2d_2=qsr, clinfo2=' qsr : ' ) 
     778 
    516779      ENDIF 
    517780 
    518781      ! ----------------------------------------------------------------------------- ! 
    519       !     III    Total FLUXES                                                       ! 
     782      !     IV    Total FLUXES                                                       ! 
    520783      ! ----------------------------------------------------------------------------- ! 
    521784      ! 
    522       emp (:,:) = (  zevap(:,:)                                          &   ! mass flux (evap. - precip.) 
    523          &         - sf(jp_prec)%fnow(:,:,1) * rn_pfac  ) * tmask(:,:,1) 
    524       ! 
    525       qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                                &   ! Downward Non Solar 
    526          &     - sf(jp_snow)%fnow(:,:,1) * rn_pfac * rLfus                        &   ! remove latent melting heat for solid precip 
    527          &     - zevap(:,:) * pst(:,:) * rcp                                      &   ! remove evap heat content at SST 
    528          &     + ( sf(jp_prec)%fnow(:,:,1) - sf(jp_snow)%fnow(:,:,1) ) * rn_pfac  &   ! add liquid precip heat content at Tair 
    529          &     * ( sf(jp_tair)%fnow(:,:,1) - rt0 ) * rcp                          & 
    530          &     + sf(jp_snow)%fnow(:,:,1) * rn_pfac                                &   ! add solid  precip heat content at min(Tair,Tsnow) 
    531          &     * ( MIN( sf(jp_tair)%fnow(:,:,1), rt0 ) - rt0 ) * rcpi 
     785      emp (:,:) = (  pevp(:,:)                                       &   ! mass flux (evap. - precip.) 
     786         &         - pprec(:,:) * rn_pfac  ) * tmask(:,:,1) 
     787      ! 
     788      qns(:,:) = zqlw(:,:) + psen(:,:) + zqla(:,:)                   &   ! Downward Non Solar 
     789         &     - psnow(:,:) * rn_pfac * rLfus                        &   ! remove latent melting heat for solid precip 
     790         &     - pevp(:,:) * pst(:,:) * rcp                          &   ! remove evap heat content at SST !LB??? pst is Celsius !? 
     791         &     + ( pprec(:,:) - psnow(:,:) ) * rn_pfac               &   ! add liquid precip heat content at Tair 
     792         &     * ( ptair(:,:) - rt0 ) * rcp                          & 
     793         &     + psnow(:,:) * rn_pfac                                &   ! add solid  precip heat content at min(Tair,Tsnow) 
     794         &     * ( MIN( ptair(:,:), rt0 ) - rt0 ) * rcpi 
    532795      qns(:,:) = qns(:,:) * tmask(:,:,1) 
    533796      ! 
    534797#if defined key_si3 
    535       qns_oce(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                                ! non solar without emp (only needed by SI3) 
     798      qns_oce(:,:) = zqlw(:,:) + psen(:,:) + zqla(:,:)                             ! non solar without emp (only needed by SI3) 
    536799      qsr_oce(:,:) = qsr(:,:) 
    537800#endif 
    538801      ! 
     802      CALL iom_put( "rho_air"  , rhoa*tmask(:,:,1) )       ! output air density [kg/m^3] 
     803      CALL iom_put( "evap_oce" , pevp )                    ! evaporation 
     804      CALL iom_put( "qlw_oce"  , zqlw )                    ! output downward longwave heat over the ocean 
     805      CALL iom_put( "qsb_oce"  , psen )                    ! output downward sensible heat over the ocean 
     806      CALL iom_put( "qla_oce"  , zqla )                    ! output downward latent   heat over the ocean 
     807      tprecip(:,:) = pprec(:,:) * rn_pfac * tmask(:,:,1)   ! output total precipitation [kg/m2/s] 
     808      sprecip(:,:) = psnow(:,:) * rn_pfac * tmask(:,:,1)   ! output solid precipitation [kg/m2/s] 
     809      CALL iom_put( 'snowpre', sprecip )                   ! Snow 
     810      CALL iom_put( 'precip' , tprecip )                   ! Total precipitation 
     811      ! 
    539812      IF ( nn_ice == 0 ) THEN 
    540          CALL iom_put( "qlw_oce" ,   zqlw )                 ! output downward longwave heat over the ocean 
    541          CALL iom_put( "qsb_oce" , - zqsb )                 ! output downward sensible heat over the ocean 
    542          CALL iom_put( "qla_oce" , - zqla )                 ! output downward latent   heat over the ocean 
    543          CALL iom_put( "qemp_oce",   qns-zqlw+zqsb+zqla )   ! output downward heat content of E-P over the ocean 
    544          CALL iom_put( "qns_oce" ,   qns  )                 ! output downward non solar heat over the ocean 
    545          CALL iom_put( "qsr_oce" ,   qsr  )                 ! output downward solar heat over the ocean 
    546          CALL iom_put( "qt_oce"  ,   qns+qsr )              ! output total downward heat over the ocean 
    547          tprecip(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac * tmask(:,:,1) ! output total precipitation [kg/m2/s] 
    548          sprecip(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac * tmask(:,:,1) ! output solid precipitation [kg/m2/s] 
    549          CALL iom_put( 'snowpre', sprecip )                 ! Snow 
    550          CALL iom_put( 'precip' , tprecip )                 ! Total precipitation 
     813         CALL iom_put( "qemp_oce" , qns-zqlw-psen-zqla )   ! output downward heat content of E-P over the ocean 
     814         CALL iom_put( "qns_oce"  ,   qns  )               ! output downward non solar heat over the ocean 
     815         CALL iom_put( "qsr_oce"  ,   qsr  )               ! output downward solar heat over the ocean 
     816         CALL iom_put( "qt_oce"   ,   qns+qsr )            ! output total downward heat over the ocean 
     817      ENDIF 
     818      ! 
     819      IF( ln_skin_cs .OR. ln_skin_wl ) THEN 
     820         CALL iom_put( "t_skin" ,  (zst - rt0) * tmask(:,:,1) )           ! T_skin in Celsius 
     821         CALL iom_put( "dt_skin" , (zst - pst - rt0) * tmask(:,:,1) )     ! T_skin - SST temperature difference... 
    551822      ENDIF 
    552823      ! 
    553824      IF(ln_ctl) THEN 
    554          CALL prt_ctl(tab2d_1=zqsb , clinfo1=' blk_oce: zqsb   : ', tab2d_2=zqlw , clinfo2=' zqlw  : ') 
    555          CALL prt_ctl(tab2d_1=zqla , clinfo1=' blk_oce: zqla   : ', tab2d_2=qsr  , clinfo2=' qsr   : ') 
    556          CALL prt_ctl(tab2d_1=pst  , clinfo1=' blk_oce: pst    : ', tab2d_2=emp  , clinfo2=' emp   : ') 
    557          CALL prt_ctl(tab2d_1=utau , clinfo1=' blk_oce: utau   : ', mask1=umask,   & 
    558             &         tab2d_2=vtau , clinfo2=              ' vtau  : ' , mask2=vmask ) 
    559       ENDIF 
    560       ! 
    561    END SUBROUTINE blk_oce 
    562  
    563  
    564  
    565    FUNCTION rho_air( ptak, pqa, pslp ) 
    566       !!------------------------------------------------------------------------------- 
    567       !!                           ***  FUNCTION rho_air  *** 
    568       !! 
    569       !! ** Purpose : compute density of (moist) air using the eq. of state of the atmosphere 
    570       !! 
    571       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk)  
    572       !!------------------------------------------------------------------------------- 
    573       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   ptak      ! air temperature             [K] 
    574       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqa       ! air specific humidity   [kg/kg] 
    575       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pslp      ! pressure in                [Pa] 
    576       REAL(wp), DIMENSION(jpi,jpj)             ::   rho_air   ! density of moist air   [kg/m^3] 
    577       !!------------------------------------------------------------------------------- 
    578       ! 
    579       rho_air = pslp / (  R_dry*ptak * ( 1._wp + rctv0*pqa )  ) 
    580       ! 
    581    END FUNCTION rho_air 
    582  
    583  
    584    FUNCTION cp_air( pqa ) 
    585       !!------------------------------------------------------------------------------- 
    586       !!                           ***  FUNCTION cp_air  *** 
    587       !! 
    588       !! ** Purpose : Compute specific heat (Cp) of moist air 
    589       !! 
    590       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    591       !!------------------------------------------------------------------------------- 
    592       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqa      ! air specific humidity         [kg/kg] 
    593       REAL(wp), DIMENSION(jpi,jpj)             ::   cp_air   ! specific heat of moist air   [J/K/kg] 
    594       !!------------------------------------------------------------------------------- 
    595       ! 
    596       Cp_air = Cp_dry + Cp_vap * pqa 
    597       ! 
    598    END FUNCTION cp_air 
    599  
    600  
    601    FUNCTION q_sat( ptak, pslp ) 
    602       !!---------------------------------------------------------------------------------- 
    603       !!                           ***  FUNCTION q_sat  *** 
    604       !! 
    605       !! ** Purpose : Specific humidity at saturation in [kg/kg] 
    606       !!              Based on accurate estimate of "e_sat" 
    607       !!              aka saturation water vapor (Goff, 1957) 
    608       !! 
    609       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    610       !!---------------------------------------------------------------------------------- 
    611       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   ptak    ! air temperature                       [K] 
    612       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pslp    ! sea level atmospheric pressure       [Pa] 
    613       REAL(wp), DIMENSION(jpi,jpj)             ::   q_sat   ! Specific humidity at saturation   [kg/kg] 
    614       ! 
    615       INTEGER  ::   ji, jj         ! dummy loop indices 
    616       REAL(wp) ::   ze_sat, ztmp   ! local scalar 
    617       !!---------------------------------------------------------------------------------- 
    618       ! 
    619       DO jj = 1, jpj 
    620          DO ji = 1, jpi 
    621             ! 
    622             ztmp = rt0 / ptak(ji,jj) 
    623             ! 
    624             ! Vapour pressure at saturation [hPa] : WMO, (Goff, 1957) 
    625             ze_sat = 10.**( 10.79574*(1. - ztmp) - 5.028*LOG10(ptak(ji,jj)/rt0)        & 
    626                &    + 1.50475*10.**(-4)*(1. - 10.**(-8.2969*(ptak(ji,jj)/rt0 - 1.)) )  & 
    627                &    + 0.42873*10.**(-3)*(10.**(4.76955*(1. - ztmp)) - 1.) + 0.78614  ) 
    628                ! 
    629             q_sat(ji,jj) = reps0 * ze_sat/( 0.01_wp*pslp(ji,jj) - (1._wp - reps0)*ze_sat )   ! 0.01 because SLP is in [Pa] 
    630             ! 
    631          END DO 
    632       END DO 
    633       ! 
    634    END FUNCTION q_sat 
    635  
    636  
    637    FUNCTION gamma_moist( ptak, pqa ) 
    638       !!---------------------------------------------------------------------------------- 
    639       !!                           ***  FUNCTION gamma_moist  *** 
    640       !! 
    641       !! ** Purpose : Compute the moist adiabatic lapse-rate. 
    642       !!     => http://glossary.ametsoc.org/wiki/Moist-adiabatic_lapse_rate 
    643       !!     => http://www.geog.ucsb.edu/~joel/g266_s10/lecture_notes/chapt03/oh10_3_01/oh10_3_01.html 
    644       !! 
    645       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    646       !!---------------------------------------------------------------------------------- 
    647       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   ptak          ! air temperature       [K] 
    648       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqa           ! specific humidity [kg/kg] 
    649       REAL(wp), DIMENSION(jpi,jpj)             ::   gamma_moist   ! moist adiabatic lapse-rate 
    650       ! 
    651       INTEGER  ::   ji, jj         ! dummy loop indices 
    652       REAL(wp) :: zrv, ziRT        ! local scalar 
    653       !!---------------------------------------------------------------------------------- 
    654       ! 
    655       DO jj = 1, jpj 
    656          DO ji = 1, jpi 
    657             zrv = pqa(ji,jj) / (1. - pqa(ji,jj)) 
    658             ziRT = 1. / (R_dry*ptak(ji,jj))    ! 1/RT 
    659             gamma_moist(ji,jj) = grav * ( 1. + rLevap*zrv*ziRT ) / ( Cp_dry + rLevap*rLevap*zrv*reps0*ziRT/ptak(ji,jj) ) 
    660          END DO 
    661       END DO 
    662       ! 
    663    END FUNCTION gamma_moist 
    664  
    665  
    666    FUNCTION L_vap( psst ) 
    667       !!--------------------------------------------------------------------------------- 
    668       !!                           ***  FUNCTION L_vap  *** 
    669       !! 
    670       !! ** Purpose : Compute the latent heat of vaporization of water from temperature 
    671       !! 
    672       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    673       !!---------------------------------------------------------------------------------- 
    674       REAL(wp), DIMENSION(jpi,jpj)             ::   L_vap   ! latent heat of vaporization   [J/kg] 
    675       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   psst   ! water temperature                [K] 
    676       !!---------------------------------------------------------------------------------- 
    677       ! 
    678       L_vap = (  2.501 - 0.00237 * ( psst(:,:) - rt0)  ) * 1.e6 
    679       ! 
    680    END FUNCTION L_vap 
     825         CALL prt_ctl(tab2d_1=zqlw , clinfo1=' blk_oce_2: zqlw  : ') 
     826         CALL prt_ctl(tab2d_1=zqla , clinfo1=' blk_oce_2: zqla  : ', tab2d_2=qsr  , clinfo2=' qsr   : ') 
     827         CALL prt_ctl(tab2d_1=emp  , clinfo1=' blk_oce_2: emp   : ') 
     828      ENDIF 
     829      ! 
     830   END SUBROUTINE blk_oce_2 
     831 
    681832 
    682833#if defined key_si3 
     
    684835   !!   'key_si3'                                       SI3 sea-ice model 
    685836   !!---------------------------------------------------------------------- 
    686    !!   blk_ice_tau : provide the air-ice stress 
    687    !!   blk_ice_flx : provide the heat and mass fluxes at air-ice interface 
     837   !!   blk_ice_ : provide the air-ice stress 
     838   !!   blk_ice_ : provide the heat and mass fluxes at air-ice interface 
    688839   !!   blk_ice_qcn : provide ice surface temperature and snow/ice conduction flux (emulating conduction flux) 
    689840   !!   Cdn10_Lupkes2012 : Lupkes et al. (2012) air-ice drag 
    690    !!   Cdn10_Lupkes2015 : Lupkes et al. (2015) air-ice drag  
     841   !!   Cdn10_Lupkes2015 : Lupkes et al. (2015) air-ice drag 
    691842   !!---------------------------------------------------------------------- 
    692843 
    693    SUBROUTINE blk_ice_tau 
    694       !!--------------------------------------------------------------------- 
    695       !!                     ***  ROUTINE blk_ice_tau  *** 
     844   SUBROUTINE blk_ice_1( pwndi, pwndj, ptair, phumi, pslp , puice, pvice, ptsui,  &   ! inputs 
     845      &                  putaui, pvtaui, pseni, pevpi, pssqi, pcd_dui             )   ! optional outputs 
     846      !!--------------------------------------------------------------------- 
     847      !!                     ***  ROUTINE blk_ice_1  *** 
    696848      !! 
    697849      !! ** Purpose :   provide the surface boundary condition over sea-ice 
     
    701853      !!                NB: ice drag coefficient is assumed to be a constant 
    702854      !!--------------------------------------------------------------------- 
     855      REAL(wp) , INTENT(in   ), DIMENSION(:,:  ) ::   pslp    ! sea-level pressure [Pa] 
     856      REAL(wp) , INTENT(in   ), DIMENSION(:,:  ) ::   pwndi   ! atmospheric wind at T-point [m/s] 
     857      REAL(wp) , INTENT(in   ), DIMENSION(:,:  ) ::   pwndj   ! atmospheric wind at T-point [m/s] 
     858      REAL(wp) , INTENT(in   ), DIMENSION(:,:  ) ::   ptair   ! atmospheric wind at T-point [m/s] 
     859      REAL(wp) , INTENT(in   ), DIMENSION(:,:  ) ::   phumi   ! atmospheric wind at T-point [m/s] 
     860      REAL(wp) , INTENT(in   ), DIMENSION(:,:  ) ::   puice   ! sea-ice velocity on I or C grid [m/s] 
     861      REAL(wp) , INTENT(in   ), DIMENSION(:,:  ) ::   pvice   ! " 
     862      REAL(wp) , INTENT(in   ), DIMENSION(:,:  ) ::   ptsui   ! sea-ice surface temperature [K] 
     863      REAL(wp) , INTENT(  out), DIMENSION(:,:  ), OPTIONAL ::   putaui  ! if ln_blk 
     864      REAL(wp) , INTENT(  out), DIMENSION(:,:  ), OPTIONAL ::   pvtaui  ! if ln_blk 
     865      REAL(wp) , INTENT(  out), DIMENSION(:,:  ), OPTIONAL ::   pseni   ! if ln_abl 
     866      REAL(wp) , INTENT(  out), DIMENSION(:,:  ), OPTIONAL ::   pevpi   ! if ln_abl 
     867      REAL(wp) , INTENT(  out), DIMENSION(:,:  ), OPTIONAL ::   pssqi   ! if ln_abl 
     868      REAL(wp) , INTENT(  out), DIMENSION(:,:  ), OPTIONAL ::   pcd_dui ! if ln_abl 
     869      ! 
    703870      INTEGER  ::   ji, jj    ! dummy loop indices 
    704       REAL(wp) ::   zwndi_f , zwndj_f, zwnorm_f   ! relative wind module and components at F-point 
    705871      REAL(wp) ::   zwndi_t , zwndj_t             ! relative wind components at T-point 
    706       REAL(wp), DIMENSION(jpi,jpj) ::   zrhoa     ! transfer coefficient for momentum      (tau) 
    707       !!--------------------------------------------------------------------- 
    708       ! 
    709       ! set transfer coefficients to default sea-ice values 
    710       Cd_atm(:,:) = Cd_ice 
    711       Ch_atm(:,:) = Cd_ice 
    712       Ce_atm(:,:) = Cd_ice 
    713  
    714       wndm_ice(:,:) = 0._wp      !!gm brutal.... 
     872      REAL(wp) ::   zootm_su                      ! sea-ice surface mean temperature 
     873      REAL(wp) ::   zztmp1, zztmp2                ! temporary arrays 
     874      REAL(wp), DIMENSION(jpi,jpj) ::   zcd_dui   ! transfer coefficient for momentum      (tau) 
     875      !!--------------------------------------------------------------------- 
     876      ! 
    715877 
    716878      ! ------------------------------------------------------------ ! 
     
    720882      DO jj = 2, jpjm1 
    721883         DO ji = fs_2, fs_jpim1   ! vect. opt. 
    722             zwndi_t = (  sf(jp_wndi)%fnow(ji,jj,1) - rn_vfac * 0.5 * ( u_ice(ji-1,jj  ) + u_ice(ji,jj) )  ) 
    723             zwndj_t = (  sf(jp_wndj)%fnow(ji,jj,1) - rn_vfac * 0.5 * ( v_ice(ji  ,jj-1) + v_ice(ji,jj) )  ) 
     884            zwndi_t = (  pwndi(ji,jj) - rn_vfac * 0.5_wp * ( puice(ji-1,jj  ) + puice(ji,jj) )  ) 
     885            zwndj_t = (  pwndj(ji,jj) - rn_vfac * 0.5_wp * ( pvice(ji  ,jj-1) + pvice(ji,jj) )  ) 
    724886            wndm_ice(ji,jj) = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1) 
    725887         END DO 
     
    729891      ! Make ice-atm. drag dependent on ice concentration 
    730892      IF    ( ln_Cd_L12 ) THEN   ! calculate new drag from Lupkes(2012) equations 
    731          CALL Cdn10_Lupkes2012( Cd_atm ) 
    732          Ch_atm(:,:) = Cd_atm(:,:)       ! momentum and heat transfer coef. are considered identical 
     893         CALL Cdn10_Lupkes2012( Cd_ice ) 
     894         Ch_ice(:,:) = Cd_ice(:,:)       ! momentum and heat transfer coef. are considered identical 
     895         Ce_ice(:,:) = Cd_ice(:,:) 
    733896      ELSEIF( ln_Cd_L15 ) THEN   ! calculate new drag from Lupkes(2015) equations 
    734          CALL Cdn10_Lupkes2015( Cd_atm, Ch_atm )  
    735       ENDIF 
    736  
    737 !!      CALL iom_put( "Cd_ice", Cd_atm)  ! output value of pure ice-atm. transfer coef. 
    738 !!      CALL iom_put( "Ch_ice", Ch_atm)  ! output value of pure ice-atm. transfer coef. 
     897         CALL Cdn10_Lupkes2015( ptsui, pslp, Cd_ice, Ch_ice ) 
     898         Ce_ice(:,:) = Ch_ice(:,:)       ! sensible and latent heat transfer coef. are considered identical 
     899      ENDIF 
     900 
     901      !! IF ( iom_use("Cd_ice") ) CALL iom_put("Cd_ice", Cd_ice)   ! output value of pure ice-atm. transfer coef. 
     902      !! IF ( iom_use("Ch_ice") ) CALL iom_put("Ch_ice", Ch_ice)   ! output value of pure ice-atm. transfer coef. 
    739903 
    740904      ! local scalars ( place there for vector optimisation purposes) 
    741       ! Computing density of air! Way denser that 1.2 over sea-ice !!! 
    742       zrhoa (:,:) =  rho_air(sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1), sf(jp_slp)%fnow(:,:,1)) 
    743  
    744       !!gm brutal.... 
    745       utau_ice  (:,:) = 0._wp 
    746       vtau_ice  (:,:) = 0._wp 
    747       !!gm end 
    748  
    749       ! ------------------------------------------------------------ ! 
    750       !    Wind stress relative to the moving ice ( U10m - U_ice )   ! 
    751       ! ------------------------------------------------------------ ! 
    752       ! C-grid ice dynamics :   U & V-points (same as ocean) 
    753       DO jj = 2, jpjm1 
    754          DO ji = fs_2, fs_jpim1   ! vect. opt. 
    755             utau_ice(ji,jj) = 0.5 * zrhoa(ji,jj) * Cd_atm(ji,jj) * ( wndm_ice(ji+1,jj  ) + wndm_ice(ji,jj) )            & 
    756                &          * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj,1) + sf(jp_wndi)%fnow(ji,jj,1) ) - rn_vfac * u_ice(ji,jj) ) 
    757             vtau_ice(ji,jj) = 0.5 * zrhoa(ji,jj) * Cd_atm(ji,jj) * ( wndm_ice(ji,jj+1  ) + wndm_ice(ji,jj) )            & 
    758                &          * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1,1) + sf(jp_wndj)%fnow(ji,jj,1) ) - rn_vfac * v_ice(ji,jj) ) 
     905      !IF (ln_abl) rhoa  (:,:)  = rho_air( ptair(:,:), phumi(:,:), pslp(:,:) ) !!GS: rhoa must be (re)computed here with ABL to avoid division by zero after (TBI) 
     906      zcd_dui(:,:) = wndm_ice(:,:) * Cd_ice(:,:) 
     907 
     908      IF( ln_blk ) THEN 
     909         ! ------------------------------------------------------------ ! 
     910         !    Wind stress relative to the moving ice ( U10m - U_ice )   ! 
     911         ! ------------------------------------------------------------ ! 
     912         ! C-grid ice dynamics :   U & V-points (same as ocean) 
     913         DO jj = 2, jpjm1 
     914            DO ji = fs_2, fs_jpim1   ! vect. opt. 
     915               putaui(ji,jj) = 0.5_wp * (  rhoa(ji+1,jj) * zcd_dui(ji+1,jj)             & 
     916                  &                      + rhoa(ji  ,jj) * zcd_dui(ji  ,jj)  )          & 
     917                  &         * ( 0.5_wp * ( pwndi(ji+1,jj) + pwndi(ji,jj) ) - rn_vfac * puice(ji,jj) ) 
     918               pvtaui(ji,jj) = 0.5_wp * (  rhoa(ji,jj+1) * zcd_dui(ji,jj+1)             & 
     919                  &                      + rhoa(ji,jj  ) * zcd_dui(ji,jj  )  )          & 
     920                  &         * ( 0.5_wp * ( pwndj(ji,jj+1) + pwndj(ji,jj) ) - rn_vfac * pvice(ji,jj) ) 
     921            END DO 
    759922         END DO 
    760       END DO 
    761       CALL lbc_lnk_multi( 'sbcblk', utau_ice, 'U', -1., vtau_ice, 'V', -1. ) 
    762       ! 
    763       ! 
    764       IF(ln_ctl) THEN 
    765          CALL prt_ctl(tab2d_1=utau_ice  , clinfo1=' blk_ice: utau_ice : ', tab2d_2=vtau_ice  , clinfo2=' vtau_ice : ') 
    766          CALL prt_ctl(tab2d_1=wndm_ice  , clinfo1=' blk_ice: wndm_ice : ') 
    767       ENDIF 
    768       ! 
    769    END SUBROUTINE blk_ice_tau 
    770  
    771  
    772    SUBROUTINE blk_ice_flx( ptsu, phs, phi, palb ) 
    773       !!--------------------------------------------------------------------- 
    774       !!                     ***  ROUTINE blk_ice_flx  *** 
     923         CALL lbc_lnk_multi( 'sbcblk', putaui, 'U', -1., pvtaui, 'V', -1. ) 
     924         ! 
     925         IF(ln_ctl)   CALL prt_ctl( tab2d_1=putaui  , clinfo1=' blk_ice: putaui : '   & 
     926            &                     , tab2d_2=pvtaui  , clinfo2='          pvtaui : ' ) 
     927      ELSE 
     928         zztmp1 = 11637800.0_wp 
     929         zztmp2 =    -5897.8_wp 
     930         DO jj = 1, jpj 
     931            DO ji = 1, jpi 
     932               pcd_dui(ji,jj) = zcd_dui (ji,jj) 
     933               pseni  (ji,jj) = wndm_ice(ji,jj) * Ch_ice(ji,jj) 
     934               pevpi  (ji,jj) = wndm_ice(ji,jj) * Ce_ice(ji,jj) 
     935               zootm_su       = zztmp2 / ptsui(ji,jj)   ! ptsui is in K (it can't be zero ??) 
     936               pssqi  (ji,jj) = zztmp1 * EXP( zootm_su ) / rhoa(ji,jj) 
     937            END DO 
     938         END DO 
     939      ENDIF 
     940      ! 
     941      IF(ln_ctl)  CALL prt_ctl(tab2d_1=wndm_ice  , clinfo1=' blk_ice: wndm_ice : ') 
     942      ! 
     943   END SUBROUTINE blk_ice_1 
     944 
     945 
     946   SUBROUTINE blk_ice_2( ptsu, phs, phi, palb, ptair, phumi, pslp, pqlw, pprec, psnow  ) 
     947      !!--------------------------------------------------------------------- 
     948      !!                     ***  ROUTINE blk_ice_2  *** 
    775949      !! 
    776950      !! ** Purpose :   provide the heat and mass fluxes at air-ice interface 
     
    782956      !! caution : the net upward water flux has with mm/day unit 
    783957      !!--------------------------------------------------------------------- 
    784       REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   ptsu   ! sea ice surface temperature 
     958      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   ptsu   ! sea ice surface temperature [K] 
    785959      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phs    ! snow thickness 
    786960      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phi    ! ice thickness 
    787961      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   palb   ! ice albedo (all skies) 
     962      REAL(wp), DIMENSION(:,:  ), INTENT(in)  ::   ptair 
     963      REAL(wp), DIMENSION(:,:  ), INTENT(in)  ::   phumi 
     964      REAL(wp), DIMENSION(:,:  ), INTENT(in)  ::   pslp 
     965      REAL(wp), DIMENSION(:,:  ), INTENT(in)  ::   pqlw 
     966      REAL(wp), DIMENSION(:,:  ), INTENT(in)  ::   pprec 
     967      REAL(wp), DIMENSION(:,:  ), INTENT(in)  ::   psnow 
    788968      !! 
    789969      INTEGER  ::   ji, jj, jl               ! dummy loop indices 
    790970      REAL(wp) ::   zst3                     ! local variable 
    791971      REAL(wp) ::   zcoef_dqlw, zcoef_dqla   !   -      - 
    792       REAL(wp) ::   zztmp, z1_rLsub           !   -      - 
     972      REAL(wp) ::   zztmp, zztmp2, z1_rLsub  !   -      - 
    793973      REAL(wp) ::   zfr1, zfr2               ! local variables 
    794974      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   z1_st         ! inverse of surface temperature 
     
    798978      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   z_dqsb        ! sensible  heat sensitivity over ice 
    799979      REAL(wp), DIMENSION(jpi,jpj)     ::   zevap, zsnw   ! evaporation and snw distribution after wind blowing (SI3) 
    800       REAL(wp), DIMENSION(jpi,jpj)     ::   zrhoa 
    801       !!--------------------------------------------------------------------- 
    802       ! 
    803       zcoef_dqlw = 4.0 * 0.95 * Stef             ! local scalars 
    804       zcoef_dqla = -Ls * 11637800. * (-5897.8) 
    805       ! 
    806       zrhoa(:,:) = rho_air( sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1), sf(jp_slp)%fnow(:,:,1) ) 
     980      REAL(wp), DIMENSION(jpi,jpj)     ::   zqair         ! specific humidity of air at z=rn_zqt [kg/kg] !LB 
     981      !!--------------------------------------------------------------------- 
     982      ! 
     983      zcoef_dqlw = 4._wp * 0.95_wp * stefan             ! local scalars 
     984      zcoef_dqla = -rLsub * 11637800._wp * (-5897.8_wp) !LB: BAD! 
     985      ! 
     986      SELECT CASE( nhumi ) 
     987      CASE( np_humi_sph ) 
     988         zqair(:,:) =  phumi(:,:)      ! what we read in file is already a spec. humidity! 
     989      CASE( np_humi_dpt ) 
     990         zqair(:,:) = q_sat( phumi(:,:), pslp ) 
     991      CASE( np_humi_rlh ) 
     992         zqair(:,:) = q_air_rh( 0.01_wp*phumi(:,:), ptair(:,:), pslp(:,:) ) !LB: 0.01 => RH is % percent in file 
     993      END SELECT 
    807994      ! 
    808995      zztmp = 1. / ( 1. - albo ) 
    809       WHERE( ptsu(:,:,:) /= 0._wp )   ;   z1_st(:,:,:) = 1._wp / ptsu(:,:,:) 
    810       ELSEWHERE                       ;   z1_st(:,:,:) = 0._wp 
     996      WHERE( ptsu(:,:,:) /= 0._wp ) 
     997         z1_st(:,:,:) = 1._wp / ptsu(:,:,:) 
     998      ELSEWHERE 
     999         z1_st(:,:,:) = 0._wp 
    8111000      END WHERE 
    8121001      !                                     ! ========================== ! 
     
    8221011               qsr_ice(ji,jj,jl) = zztmp * ( 1. - palb(ji,jj,jl) ) * qsr(ji,jj) 
    8231012               ! Long  Wave (lw) 
    824                z_qlw(ji,jj,jl) = 0.95 * ( sf(jp_qlw)%fnow(ji,jj,1) - Stef * ptsu(ji,jj,jl) * zst3 ) * tmask(ji,jj,1) 
     1013               z_qlw(ji,jj,jl) = 0.95 * ( pqlw(ji,jj) - stefan * ptsu(ji,jj,jl) * zst3 ) * tmask(ji,jj,1) 
    8251014               ! lw sensitivity 
    8261015               z_dqlw(ji,jj,jl) = zcoef_dqlw * zst3 
     
    8301019               ! ----------------------------! 
    8311020 
    832                ! ... turbulent heat fluxes with Ch_atm recalculated in blk_ice_tau 
     1021               ! ... turbulent heat fluxes with Ch_ice recalculated in blk_ice_1 
    8331022               ! Sensible Heat 
    834                z_qsb(ji,jj,jl) = zrhoa(ji,jj) * cpa * Ch_atm(ji,jj) * wndm_ice(ji,jj) * (ptsu(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj,1)) 
     1023               z_qsb(ji,jj,jl) = rhoa(ji,jj) * rCp_air * Ch_ice(ji,jj) * wndm_ice(ji,jj) * (ptsu(ji,jj,jl) - ptair(ji,jj)) 
    8351024               ! Latent Heat 
    836                qla_ice(ji,jj,jl) = rn_efac * MAX( 0.e0, zrhoa(ji,jj) * Ls  * Ch_atm(ji,jj) * wndm_ice(ji,jj) *  & 
    837                   &                ( 11637800. * EXP( -5897.8 * z1_st(ji,jj,jl) ) / zrhoa(ji,jj) - sf(jp_humi)%fnow(ji,jj,1) ) ) 
     1025               zztmp2 = EXP( -5897.8 * z1_st(ji,jj,jl) ) 
     1026               qla_ice(ji,jj,jl) = rn_efac * MAX( 0.e0, rhoa(ji,jj) * rLsub  * Ce_ice(ji,jj) * wndm_ice(ji,jj) *  & 
     1027                  &                ( 11637800. * zztmp2 / rhoa(ji,jj) - zqair(ji,jj) ) ) 
    8381028               ! Latent heat sensitivity for ice (Dqla/Dt) 
    8391029               IF( qla_ice(ji,jj,jl) > 0._wp ) THEN 
    840                   dqla_ice(ji,jj,jl) = rn_efac * zcoef_dqla * Ch_atm(ji,jj) * wndm_ice(ji,jj) *  & 
    841                      &                 z1_st(ji,jj,jl)*z1_st(ji,jj,jl) * EXP(-5897.8 * z1_st(ji,jj,jl)) 
     1030                  dqla_ice(ji,jj,jl) = rn_efac * zcoef_dqla * Ce_ice(ji,jj) * wndm_ice(ji,jj) *  & 
     1031                     &                 z1_st(ji,jj,jl) * z1_st(ji,jj,jl) * zztmp2 
    8421032               ELSE 
    8431033                  dqla_ice(ji,jj,jl) = 0._wp 
     
    8451035 
    8461036               ! Sensible heat sensitivity (Dqsb_ice/Dtn_ice) 
    847                z_dqsb(ji,jj,jl) = zrhoa(ji,jj) * cpa * Ch_atm(ji,jj) * wndm_ice(ji,jj) 
     1037               z_dqsb(ji,jj,jl) = rhoa(ji,jj) * rCp_air * Ch_ice(ji,jj) * wndm_ice(ji,jj) 
    8481038 
    8491039               ! ----------------------------! 
     
    8601050      END DO 
    8611051      ! 
    862       tprecip(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac * tmask(:,:,1)  ! total precipitation [kg/m2/s] 
    863       sprecip(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac * tmask(:,:,1)  ! solid precipitation [kg/m2/s] 
    864       CALL iom_put( 'snowpre', sprecip )                    ! Snow precipitation 
    865       CALL iom_put( 'precip' , tprecip )                    ! Total precipitation 
     1052      tprecip(:,:) = pprec(:,:) * rn_pfac * tmask(:,:,1)  ! total precipitation [kg/m2/s] 
     1053      sprecip(:,:) = psnow(:,:) * rn_pfac * tmask(:,:,1)  ! solid precipitation [kg/m2/s] 
     1054      CALL iom_put( 'snowpre', sprecip )                  ! Snow precipitation 
     1055      CALL iom_put( 'precip' , tprecip )                  ! Total precipitation 
    8661056 
    8671057      ! --- evaporation --- ! 
     
    8801070      ! --- heat flux associated with emp --- ! 
    8811071      qemp_oce(:,:) = - ( 1._wp - at_i_b(:,:) ) * zevap(:,:) * sst_m(:,:) * rcp                  & ! evap at sst 
    882          &          + ( tprecip(:,:) - sprecip(:,:) ) * ( sf(jp_tair)%fnow(:,:,1) - rt0 ) * rcp  & ! liquid precip at Tair 
     1072         &          + ( tprecip(:,:) - sprecip(:,:) ) * ( ptair(:,:) - rt0 ) * rcp               & ! liquid precip at Tair 
    8831073         &          +   sprecip(:,:) * ( 1._wp - zsnw ) *                                        & ! solid precip at min(Tair,Tsnow) 
    884          &              ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0 ) - rt0 ) * rcpi * tmask(:,:,1) - rLfus ) 
     1074         &              ( ( MIN( ptair(:,:), rt0 ) - rt0 ) * rcpi * tmask(:,:,1) - rLfus ) 
    8851075      qemp_ice(:,:) =   sprecip(:,:) * zsnw *                                                    & ! solid precip (only) 
    886          &              ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0 ) - rt0 ) * rcpi * tmask(:,:,1) - rLfus ) 
     1076         &              ( ( MIN( ptair(:,:), rt0 ) - rt0 ) * rcpi * tmask(:,:,1) - rLfus ) 
    8871077 
    8881078      ! --- total solar and non solar fluxes --- ! 
     
    8921082 
    8931083      ! --- heat content of precip over ice in J/m3 (to be used in 1D-thermo) --- ! 
    894       qprec_ice(:,:) = rhos * ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0 ) - rt0 ) * rcpi * tmask(:,:,1) - rLfus ) 
     1084      qprec_ice(:,:) = rhos * ( ( MIN( ptair(:,:), rt0 ) - rt0 ) * rcpi * tmask(:,:,1) - rLfus ) 
    8951085 
    8961086      ! --- heat content of evap over ice in W/m2 (to be used in 1D-thermo) --- 
    8971087      DO jl = 1, jpl 
    8981088         qevap_ice(:,:,jl) = 0._wp ! should be -evap_ice(:,:,jl)*( ( Tice - rt0 ) * rcpi * tmask(:,:,1) ) 
    899          !                         ! But we do not have Tice => consider it at 0degC => evap=0  
     1089         !                         ! But we do not have Tice => consider it at 0degC => evap=0 
    9001090      END DO 
    9011091 
     
    9041094      zfr2 = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice )            ! zfr2 such that zfr1 + zfr2 to equal 1 
    9051095      ! 
    906       WHERE    ( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) <  0.1_wp )       ! linear decrease from hi=0 to 10cm   
     1096      WHERE    ( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) <  0.1_wp )       ! linear decrease from hi=0 to 10cm 
    9071097         qtr_ice_top(:,:,:) = qsr_ice(:,:,:) * ( zfr1 + zfr2 * ( 1._wp - phi(:,:,:) * 10._wp ) ) 
    9081098      ELSEWHERE( phs(:,:,:) <= 0._wp .AND. phi(:,:,:) >= 0.1_wp )       ! constant (zfr1) when hi>10cm 
    9091099         qtr_ice_top(:,:,:) = qsr_ice(:,:,:) * zfr1 
    9101100      ELSEWHERE                                                         ! zero when hs>0 
    911          qtr_ice_top(:,:,:) = 0._wp  
     1101         qtr_ice_top(:,:,:) = 0._wp 
    9121102      END WHERE 
    9131103      ! 
     
    9211111      ENDIF 
    9221112      ! 
    923    END SUBROUTINE blk_ice_flx 
    924     
     1113   END SUBROUTINE blk_ice_2 
     1114 
    9251115 
    9261116   SUBROUTINE blk_ice_qcn( ld_virtual_itd, ptsu, ptb, phs, phi ) 
     
    9311121      !!                to force sea ice / snow thermodynamics 
    9321122      !!                in the case conduction flux is emulated 
    933       !!                 
     1123      !! 
    9341124      !! ** Method  :   compute surface energy balance assuming neglecting heat storage 
    9351125      !!                following the 0-layer Semtner (1976) approach 
     
    9561146      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zgfac   ! enhanced conduction factor 
    9571147      !!--------------------------------------------------------------------- 
    958        
     1148 
    9591149      ! -------------------------------------! 
    9601150      !      I   Enhanced conduction factor  ! 
     
    9641154      ! 
    9651155      zgfac(:,:,:) = 1._wp 
    966        
     1156 
    9671157      IF( ld_virtual_itd ) THEN 
    9681158         ! 
     
    9701160         zfac2 = EXP(1._wp) * 0.5_wp * zepsilon 
    9711161         zfac3 = 2._wp / zepsilon 
    972          !    
    973          DO jl = 1, jpl                 
     1162         ! 
     1163         DO jl = 1, jpl 
    9741164            DO jj = 1 , jpj 
    9751165               DO ji = 1, jpi 
     
    9791169            END DO 
    9801170         END DO 
    981          !       
    982       ENDIF 
    983        
     1171         ! 
     1172      ENDIF 
     1173 
    9841174      ! -------------------------------------------------------------! 
    9851175      !      II   Surface temperature and conduction flux            ! 
     
    9911181         DO jj = 1 , jpj 
    9921182            DO ji = 1, jpi 
    993                !                     
     1183               ! 
    9941184               zkeff_h = zfac * zgfac(ji,jj,jl) / &                                    ! Effective conductivity of the snow-ice system divided by thickness 
    9951185                  &      ( rcnd_i * phs(ji,jj,jl) + rn_cnd_s * MAX( 0.01, phi(ji,jj,jl) ) ) 
     
    10081198               qns_ice(ji,jj,jl) = qns_ice(ji,jj,jl) + dqns_ice(ji,jj,jl) * ( ptsu(ji,jj,jl) - ztsu0 ) 
    10091199               qml_ice(ji,jj,jl) = ( qsr_ice(ji,jj,jl) - qtr_ice_top(ji,jj,jl) + qns_ice(ji,jj,jl) - qcn_ice(ji,jj,jl) )  & 
    1010                              &   * MAX( 0._wp , SIGN( 1._wp, ptsu(ji,jj,jl) - rt0 ) ) 
     1200                  &   * MAX( 0._wp , SIGN( 1._wp, ptsu(ji,jj,jl) - rt0 ) ) 
    10111201 
    10121202               ! --- Diagnose the heat loss due to changing non-solar flux (as in icethd_zdf_bl99) --- ! 
    1013                hfx_err_dif(ji,jj) = hfx_err_dif(ji,jj) - ( dqns_ice(ji,jj,jl) * ( ptsu(ji,jj,jl) - ztsu0 ) ) * a_i_b(ji,jj,jl)  
     1203               hfx_err_dif(ji,jj) = hfx_err_dif(ji,jj) - ( dqns_ice(ji,jj,jl) * ( ptsu(ji,jj,jl) - ztsu0 ) ) * a_i_b(ji,jj,jl) 
    10141204 
    10151205            END DO 
    10161206         END DO 
    10171207         ! 
    1018       END DO  
    1019       !       
     1208      END DO 
     1209      ! 
    10201210   END SUBROUTINE blk_ice_qcn 
    1021     
    1022  
    1023    SUBROUTINE Cdn10_Lupkes2012( Cd ) 
     1211 
     1212 
     1213   SUBROUTINE Cdn10_Lupkes2012( pcd ) 
    10241214      !!---------------------------------------------------------------------- 
    10251215      !!                      ***  ROUTINE  Cdn10_Lupkes2012  *** 
    10261216      !! 
    1027       !! ** Purpose :    Recompute the neutral air-ice drag referenced at 10m  
     1217      !! ** Purpose :    Recompute the neutral air-ice drag referenced at 10m 
    10281218      !!                 to make it dependent on edges at leads, melt ponds and flows. 
    10291219      !!                 After some approximations, this can be resumed to a dependency 
    10301220      !!                 on ice concentration. 
    1031       !!                 
     1221      !! 
    10321222      !! ** Method :     The parameterization is taken from Lupkes et al. (2012) eq.(50) 
    10331223      !!                 with the highest level of approximation: level4, eq.(59) 
     
    10411231      !! 
    10421232      !!                 This new drag has a parabolic shape (as a function of A) starting at 
    1043       !!                 Cdw(say 1.5e-3) for A=0, reaching 1.97e-3 for A~0.5  
     1233      !!                 Cdw(say 1.5e-3) for A=0, reaching 1.97e-3 for A~0.5 
    10441234      !!                 and going down to Cdi(say 1.4e-3) for A=1 
    10451235      !! 
     
    10511241      !! 
    10521242      !!---------------------------------------------------------------------- 
    1053       REAL(wp), DIMENSION(:,:), INTENT(inout) ::   Cd 
     1243      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pcd 
    10541244      REAL(wp), PARAMETER ::   zCe   = 2.23e-03_wp 
    10551245      REAL(wp), PARAMETER ::   znu   = 1._wp 
     
    10661256 
    10671257      ! ice-atm drag 
    1068       Cd(:,:) = Cd_ice +  &                                                         ! pure ice drag 
    1069          &      zCe    * ( 1._wp - at_i_b(:,:) )**zcoef * at_i_b(:,:)**(zmu-1._wp)  ! change due to sea-ice morphology 
    1070        
     1258      pcd(:,:) = rCd_ice +  &                                                         ! pure ice drag 
     1259         &      zCe     * ( 1._wp - at_i_b(:,:) )**zcoef * at_i_b(:,:)**(zmu-1._wp)  ! change due to sea-ice morphology 
     1260 
    10711261   END SUBROUTINE Cdn10_Lupkes2012 
    10721262 
    10731263 
    1074    SUBROUTINE Cdn10_Lupkes2015( Cd, Ch ) 
     1264   SUBROUTINE Cdn10_Lupkes2015( ptm_su, pslp, pcd, pch ) 
    10751265      !!---------------------------------------------------------------------- 
    10761266      !!                      ***  ROUTINE  Cdn10_Lupkes2015  *** 
    10771267      !! 
    10781268      !! ** pUrpose :    Alternative turbulent transfert coefficients formulation 
    1079       !!                 between sea-ice and atmosphere with distinct momentum  
    1080       !!                 and heat coefficients depending on sea-ice concentration  
     1269      !!                 between sea-ice and atmosphere with distinct momentum 
     1270      !!                 and heat coefficients depending on sea-ice concentration 
    10811271      !!                 and atmospheric stability (no meltponds effect for now). 
    1082       !!                 
     1272      !! 
    10831273      !! ** Method :     The parameterization is adapted from Lupkes et al. (2015) 
    10841274      !!                 and ECHAM6 atmospheric model. Compared to Lupkes2012 scheme, 
    10851275      !!                 it considers specific skin and form drags (Andreas et al. 2010) 
    1086       !!                 to compute neutral transfert coefficients for both heat and  
     1276      !!                 to compute neutral transfert coefficients for both heat and 
    10871277      !!                 momemtum fluxes. Atmospheric stability effect on transfert 
    10881278      !!                 coefficient is also taken into account following Louis (1979). 
     
    10931283      !!---------------------------------------------------------------------- 
    10941284      ! 
    1095       REAL(wp), DIMENSION(:,:), INTENT(inout) ::   Cd 
    1096       REAL(wp), DIMENSION(:,:), INTENT(inout) ::   Ch 
    1097       REAL(wp), DIMENSION(jpi,jpj)            ::   ztm_su, zst, zqo_sat, zqi_sat 
     1285      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   ptm_su ! sea-ice surface temperature [K] 
     1286      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   pslp   ! sea-level pressure [Pa] 
     1287      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pcd    ! momentum transfert coefficient 
     1288      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pch    ! heat transfert coefficient 
     1289      REAL(wp), DIMENSION(jpi,jpj)            ::   zst, zqo_sat, zqi_sat 
    10981290      ! 
    10991291      ! ECHAM6 constants 
     
    11231315      !!---------------------------------------------------------------------- 
    11241316 
    1125       ! mean temperature 
    1126       WHERE( at_i_b(:,:) > 1.e-20 )   ;   ztm_su(:,:) = SUM( t_su(:,:,:) * a_i_b(:,:,:) , dim=3 ) / at_i_b(:,:) 
    1127       ELSEWHERE                       ;   ztm_su(:,:) = rt0 
    1128       ENDWHERE 
    1129        
    11301317      ! Momentum Neutral Transfert Coefficients (should be a constant) 
    11311318      zCdn_form_tmp = zce10 * ( LOG( 10._wp / z0_form_ice + 1._wp ) / LOG( rn_zu / z0_form_ice + 1._wp ) )**2   ! Eq. 40 
    11321319      zCdn_skin_ice = ( vkarmn                                      / LOG( rn_zu / z0_skin_ice + 1._wp ) )**2   ! Eq. 7 
    1133       zCdn_ice      = zCdn_skin_ice   ! Eq. 7 (cf Lupkes email for details) 
     1320      zCdn_ice      = zCdn_skin_ice   ! Eq. 7 
    11341321      !zCdn_ice     = 1.89e-3         ! old ECHAM5 value (cf Eq. 32) 
    11351322 
    11361323      ! Heat Neutral Transfert Coefficients 
    1137       zChn_skin_ice = vkarmn**2 / ( LOG( rn_zu / z0_ice + 1._wp ) * LOG( rn_zu * z1_alpha / z0_skin_ice + 1._wp ) )   ! Eq. 50 + Eq. 52 (cf Lupkes email for details) 
    1138       
     1324      zChn_skin_ice = vkarmn**2 / ( LOG( rn_zu / z0_ice + 1._wp ) * LOG( rn_zu * z1_alpha / z0_skin_ice + 1._wp ) )   ! Eq. 50 + Eq. 52 
     1325 
    11391326      ! Atmospheric and Surface Variables 
    11401327      zst(:,:)     = sst_m(:,:) + rt0                                        ! convert SST from Celcius to Kelvin 
    1141       zqo_sat(:,:) = 0.98_wp * q_sat( zst(:,:)   , sf(jp_slp)%fnow(:,:,1) )  ! saturation humidity over ocean [kg/kg] 
    1142       zqi_sat(:,:) = 0.98_wp * q_sat( ztm_su(:,:), sf(jp_slp)%fnow(:,:,1) )  ! saturation humidity over ice   [kg/kg] 
     1328      zqo_sat(:,:) = rdct_qsat_salt * q_sat( zst(:,:)   , pslp(:,:) )   ! saturation humidity over ocean [kg/kg] 
     1329      zqi_sat(:,:) =                  q_sat( ptm_su(:,:), pslp(:,:) )   ! saturation humidity over ice   [kg/kg] 
    11431330      ! 
    11441331      DO jj = 2, jpjm1           ! reduced loop is necessary for reproducibility 
     
    11461333            ! Virtual potential temperature [K] 
    11471334            zthetav_os = zst(ji,jj)    * ( 1._wp + rctv0 * zqo_sat(ji,jj) )   ! over ocean 
    1148             zthetav_is = ztm_su(ji,jj) * ( 1._wp + rctv0 * zqi_sat(ji,jj) )   ! ocean ice 
     1335            zthetav_is = ptm_su(ji,jj) * ( 1._wp + rctv0 * zqi_sat(ji,jj) )   ! ocean ice 
    11491336            zthetav_zu = t_zu (ji,jj)  * ( 1._wp + rctv0 * q_zu(ji,jj)    )   ! at zu 
    1150              
     1337 
    11511338            ! Bulk Richardson Number (could use Ri_bulk function from aerobulk instead) 
    11521339            zrib_o = grav / zthetav_os * ( zthetav_zu - zthetav_os ) * rn_zu / MAX( 0.5, wndm(ji,jj)     )**2   ! over ocean 
    11531340            zrib_i = grav / zthetav_is * ( zthetav_zu - zthetav_is ) * rn_zu / MAX( 0.5, wndm_ice(ji,jj) )**2   ! over ice 
    1154              
     1341 
    11551342            ! Momentum and Heat Neutral Transfert Coefficients 
    11561343            zCdn_form_ice = zCdn_form_tmp * at_i_b(ji,jj) * ( 1._wp - at_i_b(ji,jj) )**zbeta  ! Eq. 40 
    1157             zChn_form_ice = zCdn_form_ice / ( 1._wp + ( LOG( z1_alphaf ) / vkarmn ) * SQRT( zCdn_form_ice ) )               ! Eq. 53  
    1158                         
    1159             ! Momentum and Heat Stability functions (possibility to use psi_m_ecmwf instead) 
     1344            zChn_form_ice = zCdn_form_ice / ( 1._wp + ( LOG( z1_alphaf ) / vkarmn ) * SQRT( zCdn_form_ice ) )               ! Eq. 53 
     1345 
     1346            ! Momentum and Heat Stability functions (possibility to use psi_m_ecmwf instead ?) 
    11601347            z0w = rn_zu * EXP( -1._wp * vkarmn / SQRT( Cdn_oce(ji,jj) ) ) ! over water 
    1161             z0i = z0_skin_ice                                             ! over ice (cf Lupkes email for details) 
     1348            z0i = z0_skin_ice                                             ! over ice 
    11621349            IF( zrib_o <= 0._wp ) THEN 
    11631350               zfmw = 1._wp - zam * zrib_o / ( 1._wp + 3._wp * zc2 * Cdn_oce(ji,jj) * SQRT( -zrib_o * ( rn_zu / z0w + 1._wp ) ) )  ! Eq. 10 
     
    11681355               zfhw = 1._wp / ( 1._wp + zah * zrib_o / SQRT( 1._wp + zrib_o ) )   ! Eq. 28 
    11691356            ENDIF 
    1170              
     1357 
    11711358            IF( zrib_i <= 0._wp ) THEN 
    11721359               zfmi = 1._wp - zam * zrib_i / (1._wp + 3._wp * zc2 * zCdn_ice * SQRT( -zrib_i * ( rn_zu / z0i + 1._wp)))   ! Eq.  9 
     
    11761363               zfhi = 1._wp / ( 1._wp + zah * zrib_i / SQRT( 1._wp + zrib_i ) )   ! Eq. 27 
    11771364            ENDIF 
    1178              
     1365 
    11791366            ! Momentum Transfert Coefficients (Eq. 38) 
    1180             Cd(ji,jj) = zCdn_skin_ice *   zfmi +  & 
     1367            pcd(ji,jj) = zCdn_skin_ice *   zfmi +  & 
    11811368               &        zCdn_form_ice * ( zfmi * at_i_b(ji,jj) + zfmw * ( 1._wp - at_i_b(ji,jj) ) ) / MAX( 1.e-06, at_i_b(ji,jj) ) 
    1182              
     1369 
    11831370            ! Heat Transfert Coefficients (Eq. 49) 
    1184             Ch(ji,jj) = zChn_skin_ice *   zfhi +  & 
     1371            pch(ji,jj) = zChn_skin_ice *   zfhi +  & 
    11851372               &        zChn_form_ice * ( zfhi * at_i_b(ji,jj) + zfhw * ( 1._wp - at_i_b(ji,jj) ) ) / MAX( 1.e-06, at_i_b(ji,jj) ) 
    11861373            ! 
    11871374         END DO 
    11881375      END DO 
    1189       CALL lbc_lnk_multi( 'sbcblk', Cd, 'T',  1., Ch, 'T', 1. ) 
     1376      CALL lbc_lnk_multi( 'sbcblk', pcd, 'T',  1., pch, 'T', 1. ) 
    11901377      ! 
    11911378   END SUBROUTINE Cdn10_Lupkes2015 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcblk_algo_ecmwf.F90

    r10069 r12182  
    11MODULE sbcblk_algo_ecmwf 
    22   !!====================================================================== 
    3    !!                       ***  MODULE  sbcblk_algo_ecmwf  *** 
    4    !! Computes turbulent components of surface fluxes 
    5    !!         according to the method in IFS of the ECMWF model 
    6    !! 
     3   !!                   ***  MODULE  sbcblk_algo_ecmwf  *** 
     4   !! Computes: 
    75   !!   * bulk transfer coefficients C_D, C_E and C_H 
    86   !!   * air temp. and spec. hum. adjusted from zt (2m) to zu (10m) if needed 
     
    108   !!   => all these are used in bulk formulas in sbcblk.F90 
    119   !! 
    12    !!    Using the bulk formulation/param. of IFS of ECMWF (cycle 31r2) 
     10   !!    Using the bulk formulation/param. of IFS of ECMWF (cycle 40r1) 
    1311   !!         based on IFS doc (avaible online on the ECMWF's website) 
    1412   !! 
     13   !!       Routine turb_ecmwf maintained and developed in AeroBulk 
     14   !!                     (https://github.com/brodeau/aerobulk) 
    1515   !! 
    16    !!       Routine turb_ecmwf maintained and developed in AeroBulk 
    17    !!                     (http://aerobulk.sourceforge.net/) 
    18    !! 
    19    !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
     16   !! ** Author: L. Brodeau, June 2019 / AeroBulk (https://github.com/brodeau/aerobulk) 
    2017   !!---------------------------------------------------------------------- 
    2118   !! History :  4.0  !  2016-02  (L.Brodeau)   Original code 
     
    4138 
    4239   USE sbc_oce         ! Surface boundary condition: ocean fields 
     40   USE sbcblk_phy      ! all thermodynamics functions, rho_air, q_sat, etc... !LB 
     41   USE sbcblk_skin_ecmwf ! cool-skin/warm layer scheme !LB 
    4342 
    4443   IMPLICIT NONE 
    4544   PRIVATE 
    4645 
    47    PUBLIC ::   TURB_ECMWF   ! called by sbcblk.F90 
    48  
    49    !                   !! ECMWF own values for given constants, taken form IFS documentation... 
     46   PUBLIC :: SBCBLK_ALGO_ECMWF_INIT, TURB_ECMWF 
     47 
     48   !! ECMWF own values for given constants, taken form IFS documentation... 
    5049   REAL(wp), PARAMETER ::   charn0 = 0.018    ! Charnock constant (pretty high value here !!! 
    5150   !                                          !    =>  Usually 0.011 for moderate winds) 
    5251   REAL(wp), PARAMETER ::   zi0     = 1000.   ! scale height of the atmospheric boundary layer...1 
    5352   REAL(wp), PARAMETER ::   Beta0    = 1.     ! gustiness parameter ( = 1.25 in COAREv3) 
    54    REAL(wp), PARAMETER ::   rctv0    = 0.608  ! constant to obtain virtual temperature... 
    55    REAL(wp), PARAMETER ::   Cp_dry = 1005.0   ! Specic heat of dry air, constant pressure      [J/K/kg] 
    56    REAL(wp), PARAMETER ::   Cp_vap = 1860.0   ! Specic heat of water vapor, constant pressure  [J/K/kg] 
    5753   REAL(wp), PARAMETER ::   alpha_M = 0.11    ! For roughness length (smooth surface term) 
    5854   REAL(wp), PARAMETER ::   alpha_H = 0.40    ! (Chapter 3, p.34, IFS doc Cy31r1) 
    5955   REAL(wp), PARAMETER ::   alpha_Q = 0.62    ! 
     56 
     57   INTEGER , PARAMETER ::   nb_itt = 10             ! number of itterations 
     58 
    6059   !!---------------------------------------------------------------------- 
    6160CONTAINS 
    6261 
    63    SUBROUTINE TURB_ECMWF( zt, zu, sst, t_zt, ssq , q_zt , U_zu,   & 
    64       &                   Cd, Ch, Ce , t_zu, q_zu, U_blk,         & 
    65       &                   Cdn, Chn, Cen                           ) 
    66       !!---------------------------------------------------------------------------------- 
    67       !!                      ***  ROUTINE  turb_ecmwf  *** 
    68       !! 
    69       !!            2015: L. Brodeau (brodeau@gmail.com) 
    70       !! 
    71       !! ** Purpose :   Computes turbulent transfert coefficients of surface 
    72       !!                fluxes according to IFS doc. (cycle 31) 
    73       !!                If relevant (zt /= zu), adjust temperature and humidity from height zt to zu 
    74       !! 
    75       !! ** Method : Monin Obukhov Similarity Theory 
     62 
     63   SUBROUTINE sbcblk_algo_ecmwf_init(l_use_cs, l_use_wl) 
     64      !!--------------------------------------------------------------------- 
     65      !!                  ***  FUNCTION sbcblk_algo_ecmwf_init  *** 
    7666      !! 
    7767      !! INPUT : 
    7868      !! ------- 
     69      !!    * l_use_cs : use the cool-skin parameterization 
     70      !!    * l_use_wl : use the warm-layer parameterization 
     71      !!--------------------------------------------------------------------- 
     72      LOGICAL , INTENT(in) ::   l_use_cs ! use the cool-skin parameterization 
     73      LOGICAL , INTENT(in) ::   l_use_wl ! use the warm-layer parameterization 
     74      INTEGER :: ierr 
     75      !!--------------------------------------------------------------------- 
     76      IF( l_use_wl ) THEN 
     77         ierr = 0 
     78         ALLOCATE ( dT_wl(jpi,jpj), Hz_wl(jpi,jpj), STAT=ierr ) 
     79         IF( ierr > 0 ) CALL ctl_stop( ' SBCBLK_ALGO_ECMWF_INIT => allocation of dT_wl & Hz_wl failed!' ) 
     80         dT_wl(:,:)  = 0._wp 
     81         Hz_wl(:,:)  = rd0 ! (rd0, constant, = 3m is default for Zeng & Beljaars) 
     82      ENDIF 
     83      IF( l_use_cs ) THEN 
     84         ierr = 0 
     85         ALLOCATE ( dT_cs(jpi,jpj), STAT=ierr ) 
     86         IF( ierr > 0 ) CALL ctl_stop( ' SBCBLK_ALGO_ECMWF_INIT => allocation of dT_cs failed!' ) 
     87         dT_cs(:,:) = -0.25_wp  ! First guess of skin correction 
     88      ENDIF 
     89   END SUBROUTINE sbcblk_algo_ecmwf_init 
     90 
     91 
     92 
     93   SUBROUTINE turb_ecmwf( kt, zt, zu, T_s, t_zt, q_s, q_zt, U_zu, l_use_cs, l_use_wl, & 
     94      &                      Cd, Ch, Ce, t_zu, q_zu, U_blk,                           & 
     95      &                      Cdn, Chn, Cen,                                           & 
     96      &                      Qsw, rad_lw, slp, pdT_cs,                                & ! optionals for cool-skin (and warm-layer) 
     97      &                      pdT_wl, pHz_wl )                                           ! optionals for warm-layer only 
     98      !!---------------------------------------------------------------------- 
     99      !!                      ***  ROUTINE  turb_ecmwf  *** 
     100      !! 
     101      !! ** Purpose :   Computes turbulent transfert coefficients of surface 
     102      !!                fluxes according to IFS doc. (cycle 45r1) 
     103      !!                If relevant (zt /= zu), adjust temperature and humidity from height zt to zu 
     104      !!                Returns the effective bulk wind speed at zu to be used in the bulk formulas 
     105      !! 
     106      !!                Applies the cool-skin warm-layer correction of the SST to T_s 
     107      !!                if the net shortwave flux at the surface (Qsw), the downwelling longwave 
     108      !!                radiative fluxes at the surface (rad_lw), and the sea-leve pressure (slp) 
     109      !!                are provided as (optional) arguments! 
     110      !! 
     111      !! INPUT : 
     112      !! ------- 
     113      !!    *  kt   : current time step (starts at 1) 
    79114      !!    *  zt   : height for temperature and spec. hum. of air            [m] 
    80       !!    *  zu   : height for wind speed (generally 10m)                   [m] 
    81       !!    *  U_zu : scalar wind speed at 10m                                [m/s] 
    82       !!    *  sst  : SST                                                     [K] 
     115      !!    *  zu   : height for wind speed (usually 10m)                     [m] 
    83116      !!    *  t_zt : potential air temperature at zt                         [K] 
    84       !!    *  ssq  : specific humidity at saturation at SST                  [kg/kg] 
    85117      !!    *  q_zt : specific humidity of air at zt                          [kg/kg] 
    86       !! 
     118      !!    *  U_zu : scalar wind speed at zu                                 [m/s] 
     119      !!    * l_use_cs : use the cool-skin parameterization 
     120      !!    * l_use_wl : use the warm-layer parameterization 
     121      !! 
     122      !! INPUT/OUTPUT: 
     123      !! ------------- 
     124      !!    *  T_s  : always "bulk SST" as input                              [K] 
     125      !!              -> unchanged "bulk SST" as output if CSWL not used      [K] 
     126      !!              -> skin temperature as output if CSWL used              [K] 
     127      !! 
     128      !!    *  q_s  : SSQ aka saturation specific humidity at temp. T_s       [kg/kg] 
     129      !!              -> doesn't need to be given a value if skin temp computed (in case l_use_cs=True or l_use_wl=True) 
     130      !!              -> MUST be given the correct value if not computing skint temp. (in case l_use_cs=False or l_use_wl=False) 
     131      !! 
     132      !! OPTIONAL INPUT: 
     133      !! --------------- 
     134      !!    *  Qsw    : net solar flux (after albedo) at the surface (>0)     [W/m^2] 
     135      !!    *  rad_lw : downwelling longwave radiation at the surface  (>0)   [W/m^2] 
     136      !!    *  slp    : sea-level pressure                                    [Pa] 
     137      !! 
     138      !! OPTIONAL OUTPUT: 
     139      !! ---------------- 
     140      !!    * pdT_cs  : SST increment "dT" for cool-skin correction           [K] 
     141      !!    * pdT_wl  : SST increment "dT" for warm-layer correction          [K] 
     142      !!    * pHz_wl  : thickness of warm-layer                               [m] 
    87143      !! 
    88144      !! OUTPUT : 
     
    93149      !!    *  t_zu   : pot. air temperature adjusted at wind height zu       [K] 
    94150      !!    *  q_zu   : specific humidity of air        //                    [kg/kg] 
    95       !!    *  U_blk  : bulk wind at 10m                                      [m/s] 
    96       !! 
    97       !! 
    98       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    99       !!---------------------------------------------------------------------------------- 
     151      !!    *  U_blk  : bulk wind speed at zu                                 [m/s] 
     152      !! 
     153      !! 
     154      !! ** Author: L. Brodeau, June 2019 / AeroBulk (https://github.com/brodeau/aerobulk/) 
     155      !!---------------------------------------------------------------------------------- 
     156      INTEGER,  INTENT(in   )                     ::   kt       ! current time step 
    100157      REAL(wp), INTENT(in   )                     ::   zt       ! height for t_zt and q_zt                    [m] 
    101158      REAL(wp), INTENT(in   )                     ::   zu       ! height for U_zu                             [m] 
    102       REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   sst      ! sea surface temperature                [Kelvin] 
     159      REAL(wp), INTENT(inout), DIMENSION(jpi,jpj) ::   T_s      ! sea surface temperature                [Kelvin] 
    103160      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   t_zt     ! potential air temperature              [Kelvin] 
    104       REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   ssq      ! sea surface specific humidity           [kg/kg] 
    105       REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_zt     ! specific air humidity                   [kg/kg] 
     161      REAL(wp), INTENT(inout), DIMENSION(jpi,jpj) ::   q_s      ! sea surface specific humidity           [kg/kg] 
     162      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_zt     ! specific air humidity at zt             [kg/kg] 
    106163      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   U_zu     ! relative wind module at zu                [m/s] 
     164      LOGICAL , INTENT(in   )                     ::   l_use_cs ! use the cool-skin parameterization 
     165      LOGICAL , INTENT(in   )                     ::   l_use_wl ! use the warm-layer parameterization 
    107166      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Cd       ! transfer coefficient for momentum         (tau) 
    108167      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Ch       ! transfer coefficient for sensible heat (Q_sens) 
     
    110169      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   t_zu     ! pot. air temp. adjusted at zu               [K] 
    111170      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   q_zu     ! spec. humidity adjusted at zu           [kg/kg] 
    112       REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   U_blk    ! bulk wind at 10m                          [m/s] 
     171      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   U_blk    ! bulk wind speed at zu                     [m/s] 
    113172      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Cdn, Chn, Cen ! neutral transfer coefficients 
    114173      ! 
     174      REAL(wp), INTENT(in   ), OPTIONAL, DIMENSION(jpi,jpj) ::   Qsw      !             [W/m^2] 
     175      REAL(wp), INTENT(in   ), OPTIONAL, DIMENSION(jpi,jpj) ::   rad_lw   !             [W/m^2] 
     176      REAL(wp), INTENT(in   ), OPTIONAL, DIMENSION(jpi,jpj) ::   slp      !             [Pa] 
     177      REAL(wp), INTENT(  out), OPTIONAL, DIMENSION(jpi,jpj) ::   pdT_cs 
     178      REAL(wp), INTENT(  out), OPTIONAL, DIMENSION(jpi,jpj) ::   pdT_wl   !             [K] 
     179      REAL(wp), INTENT(  out), OPTIONAL, DIMENSION(jpi,jpj) ::   pHz_wl   !             [m] 
     180      ! 
    115181      INTEGER :: j_itt 
    116       LOGICAL ::   l_zt_equal_zu = .FALSE.      ! if q and t are given at same height as U 
    117       INTEGER , PARAMETER ::   nb_itt = 4       ! number of itterations 
    118       ! 
    119       REAL(wp), DIMENSION(jpi,jpj) ::   u_star, t_star, q_star,   & 
    120          &  dt_zu, dq_zu,    & 
    121          &  znu_a,           & !: Nu_air, Viscosity of air 
    122          &  Linv,            & !: 1/L (inverse of Monin Obukhov length... 
    123          &  z0, z0t, z0q 
    124       REAL(wp), DIMENSION(jpi,jpj) ::   func_m, func_h 
    125       REAL(wp), DIMENSION(jpi,jpj) ::   ztmp0, ztmp1, ztmp2 
    126       !!---------------------------------------------------------------------------------- 
    127       ! 
    128       ! Identical first gess as in COARE, with IFS parameter values though 
    129       ! 
     182      LOGICAL :: l_zt_equal_zu = .FALSE.      ! if q and t are given at same height as U 
     183      ! 
     184      REAL(wp), DIMENSION(jpi,jpj) ::  u_star, t_star, q_star 
     185      REAL(wp), DIMENSION(jpi,jpj) :: dt_zu, dq_zu      
     186      REAL(wp), DIMENSION(jpi,jpj) :: znu_a !: Nu_air, Viscosity of air 
     187      REAL(wp), DIMENSION(jpi,jpj) :: Linv  !: 1/L (inverse of Monin Obukhov length... 
     188      REAL(wp), DIMENSION(jpi,jpj) :: z0, z0t, z0q 
     189      ! 
     190      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zsst  ! to back up the initial bulk SST 
     191      ! 
     192      REAL(wp), DIMENSION(jpi,jpj) :: func_m, func_h 
     193      REAL(wp), DIMENSION(jpi,jpj) :: ztmp0, ztmp1, ztmp2 
     194      CHARACTER(len=40), PARAMETER :: crtnm = 'turb_ecmwf@sbcblk_algo_ecmwf.F90' 
     195      !!---------------------------------------------------------------------------------- 
     196 
     197      IF( kt == nit000 ) CALL SBCBLK_ALGO_ECMWF_INIT(l_use_cs, l_use_wl) 
     198 
    130199      l_zt_equal_zu = .FALSE. 
    131       IF( ABS(zu - zt) < 0.01 )   l_zt_equal_zu = .TRUE.    ! testing "zu == zt" is risky with double precision 
    132  
    133  
     200      IF( ABS(zu - zt) < 0.01_wp )   l_zt_equal_zu = .TRUE.    ! testing "zu == zt" is risky with double precision 
     201 
     202      !! Initializations for cool skin and warm layer: 
     203      IF( l_use_cs .AND. (.NOT.(PRESENT(Qsw) .AND. PRESENT(rad_lw) .AND. PRESENT(slp))) ) & 
     204         &   CALL ctl_stop( '['//TRIM(crtnm)//'] => ' , 'you need to provide Qsw, rad_lw & slp to use cool-skin param!' ) 
     205 
     206      IF( l_use_wl .AND. (.NOT.(PRESENT(Qsw) .AND. PRESENT(rad_lw) .AND. PRESENT(slp))) ) & 
     207         &   CALL ctl_stop( '['//TRIM(crtnm)//'] => ' , 'you need to provide Qsw, rad_lw & slp to use warm-layer param!' ) 
     208 
     209      IF( l_use_cs .OR. l_use_wl ) THEN 
     210         ALLOCATE ( zsst(jpi,jpj) ) 
     211         zsst = T_s ! backing up the bulk SST 
     212         IF( l_use_cs ) T_s = T_s - 0.25_wp   ! First guess of correction 
     213         q_s    = rdct_qsat_salt*q_sat(MAX(T_s, 200._wp), slp) ! First guess of q_s 
     214      ENDIF 
     215 
     216 
     217      ! Identical first gess as in COARE, with IFS parameter values though... 
     218      ! 
    134219      !! First guess of temperature and humidity at height zu: 
    135       t_zu = MAX( t_zt , 0.0 )   ! who knows what's given on masked-continental regions... 
    136       q_zu = MAX( q_zt , 1.e-6)   !               " 
     220      t_zu = MAX( t_zt ,  180._wp )   ! who knows what's given on masked-continental regions... 
     221      q_zu = MAX( q_zt , 1.e-6_wp )   !               " 
    137222 
    138223      !! Pot. temp. difference (and we don't want it to be 0!) 
    139       dt_zu = t_zu - sst   ;   dt_zu = SIGN( MAX(ABS(dt_zu),1.e-6), dt_zu ) 
    140       dq_zu = q_zu - ssq   ;   dq_zu = SIGN( MAX(ABS(dq_zu),1.e-9), dq_zu ) 
    141  
    142       znu_a = visc_air(t_zt) ! Air viscosity (m^2/s) at zt given from temperature in (K) 
    143  
    144       ztmp2 = 0.5 * 0.5 ! initial guess for wind gustiness contribution 
    145       U_blk = SQRT(U_zu*U_zu + ztmp2) 
    146  
    147       ! z0     = 0.0001 
    148       ztmp2   = 10000.     ! optimization: ztmp2 == 1/z0 
    149       ztmp0   = LOG(zu*ztmp2) 
    150       ztmp1   = LOG(10.*ztmp2) 
    151       u_star = 0.035*U_blk*ztmp1/ztmp0       ! (u* = 0.035*Un10) 
    152  
    153       z0     = charn0*u_star*u_star/grav + 0.11*znu_a/u_star 
    154       z0t    = 0.1*EXP(vkarmn/(0.00115/(vkarmn/ztmp1)))   !  WARNING: 1/z0t ! 
     224      dt_zu = t_zu - T_s ;   dt_zu = SIGN( MAX(ABS(dt_zu),1.E-6_wp), dt_zu ) 
     225      dq_zu = q_zu - q_s ;   dq_zu = SIGN( MAX(ABS(dq_zu),1.E-9_wp), dq_zu ) 
     226 
     227      znu_a = visc_air(t_zu) ! Air viscosity (m^2/s) at zt given from temperature in (K) 
     228 
     229      U_blk = SQRT(U_zu*U_zu + 0.5_wp*0.5_wp) ! initial guess for wind gustiness contribution 
     230 
     231      ztmp0   = LOG(    zu*10000._wp) ! optimization: 10000. == 1/z0 (with z0 first guess == 0.0001) 
     232      ztmp1   = LOG(10._wp*10000._wp) !       "                    "               " 
     233      u_star = 0.035_wp*U_blk*ztmp1/ztmp0       ! (u* = 0.035*Un10) 
     234 
     235      z0     = charn0*u_star*u_star/grav + 0.11_wp*znu_a/u_star 
     236      z0     = MIN( MAX(ABS(z0), 1.E-9) , 1._wp )                      ! (prevents FPE from stupid values from masked region later on) 
     237 
     238      z0t    = 1._wp / ( 0.1_wp*EXP(vkarmn/(0.00115/(vkarmn/ztmp1))) ) 
     239      z0t    = MIN( MAX(ABS(z0t), 1.E-9) , 1._wp )                      ! (prevents FPE from stupid values from masked region later on) 
    155240 
    156241      Cd     = (vkarmn/ztmp0)**2    ! first guess of Cd 
    157242 
    158       ztmp0 = vkarmn*vkarmn/LOG(zt*z0t)/Cd 
    159  
    160       ztmp2 = Ri_bulk( zu, t_zu, dt_zu, q_zu, dq_zu, U_blk )   ! Ribu = Bulk Richardson number 
    161  
    162       !! First estimate of zeta_u, depending on the stability, ie sign of Ribu (ztmp2): 
    163       ztmp1 = 0.5 + SIGN( 0.5 , ztmp2 ) 
     243      ztmp0 = vkarmn*vkarmn/LOG(zt/z0t)/Cd 
     244 
     245      ztmp2 = Ri_bulk( zu, T_s, t_zu, q_s, q_zu, U_blk ) ! Bulk Richardson Number (BRN) 
     246 
     247      !! First estimate of zeta_u, depending on the stability, ie sign of BRN (ztmp2): 
     248      ztmp1 = 0.5 + SIGN( 0.5_wp , ztmp2 ) 
    164249      func_m = ztmp0*ztmp2 ! temporary array !! 
    165       !!             Ribu < 0                                 Ribu > 0   Beta = 1.25 
    166       func_h = (1.-ztmp1)*(func_m/(1.+ztmp2/(-zu/(zi0*0.004*Beta0**3)))) &  ! temporary array !!! func_h == zeta_u 
    167          &  +     ztmp1*(func_m*(1. + 27./9.*ztmp2/ztmp0)) 
     250      func_h = (1._wp-ztmp1) * (func_m/(1._wp+ztmp2/(-zu/(zi0*0.004_wp*Beta0**3)))) & !  BRN < 0 ! temporary array !!! func_h == zeta_u 
     251         &  +     ztmp1   * (func_m*(1._wp + 27._wp/9._wp*ztmp2/func_m))              !  BRN > 0 
     252      !#LB: should make sure that the "func_m" of "27./9.*ztmp2/func_m" is "ztmp0*ztmp2" and not "ztmp0==vkarmn*vkarmn/LOG(zt/z0t)/Cd" ! 
    168253 
    169254      !! First guess M-O stability dependent scaling params.(u*,t*,q*) to estimate z0 and z/L 
    170       ztmp0   =        vkarmn/(LOG(zu*z0t) - psi_h_ecmwf(func_h)) 
    171  
    172       u_star = U_blk*vkarmn/(LOG(zu) - LOG(z0)  - psi_m_ecmwf(func_h)) 
     255      ztmp0  = vkarmn/(LOG(zu/z0t) - psi_h_ecmwf(func_h)) 
     256 
     257      u_star = MAX ( U_blk*vkarmn/(LOG(zu) - LOG(z0)  - psi_m_ecmwf(func_h)) , 1.E-9 )  !  (MAX => prevents FPE from stupid values from masked region later on) 
    173258      t_star = dt_zu*ztmp0 
    174259      q_star = dq_zu*ztmp0 
    175260 
    176       ! What's need to be done if zt /= zu: 
     261      ! What needs to be done if zt /= zu: 
    177262      IF( .NOT. l_zt_equal_zu ) THEN 
    178          ! 
    179263         !! First update of values at zu (or zt for wind) 
    180264         ztmp0 = psi_h_ecmwf(func_h) - psi_h_ecmwf(zt*func_h/zu)    ! zt*func_h/zu == zeta_t 
    181          ztmp1 = log(zt/zu) + ztmp0 
     265         ztmp1 = LOG(zt/zu) + ztmp0 
    182266         t_zu = t_zt - t_star/vkarmn*ztmp1 
    183267         q_zu = q_zt - q_star/vkarmn*ztmp1 
    184          q_zu = (0.5 + sign(0.5,q_zu))*q_zu !Makes it impossible to have negative humidity : 
    185  
    186          dt_zu = t_zu - sst  ; dt_zu = SIGN( MAX(ABS(dt_zu),1.E-6), dt_zu ) 
    187          dq_zu = q_zu - ssq  ; dq_zu = SIGN( MAX(ABS(dq_zu),1.E-9), dq_zu ) 
     268         q_zu = (0.5_wp + SIGN(0.5_wp,q_zu))*q_zu !Makes it impossible to have negative humidity : 
    188269         ! 
     270         dt_zu = t_zu - T_s  ; dt_zu = SIGN( MAX(ABS(dt_zu),1.E-6_wp), dt_zu ) 
     271         dq_zu = q_zu - q_s  ; dq_zu = SIGN( MAX(ABS(dq_zu),1.E-9_wp), dq_zu ) 
    189272      ENDIF 
    190273 
     
    194277 
    195278      !! First guess of inverse of Monin-Obukov length (1/L) : 
    196       ztmp0 = (1. + rctv0*q_zu)  ! the factor to apply to temp. to get virt. temp... 
    197       Linv  =  grav*vkarmn*(t_star*ztmp0 + rctv0*t_zu*q_star) / ( u_star*u_star * t_zu*ztmp0 ) 
     279      Linv = One_on_L( t_zu, q_zu, u_star, t_star, q_star ) 
    198280 
    199281      !! Functions such as  u* = U_blk*vkarmn/func_m 
    200       ztmp1 = zu + z0 
    201       ztmp0 = ztmp1*Linv 
    202       func_m = LOG(ztmp1) -LOG(z0) - psi_m_ecmwf(ztmp0) + psi_m_ecmwf(z0*Linv) 
    203       func_h = LOG(ztmp1*z0t) - psi_h_ecmwf(ztmp0) + psi_h_ecmwf(1./z0t*Linv) 
    204  
     282      ztmp0 = zu*Linv 
     283      func_m = LOG(zu) - LOG(z0)  - psi_m_ecmwf(ztmp0) + psi_m_ecmwf( z0*Linv) 
     284      func_h = LOG(zu) - LOG(z0t) - psi_h_ecmwf(ztmp0) + psi_h_ecmwf(z0t*Linv) 
    205285 
    206286      !! ITERATION BLOCK 
    207       !! *************** 
    208  
    209287      DO j_itt = 1, nb_itt 
    210288 
    211289         !! Bulk Richardson Number at z=zu (Eq. 3.25) 
    212          ztmp0 = Ri_bulk(zu, t_zu, dt_zu, q_zu, dq_zu, U_blk) 
     290         ztmp0 = Ri_bulk( zu, T_s, t_zu, q_s, q_zu, U_blk ) ! Bulk Richardson Number (BRN) 
    213291 
    214292         !! New estimate of the inverse of the Monin-Obukhon length (Linv == zeta/zu) : 
    215          Linv = ztmp0*func_m*func_m/func_h / zu     ! From Eq. 3.23, Chap.3, p.33, IFS doc - Cy31r1 
     293         Linv = ztmp0*func_m*func_m/func_h / zu     ! From Eq. 3.23, Chap.3.2.3, IFS doc - Cy40r1 
     294         !! Note: it is slightly different that the L we would get with the usual 
     295         Linv = SIGN( MIN(ABS(Linv),200._wp), Linv ) ! (prevent FPE from stupid values from masked region later on...) 
    216296 
    217297         !! Update func_m with new Linv: 
    218          ztmp1 = zu + z0 
    219          func_m = LOG(ztmp1) -LOG(z0) - psi_m_ecmwf(ztmp1*Linv) + psi_m_ecmwf(z0*Linv) 
     298         func_m = LOG(zu) -LOG(z0) - psi_m_ecmwf(zu*Linv) + psi_m_ecmwf(z0*Linv) ! LB: should be "zu+z0" rather than "zu" alone, but z0 is tiny wrt zu! 
    220299 
    221300         !! Need to update roughness lengthes: 
     
    223302         ztmp2  = u_star*u_star 
    224303         ztmp1  = znu_a/u_star 
    225          z0    = alpha_M*ztmp1 + charn0*ztmp2/grav 
    226          z0t    = alpha_H*ztmp1                              ! eq.3.26, Chap.3, p.34, IFS doc - Cy31r1 
    227          z0q    = alpha_Q*ztmp1 
    228  
    229          !! Update wind at 10m taking into acount convection-related wind gustiness: 
    230          ! Only true when unstable (L<0) => when ztmp0 < 0 => - !!! 
    231          ztmp2 = ztmp2 * (MAX(-zi0*Linv/vkarmn,0.))**(2./3.) ! => w*^2  (combining Eq. 3.8 and 3.18, hap.3, IFS doc - Cy31r1) 
    232          !! => equivalent using Beta=1 (gustiness parameter, 1.25 for COARE, also zi0=600 in COARE..) 
    233          U_blk = MAX(sqrt(U_zu*U_zu + ztmp2), 0.2)              ! eq.3.17, Chap.3, p.32, IFS doc - Cy31r1 
     304         z0     = MIN( ABS( alpha_M*ztmp1 + charn0*ztmp2/grav ) , 0.001_wp) 
     305         z0t    = MIN( ABS( alpha_H*ztmp1                     ) , 0.001_wp)   ! eq.3.26, Chap.3, p.34, IFS doc - Cy31r1 
     306         z0q    = MIN( ABS( alpha_Q*ztmp1                     ) , 0.001_wp) 
     307 
     308         !! Update wind at zu with convection-related wind gustiness in unstable conditions (Chap. 3.2, IFS doc - Cy40r1, Eq.3.17 and Eq.3.18 + Eq.3.8) 
     309         ztmp2 = Beta0*Beta0*ztmp2*(MAX(-zi0*Linv/vkarmn,0._wp))**(2._wp/3._wp) ! square of wind gustiness contribution  (combining Eq. 3.8 and 3.18, hap.3, IFS doc - Cy31r1) 
     310         !!   ! Only true when unstable (L<0) => when ztmp0 < 0 => explains "-" before zi0 
     311         U_blk = MAX(SQRT(U_zu*U_zu + ztmp2), 0.2_wp)        ! include gustiness in bulk wind speed 
    234312         ! => 0.2 prevents U_blk to be 0 in stable case when U_zu=0. 
    235313 
     
    238316         !! as well the air-sea differences: 
    239317         IF( .NOT. l_zt_equal_zu ) THEN 
    240  
    241318            !! Arrays func_m and func_h are free for a while so using them as temporary arrays... 
    242             func_h = psi_h_ecmwf((zu+z0)*Linv) ! temporary array !!! 
    243             func_m = psi_h_ecmwf((zt+z0)*Linv) ! temporary array !!! 
     319            func_h = psi_h_ecmwf(zu*Linv) ! temporary array !!! 
     320            func_m = psi_h_ecmwf(zt*Linv) ! temporary array !!! 
    244321 
    245322            ztmp2  = psi_h_ecmwf(z0t*Linv) 
    246323            ztmp0  = func_h - ztmp2 
    247             ztmp1  = vkarmn/(LOG(zu+z0) - LOG(z0t) - ztmp0) 
     324            ztmp1  = vkarmn/(LOG(zu) - LOG(z0t) - ztmp0) 
    248325            t_star = dt_zu*ztmp1 
    249326            ztmp2  = ztmp0 - func_m + ztmp2 
     
    253330            ztmp2  = psi_h_ecmwf(z0q*Linv) 
    254331            ztmp0  = func_h - ztmp2 
    255             ztmp1  = vkarmn/(LOG(zu+z0) - LOG(z0q) - ztmp0) 
     332            ztmp1  = vkarmn/(LOG(zu) - LOG(z0q) - ztmp0) 
    256333            q_star = dq_zu*ztmp1 
    257334            ztmp2  = ztmp0 - func_m + ztmp2 
    258             ztmp1  = log(zt/zu) + ztmp2 
     335            ztmp1  = LOG(zt/zu) + ztmp2 
    259336            q_zu   = q_zt - q_star/vkarmn*ztmp1 
    260  
    261             dt_zu = t_zu - sst ;  dt_zu = SIGN( MAX(ABS(dt_zu),1.E-6), dt_zu ) 
    262             dq_zu = q_zu - ssq ;  dq_zu = SIGN( MAX(ABS(dq_zu),1.E-9), dq_zu ) 
    263  
    264          END IF 
     337         ENDIF 
    265338 
    266339         !! Updating because of updated z0 and z0t and new Linv... 
    267          ztmp1 = zu + z0 
    268          ztmp0 = ztmp1*Linv 
    269          func_m = log(ztmp1) - LOG(z0 ) - psi_m_ecmwf(ztmp0) + psi_m_ecmwf(z0 *Linv) 
    270          func_h = log(ztmp1) - LOG(z0t) - psi_h_ecmwf(ztmp0) + psi_h_ecmwf(z0t*Linv) 
    271  
    272       END DO 
     340         ztmp0 = zu*Linv 
     341         func_m = log(zu) - LOG(z0 ) - psi_m_ecmwf(ztmp0) + psi_m_ecmwf(z0 *Linv) 
     342         func_h = log(zu) - LOG(z0t) - psi_h_ecmwf(ztmp0) + psi_h_ecmwf(z0t*Linv) 
     343 
     344 
     345         IF( l_use_cs ) THEN 
     346            !! Cool-skin contribution 
     347 
     348            CALL UPDATE_QNSOL_TAU( zu, T_s, q_s, t_zu, q_zu, u_star, t_star, q_star, U_zu, U_blk, slp, rad_lw, & 
     349               &                   ztmp1, ztmp0,  Qlat=ztmp2)  ! Qnsol -> ztmp1 / Tau -> ztmp0 
     350 
     351            CALL CS_ECMWF( Qsw, ztmp1, u_star, zsst )  ! Qnsol -> ztmp1 
     352 
     353            T_s(:,:) = zsst(:,:) + dT_cs(:,:)*tmask(:,:,1) 
     354            IF( l_use_wl ) T_s(:,:) = T_s(:,:) + dT_wl(:,:)*tmask(:,:,1) 
     355            q_s(:,:) = rdct_qsat_salt*q_sat(MAX(T_s(:,:), 200._wp), slp(:,:)) 
     356 
     357         ENDIF 
     358 
     359         IF( l_use_wl ) THEN 
     360            !! Warm-layer contribution 
     361            CALL UPDATE_QNSOL_TAU( zu, T_s, q_s, t_zu, q_zu, u_star, t_star, q_star, U_zu, U_blk, slp, rad_lw, & 
     362               &                   ztmp1, ztmp2)  ! Qnsol -> ztmp1 / Tau -> ztmp2 
     363            CALL WL_ECMWF( Qsw, ztmp1, u_star, zsst ) 
     364            !! Updating T_s and q_s !!! 
     365            T_s(:,:) = zsst(:,:) + dT_wl(:,:)*tmask(:,:,1) ! 
     366            IF( l_use_cs ) T_s(:,:) = T_s(:,:) + dT_cs(:,:)*tmask(:,:,1) 
     367            q_s(:,:) = rdct_qsat_salt*q_sat(MAX(T_s(:,:), 200._wp), slp(:,:)) 
     368         ENDIF 
     369 
     370         IF( l_use_cs .OR. l_use_wl .OR. (.NOT. l_zt_equal_zu) ) THEN 
     371            dt_zu = t_zu - T_s ;  dt_zu = SIGN( MAX(ABS(dt_zu),1.E-6_wp), dt_zu ) 
     372            dq_zu = q_zu - q_s ;  dq_zu = SIGN( MAX(ABS(dq_zu),1.E-9_wp), dq_zu ) 
     373         ENDIF 
     374 
     375      END DO !DO j_itt = 1, nb_itt 
    273376 
    274377      Cd = vkarmn*vkarmn/(func_m*func_m) 
    275378      Ch = vkarmn*vkarmn/(func_m*func_h) 
    276       ztmp1 = log((zu + z0)/z0q) - psi_h_ecmwf((zu + z0)*Linv) + psi_h_ecmwf(z0q*Linv)   ! func_q 
    277       Ce = vkarmn*vkarmn/(func_m*ztmp1) 
    278  
    279       ztmp1 = zu + z0 
    280       Cdn = vkarmn*vkarmn / (log(ztmp1/z0 )*log(ztmp1/z0 )) 
    281       Chn = vkarmn*vkarmn / (log(ztmp1/z0t)*log(ztmp1/z0t)) 
    282       Cen = vkarmn*vkarmn / (log(ztmp1/z0q)*log(ztmp1/z0q)) 
    283  
    284    END SUBROUTINE TURB_ECMWF 
     379      ztmp2 = log(zu/z0q) - psi_h_ecmwf(zu*Linv) + psi_h_ecmwf(z0q*Linv)   ! func_q 
     380      Ce = vkarmn*vkarmn/(func_m*ztmp2) 
     381 
     382      Cdn = vkarmn*vkarmn / (log(zu/z0 )*log(zu/z0 )) 
     383      Chn = vkarmn*vkarmn / (log(zu/z0t)*log(zu/z0t)) 
     384      Cen = vkarmn*vkarmn / (log(zu/z0q)*log(zu/z0q)) 
     385 
     386      IF( l_use_cs .AND. PRESENT(pdT_cs) ) pdT_cs = dT_cs 
     387      IF( l_use_wl .AND. PRESENT(pdT_wl) ) pdT_wl = dT_wl 
     388      IF( l_use_wl .AND. PRESENT(pHz_wl) ) pHz_wl = Hz_wl 
     389 
     390      IF( l_use_cs .OR. l_use_wl ) DEALLOCATE ( zsst ) 
     391 
     392   END SUBROUTINE turb_ecmwf 
    285393 
    286394 
     
    294402      !!         and L is M-O length 
    295403      !! 
    296       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
     404      !! ** Author: L. Brodeau, June 2016 / AeroBulk (https://github.com/brodeau/aerobulk/) 
    297405      !!---------------------------------------------------------------------------------- 
    298406      REAL(wp), DIMENSION(jpi,jpj) :: psi_m_ecmwf 
     
    302410      REAL(wp) :: zzeta, zx, ztmp, psi_unst, psi_stab, stab 
    303411      !!---------------------------------------------------------------------------------- 
    304       ! 
    305412      DO jj = 1, jpj 
    306413         DO ji = 1, jpi 
    307414            ! 
    308             zzeta = MIN( pzeta(ji,jj) , 5. ) !! Very stable conditions (L positif and big!): 
     415            zzeta = MIN( pzeta(ji,jj) , 5._wp ) !! Very stable conditions (L positif and big!): 
    309416            ! 
    310417            ! Unstable (Paulson 1970): 
    311418            !   eq.3.20, Chap.3, p.33, IFS doc - Cy31r1 
    312             zx = SQRT(ABS(1. - 16.*zzeta)) 
    313             ztmp = 1. + SQRT(zx) 
     419            zx = SQRT(ABS(1._wp - 16._wp*zzeta)) 
     420            ztmp = 1._wp + SQRT(zx) 
    314421            ztmp = ztmp*ztmp 
    315             psi_unst = LOG( 0.125*ztmp*(1. + zx) )   & 
    316                &       -2.*ATAN( SQRT(zx) ) + 0.5*rpi 
     422            psi_unst = LOG( 0.125_wp*ztmp*(1._wp + zx) )   & 
     423               &       -2._wp*ATAN( SQRT(zx) ) + 0.5_wp*rpi 
    317424            ! 
    318425            ! Unstable: 
    319426            ! eq.3.22, Chap.3, p.33, IFS doc - Cy31r1 
    320             psi_stab = -2./3.*(zzeta - 5./0.35)*EXP(-0.35*zzeta) & 
    321                &       - zzeta - 2./3.*5./0.35 
     427            psi_stab = -2._wp/3._wp*(zzeta - 5._wp/0.35_wp)*EXP(-0.35_wp*zzeta) & 
     428               &       - zzeta - 2._wp/3._wp*5._wp/0.35_wp 
    322429            ! 
    323430            ! Combining: 
    324             stab = 0.5 + SIGN(0.5, zzeta) ! zzeta > 0 => stab = 1 
    325             ! 
    326             psi_m_ecmwf(ji,jj) = (1. - stab) * psi_unst & ! (zzeta < 0) Unstable 
    327                &                +      stab  * psi_stab   ! (zzeta > 0) Stable 
     431            stab = 0.5_wp + SIGN(0.5_wp, zzeta) ! zzeta > 0 => stab = 1 
     432            ! 
     433            psi_m_ecmwf(ji,jj) = (1._wp - stab) * psi_unst & ! (zzeta < 0) Unstable 
     434               &                +      stab  * psi_stab      ! (zzeta > 0) Stable 
    328435            ! 
    329436         END DO 
    330437      END DO 
    331       ! 
    332438   END FUNCTION psi_m_ecmwf 
    333439 
    334     
     440 
    335441   FUNCTION psi_h_ecmwf( pzeta ) 
    336442      !!---------------------------------------------------------------------------------- 
     
    342448      !!         and L is M-O length 
    343449      !! 
    344       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
     450      !! ** Author: L. Brodeau, June 2016 / AeroBulk (https://github.com/brodeau/aerobulk/) 
    345451      !!---------------------------------------------------------------------------------- 
    346452      REAL(wp), DIMENSION(jpi,jpj) :: psi_h_ecmwf 
     
    354460         DO ji = 1, jpi 
    355461            ! 
    356             zzeta = MIN(pzeta(ji,jj) , 5.)   ! Very stable conditions (L positif and big!): 
    357             ! 
    358             zx  = ABS(1. - 16.*zzeta)**.25        ! this is actually (1/phi_m)**2  !!! 
     462            zzeta = MIN(pzeta(ji,jj) , 5._wp)   ! Very stable conditions (L positif and big!): 
     463            ! 
     464            zx  = ABS(1._wp - 16._wp*zzeta)**.25        ! this is actually (1/phi_m)**2  !!! 
    359465            !                                     ! eq.3.19, Chap.3, p.33, IFS doc - Cy31r1 
    360466            ! Unstable (Paulson 1970) : 
    361             psi_unst = 2.*LOG(0.5*(1. + zx*zx))   ! eq.3.20, Chap.3, p.33, IFS doc - Cy31r1 
     467            psi_unst = 2._wp*LOG(0.5_wp*(1._wp + zx*zx))   ! eq.3.20, Chap.3, p.33, IFS doc - Cy31r1 
    362468            ! 
    363469            ! Stable: 
    364             psi_stab = -2./3.*(zzeta - 5./0.35)*EXP(-0.35*zzeta) & ! eq.3.22, Chap.3, p.33, IFS doc - Cy31r1 
    365                &       - ABS(1. + 2./3.*zzeta)**1.5 - 2./3.*5./0.35 + 1.  
     470            psi_stab = -2._wp/3._wp*(zzeta - 5._wp/0.35_wp)*EXP(-0.35_wp*zzeta) & ! eq.3.22, Chap.3, p.33, IFS doc - Cy31r1 
     471               &       - ABS(1._wp + 2._wp/3._wp*zzeta)**1.5_wp - 2._wp/3._wp*5._wp/0.35_wp + 1._wp 
    366472            ! LB: added ABS() to avoid NaN values when unstable, which contaminates the unstable solution... 
    367473            ! 
    368             stab = 0.5 + SIGN(0.5, zzeta) ! zzeta > 0 => stab = 1 
    369             ! 
    370             ! 
    371             psi_h_ecmwf(ji,jj) = (1. - stab) * psi_unst &   ! (zzeta < 0) Unstable 
    372                &                +    stab    * psi_stab     ! (zzeta > 0) Stable 
     474            stab = 0.5_wp + SIGN(0.5_wp, zzeta) ! zzeta > 0 => stab = 1 
     475            ! 
     476            ! 
     477            psi_h_ecmwf(ji,jj) = (1._wp - stab) * psi_unst &   ! (zzeta < 0) Unstable 
     478               &                +    stab    * psi_stab        ! (zzeta > 0) Stable 
    373479            ! 
    374480         END DO 
    375481      END DO 
    376       ! 
    377482   END FUNCTION psi_h_ecmwf 
    378483 
    379  
    380    FUNCTION Ri_bulk( pz, ptz, pdt, pqz, pdq, pub ) 
    381       !!---------------------------------------------------------------------------------- 
    382       !! Bulk Richardson number (Eq. 3.25 IFS doc) 
    383       !! 
    384       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    385       !!---------------------------------------------------------------------------------- 
    386       REAL(wp), DIMENSION(jpi,jpj) ::   Ri_bulk   ! 
    387       ! 
    388       REAL(wp)                    , INTENT(in) ::   pz    ! height above the sea        [m] 
    389       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   ptz   ! air temperature at pz m     [K] 
    390       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pdt   ! ptz - sst                   [K] 
    391       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqz   ! air temperature at pz m [kg/kg] 
    392       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pdq   ! pqz - ssq               [kg/kg] 
    393       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pub   ! bulk wind speed           [m/s] 
    394       !!---------------------------------------------------------------------------------- 
    395       ! 
    396       Ri_bulk =   grav*pz/(pub*pub)                                          & 
    397          &      * ( pdt/(ptz - 0.5_wp*(pdt + grav*pz/(Cp_dry+Cp_vap*pqz)))   & 
    398          &          + rctv0*pdq ) 
    399       ! 
    400    END FUNCTION Ri_bulk 
    401  
    402  
    403    FUNCTION visc_air(ptak) 
    404       !!---------------------------------------------------------------------------------- 
    405       !! Air kinetic viscosity (m^2/s) given from temperature in degrees... 
    406       !! 
    407       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    408       !!---------------------------------------------------------------------------------- 
    409       REAL(wp), DIMENSION(jpi,jpj)             ::   visc_air   ! 
    410       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   ptak       ! air temperature in (K) 
    411       ! 
    412       INTEGER  ::   ji, jj      ! dummy loop indices 
    413       REAL(wp) ::   ztc, ztc2   ! local scalar 
    414       !!---------------------------------------------------------------------------------- 
    415       ! 
    416       DO jj = 1, jpj 
    417          DO ji = 1, jpi 
    418             ztc  = ptak(ji,jj) - rt0   ! air temp, in deg. C 
    419             ztc2 = ztc*ztc 
    420             visc_air(ji,jj) = 1.326e-5*(1. + 6.542E-3*ztc + 8.301e-6*ztc2 - 4.84e-9*ztc2*ztc) 
    421          END DO 
    422       END DO 
    423       ! 
    424    END FUNCTION visc_air 
    425484 
    426485   !!====================================================================== 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcblk_algo_ncar.F90

    r10190 r12182  
    1111   !! 
    1212   !!       Routine turb_ncar maintained and developed in AeroBulk 
    13    !!                     (http://aerobulk.sourceforge.net/) 
     13   !!                     (https://github.com/brodeau/aerobulk/) 
    1414   !! 
    1515   !!                         L. Brodeau, 2015 
     
    3838   USE lib_fortran     ! to use key_nosignedzero 
    3939 
     40   USE sbcblk_phy      ! all thermodynamics functions, rho_air, q_sat, etc... !LB 
    4041 
    4142   IMPLICIT NONE 
    4243   PRIVATE 
    4344 
    44    PUBLIC ::   TURB_NCAR   ! called by sbcblk.F90 
    45  
    46    !                              ! NCAR own values for given constants: 
    47    REAL(wp), PARAMETER ::   rctv0 = 0.608   ! constant to obtain virtual temperature... 
    48     
     45   PUBLIC :: TURB_NCAR   ! called by sbcblk.F90 
     46 
     47   INTEGER , PARAMETER ::   nb_itt = 5        ! number of itterations 
     48 
    4949   !!---------------------------------------------------------------------- 
    5050CONTAINS 
     
    6161      !!                Returns the effective bulk wind speed at 10m to be used in the bulk formulas 
    6262      !! 
    63       !! ** Method : Monin Obukhov Similarity Theory 
    64       !!             + Large & Yeager (2004,2008) closure: CD_n10 = f(U_n10) 
    65       !! 
    66       !! ** References :   Large & Yeager, 2004 / Large & Yeager, 2008 
    67       !! 
    68       !! ** Last update: Laurent Brodeau, June 2014: 
    69       !!    - handles both cases zt=zu and zt/=zu 
    70       !!    - optimized: less 2D arrays allocated and less operations 
    71       !!    - better first guess of stability by checking air-sea difference of virtual temperature 
    72       !!       rather than temperature difference only... 
    73       !!    - added function "cd_neutral_10m" that uses the improved parametrization of 
    74       !!      Large & Yeager 2008. Drag-coefficient reduction for Cyclone conditions! 
    75       !!    - using code-wide physical constants defined into "phycst.mod" rather than redifining them 
    76       !!      => 'vkarmn' and 'grav' 
    77       !! 
    78       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    7963      !! 
    8064      !! INPUT : 
    8165      !! ------- 
    8266      !!    *  zt   : height for temperature and spec. hum. of air            [m] 
    83       !!    *  zu   : height for wind speed (generally 10m)                   [m] 
    84       !!    *  U_zu : scalar wind speed at 10m                                [m/s] 
    85       !!    *  sst  : SST                                                     [K] 
     67      !!    *  zu   : height for wind speed (usually 10m)                     [m] 
     68      !!    *  sst  : bulk SST                                                [K] 
    8669      !!    *  t_zt : potential air temperature at zt                         [K] 
    8770      !!    *  ssq  : specific humidity at saturation at SST                  [kg/kg] 
    8871      !!    *  q_zt : specific humidity of air at zt                          [kg/kg] 
     72      !!    *  U_zu : scalar wind speed at zu                                 [m/s] 
    8973      !! 
    9074      !! 
     
    9680      !!    *  t_zu   : pot. air temperature adjusted at wind height zu       [K] 
    9781      !!    *  q_zu   : specific humidity of air        //                    [kg/kg] 
    98       !!    *  U_blk  : bulk wind at 10m                                      [m/s] 
     82      !!    *  U_blk  : bulk wind speed at zu                                 [m/s] 
     83      !! 
     84      !! 
     85      !! ** Author: L. Brodeau, June 2019 / AeroBulk (https://github.com/brodeau/aerobulk/) 
    9986      !!---------------------------------------------------------------------------------- 
    10087      REAL(wp), INTENT(in   )                     ::   zt       ! height for t_zt and q_zt                    [m] 
     
    10390      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   t_zt     ! potential air temperature              [Kelvin] 
    10491      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   ssq      ! sea surface specific humidity           [kg/kg] 
    105       REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_zt     ! specific air humidity                   [kg/kg] 
     92      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_zt     ! specific air humidity at zt             [kg/kg] 
    10693      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   U_zu     ! relative wind module at zu                [m/s] 
    10794      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Cd       ! transfer coefficient for momentum         (tau) 
     
    11097      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   t_zu     ! pot. air temp. adjusted at zu               [K] 
    11198      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   q_zu     ! spec. humidity adjusted at zu           [kg/kg] 
    112       REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   U_blk    ! bulk wind at 10m                          [m/s] 
     99      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   U_blk    ! bulk wind speed at zu                     [m/s] 
    113100      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Cdn, Chn, Cen ! neutral transfer coefficients 
    114101      ! 
    115       INTEGER ::   j_itt 
    116       LOGICAL ::   l_zt_equal_zu = .FALSE.      ! if q and t are given at same height as U 
    117       INTEGER , PARAMETER ::   nb_itt = 4       ! number of itterations 
     102      INTEGER :: j_itt 
     103      LOGICAL :: l_zt_equal_zu = .FALSE.      ! if q and t are given at same height as U 
    118104      ! 
    119105      REAL(wp), DIMENSION(jpi,jpj) ::   Cx_n10        ! 10m neutral latent/sensible coefficient 
     
    126112      ! 
    127113      l_zt_equal_zu = .FALSE. 
    128       IF( ABS(zu - zt) < 0.01 ) l_zt_equal_zu = .TRUE.    ! testing "zu == zt" is risky with double precision 
    129  
    130       U_blk = MAX( 0.5 , U_zu )   !  relative wind speed at zu (normally 10m), we don't want to fall under 0.5 m/s 
     114      IF( ABS(zu - zt) < 0.01_wp )  l_zt_equal_zu = .TRUE.    ! testing "zu == zt" is risky with double precision 
     115 
     116      U_blk = MAX( 0.5_wp , U_zu )   !  relative wind speed at zu (normally 10m), we don't want to fall under 0.5 m/s 
    131117 
    132118      !! First guess of stability: 
    133       ztmp0 = t_zt*(1. + rctv0*q_zt) - sst*(1. + rctv0*ssq) ! air-sea difference of virtual pot. temp. at zt 
    134       stab  = 0.5 + sign(0.5,ztmp0)                           ! stab = 1 if dTv > 0  => STABLE, 0 if unstable 
     119      ztmp0 = virt_temp(t_zt, q_zt) - virt_temp(sst, ssq) ! air-sea difference of virtual pot. temp. at zt 
     120      stab  = 0.5_wp + sign(0.5_wp,ztmp0)                           ! stab = 1 if dTv > 0  => STABLE, 0 if unstable 
    135121 
    136122      !! Neutral coefficients at 10m: 
     
    139125         ztmp0   (:,:) = cdn_wave(:,:) 
    140126      ELSE 
    141          ztmp0 = cd_neutral_10m( U_blk ) 
     127      ztmp0 = cd_neutral_10m( U_blk ) 
    142128      ENDIF 
    143129 
     
    146132      !! Initializing transf. coeff. with their first guess neutral equivalents : 
    147133      Cd = ztmp0 
    148       Ce = 1.e-3*( 34.6 * sqrt_Cd_n10 ) 
    149       Ch = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1. - stab)) 
     134      Ce = 1.e-3_wp*( 34.6_wp * sqrt_Cd_n10 ) 
     135      Ch = 1.e-3_wp*sqrt_Cd_n10*(18._wp*stab + 32.7_wp*(1._wp - stab)) 
    150136      stab = sqrt_Cd_n10   ! Temporaty array !!! stab == SQRT(Cd) 
    151137  
    152       IF( ln_cdgw )   Cen = Ce  ; Chn = Ch 
     138      IF( ln_cdgw ) THEN 
     139   Cen = Ce 
     140   Chn = Ch 
     141      ENDIF 
    153142 
    154143      !! Initializing values at z_u with z_t values: 
    155144      t_zu = t_zt   ;   q_zu = q_zt 
    156145 
    157       !!  * Now starting iteration loop 
    158       DO j_itt=1, nb_itt 
     146      !! ITERATION BLOCK 
     147      DO j_itt = 1, nb_itt 
    159148         ! 
    160149         ztmp1 = t_zu - sst   ! Updating air/sea differences 
     
    162151 
    163152         ! Updating turbulent scales :   (L&Y 2004 eq. (7)) 
    164          ztmp1  = Ch/stab*ztmp1    ! theta*   (stab == SQRT(Cd)) 
    165          ztmp2  = Ce/stab*ztmp2    ! q*       (stab == SQRT(Cd)) 
    166  
    167          ztmp0 = 1. + rctv0*q_zu      ! multiply this with t and you have the virtual temperature 
     153         ztmp0 = stab*U_blk       ! u*       (stab == SQRT(Cd)) 
     154         ztmp1 = Ch/stab*ztmp1    ! theta*   (stab == SQRT(Cd)) 
     155         ztmp2 = Ce/stab*ztmp2    ! q*       (stab == SQRT(Cd)) 
    168156 
    169157         ! Estimate the inverse of Monin-Obukov length (1/L) at height zu: 
    170          ztmp0 =  (grav*vkarmn/(t_zu*ztmp0)*(ztmp1*ztmp0 + rctv0*t_zu*ztmp2)) / (Cd*U_blk*U_blk) 
    171          !                                                      ( Cd*U_blk*U_blk is U*^2 at zu ) 
    172  
     158         ztmp0 = One_on_L( t_zu, q_zu, ztmp0, ztmp1, ztmp2 ) 
     159          
    173160         !! Stability parameters : 
    174          zeta_u   = zu*ztmp0   ;  zeta_u = sign( min(abs(zeta_u),10.0), zeta_u ) 
     161         zeta_u   = zu*ztmp0 
     162         zeta_u = sign( min(abs(zeta_u),10._wp), zeta_u ) 
    175163         zpsi_h_u = psi_h( zeta_u ) 
    176164 
     
    178166         IF( .NOT. l_zt_equal_zu ) THEN 
    179167            !! Array 'stab' is free for the moment so using it to store 'zeta_t' 
    180             stab = zt*ztmp0 ;  stab = SIGN( MIN(ABS(stab),10.0), stab )  ! Temporaty array stab == zeta_t !!! 
     168            stab = zt*ztmp0 
     169            stab = SIGN( MIN(ABS(stab),10._wp), stab )  ! Temporaty array stab == zeta_t !!! 
    181170            stab = LOG(zt/zu) + zpsi_h_u - psi_h(stab)                   ! stab just used as temp array again! 
    182171            t_zu = t_zt - ztmp1/vkarmn*stab    ! ztmp1 is still theta*  L&Y 2004 eq.(9b) 
    183172            q_zu = q_zt - ztmp2/vkarmn*stab    ! ztmp2 is still q*      L&Y 2004 eq.(9c) 
    184             q_zu = max(0., q_zu) 
    185          END IF 
    186  
     173            q_zu = max(0._wp, q_zu) 
     174         ENDIF 
     175 
     176         ! Update neutral wind speed at 10m and neutral Cd at 10m (L&Y 2004 eq. 9a)... 
     177         !   In very rare low-wind conditions, the old way of estimating the 
     178         !   neutral wind speed at 10m leads to a negative value that causes the code 
     179         !   to crash. To prevent this a threshold of 0.25m/s is imposed. 
    187180         ztmp2 = psi_m(zeta_u) 
    188181         IF( ln_cdgw ) THEN      ! surface wave case 
    189182            stab = vkarmn / ( vkarmn / sqrt_Cd_n10 - ztmp2 )  ! (stab == SQRT(Cd)) 
    190183            Cd   = stab * stab 
    191             ztmp0 = (LOG(zu/10.) - zpsi_h_u) / vkarmn / sqrt_Cd_n10 
     184            ztmp0 = (LOG(zu/10._wp) - zpsi_h_u) / vkarmn / sqrt_Cd_n10 
    192185            ztmp2 = stab / sqrt_Cd_n10   ! (stab == SQRT(Cd)) 
    193             ztmp1 = 1. + Chn * ztmp0      
     186            ztmp1 = 1._wp + Chn * ztmp0      
    194187            Ch    = Chn * ztmp2 / ztmp1  ! L&Y 2004 eq. (10b) 
    195             ztmp1 = 1. + Cen * ztmp0 
     188            ztmp1 = 1._wp + Cen * ztmp0 
    196189            Ce    = Cen * ztmp2 / ztmp1  ! L&Y 2004 eq. (10c) 
    197190 
    198191         ELSE 
    199             ! Update neutral wind speed at 10m and neutral Cd at 10m (L&Y 2004 eq. 9a)... 
    200             !   In very rare low-wind conditions, the old way of estimating the 
    201             !   neutral wind speed at 10m leads to a negative value that causes the code 
    202             !   to crash. To prevent this a threshold of 0.25m/s is imposed. 
    203             ztmp0 = MAX( 0.25 , U_blk/(1. + sqrt_Cd_n10/vkarmn*(LOG(zu/10.) - ztmp2)) ) ! U_n10 (ztmp2 == psi_m(zeta_u)) 
    204             ztmp0 = cd_neutral_10m(ztmp0)                                               ! Cd_n10 
    205             Cdn(:,:) = ztmp0 
    206             sqrt_Cd_n10 = sqrt(ztmp0) 
    207  
    208             stab    = 0.5 + sign(0.5,zeta_u)                           ! update stability 
    209             Cx_n10  = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1. - stab))  ! L&Y 2004 eq. (6c-6d)    (Cx_n10 == Ch_n10) 
    210             Chn(:,:) = Cx_n10 
    211  
    212             !! Update of transfer coefficients: 
    213             ztmp1 = 1. + sqrt_Cd_n10/vkarmn*(LOG(zu/10.) - ztmp2)   ! L&Y 2004 eq. (10a) (ztmp2 == psi_m(zeta_u)) 
    214             Cd      = ztmp0 / ( ztmp1*ztmp1 ) 
    215             stab = SQRT( Cd ) ! Temporary array !!! (stab == SQRT(Cd)) 
    216  
    217             ztmp0 = (LOG(zu/10.) - zpsi_h_u) / vkarmn / sqrt_Cd_n10 
    218             ztmp2 = stab / sqrt_Cd_n10   ! (stab == SQRT(Cd)) 
    219             ztmp1 = 1. + Cx_n10*ztmp0    ! (Cx_n10 == Ch_n10) 
    220             Ch  = Cx_n10*ztmp2 / ztmp1   ! L&Y 2004 eq. (10b) 
    221  
    222             Cx_n10  = 1.e-3 * (34.6 * sqrt_Cd_n10)  ! L&Y 2004 eq. (6b)    ! Cx_n10 == Ce_n10 
    223             Cen(:,:) = Cx_n10 
    224             ztmp1 = 1. + Cx_n10*ztmp0 
    225             Ce  = Cx_n10*ztmp2 / ztmp1  ! L&Y 2004 eq. (10c) 
    226             ENDIF 
    227          ! 
    228       END DO 
    229       ! 
     192         ! Update neutral wind speed at 10m and neutral Cd at 10m (L&Y 2004 eq. 9a)... 
     193         !   In very rare low-wind conditions, the old way of estimating the 
     194         !   neutral wind speed at 10m leads to a negative value that causes the code 
     195         !   to crash. To prevent this a threshold of 0.25m/s is imposed. 
     196         ztmp0 = MAX( 0.25_wp , U_blk/(1._wp + sqrt_Cd_n10/vkarmn*(LOG(zu/10._wp) - ztmp2)) ) ! U_n10 (ztmp2 == psi_m(zeta_u)) 
     197         ztmp0 = cd_neutral_10m(ztmp0)                                               ! Cd_n10 
     198         Cdn(:,:) = ztmp0 
     199         sqrt_Cd_n10 = sqrt(ztmp0) 
     200 
     201         stab    = 0.5_wp + sign(0.5_wp,zeta_u)                        ! update stability 
     202         Cx_n10  = 1.e-3_wp*sqrt_Cd_n10*(18._wp*stab + 32.7_wp*(1._wp - stab))  ! L&Y 2004 eq. (6c-6d)    (Cx_n10 == Ch_n10) 
     203         Chn(:,:) = Cx_n10 
     204 
     205         !! Update of transfer coefficients: 
     206         ztmp1 = 1._wp + sqrt_Cd_n10/vkarmn*(LOG(zu/10._wp) - ztmp2)   ! L&Y 2004 eq. (10a) (ztmp2 == psi_m(zeta_u)) 
     207         Cd      = ztmp0 / ( ztmp1*ztmp1 ) 
     208         stab = SQRT( Cd ) ! Temporary array !!! (stab == SQRT(Cd)) 
     209 
     210         ztmp0 = (LOG(zu/10._wp) - zpsi_h_u) / vkarmn / sqrt_Cd_n10 
     211         ztmp2 = stab / sqrt_Cd_n10   ! (stab == SQRT(Cd)) 
     212         ztmp1 = 1._wp + Cx_n10*ztmp0    ! (Cx_n10 == Ch_n10) 
     213         Ch  = Cx_n10*ztmp2 / ztmp1   ! L&Y 2004 eq. (10b) 
     214 
     215         Cx_n10  = 1.e-3_wp * (34.6_wp * sqrt_Cd_n10)  ! L&Y 2004 eq. (6b)    ! Cx_n10 == Ce_n10 
     216         Cen(:,:) = Cx_n10 
     217         ztmp1 = 1._wp + Cx_n10*ztmp0 
     218         Ce  = Cx_n10*ztmp2 / ztmp1  ! L&Y 2004 eq. (10c) 
     219         ENDIF 
     220 
     221      END DO !DO j_itt = 1, nb_itt 
     222 
    230223   END SUBROUTINE turb_ncar 
    231224 
     
    238231      !! Origin: Large & Yeager 2008 eq.(11a) and eq.(11b) 
    239232      !! 
    240       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
     233      !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://github.com/brodeau/aerobulk/) 
    241234      !!---------------------------------------------------------------------------------- 
    242235      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pw10           ! scalar wind speed at 10m (m/s) 
     
    255248            ! 
    256249            ! When wind speed > 33 m/s => Cyclone conditions => special treatment 
    257             zgt33 = 0.5 + SIGN( 0.5, (zw - 33.) )   ! If pw10 < 33. => 0, else => 1 
    258             ! 
    259             cd_neutral_10m(ji,jj) = 1.e-3 * ( & 
    260                &       (1. - zgt33)*( 2.7/zw + 0.142 + zw/13.09 - 3.14807E-10*zw6) & ! wind <  33 m/s 
    261                &      +    zgt33   *      2.34 )                                     ! wind >= 33 m/s 
    262             ! 
    263             cd_neutral_10m(ji,jj) = MAX(cd_neutral_10m(ji,jj), 1.E-6) 
     250            zgt33 = 0.5_wp + SIGN( 0.5_wp, (zw - 33._wp) )   ! If pw10 < 33. => 0, else => 1 
     251            ! 
     252            cd_neutral_10m(ji,jj) = 1.e-3_wp * ( & 
     253               &       (1._wp - zgt33)*( 2.7_wp/zw + 0.142_wp + zw/13.09_wp - 3.14807E-10_wp*zw6) & ! wind <  33 m/s 
     254               &      +    zgt33   *      2.34_wp )                                                 ! wind >= 33 m/s 
     255            ! 
     256            cd_neutral_10m(ji,jj) = MAX(cd_neutral_10m(ji,jj), 1.E-6_wp) 
    264257            ! 
    265258         END DO 
     
    273266      !! Universal profile stability function for momentum 
    274267      !!    !! Psis, L&Y 2004 eq. (8c), (8d), (8e) 
    275       !!      
    276       !! pzet0 : stability paramenter, z/L where z is altitude measurement                                           
     268      !! 
     269      !! pzeta : stability paramenter, z/L where z is altitude measurement 
    277270      !!         and L is M-O length 
    278271      !! 
    279       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    280       !!---------------------------------------------------------------------------------- 
    281       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pzeta 
    282       REAL(wp), DIMENSION(jpi,jpj)             ::   psi_m 
    283       ! 
    284       INTEGER  ::   ji, jj         ! dummy loop indices 
     272      !! ** Author: L. Brodeau, June 2016 / AeroBulk (https://github.com/brodeau/aerobulk/) 
     273      !!---------------------------------------------------------------------------------- 
     274      REAL(wp), DIMENSION(jpi,jpj) :: psi_m 
     275      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pzeta 
     276      ! 
     277      INTEGER  ::   ji, jj    ! dummy loop indices 
    285278      REAL(wp) :: zx2, zx, zstab   ! local scalars 
    286279      !!---------------------------------------------------------------------------------- 
    287       ! 
    288280      DO jj = 1, jpj 
    289281         DO ji = 1, jpi 
    290             zx2 = SQRT( ABS( 1. - 16.*pzeta(ji,jj) ) ) 
    291             zx2 = MAX ( zx2 , 1. ) 
     282            zx2 = SQRT( ABS( 1._wp - 16._wp*pzeta(ji,jj) ) ) 
     283            zx2 = MAX( zx2 , 1._wp ) 
    292284            zx  = SQRT( zx2 ) 
    293             zstab = 0.5 + SIGN( 0.5 , pzeta(ji,jj) ) 
    294             ! 
    295             psi_m(ji,jj) =        zstab  * (-5.*pzeta(ji,jj))       &          ! Stable 
    296                &          + (1. - zstab) * (2.*LOG((1. + zx)*0.5)   &          ! Unstable 
    297                &               + LOG((1. + zx2)*0.5) - 2.*ATAN(zx) + rpi*0.5)  !    " 
     285            zstab = 0.5_wp + SIGN( 0.5_wp , pzeta(ji,jj) ) 
     286            ! 
     287            psi_m(ji,jj) =        zstab  * (-5._wp*pzeta(ji,jj))       &          ! Stable 
     288               &          + (1._wp - zstab) * (2._wp*LOG((1._wp + zx)*0.5_wp)   &          ! Unstable 
     289               &               + LOG((1._wp + zx2)*0.5_wp) - 2._wp*ATAN(zx) + rpi*0.5_wp)  !    " 
    298290            ! 
    299291         END DO 
    300292      END DO 
    301       ! 
    302293   END FUNCTION psi_m 
    303294 
     
    308299      !!    !! Psis, L&Y 2004 eq. (8c), (8d), (8e) 
    309300      !! 
    310       !! pzet0 : stability paramenter, z/L where z is altitude measurement                                           
     301      !! pzeta : stability paramenter, z/L where z is altitude measurement 
    311302      !!         and L is M-O length 
    312303      !! 
    313       !! ** Author: L. Brodeau, june 2016 / AeroBulk (https://sourceforge.net/p/aerobulk) 
    314       !!---------------------------------------------------------------------------------- 
     304      !! ** Author: L. Brodeau, June 2016 / AeroBulk (https://github.com/brodeau/aerobulk/) 
     305      !!---------------------------------------------------------------------------------- 
     306      REAL(wp), DIMENSION(jpi,jpj) :: psi_h 
    315307      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pzeta 
    316       REAL(wp), DIMENSION(jpi,jpj)             :: psi_h 
    317       ! 
    318       INTEGER  ::   ji, jj    ! dummy loop indices 
     308      ! 
     309      INTEGER  ::   ji, jj     ! dummy loop indices 
    319310      REAL(wp) :: zx2, zstab  ! local scalars 
    320311      !!---------------------------------------------------------------------------------- 
     
    322313      DO jj = 1, jpj 
    323314         DO ji = 1, jpi 
    324             zx2 = SQRT( ABS( 1. - 16.*pzeta(ji,jj) ) ) 
    325             zx2 = MAX ( zx2 , 1. ) 
    326             zstab = 0.5 + SIGN( 0.5 , pzeta(ji,jj) ) 
    327             ! 
    328             psi_h(ji,jj) =         zstab  * (-5.*pzeta(ji,jj))        &  ! Stable 
    329                &           + (1. - zstab) * (2.*LOG( (1. + zx2)*0.5 ))   ! Unstable 
     315            zx2 = SQRT( ABS( 1._wp - 16._wp*pzeta(ji,jj) ) ) 
     316            zx2 = MAX( zx2 , 1._wp ) 
     317            zstab = 0.5_wp + SIGN( 0.5_wp , pzeta(ji,jj) ) 
     318            ! 
     319            psi_h(ji,jj) =         zstab  * (-5._wp*pzeta(ji,jj))        &  ! Stable 
     320               &           + (1._wp - zstab) * (2._wp*LOG( (1._wp + zx2)*0.5_wp ))   ! Unstable 
    330321            ! 
    331322         END DO 
    332323      END DO 
    333       ! 
    334324   END FUNCTION psi_h 
    335325 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbccpl.F90

    r12150 r12182  
    451451      CASE( 'conservative'  ) 
    452452         srcv( (/jpr_rain, jpr_snow, jpr_ievp, jpr_tevp/) )%laction = .TRUE. 
    453          IF ( k_ice <= 1 )  srcv(jpr_ievp)%laction = .FALSE. 
     453         IF( k_ice <= 1 )  srcv(jpr_ievp)%laction = .FALSE. 
    454454      CASE( 'oce and ice'   )   ;   srcv( (/jpr_ievp, jpr_sbpr, jpr_semp, jpr_oemp/) )%laction = .TRUE. 
    455455      CASE default              ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_emp%cldes' ) 
     
    532532      !                                                      ! ------------------------- ! 
    533533      srcv(jpr_taum)%clname = 'O_TauMod'   ;   IF( TRIM(sn_rcv_taumod%cldes) == 'coupled' )   srcv(jpr_taum)%laction = .TRUE. 
    534       lhftau = srcv(jpr_taum)%laction 
    535534      ! 
    536535      !                                                      ! ------------------------- ! 
     
    557556      srcv(jpr_botm )%clname = 'OBotMlt' 
    558557      IF( TRIM(sn_rcv_iceflx%cldes) == 'coupled' ) THEN 
    559          IF ( TRIM( sn_rcv_iceflx%clcat ) == 'yes' ) THEN 
     558         IF( TRIM( sn_rcv_iceflx%clcat ) == 'yes' ) THEN 
    560559            srcv(jpr_topm:jpr_botm)%nct = nn_cats_cpl 
    561560         ELSE 
     
    568567      !                                                      ! ------------------------- ! 
    569568      srcv(jpr_ts_ice)%clname = 'OTsfIce'    ! needed by Met Office 
    570       IF ( TRIM( sn_rcv_ts_ice%cldes ) == 'ice' )   srcv(jpr_ts_ice)%laction = .TRUE. 
    571       IF ( TRIM( sn_rcv_ts_ice%clcat ) == 'yes' )   srcv(jpr_ts_ice)%nct     = nn_cats_cpl 
    572       IF ( TRIM( sn_rcv_emp%clcat    ) == 'yes' )   srcv(jpr_ievp)%nct       = nn_cats_cpl 
     569      IF( TRIM( sn_rcv_ts_ice%cldes ) == 'ice' )   srcv(jpr_ts_ice)%laction = .TRUE. 
     570      IF( TRIM( sn_rcv_ts_ice%clcat ) == 'yes' )   srcv(jpr_ts_ice)%nct     = nn_cats_cpl 
     571      IF( TRIM( sn_rcv_emp%clcat    ) == 'yes' )   srcv(jpr_ievp)%nct       = nn_cats_cpl 
    573572 
    574573      !                                                      ! ------------------------- ! 
     
    692691         ! for example O_Runoff received by OPA from SAS and therefore O_Runoff received by SAS from the Atmosphere 
    693692         DO jn = 1, jprcv 
    694             IF ( srcv(jn)%clname(1:1) == "O" ) srcv(jn)%clname = "S"//srcv(jn)%clname(2:LEN(srcv(jn)%clname)) 
     693            IF( srcv(jn)%clname(1:1) == "O" ) srcv(jn)%clname = "S"//srcv(jn)%clname(2:LEN(srcv(jn)%clname)) 
    695694         END DO 
    696695         ! 
     
    719718      ! =================================================== ! 
    720719      DO jn = 1, jprcv 
    721          IF ( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) ) 
     720         IF( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) ) 
    722721      END DO 
    723722      ! Allocate taum part of frcv which is used even when not received as coupling field 
    724       IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) ) 
     723      IF( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) ) 
    725724      ! Allocate w10m part of frcv which is used even when not received as coupling field 
    726       IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) ) 
     725      IF( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) ) 
    727726      ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field 
    728       IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) ) 
    729       IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) ) 
     727      IF( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) ) 
     728      IF( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) ) 
    730729      ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE. 
    731730      IF( k_ice /= 0 ) THEN 
    732          IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) ) 
    733          IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) ) 
    734       END IF 
     731         IF( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) ) 
     732         IF( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) ) 
     733      ENDIF 
    735734 
    736735      ! ================================ ! 
     
    756755      CASE( 'oce and ice' , 'weighted oce and ice' , 'oce and weighted ice' ) 
    757756         ssnd( (/jps_toce, jps_tice/) )%laction = .TRUE. 
    758          IF ( TRIM( sn_snd_temp%clcat ) == 'yes' )  ssnd(jps_tice)%nct = nn_cats_cpl 
     757         IF( TRIM( sn_snd_temp%clcat ) == 'yes' )  ssnd(jps_tice)%nct = nn_cats_cpl 
    759758      CASE( 'mixed oce-ice'                        )   ;   ssnd( jps_tmix )%laction = .TRUE. 
    760759      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_temp%cldes' ) 
     
    776775      !     1. sending mixed oce-ice albedo or 
    777776      !     2. receiving mixed oce-ice solar radiation  
    778       IF ( TRIM ( sn_snd_alb%cldes ) == 'mixed oce-ice' .OR. TRIM ( sn_rcv_qsr%cldes ) == 'mixed oce-ice' ) THEN 
     777      IF( TRIM ( sn_snd_alb%cldes ) == 'mixed oce-ice' .OR. TRIM ( sn_rcv_qsr%cldes ) == 'mixed oce-ice' ) THEN 
    779778         CALL oce_alb( zaos, zacs ) 
    780779         ! Due to lack of information on nebulosity : mean clear/overcast sky 
     
    795794         ssnd(jps_fice1)%laction = .TRUE.                 ! First-order regridded ice concentration, to be used producing atmos-to-ice fluxes (Met Office requirement) 
    796795! Currently no namelist entry to determine sending of multi-category ice fraction so use the thickness entry for now 
    797          IF ( TRIM( sn_snd_thick%clcat  ) == 'yes' ) ssnd(jps_fice)%nct  = nn_cats_cpl 
    798          IF ( TRIM( sn_snd_thick1%clcat ) == 'yes' ) ssnd(jps_fice1)%nct = nn_cats_cpl 
     796         IF( TRIM( sn_snd_thick%clcat  ) == 'yes' ) ssnd(jps_fice)%nct  = nn_cats_cpl 
     797         IF( TRIM( sn_snd_thick1%clcat ) == 'yes' ) ssnd(jps_fice1)%nct = nn_cats_cpl 
    799798      ENDIF 
    800799       
    801       IF (TRIM( sn_snd_ifrac%cldes )  == 'coupled') ssnd(jps_ficet)%laction = .TRUE.  
     800      IF(TRIM( sn_snd_ifrac%cldes )  == 'coupled') ssnd(jps_ficet)%laction = .TRUE.  
    802801 
    803802      SELECT CASE ( TRIM( sn_snd_thick%cldes ) ) 
     
    805804      CASE( 'ice and snow' )  
    806805         ssnd(jps_hice:jps_hsnw)%laction = .TRUE. 
    807          IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) THEN 
     806         IF( TRIM( sn_snd_thick%clcat ) == 'yes' ) THEN 
    808807            ssnd(jps_hice:jps_hsnw)%nct = nn_cats_cpl 
    809808         ENDIF 
    810809      CASE ( 'weighted ice and snow' )  
    811810         ssnd(jps_hice:jps_hsnw)%laction = .TRUE. 
    812          IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) ssnd(jps_hice:jps_hsnw)%nct = nn_cats_cpl 
     811         IF( TRIM( sn_snd_thick%clcat ) == 'yes' ) ssnd(jps_hice:jps_hsnw)%nct = nn_cats_cpl 
    813812      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_thick%cldes' ) 
    814813      END SELECT 
     
    827826         ssnd(jps_a_p)%laction  = .TRUE.  
    828827         ssnd(jps_ht_p)%laction = .TRUE.  
    829          IF ( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN  
     828         IF( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN  
    830829            ssnd(jps_a_p)%nct  = nn_cats_cpl  
    831830            ssnd(jps_ht_p)%nct = nn_cats_cpl  
    832831         ELSE  
    833             IF ( nn_cats_cpl > 1 ) THEN  
     832            IF( nn_cats_cpl > 1 ) THEN  
    834833               CALL ctl_stop( 'sbc_cpl_init: use weighted ice option for sn_snd_mpnd%cldes if not exchanging category fields' )  
    835834            ENDIF  
     
    838837         ssnd(jps_a_p)%laction  = .TRUE.  
    839838         ssnd(jps_ht_p)%laction = .TRUE.  
    840          IF ( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN  
     839         IF( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN  
    841840            ssnd(jps_a_p)%nct  = nn_cats_cpl   
    842841            ssnd(jps_ht_p)%nct = nn_cats_cpl   
     
    913912      CASE ( 'ice only' )  
    914913         ssnd(jps_ttilyr)%laction = .TRUE.  
    915          IF ( TRIM( sn_snd_ttilyr%clcat ) == 'yes' ) THEN  
     914         IF( TRIM( sn_snd_ttilyr%clcat ) == 'yes' ) THEN  
    916915            ssnd(jps_ttilyr)%nct = nn_cats_cpl  
    917916         ELSE  
    918             IF ( nn_cats_cpl > 1 ) THEN  
     917            IF( nn_cats_cpl > 1 ) THEN  
    919918               CALL ctl_stop( 'sbc_cpl_init: use weighted ice option for sn_snd_ttilyr%cldes if not exchanging category fields' )  
    920919            ENDIF  
     
    922921      CASE ( 'weighted ice' )  
    923922         ssnd(jps_ttilyr)%laction = .TRUE.  
    924          IF ( TRIM( sn_snd_ttilyr%clcat ) == 'yes' ) ssnd(jps_ttilyr)%nct = nn_cats_cpl  
     923         IF( TRIM( sn_snd_ttilyr%clcat ) == 'yes' ) ssnd(jps_ttilyr)%nct = nn_cats_cpl  
    925924      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_ttilyr%cldes;'//sn_snd_ttilyr%cldes )  
    926925      END SELECT  
     
    932931      CASE ( 'ice only' )  
    933932         ssnd(jps_kice)%laction = .TRUE.  
    934          IF ( TRIM( sn_snd_cond%clcat ) == 'yes' ) THEN  
     933         IF( TRIM( sn_snd_cond%clcat ) == 'yes' ) THEN  
    935934            ssnd(jps_kice)%nct = nn_cats_cpl  
    936935         ELSE  
    937             IF ( nn_cats_cpl > 1 ) THEN  
     936            IF( nn_cats_cpl > 1 ) THEN  
    938937               CALL ctl_stop( 'sbc_cpl_init: use weighted ice option for sn_snd_cond%cldes if not exchanging category fields' )  
    939938            ENDIF  
     
    941940      CASE ( 'weighted ice' )  
    942941         ssnd(jps_kice)%laction = .TRUE.  
    943          IF ( TRIM( sn_snd_cond%clcat ) == 'yes' ) ssnd(jps_kice)%nct = nn_cats_cpl  
     942         IF( TRIM( sn_snd_cond%clcat ) == 'yes' ) ssnd(jps_kice)%nct = nn_cats_cpl  
    944943      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_cond%cldes;'//sn_snd_cond%cldes )  
    945944      END SELECT  
     
    10021001         ! for example O_SSTSST sent by OPA to SAS and therefore S_SSTSST sent by SAS to the Atmosphere 
    10031002         DO jn = 1, jpsnd 
    1004             IF ( ssnd(jn)%clname(1:1) == "O" ) ssnd(jn)%clname = "S"//ssnd(jn)%clname(2:LEN(ssnd(jn)%clname)) 
     1003            IF( ssnd(jn)%clname(1:1) == "O" ) ssnd(jn)%clname = "S"//ssnd(jn)%clname(2:LEN(ssnd(jn)%clname)) 
    10051004         END DO 
    10061005         ! 
     
    10291028      CALL cpl_define(jprcv, jpsnd, nn_cplmodel) 
    10301029       
    1031       IF (ln_usecplmask) THEN  
     1030      IF(ln_usecplmask) THEN  
    10321031         xcplmask(:,:,:) = 0. 
    10331032         CALL iom_open( 'cplmask', inum ) 
     
    12661265     
    12671266          IF( kt == nit000 ) ssh_ibb(:,:) = ssh_ib(:,:)  ! correct this later (read from restart if possible)  
    1268       END IF  
     1267      ENDIF  
    12691268      ! 
    12701269      IF( ln_sdw ) THEN  ! Stokes Drift correction activated 
     
    14191418         ELSE IF( srcv(jpr_qnsmix)%laction ) THEN   ;   zqns(:,:) = frcv(jpr_qnsmix)%z3(:,:,1) 
    14201419         ELSE                                       ;   zqns(:,:) = 0._wp 
    1421          END IF 
     1420         ENDIF 
    14221421         ! update qns over the free ocean with: 
    14231422         IF( nn_components /= jp_iam_opa ) THEN 
     
    16911690      ! --- evaporation over ice (kg/m2/s) --- ! 
    16921691      DO jl=1,jpl 
    1693          IF (sn_rcv_emp%clcat == 'yes') THEN   ;   zevap_ice(:,:,jl) = frcv(jpr_ievp)%z3(:,:,jl) 
     1692         IF(sn_rcv_emp%clcat == 'yes') THEN   ;   zevap_ice(:,:,jl) = frcv(jpr_ievp)%z3(:,:,jl) 
    16941693         ELSE                                  ;   zevap_ice(:,:,jl) = frcv(jpr_ievp)%z3(:,:,1 )   ;   ENDIF 
    16951694      ENDDO 
     
    17901789      CASE( 'conservative' )     ! the required fields are directly provided 
    17911790         zqns_tot(:,:) = frcv(jpr_qnsmix)%z3(:,:,1) 
    1792          IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
     1791         IF( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
    17931792            zqns_ice(:,:,1:jpl) = frcv(jpr_qnsice)%z3(:,:,1:jpl) 
    17941793         ELSE 
     
    17991798      CASE( 'oce and ice' )      ! the total flux is computed from ocean and ice fluxes 
    18001799         zqns_tot(:,:) =  ziceld(:,:) * frcv(jpr_qnsoce)%z3(:,:,1) 
    1801          IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
     1800         IF( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
    18021801            DO jl=1,jpl 
    18031802               zqns_tot(:,:   ) = zqns_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qnsice)%z3(:,:,jl)    
     
    19011900#endif 
    19021901      ! outputs 
    1903       IF ( srcv(jpr_cal)%laction       ) CALL iom_put('hflx_cal_cea'    , - frcv(jpr_cal)%z3(:,:,1) * rLfus )                      ! latent heat from calving 
    1904       IF ( srcv(jpr_icb)%laction       ) CALL iom_put('hflx_icb_cea'    , - frcv(jpr_icb)%z3(:,:,1) * rLfus )                      ! latent heat from icebergs melting 
    1905       IF ( iom_use('hflx_rain_cea')    ) CALL iom_put('hflx_rain_cea'   , ( tprecip(:,:) - sprecip(:,:) ) * zcptrain(:,:) )        ! heat flux from rain (cell average) 
    1906       IF ( iom_use('hflx_evap_cea')    ) CALL iom_put('hflx_evap_cea'   , ( frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) & 
     1902      IF( srcv(jpr_cal)%laction       ) CALL iom_put('hflx_cal_cea'    , - frcv(jpr_cal)%z3(:,:,1) * rLfus )                      ! latent heat from calving 
     1903      IF( srcv(jpr_icb)%laction       ) CALL iom_put('hflx_icb_cea'    , - frcv(jpr_icb)%z3(:,:,1) * rLfus )                      ! latent heat from icebergs melting 
     1904      IF( iom_use('hflx_rain_cea')    ) CALL iom_put('hflx_rain_cea'   , ( tprecip(:,:) - sprecip(:,:) ) * zcptrain(:,:) )        ! heat flux from rain (cell average) 
     1905      IF( iom_use('hflx_evap_cea')    ) CALL iom_put('hflx_evap_cea'   , ( frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) & 
    19071906           &                                                              * picefr(:,:) ) * zcptn(:,:) * tmask(:,:,1) )            ! heat flux from evap (cell average) 
    1908       IF ( iom_use('hflx_snow_cea')    ) CALL iom_put('hflx_snow_cea'   , sprecip(:,:) * ( zcptsnw(:,:) - rLfus )  )               ! heat flux from snow (cell average) 
    1909       IF ( iom_use('hflx_snow_ao_cea') ) CALL iom_put('hflx_snow_ao_cea', sprecip(:,:) * ( zcptsnw(:,:) - rLfus ) & 
     1907      IF( iom_use('hflx_snow_cea')    ) CALL iom_put('hflx_snow_cea'   , sprecip(:,:) * ( zcptsnw(:,:) - rLfus )  )               ! heat flux from snow (cell average) 
     1908      IF( iom_use('hflx_snow_ao_cea') ) CALL iom_put('hflx_snow_ao_cea', sprecip(:,:) * ( zcptsnw(:,:) - rLfus ) & 
    19101909           &                                                              * ( 1._wp - zsnw(:,:) )                  )               ! heat flux from snow (over ocean) 
    1911       IF ( iom_use('hflx_snow_ai_cea') ) CALL iom_put('hflx_snow_ai_cea', sprecip(:,:) * ( zcptsnw(:,:) - rLfus ) &  
     1910      IF( iom_use('hflx_snow_ai_cea') ) CALL iom_put('hflx_snow_ai_cea', sprecip(:,:) * ( zcptsnw(:,:) - rLfus ) &  
    19121911           &                                                              *           zsnw(:,:)                    )               ! heat flux from snow (over ice) 
    19131912      ! note: hflx for runoff and iceshelf are done in sbcrnf and sbcisf resp. 
     
    19201919      CASE( 'conservative' ) 
    19211920         zqsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1) 
    1922          IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
     1921         IF( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
    19231922            zqsr_ice(:,:,1:jpl) = frcv(jpr_qsrice)%z3(:,:,1:jpl) 
    19241923         ELSE 
     
    19321931      CASE( 'oce and ice' ) 
    19331932         zqsr_tot(:,:  ) =  ziceld(:,:) * frcv(jpr_qsroce)%z3(:,:,1) 
    1934          IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
     1933         IF( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN 
    19351934            DO jl = 1, jpl 
    19361935               zqsr_tot(:,:   ) = zqsr_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qsrice)%z3(:,:,jl)    
     
    19881987      !                                                      ! ========================= ! 
    19891988      CASE ('coupled') 
    1990          IF ( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN 
     1989         IF( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN 
    19911990            zdqns_ice(:,:,1:jpl) = frcv(jpr_dqnsdt)%z3(:,:,1:jpl) 
    19921991         ELSE 
     
    20672066      IF( ssnd(jps_toce)%laction .OR. ssnd(jps_tice)%laction .OR. ssnd(jps_tmix)%laction ) THEN 
    20682067          
    2069          IF ( nn_components == jp_iam_opa ) THEN 
     2068         IF( nn_components == jp_iam_opa ) THEN 
    20702069            ztmp1(:,:) = ts(:,:,1,jp_tem,Kmm)   ! send temperature as it is (potential or conservative) -> use of l_useCT on the received part 
    20712070         ELSE 
     
    24722471      IF( ssnd(jps_ficet)%laction ) THEN  
    24732472         CALL cpl_snd( jps_ficet, isec, RESHAPE ( fr_i, (/jpi,jpj,1/) ), info )  
    2474       END IF  
     2473      ENDIF  
    24752474      !                                                      ! ------------------------- !  
    24762475      !                                                      !   Water levels to waves   !  
     
    24872486         ENDIF   
    24882487         CALL cpl_snd( jps_wlev  , isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )  
    2489       END IF  
     2488      ENDIF  
    24902489      ! 
    24912490      !  Fields sent by OPA to SAS when doing OPA<->SAS coupling 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcdcy.F90

    r10425 r12182  
    77   !!   NEMO    2.0  !  2006-02  (S. Masson, G. Madec)  adaptation to NEMO 
    88   !!           3.1  !  2009-07  (J.M. Molines)  adaptation to v3.1 
     9   !!           4.*  !  2019-10  (L. Brodeau)  nothing really new, but the routine 
     10   !!                ! "sbc_dcy_param" has been extracted from old function "sbc_dcy" 
     11   !!                ! => this allows the warm-layer param of COARE3* to know the time 
     12   !!                ! of dawn and dusk even if "ln_dm2dc=.false." (rdawn_dcy & rdusk_dcy 
     13   !!                ! are now public) 
    914   !!---------------------------------------------------------------------- 
    1015 
     
    2227   IMPLICIT NONE 
    2328   PRIVATE 
    24     
     29 
    2530   INTEGER, PUBLIC ::   nday_qsr   !: day when parameters were computed 
    26     
     31 
    2732   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   raa , rbb  , rcc  , rab     ! diurnal cycle parameters 
    28    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rtmd, rdawn, rdusk, rscal   !    -      -       - 
    29    
     33   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rtmd, rscal   !    -      -       - 
     34   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC :: rdawn_dcy, rdusk_dcy   !    -      -       - 
     35 
    3036   PUBLIC   sbc_dcy        ! routine called by sbc 
     37   PUBLIC   sbc_dcy_param  ! routine used here and called by warm-layer parameterization (sbcblk_skin_coare*) 
    3138 
    3239   !!---------------------------------------------------------------------- 
    3340   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
    34    !! $Id$  
     41   !! $Id$ 
    3542   !! Software governed by the CeCILL license (see ./LICENSE) 
    3643   !!---------------------------------------------------------------------- 
    3744CONTAINS 
    3845 
    39       INTEGER FUNCTION sbc_dcy_alloc() 
    40          !!---------------------------------------------------------------------- 
    41          !!                ***  FUNCTION sbc_dcy_alloc  *** 
    42          !!---------------------------------------------------------------------- 
    43          ALLOCATE( raa (jpi,jpj) , rbb  (jpi,jpj) , rcc  (jpi,jpj) , rab  (jpi,jpj) ,     & 
    44             &      rtmd(jpi,jpj) , rdawn(jpi,jpj) , rdusk(jpi,jpj) , rscal(jpi,jpj) , STAT=sbc_dcy_alloc ) 
    45             ! 
    46          CALL mpp_sum ( 'sbcdcy', sbc_dcy_alloc ) 
    47          IF( sbc_dcy_alloc /= 0 )   CALL ctl_stop( 'STOP', 'sbc_dcy_alloc: failed to allocate arrays' ) 
    48       END FUNCTION sbc_dcy_alloc 
     46   INTEGER FUNCTION sbc_dcy_alloc() 
     47      !!---------------------------------------------------------------------- 
     48      !!                ***  FUNCTION sbc_dcy_alloc  *** 
     49      !!---------------------------------------------------------------------- 
     50      ALLOCATE( raa (jpi,jpj) , rbb  (jpi,jpj) , rcc  (jpi,jpj) , rab  (jpi,jpj) ,     & 
     51         &      rtmd(jpi,jpj) , rdawn_dcy(jpi,jpj) , rdusk_dcy(jpi,jpj) , rscal(jpi,jpj) , STAT=sbc_dcy_alloc ) 
     52      ! 
     53      CALL mpp_sum ( 'sbcdcy', sbc_dcy_alloc ) 
     54      IF( sbc_dcy_alloc /= 0 )   CALL ctl_stop( 'STOP', 'sbc_dcy_alloc: failed to allocate arrays' ) 
     55   END FUNCTION sbc_dcy_alloc 
    4956 
    5057 
     
    6067      !! 
    6168      !! reference  : Bernie, DJ, E Guilyardi, G Madec, JM Slingo, and SJ Woolnough, 2007 
    62       !!              Impact of resolving the diurnal cycle in an ocean--atmosphere GCM.  
     69      !!              Impact of resolving the diurnal cycle in an ocean--atmosphere GCM. 
    6370      !!              Part 1: a diurnally forced OGCM. Climate Dynamics 29:6, 575-590. 
    6471      !!---------------------------------------------------------------------- 
    6572      LOGICAL , OPTIONAL          , INTENT(in) ::   l_mask    ! use the routine for night mask computation 
    66       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqsrin    ! input daily QSR flux  
     73      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pqsrin    ! input daily QSR flux 
    6774      REAL(wp), DIMENSION(jpi,jpj)             ::   zqsrout   ! output QSR flux with diurnal cycle 
    6875      !! 
    6976      INTEGER  ::   ji, jj                                       ! dummy loop indices 
    7077      INTEGER, DIMENSION(jpi,jpj) :: imask_night ! night mask 
    71       REAL(wp) ::   ztwopi, zinvtwopi, zconvrad  
    7278      REAL(wp) ::   zlo, zup, zlousd, zupusd 
    73       REAL(wp) ::   zdsws, zdecrad, ztx, zsin, zcos 
    74       REAL(wp) ::   ztmp, ztmp1, ztmp2, ztest 
     79      REAL(wp) ::   ztmp, ztmp1, ztmp2 
    7580      REAL(wp) ::   ztmpm, ztmpm1, ztmpm2 
    76       !---------------------------statement functions------------------------ 
    77       REAL(wp) ::   fintegral, pt1, pt2, paaa, pbbb, pccc        ! dummy statement function arguments 
    78       fintegral( pt1, pt2, paaa, pbbb, pccc ) =                         & 
    79          &   paaa * pt2 + zinvtwopi * pbbb * SIN(pccc + ztwopi * pt2)   & 
    80          & - paaa * pt1 - zinvtwopi * pbbb * SIN(pccc + ztwopi * pt1) 
    8181      !!--------------------------------------------------------------------- 
    8282      ! 
    8383      ! Initialization 
    8484      ! -------------- 
    85       ztwopi    = 2._wp * rpi 
    86       zinvtwopi = 1._wp / ztwopi 
    87       zconvrad  = ztwopi / 360._wp 
    88  
    8985      ! When are we during the day (from 0 to 1) 
    9086      zlo = ( REAL(nsec_day, wp) - 0.5_wp * rdt ) / rday 
    9187      zup = zlo + ( REAL(nn_fsbc, wp)     * rdt ) / rday 
    92       !                                           
    93       IF( nday_qsr == -1 ) THEN       ! first time step only   
     88      ! 
     89      IF( nday_qsr == -1 ) THEN       ! first time step only 
    9490         IF(lwp) THEN 
    9591            WRITE(numout,*) 
     
    9894            WRITE(numout,*) 
    9995         ENDIF 
     96      ENDIF 
     97 
     98      ! Setting parameters for each new day: 
     99      CALL sbc_dcy_param() 
     100 
     101      !CALL iom_put( "rdusk_dcy", rdusk_dcy(:,:)*tmask(:,:,1) ) !LB 
     102      !CALL iom_put( "rdawn_dcy", rdawn_dcy(:,:)*tmask(:,:,1) ) !LB 
     103      !CALL iom_put( "rscal_dcy", rscal(:,:)*tmask(:,:,1) ) !LB 
     104 
     105 
     106      !     3. update qsr with the diurnal cycle 
     107      !     ------------------------------------ 
     108 
     109      imask_night(:,:) = 0 
     110      DO jj = 1, jpj 
     111         DO ji = 1, jpi 
     112            ztmpm = 0._wp 
     113            IF( ABS(rab(ji,jj)) < 1. ) THEN         ! day duration is less than 24h 
     114               ! 
     115               IF( rdawn_dcy(ji,jj) < rdusk_dcy(ji,jj) ) THEN       ! day time in one part 
     116                  zlousd = MAX(zlo, rdawn_dcy(ji,jj)) 
     117                  zlousd = MIN(zlousd, zup) 
     118                  zupusd = MIN(zup, rdusk_dcy(ji,jj)) 
     119                  zupusd = MAX(zupusd, zlo) 
     120                  ztmp = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj)) 
     121                  zqsrout(ji,jj) = pqsrin(ji,jj) * ztmp * rscal(ji,jj) 
     122                  ztmpm = zupusd - zlousd 
     123                  IF( ztmpm .EQ. 0 ) imask_night(ji,jj) = 1 
     124                  ! 
     125               ELSE                                         ! day time in two parts 
     126                  zlousd = MIN(zlo, rdusk_dcy(ji,jj)) 
     127                  zupusd = MIN(zup, rdusk_dcy(ji,jj)) 
     128                  ztmp1 = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj)) 
     129                  ztmpm1=zupusd-zlousd 
     130                  zlousd = MAX(zlo, rdawn_dcy(ji,jj)) 
     131                  zupusd = MAX(zup, rdawn_dcy(ji,jj)) 
     132                  ztmp2 = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj)) 
     133                  ztmpm2 =zupusd-zlousd 
     134                  ztmp = ztmp1 + ztmp2 
     135                  ztmpm = ztmpm1 + ztmpm2 
     136                  zqsrout(ji,jj) = pqsrin(ji,jj) * ztmp * rscal(ji,jj) 
     137                  IF(ztmpm .EQ. 0.) imask_night(ji,jj) = 1 
     138               ENDIF 
     139            ELSE                                   ! 24h light or 24h night 
     140               ! 
     141               IF( raa(ji,jj) > rbb(ji,jj) ) THEN           ! 24h day 
     142                  ztmp = fintegral(zlo, zup, raa(ji,jj), rbb(ji,jj), rcc(ji,jj)) 
     143                  zqsrout(ji,jj) = pqsrin(ji,jj) * ztmp * rscal(ji,jj) 
     144                  imask_night(ji,jj) = 0 
     145                  ! 
     146               ELSE                                         ! No day 
     147                  zqsrout(ji,jj) = 0.0_wp 
     148                  imask_night(ji,jj) = 1 
     149               ENDIF 
     150            ENDIF 
     151         END DO 
     152      END DO 
     153      ! 
     154      IF( PRESENT(l_mask) .AND. l_mask ) THEN 
     155         zqsrout(:,:) = float(imask_night(:,:)) 
     156      ENDIF 
     157      ! 
     158   END FUNCTION sbc_dcy 
     159 
     160 
     161   SUBROUTINE sbc_dcy_param( ) 
     162      !! 
     163      INTEGER  ::   ji, jj                                       ! dummy loop indices 
     164      !INTEGER, DIMENSION(jpi,jpj) :: imask_night ! night mask 
     165      REAL(wp) ::   zdsws, zdecrad, ztx, zsin, zcos 
     166      REAL(wp) ::   ztmp, ztest 
     167      !---------------------------statement functions------------------------ 
     168      ! 
     169      IF( nday_qsr == -1 ) THEN       ! first time step only 
    100170         ! allocate sbcdcy arrays 
    101171         IF( sbc_dcy_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_dcy_alloc : unable to allocate arrays' ) 
    102172         ! Compute rcc needed to compute the time integral of the diurnal cycle 
    103          rcc(:,:) = zconvrad * glamt(:,:) - rpi 
     173         rcc(:,:) = rad * glamt(:,:) - rpi 
    104174         ! time of midday 
    105175         rtmd(:,:) = 0.5_wp - glamt(:,:) / 360._wp 
     
    107177      ENDIF 
    108178 
    109       ! If this is a new day, we have to update the dawn, dusk and scaling function   
     179      ! If this is a new day, we have to update the dawn, dusk and scaling function 
    110180      !---------------------- 
    111      
    112       !     2.1 dawn and dusk   
    113  
    114       ! nday is the number of days since the beginning of the current month  
    115       IF( nday_qsr /= nday ) THEN  
     181 
     182      !     2.1 dawn and dusk 
     183 
     184      ! nday is the number of days since the beginning of the current month 
     185      IF( nday_qsr /= nday ) THEN 
    116186         ! save the day of the year and the daily mean of qsr 
    117          nday_qsr = nday  
    118          ! number of days since the previous winter solstice (supposed to be always 21 December)          
     187         nday_qsr = nday 
     188         ! number of days since the previous winter solstice (supposed to be always 21 December) 
    119189         zdsws = REAL(11 + nday_year, wp) 
    120190         ! declination of the earths orbit 
    121          zdecrad = (-23.5_wp * zconvrad) * COS( zdsws * ztwopi / REAL(nyear_len(1),wp) ) 
     191         zdecrad = (-23.5_wp * rad) * COS( zdsws * 2._wp*rpi / REAL(nyear_len(1),wp) ) 
    122192         ! Compute A and B needed to compute the time integral of the diurnal cycle 
    123193 
     
    125195         DO jj = 1, jpj 
    126196            DO ji = 1, jpi 
    127                ztmp = zconvrad * gphit(ji,jj) 
     197               ztmp = rad * gphit(ji,jj) 
    128198               raa(ji,jj) = SIN( ztmp ) * zsin 
    129199               rbb(ji,jj) = COS( ztmp ) * zcos 
    130             END DO   
    131          END DO   
     200            END DO 
     201         END DO 
    132202         ! Compute the time of dawn and dusk 
    133203 
    134          ! rab to test if the day time is equal to 0, less than 24h of full day         
     204         ! rab to test if the day time is equal to 0, less than 24h of full day 
    135205         rab(:,:) = -raa(:,:) / rbb(:,:) 
    136206         DO jj = 1, jpj 
    137207            DO ji = 1, jpi 
    138                IF ( ABS(rab(ji,jj)) < 1._wp ) THEN         ! day duration is less than 24h 
    139          ! When is it night? 
    140                   ztx = zinvtwopi * (ACOS(rab(ji,jj)) - rcc(ji,jj)) 
    141                   ztest = -rbb(ji,jj) * SIN( rcc(ji,jj) + ztwopi * ztx ) 
    142          ! is it dawn or dusk? 
    143                   IF ( ztest > 0._wp ) THEN 
    144                      rdawn(ji,jj) = ztx 
    145                      rdusk(ji,jj) = rtmd(ji,jj) + ( rtmd(ji,jj) - rdawn(ji,jj) ) 
     208               IF( ABS(rab(ji,jj)) < 1._wp ) THEN         ! day duration is less than 24h 
     209                  ! When is it night? 
     210                  ztx = 1._wp/(2._wp*rpi) * (ACOS(rab(ji,jj)) - rcc(ji,jj)) 
     211                  ztest = -rbb(ji,jj) * SIN( rcc(ji,jj) + 2._wp*rpi * ztx ) 
     212                  ! is it dawn or dusk? 
     213                  IF( ztest > 0._wp ) THEN 
     214                     rdawn_dcy(ji,jj) = ztx 
     215                     rdusk_dcy(ji,jj) = rtmd(ji,jj) + ( rtmd(ji,jj) - rdawn_dcy(ji,jj) ) 
    146216                  ELSE 
    147                      rdusk(ji,jj) = ztx 
    148                      rdawn(ji,jj) = rtmd(ji,jj) - ( rdusk(ji,jj) - rtmd(ji,jj) ) 
     217                     rdusk_dcy(ji,jj) = ztx 
     218                     rdawn_dcy(ji,jj) = rtmd(ji,jj) - ( rdusk_dcy(ji,jj) - rtmd(ji,jj) ) 
    149219                  ENDIF 
    150220               ELSE 
    151                   rdawn(ji,jj) = rtmd(ji,jj) + 0.5_wp 
    152                   rdusk(ji,jj) = rdawn(ji,jj) 
    153                ENDIF 
    154              END DO   
    155          END DO   
    156          rdawn(:,:) = MOD( (rdawn(:,:) + 1._wp), 1._wp ) 
    157          rdusk(:,:) = MOD( (rdusk(:,:) + 1._wp), 1._wp ) 
     221                  rdawn_dcy(ji,jj) = rtmd(ji,jj) + 0.5_wp 
     222                  rdusk_dcy(ji,jj) = rdawn_dcy(ji,jj) 
     223               ENDIF 
     224            END DO 
     225         END DO 
     226         rdawn_dcy(:,:) = MOD( (rdawn_dcy(:,:) + 1._wp), 1._wp ) 
     227         rdusk_dcy(:,:) = MOD( (rdusk_dcy(:,:) + 1._wp), 1._wp ) 
    158228         !     2.2 Compute the scaling function: 
    159229         !         S* = the inverse of the time integral of the diurnal cycle from dawn to dusk 
     
    162232         DO jj = 1, jpj 
    163233            DO ji = 1, jpi 
    164                IF ( ABS(rab(ji,jj)) < 1._wp ) THEN         ! day duration is less than 24h 
     234               IF( ABS(rab(ji,jj)) < 1._wp ) THEN         ! day duration is less than 24h 
    165235                  rscal(ji,jj) = 0.0_wp 
    166                   IF ( rdawn(ji,jj) < rdusk(ji,jj) ) THEN      ! day time in one part 
    167                      IF( (rdusk(ji,jj) - rdawn(ji,jj) ) .ge. 0.001_wp ) THEN 
    168                        rscal(ji,jj) = fintegral(rdawn(ji,jj), rdusk(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    169                        rscal(ji,jj) = 1._wp / rscal(ji,jj) 
     236                  IF( rdawn_dcy(ji,jj) < rdusk_dcy(ji,jj) ) THEN      ! day time in one part 
     237                     IF( (rdusk_dcy(ji,jj) - rdawn_dcy(ji,jj) ) .ge. 0.001_wp ) THEN 
     238                        rscal(ji,jj) = fintegral(rdawn_dcy(ji,jj), rdusk_dcy(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj)) 
     239                        rscal(ji,jj) = 1._wp / rscal(ji,jj) 
    170240                     ENDIF 
    171241                  ELSE                                         ! day time in two parts 
    172                      IF( (rdusk(ji,jj) + (1._wp - rdawn(ji,jj)) ) .ge. 0.001_wp ) THEN 
    173                        rscal(ji,jj) = fintegral(0._wp, rdusk(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))   & 
    174                           &         + fintegral(rdawn(ji,jj), 1._wp, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    175                        rscal(ji,jj) = 1. / rscal(ji,jj) 
     242                     IF( (rdusk_dcy(ji,jj) + (1._wp - rdawn_dcy(ji,jj)) ) .ge. 0.001_wp ) THEN 
     243                        rscal(ji,jj) = fintegral(0._wp, rdusk_dcy(ji,jj), raa(ji,jj), rbb(ji,jj), rcc(ji,jj))   & 
     244                           &         + fintegral(rdawn_dcy(ji,jj), 1._wp, raa(ji,jj), rbb(ji,jj), rcc(ji,jj)) 
     245                        rscal(ji,jj) = 1. / rscal(ji,jj) 
    176246                     ENDIF 
    177247                  ENDIF 
    178248               ELSE 
    179                   IF ( raa(ji,jj) > rbb(ji,jj) ) THEN         ! 24h day 
    180                      rscal(ji,jj) = fintegral(0._wp, 1._wp, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
     249                  IF( raa(ji,jj) > rbb(ji,jj) ) THEN         ! 24h day 
     250                     rscal(ji,jj) = fintegral(0._wp, 1._wp, raa(ji,jj), rbb(ji,jj), rcc(ji,jj)) 
    181251                     rscal(ji,jj) = 1._wp / rscal(ji,jj) 
    182252                  ELSE                                          ! No day 
     
    184254                  ENDIF 
    185255               ENDIF 
    186             END DO   
    187          END DO   
     256            END DO 
     257         END DO 
    188258         ! 
    189259         ztmp = rday / ( rdt * REAL(nn_fsbc, wp) ) 
    190260         rscal(:,:) = rscal(:,:) * ztmp 
    191261         ! 
    192       ENDIF  
    193          !     3. update qsr with the diurnal cycle 
    194          !     ------------------------------------ 
    195  
    196       imask_night(:,:) = 0 
    197       DO jj = 1, jpj 
    198          DO ji = 1, jpi 
    199             ztmpm = 0._wp 
    200             IF( ABS(rab(ji,jj)) < 1. ) THEN         ! day duration is less than 24h 
    201                ! 
    202                IF( rdawn(ji,jj) < rdusk(ji,jj) ) THEN       ! day time in one part 
    203                   zlousd = MAX(zlo, rdawn(ji,jj)) 
    204                   zlousd = MIN(zlousd, zup) 
    205                   zupusd = MIN(zup, rdusk(ji,jj)) 
    206                   zupusd = MAX(zupusd, zlo) 
    207                   ztmp = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    208                   zqsrout(ji,jj) = pqsrin(ji,jj) * ztmp * rscal(ji,jj) 
    209                   ztmpm = zupusd - zlousd 
    210                   IF ( ztmpm .EQ. 0 ) imask_night(ji,jj) = 1 
    211                   ! 
    212                ELSE                                         ! day time in two parts 
    213                   zlousd = MIN(zlo, rdusk(ji,jj)) 
    214                   zupusd = MIN(zup, rdusk(ji,jj)) 
    215                   ztmp1 = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    216                   ztmpm1=zupusd-zlousd 
    217                   zlousd = MAX(zlo, rdawn(ji,jj)) 
    218                   zupusd = MAX(zup, rdawn(ji,jj)) 
    219                   ztmp2 = fintegral(zlousd, zupusd, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    220                   ztmpm2 =zupusd-zlousd 
    221                   ztmp = ztmp1 + ztmp2 
    222                   ztmpm = ztmpm1 + ztmpm2 
    223                   zqsrout(ji,jj) = pqsrin(ji,jj) * ztmp * rscal(ji,jj) 
    224                   IF (ztmpm .EQ. 0.) imask_night(ji,jj) = 1 
    225                ENDIF 
    226             ELSE                                   ! 24h light or 24h night 
    227                ! 
    228                IF( raa(ji,jj) > rbb(ji,jj) ) THEN           ! 24h day 
    229                   ztmp = fintegral(zlo, zup, raa(ji,jj), rbb(ji,jj), rcc(ji,jj))  
    230                   zqsrout(ji,jj) = pqsrin(ji,jj) * ztmp * rscal(ji,jj) 
    231                   imask_night(ji,jj) = 0 
    232                   ! 
    233                ELSE                                         ! No day 
    234                   zqsrout(ji,jj) = 0.0_wp 
    235                   imask_night(ji,jj) = 1 
    236                ENDIF 
    237             ENDIF 
    238          END DO   
    239       END DO   
    240       ! 
    241       IF( PRESENT(l_mask) .AND. l_mask ) THEN 
    242          zqsrout(:,:) = float(imask_night(:,:)) 
    243       ENDIF 
    244       ! 
    245    END FUNCTION sbc_dcy 
     262      ENDIF !IF( nday_qsr /= nday ) 
     263      ! 
     264   END SUBROUTINE sbc_dcy_param 
     265 
     266 
     267   FUNCTION fintegral( pt1, pt2, paaa, pbbb, pccc ) 
     268      REAL(wp), INTENT(in) :: pt1, pt2, paaa, pbbb, pccc 
     269      REAL(wp) :: fintegral 
     270      fintegral =   paaa * pt2 + 1._wp/(2._wp*rpi) * pbbb * SIN(pccc + 2._wp*rpi*pt2)   & 
     271         &        - paaa * pt1 - 1._wp/(2._wp*rpi) * pbbb * SIN(pccc + 2._wp*rpi*pt1) 
     272   END FUNCTION fintegral 
    246273 
    247274   !!====================================================================== 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcice_cice.F90

    r11960 r12182  
    132132         IF      ( ksbc == jp_flx ) THEN 
    133133            CALL cice_sbc_force(kt) 
    134          ELSE IF ( ksbc == jp_purecpl ) THEN 
     134         ELSE IF( ksbc == jp_purecpl ) THEN 
    135135            CALL sbc_cpl_ice_flx( fr_i ) 
    136136         ENDIF 
     
    140140         CALL cice_sbc_out ( kt, ksbc ) 
    141141 
    142          IF ( ksbc == jp_purecpl )  CALL cice_sbc_hadgam(kt+1) 
     142         IF( ksbc == jp_purecpl )  CALL cice_sbc_hadgam(kt+1) 
    143143 
    144144      ENDIF                                          ! End sea-ice time step only 
     
    169169      ! there is no restart file. 
    170170      ! Values from a CICE restart file would overwrite this 
    171       IF ( .NOT. ln_rstart ) THEN     
     171      IF( .NOT. ln_rstart ) THEN     
    172172         CALL nemo2cice( ts(:,:,1,jp_tem,Kmm) , sst , 'T' , 1.)  
    173173      ENDIF   
     
    178178 
    179179! Do some CICE consistency checks 
    180       IF ( (ksbc == jp_flx) .OR. (ksbc == jp_purecpl) ) THEN 
    181          IF ( calc_strair .OR. calc_Tsfc ) THEN 
     180      IF( (ksbc == jp_flx) .OR. (ksbc == jp_purecpl) ) THEN 
     181         IF( calc_strair .OR. calc_Tsfc ) THEN 
    182182            CALL ctl_stop( 'STOP', 'cice_sbc_init : Forcing option requires calc_strair=F and calc_Tsfc=F in ice_in' ) 
    183183         ENDIF 
    184       ELSEIF (ksbc == jp_blk) THEN 
    185          IF ( .NOT. (calc_strair .AND. calc_Tsfc) ) THEN 
     184      ELSEIF(ksbc == jp_blk) THEN 
     185         IF( .NOT. (calc_strair .AND. calc_Tsfc) ) THEN 
    186186            CALL ctl_stop( 'STOP', 'cice_sbc_init : Forcing option requires calc_strair=T and calc_Tsfc=T in ice_in' ) 
    187187         ENDIF 
     
    203203 
    204204      CALL cice2nemo(aice,fr_i, 'T', 1. ) 
    205       IF ( (ksbc == jp_flx) .OR. (ksbc == jp_purecpl) ) THEN 
     205      IF( (ksbc == jp_flx) .OR. (ksbc == jp_purecpl) ) THEN 
    206206         DO jl=1,ncat 
    207207            CALL cice2nemo(aicen(:,:,jl,:),a_i(:,:,jl), 'T', 1. ) 
     
    298298! forced and coupled case  
    299299 
    300       IF ( (ksbc == jp_flx).OR.(ksbc == jp_purecpl) ) THEN 
     300      IF( (ksbc == jp_flx).OR.(ksbc == jp_purecpl) ) THEN 
    301301 
    302302         ztmpn(:,:,:)=0.0 
     
    323323 
    324324! Surface downward latent heat flux (CI_5) 
    325          IF (ksbc == jp_flx) THEN 
     325         IF(ksbc == jp_flx) THEN 
    326326            DO jl=1,ncat 
    327327               ztmpn(:,:,jl)=qla_ice(:,:,1)*a_i(:,:,jl) 
     
    333333            DO jj=1,jpj 
    334334               DO ji=1,jpi 
    335                   IF (fr_i(ji,jj).eq.0.0) THEN 
     335                  IF(fr_i(ji,jj).eq.0.0) THEN 
    336336                     DO jl=1,ncat 
    337337                        ztmpn(ji,jj,jl)=0.0 
     
    352352! GBM conductive flux through ice (CI_6) 
    353353!  Convert to GBM 
    354             IF (ksbc == jp_flx) THEN 
     354            IF(ksbc == jp_flx) THEN 
    355355               ztmp(:,:) = botmelt(:,:,jl)*a_i(:,:,jl) 
    356356            ELSE 
     
    361361! GBM surface heat flux (CI_7) 
    362362!  Convert to GBM 
    363             IF (ksbc == jp_flx) THEN 
     363            IF(ksbc == jp_flx) THEN 
    364364               ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))*a_i(:,:,jl)  
    365365            ELSE 
     
    369369         ENDDO 
    370370 
    371       ELSE IF (ksbc == jp_blk) THEN 
     371      ELSE IF(ksbc == jp_blk) THEN 
    372372 
    373373! Pass bulk forcing fields to CICE (which will calculate heat fluxes etc itself) 
     
    547547! Freshwater fluxes  
    548548 
    549       IF (ksbc == jp_flx) THEN 
     549      IF(ksbc == jp_flx) THEN 
    550550! Note that emp from the forcing files is evap*(1-aice)-(tprecip-aice*sprecip) 
    551551! What we want here is evap*(1-aice)-tprecip*(1-aice) hence manipulation below 
     
    553553! Better to use evap and tprecip? (but for now don't read in evap in this case) 
    554554         emp(:,:)  = emp(:,:)+fr_i(:,:)*(tprecip(:,:)-sprecip(:,:)) 
    555       ELSE IF (ksbc == jp_blk) THEN 
     555      ELSE IF(ksbc == jp_blk) THEN 
    556556         emp(:,:)  = (1.0-fr_i(:,:))*emp(:,:)         
    557       ELSE IF (ksbc == jp_purecpl) THEN 
     557      ELSE IF(ksbc == jp_purecpl) THEN 
    558558! emp_tot is set in sbc_cpl_ice_flx (called from cice_sbc_in above)  
    559559! This is currently as required with the coupling fields from the UM atmosphere 
     
    585585! Scale qsr and qns according to ice fraction (bulk formulae only) 
    586586 
    587       IF (ksbc == jp_blk) THEN 
     587      IF(ksbc == jp_blk) THEN 
    588588         qsr(:,:)=qsr(:,:)*(1.0-fr_i(:,:)) 
    589589         qns(:,:)=qns(:,:)*(1.0-fr_i(:,:)) 
    590590      ENDIF 
    591591! Take into account snow melting except for fully coupled when already in qns_tot 
    592       IF (ksbc == jp_purecpl) THEN 
     592      IF(ksbc == jp_purecpl) THEN 
    593593         qsr(:,:)= qsr_tot(:,:) 
    594594         qns(:,:)= qns_tot(:,:) 
     
    625625 
    626626      CALL cice2nemo(aice,fr_i,'T', 1. ) 
    627       IF ( (ksbc == jp_flx).OR.(ksbc == jp_purecpl) ) THEN 
     627      IF( (ksbc == jp_flx).OR.(ksbc == jp_purecpl) ) THEN 
    628628         DO jl=1,ncat 
    629629            CALL cice2nemo(aicen(:,:,jl,:),a_i(:,:,jl), 'T', 1. ) 
     
    878878!     B. Gather pn into global array (png) 
    879879 
    880       IF ( jpnij > 1) THEN 
     880      IF( jpnij > 1) THEN 
    881881         CALL mppsync 
    882882         CALL mppgather (pn,0,png)  
     
    891891! (may be OK but not 100% sure) 
    892892 
    893       IF (nproc==0) THEN      
     893      IF(nproc==0) THEN      
    894894!        pcg(:,:)=0.0 
    895895         DO jn=1,jpnij 
     
    10141014! the lbclnk call on pn will replace these with sensible values 
    10151015 
    1016       IF (nproc==0) THEN 
     1016      IF(nproc==0) THEN 
    10171017         png(:,:,:)=0.0 
    10181018         DO jn=1,jpnij 
     
    10271027!     C. Scatter png into NEMO field (pn) for each processor 
    10281028 
    1029       IF ( jpnij > 1) THEN 
     1029      IF( jpnij > 1) THEN 
    10301030         CALL mppsync 
    10311031         CALL mppscatter (png,0,pn)  
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcmod.F90

    r12150 r12182  
    1515   !!            3.6  ! 2014-11  (P. Mathiot, C. Harris) add ice shelves melting 
    1616   !!            4.0  ! 2016-06  (L. Brodeau) new general bulk formulation 
     17   !!            4.0  ! 2019-03  (F. Lemarié & G. Samson)  add ABL compatibility (ln_abl=TRUE) 
    1718   !!---------------------------------------------------------------------- 
    1819 
     
    3334   USE sbcflx         ! surface boundary condition: flux formulation 
    3435   USE sbcblk         ! surface boundary condition: bulk formulation 
     36   USE sbcabl         ! atmospheric boundary layer 
    3537   USE sbcice_if      ! surface boundary condition: ice-if sea-ice model 
    3638#if defined key_si3 
     
    9294      LOGICAL ::   ll_purecpl, ll_opa, ll_not_nemo   ! local logical 
    9395      !! 
    94       NAMELIST/namsbc/ nn_fsbc  ,                                                  & 
    95          &             ln_usr   , ln_flx     , ln_blk       ,                      & 
    96          &             ln_cpl   , ln_mixcpl  , nn_components,                      & 
    97          &             nn_ice   , ln_ice_embd,                                     & 
    98          &             ln_traqsr, ln_dm2dc   ,                                     & 
     96      NAMELIST/namsbc/ nn_fsbc  ,                                                    & 
     97         &             ln_usr   , ln_flx   , ln_blk   , ln_abl,                      & 
     98         &             ln_cpl   , ln_mixcpl, nn_components,                          & 
     99         &             nn_ice   , ln_ice_embd,                                       & 
     100         &             ln_traqsr, ln_dm2dc ,                                         & 
    99101         &             ln_rnf   , nn_fwb     , ln_ssr   , ln_apr_dyn,              & 
    100          &             ln_wave  , ln_cdgw    , ln_sdw   , ln_tauwoc , ln_stcor,    & 
    101          &             ln_tauw  , nn_lsm     , nn_sdrift 
     102         &             ln_wave  , ln_cdgw  , ln_sdw   , ln_tauwoc  , ln_stcor  ,     & 
     103         &             ln_tauw  , nn_lsm, nn_sdrift 
    102104      !!---------------------------------------------------------------------- 
    103105      ! 
     
    124126         IF( lk_cice )   nn_ice      = 3 
    125127      ENDIF 
    126 #else 
    127       IF( lk_si3  )   nn_ice      = 2 
    128       IF( lk_cice )   nn_ice      = 3 
     128!!GS: TBD 
     129!#else 
     130!      IF( lk_si3  )   nn_ice      = 2 
     131!      IF( lk_cice )   nn_ice      = 3 
    129132#endif 
    130133      ! 
     
    136139         WRITE(numout,*) '         flux         formulation                   ln_flx        = ', ln_flx 
    137140         WRITE(numout,*) '         bulk         formulation                   ln_blk        = ', ln_blk 
     141         WRITE(numout,*) '         ABL          formulation                   ln_abl        = ', ln_abl 
    138142         WRITE(numout,*) '      Type of coupling (Ocean/Ice/Atmosphere) : ' 
    139143         WRITE(numout,*) '         ocean-atmosphere coupled formulation       ln_cpl        = ', ln_cpl 
     
    223227      CASE( 1 )                        !- Ice-cover climatology ("Ice-if" model)   
    224228      CASE( 2 )                        !- SI3  ice model 
     229         IF( .NOT.( ln_blk .OR. ln_cpl .OR. ln_abl .OR. ln_usr ) )   & 
     230            &                   CALL ctl_stop( 'sbc_init : SI3 sea-ice model requires ln_blk or ln_cpl or ln_abl or ln_usr = T' ) 
    225231      CASE( 3 )                        !- CICE ice model 
    226          IF( .NOT.( ln_blk .OR. ln_cpl ) )   CALL ctl_stop( 'sbc_init : CICE sea-ice model requires ln_blk or ln_cpl = T' ) 
    227          IF( lk_agrif                    )   CALL ctl_stop( 'sbc_init : CICE sea-ice model not currently available with AGRIF' )  
     232         IF( .NOT.( ln_blk .OR. ln_cpl .OR. ln_abl .OR. ln_usr ) )   & 
     233            &                   CALL ctl_stop( 'sbc_init : CICE sea-ice model requires ln_blk or ln_cpl or ln_abl or ln_usr = T' ) 
     234         IF( lk_agrif                                )   & 
     235            &                   CALL ctl_stop( 'sbc_init : CICE sea-ice model not currently available with AGRIF' )  
    228236      CASE DEFAULT                     !- not supported 
    229237      END SELECT 
     
    248256 
    249257      !                          ! Choice of the Surface Boudary Condition (set nsbc) 
     258      nday_qsr = -1   ! allow initialization at the 1st call !LB: now warm-layer of COARE* calls "sbc_dcy_param" of sbcdcy.F90! 
    250259      IF( ln_dm2dc ) THEN           !* daily mean to diurnal cycle 
    251          nday_qsr = -1   ! allow initialization at the 1st call 
    252          IF( .NOT.( ln_flx .OR. ln_blk ) .AND. nn_components /= jp_iam_opa )   & 
    253             &   CALL ctl_stop( 'qsr diurnal cycle from daily values requires a flux or bulk formulation' ) 
     260         !LB:nday_qsr = -1   ! allow initialization at the 1st call 
     261         IF( .NOT.( ln_flx .OR. ln_blk .OR. ln_abl ) .AND. nn_components /= jp_iam_opa )   & 
     262            &   CALL ctl_stop( 'qsr diurnal cycle from daily values requires flux, bulk or abl formulation' ) 
    254263      ENDIF 
    255264      !                             !* Choice of the Surface Boudary Condition 
     
    264273      IF( ln_flx          ) THEN   ;   nsbc = jp_flx     ; icpt = icpt + 1   ;   ENDIF       ! flux                 formulation 
    265274      IF( ln_blk          ) THEN   ;   nsbc = jp_blk     ; icpt = icpt + 1   ;   ENDIF       ! bulk                 formulation 
     275      IF( ln_abl          ) THEN   ;   nsbc = jp_abl     ; icpt = icpt + 1   ;   ENDIF       ! ABL                  formulation 
    266276      IF( ll_purecpl      ) THEN   ;   nsbc = jp_purecpl ; icpt = icpt + 1   ;   ENDIF       ! Pure Coupled         formulation 
    267277      IF( ll_opa          ) THEN   ;   nsbc = jp_none    ; icpt = icpt + 1   ;   ENDIF       ! opa coupling via SAS module 
     
    275285         CASE( jp_flx     )   ;   WRITE(numout,*) '   ==>>>   flux formulation' 
    276286         CASE( jp_blk     )   ;   WRITE(numout,*) '   ==>>>   bulk formulation' 
     287         CASE( jp_abl     )   ;   WRITE(numout,*) '   ==>>>   ABL  formulation' 
    277288         CASE( jp_purecpl )   ;   WRITE(numout,*) '   ==>>>   pure coupled formulation' 
    278289!!gm abusive use of jp_none ??   ===>>> need to be check and changed by adding a jp_sas parameter 
     
    325336      IF( l_sbc_clo   )   CALL sbc_clo_init              ! closed sea surface initialisation 
    326337      ! 
    327       IF( ln_blk      )   CALL sbc_blk_init              ! bulk formulae initialization 
    328  
    329       IF( ln_ssr      )   CALL sbc_ssr_init              ! Sea-Surface Restoring initialization 
     338      IF( ln_blk      )   CALL sbc_blk_init            ! bulk formulae initialization 
     339 
     340      IF( ln_abl      )   CALL sbc_abl_init            ! Atmospheric Boundary Layer (ABL) 
     341 
     342      IF( ln_ssr      )   CALL sbc_ssr_init            ! Sea-Surface Restoring initialization 
    330343      ! 
    331344      ! 
     
    394407         emp_b (:,:) = emp (:,:) 
    395408         sfx_b (:,:) = sfx (:,:) 
    396          IF ( ln_rnf ) THEN 
     409         IF( ln_rnf ) THEN 
    397410            rnf_b    (:,:  ) = rnf    (:,:  ) 
    398411            rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:) 
     
    418431      CASE( jp_flx     )   ;   CALL sbc_flx       ( kt )                             ! flux formulation 
    419432      CASE( jp_blk     ) 
    420          IF( ll_sas    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )  ! OPA-SAS coupling: SAS receiving fields from OPA 
    421                                CALL sbc_blk       ( kt )                             ! bulk formulation for the ocean 
     433         IF( ll_sas    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )   ! OPA-SAS coupling: SAS receiving fields from OPA 
     434                               CALL sbc_blk       ( kt )                    ! bulk formulation for the ocean 
    422435                               ! 
    423       CASE( jp_purecpl )   ;   CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )  ! pure coupled formulation 
     436      CASE( jp_abl     ) 
     437         IF( ll_sas    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )   ! OPA-SAS coupling: SAS receiving fields from OPA 
     438                               CALL sbc_abl       ( kt )                    ! ABL  formulation for the ocean 
     439                               ! 
     440      CASE( jp_purecpl )   ;   CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )   ! pure coupled formulation 
    424441      CASE( jp_none    ) 
    425442         IF( ll_opa    )       CALL sbc_cpl_rcv   ( kt, nn_fsbc, nn_ice, Kbb, Kmm )  ! OPA-SAS coupling: OPA receiving fields from SAS 
     
    460477!!$!clem: it looks like it is necessary for the north fold (in certain circumstances). Don't know why. 
    461478!!$      CALL lbc_lnk( 'sbcmod', emp, 'T', 1. ) 
    462       IF ( ll_wd ) THEN     ! If near WAD point limit the flux for now 
     479      IF( ll_wd ) THEN     ! If near WAD point limit the flux for now 
    463480         zthscl = atanh(rn_wd_sbcfra)                     ! taper frac default is .999  
    464481         zwdht(:,:) = ssh(:,:,Kmm) + ht_0(:,:) - rn_wdmin1   ! do this calc of water 
     
    492509            CALL iom_get( numror, jpdom_autoglo, 'utau_b', utau_b, ldxios = lrxios )   ! before i-stress  (U-point) 
    493510            CALL iom_get( numror, jpdom_autoglo, 'vtau_b', vtau_b, ldxios = lrxios )   ! before j-stress  (V-point) 
    494             CALL iom_get( numror, jpdom_autoglo, 'qns_b' , qns_b, ldxios = lrxios )   ! before non solar heat flux (T-point) 
     511            CALL iom_get( numror, jpdom_autoglo,  'qns_b',  qns_b, ldxios = lrxios )   ! before non solar heat flux (T-point) 
    495512            ! The 3D heat content due to qsr forcing is treated in traqsr 
    496513            ! CALL iom_get( numror, jpdom_autoglo, 'qsr_b' , qsr_b, ldxios = lrxios  ) ! before     solar heat flux (T-point) 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbcrnf.F90

    r12150 r12182  
    435435         !                                      !    - mixed upstream-centered (ln_traadv_cen2=T) 
    436436         ! 
    437          IF ( ln_rnf_depth )   CALL ctl_warn( 'sbc_rnf_init: increased mixing turned on but effects may already',   & 
     437         IF( ln_rnf_depth )   CALL ctl_warn( 'sbc_rnf_init: increased mixing turned on but effects may already',   & 
    438438            &                                              'be spread through depth by ln_rnf_depth'               ) 
    439439         ! 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/sbctide.F90

    r10068 r12182  
    7272         ! Temporarily set nsec_day to beginning of day. 
    7373         nsec_day_orig = nsec_day 
    74          IF ( nsec_day /= NINT(0.5_wp * rdt) ) THEN  
     74         IF( nsec_day /= NINT(0.5_wp * rdt) ) THEN  
    7575            kt_tide = kt - (nsec_day - 0.5_wp * rdt)/rdt 
    7676            nsec_day = NINT(0.5_wp * rdt) 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/SBC/tideini.F90

    r11960 r12182  
    6666      ! 
    6767      IF( ln_tide ) THEN 
    68          IF (lwp) THEN 
     68         IF(lwp) THEN 
    6969            WRITE(numout,*) 
    7070            WRITE(numout,*) 'tide_init : Initialization of the tidal components' 
     
    125125      kt_tide = nit000 
    126126      ! 
    127       IF (.NOT.ln_scal_load ) rn_scal_load = 0._wp 
     127      IF(.NOT.ln_scal_load ) rn_scal_load = 0._wp 
    128128      ! 
    129129   END SUBROUTINE tide_init 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ZDF/zdfiwm.F90

    r11960 r12182  
    415415      !!              de Lavergne et al. in prep., 2017 
    416416      !!---------------------------------------------------------------------- 
    417       INTEGER  ::   ji, jj, jk   ! dummy loop indices 
    418417      INTEGER  ::   inum         ! local integer 
    419418      INTEGER  ::   ios 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/src/SAS/diawri.F90

    r11949 r12182  
    2424   !!---------------------------------------------------------------------- 
    2525   USE oce             ! ocean dynamics and tracers  
     26   USE abl            ! abl variables in case ln_abl = .true. 
    2627   USE dom_oce         ! ocean space and time domain 
    2728   USE zdf_oce         ! ocean vertical physics 
     
    5152   PUBLIC   dia_wri_state 
    5253   PUBLIC   dia_wri_alloc           ! Called by nemogcm module 
    53  
     54#if ! defined key_iomput    
     55   PUBLIC   dia_wri_alloc_abl       ! Called by sbcabl  module (if ln_abl = .true.) 
     56#endif 
    5457   INTEGER ::   nid_T, nz_T, nh_T, ndim_T, ndim_hT   ! grid_T file 
    5558   INTEGER ::   nid_U, nz_U, nh_U, ndim_U, ndim_hU   ! grid_U file 
    5659   INTEGER ::   nid_V, nz_V, nh_V, ndim_V, ndim_hV   ! grid_V file 
     60   INTEGER ::   ndim_A, ndim_hA                      ! ABL file    
     61   INTEGER ::   nid_A, nz_A, nh_A                    ! grid_ABL file    
    5762   INTEGER ::   ndex(1)                              ! ??? 
    5863   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hT, ndex_hU, ndex_hV 
     64   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hA, ndex_A ! ABL 
    5965 
    6066   !! * Substitutions 
     
    115121   END FUNCTION dia_wri_alloc 
    116122    
     123   INTEGER FUNCTION dia_wri_alloc_abl() 
     124      !!---------------------------------------------------------------------- 
     125     ALLOCATE(   ndex_hA(jpi*jpj), ndex_A (jpi*jpj*jpkam1), STAT=dia_wri_alloc_abl) 
     126      CALL mpp_sum( 'diawri', dia_wri_alloc_abl ) 
     127      ! 
     128   END FUNCTION dia_wri_alloc_abl 
    117129   
    118130   SUBROUTINE dia_wri( kt ) 
     
    137149      INTEGER  ::   ierr                                     ! error code return from allocation 
    138150      INTEGER  ::   iimi, iima, ipk, it, itmod, ijmi, ijma   ! local integers 
     151      INTEGER  ::   ipka                                     ! ABL 
    139152      REAL(wp) ::   zsto, zout, zmax, zjulian                ! local scalars 
     153      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zw3d_abl   ! ABL 3D workspace 
    140154      !!---------------------------------------------------------------------- 
    141155      ! 
     
    175189      ijmi = 1      ;      ijma = jpj 
    176190      ipk = jpk 
     191     IF(ln_abl) ipka = jpkam1 
    177192 
    178193      ! define time axis 
     
    242257 
    243258         ! No W grid FILE 
     259         IF( ln_abl ) THEN  
     260         ! Define the ABL grid FILE ( nid_A ) 
     261            CALL dia_nam( clhstnam, nwrite, 'grid_ABL' ) 
     262            IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam    ! filename 
     263            CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit 
     264               &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       & 
     265               &          nit000-1, zjulian, rdt, nh_A, nid_A, domain_id=nidom, snc4chunks=snc4set ) 
     266            CALL histvert( nid_A, "ght_abl", "Vertical T levels",      &  ! Vertical grid: gdept 
     267               &           "m", ipka, ght_abl(2:jpka), nz_A, "up" ) 
     268            !                                                            ! Index of ocean points 
     269         ALLOCATE( zw3d_abl(jpi,jpj,ipka) )  
     270         zw3d_abl(:,:,:) = 1._wp  
     271         CALL wheneq( jpi*jpj*ipka, zw3d_abl, 1, 1., ndex_A , ndim_A  )      ! volume 
     272            CALL wheneq( jpi*jpj     , zw3d_abl, 1, 1., ndex_hA, ndim_hA )      ! surface 
     273         DEALLOCATE(zw3d_abl) 
     274         ENDIF 
    244275 
    245276         ! Declare all the output fields as NETCDF variables 
     
    262293         CALL histdef( nid_T, "sowindsp", "wind speed at 10m"                  , "m/s"    ,   &  ! wndm 
    263294            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     295! 
     296         IF( ln_abl ) THEN 
     297         !                                                                                      !!! nid_A : 3D 
     298         CALL histdef( nid_A, "t_abl", "Potential Temperature"     , "K"        ,       &  ! t_abl 
     299               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout ) 
     300            CALL histdef( nid_A, "q_abl", "Humidity"                  , "kg/kg"    ,       &  ! q_abl 
     301               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     302            CALL histdef( nid_A, "u_abl", "Atmospheric U-wind   "     , "m/s"        ,     &  ! u_abl 
     303               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout ) 
     304            CALL histdef( nid_A, "v_abl", "Atmospheric V-wind   "     , "m/s"    ,         &  ! v_abl 
     305               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     306            CALL histdef( nid_A, "tke_abl", "Atmospheric TKE   "     , "m2/s2"    ,        &  ! tke_abl 
     307               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     308            CALL histdef( nid_A, "avm_abl", "Atmospheric turbulent viscosity", "m2/s"   ,  &  ! avm_abl 
     309               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     310            CALL histdef( nid_A, "avt_abl", "Atmospheric turbulent diffusivity", "m2/s2",  &  ! avt_abl 
     311               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     312            CALL histdef( nid_A, "pblh", "Atmospheric boundary layer height "  , "m",      &  ! pblh 
     313               &          jpi, jpj, nh_A,  1  , 1, 1   , -99 , 32, clop, zsto, zout )                  
     314#if defined key_si3 
     315            CALL histdef( nid_A, "oce_frac", "Fraction of open ocean"  , " ",      &  ! ato_i 
     316               &          jpi, jpj, nh_A,  1  , 1, 1   , -99 , 32, clop, zsto, zout ) 
     317#endif 
     318          CALL histend( nid_A, snc4chunks=snc4set ) 
     319       ! 
     320       ENDIF 
     321! 
    264322 
    265323         CALL histend( nid_T, snc4chunks=snc4set ) 
     
    311369      CALL histwrite( nid_T, "soicecov", it, fr_i          , ndim_hT, ndex_hT )   ! ice fraction    
    312370      CALL histwrite( nid_T, "sowindsp", it, wndm          , ndim_hT, ndex_hT )   ! wind speed    
     371! 
     372      IF( ln_abl ) THEN  
     373        ALLOCATE( zw3d_abl(jpi,jpj,jpka) ) 
     374        IF( ln_mskland )   THEN  
     375          DO jk=1,jpka 
     376             zw3d_abl(:,:,jk) = tmask(:,:,1) 
     377            END DO 
     378       ELSE 
     379            zw3d_abl(:,:,:) = 1._wp      
     380         ENDIF        
     381       CALL histwrite( nid_A,  "pblh"   , it, pblh(:,:)                  *zw3d_abl(:,:,1     ), ndim_hA, ndex_hA )   ! pblh  
     382        CALL histwrite( nid_A,  "u_abl"  , it, u_abl   (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! u_abl 
     383        CALL histwrite( nid_A,  "v_abl"  , it, v_abl   (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! v_abl 
     384        CALL histwrite( nid_A,  "t_abl"  , it, tq_abl  (:,:,2:jpka,nt_n,1)*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! t_abl 
     385        CALL histwrite( nid_A,  "q_abl"  , it, tq_abl  (:,:,2:jpka,nt_n,2)*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! q_abl      
     386        CALL histwrite( nid_A,  "tke_abl", it, tke_abl (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! tke_abl 
     387        CALL histwrite( nid_A,  "avm_abl", it, avm_abl (:,:,2:jpka       )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! avm_abl 
     388        CALL histwrite( nid_A,  "avt_abl", it, avt_abl (:,:,2:jpka       )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! avt_abl   
     389#if defined key_si3 
     390         CALL histwrite( nid_A,  "oce_frac"   , it, ato_i(:,:)                                  , ndim_hA, ndex_hA )   ! ato_i 
     391#endif 
     392       DEALLOCATE(zw3d_abl) 
     393     ENDIF 
     394! 
    313395 
    314396         ! Write fields on U grid 
     
    326408         CALL histclo( nid_U ) 
    327409         CALL histclo( nid_V ) 
     410         IF(ln_abl) CALL histclo( nid_A ) 
    328411      ENDIF 
    329412      ! 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/tests/demo_cfgs.txt

    r12150 r12182  
    1010WAD OCE 
    1111BENCH OCE ICE TOP 
     12STATION_ASF OCE 
  • NEMO/branches/2019/dev_r11943_MERGE_2019/tests/test_cases.bib

    r10627 r12182  
    115115   abstract = {Many problems of fluid dynamics involve the coupled transport of several, density-like, dependent variables (for instance, densities of mass and momenta in elastic flows). In this paper, a conservative and synchronous flux-corrected transport (FCT) formalism is developed which aims at a consistent transport of such variables. The technique differs from traditional FCT algorithms in two respects. First, the limiting of transportive fluxes of the primary variables (e.g., mass and momentum) does not derive from smooth estimates of the variables, but it derives from analytic constraints implied by the Lagrangian form of the governing continuity equations, which are imposed on the specific mixing ratios of the variables (e.g., velocity components). Second, the traditional FCT limiting based on sufficiency conditions is augmented by an iterative procedure which approaches the necessity requirements. This procedure can also be used in the framework of traditional FCT schemes, and a demonstration is provided that it can significantly reduce some of the pathological behaviors of FCT algorithms. Although the approach derived is applicable to the transport of arbitrary conserved quantities, it is particularly useful for the synchronous transport of mass and momenta in elastic flows, where it assures intrinsic stability of the algorithm regardless of the magnitude of the mass-density variable. This latter property becomes especially important in fluids with large density variations, or in models with a material “vertical” coordinate (e.g., geophysical hydrostatic stratified flows in isopycnic/isentropic coordinates), where material surfaces can collapse to zero-mass layers admitting, therefore, arbitrarily large local Courant numbers.} 
    116116} 
     117 
     118@article{Brodeau_al_2017, 
     119author={Laurent Brodeau and Bernard Barnier and Sergey Gulev and Cian Woods}, 
     120title={Climatologically significant effects of some approximations in the bulk parameterizations of turbulent air-sea fluxes}, 
     121journal={J. Phys. Oceanogr.}, 
     122doi={10.1175/JPO-D-16-0169.1}, 
     123year={2017}, 
     124pages = {5-28}, 
     125volume={47}, 
     126number={1} 
     127} 
Note: See TracChangeset for help on using the changeset viewer.