[888] | 1 | MODULE sbcmod |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE sbcmod *** |
---|
| 4 | !! Surface module : provide to the ocean its surface boundary condition |
---|
| 5 | !!====================================================================== |
---|
[2528] | 6 | !! History : 3.0 ! 2006-07 (G. Madec) Original code |
---|
| 7 | !! 3.1 ! 2008-08 (S. Masson, A. Caubel, E. Maisonnave, G. Madec) coupled interface |
---|
| 8 | !! 3.3 ! 2010-04 (M. Leclair, G. Madec) Forcing averaged over 2 time steps |
---|
| 9 | !! 3.3 ! 2010-10 (S. Masson) add diurnal cycle |
---|
| 10 | !! 3.3 ! 2010-09 (D. Storkey) add ice boundary conditions (BDY) |
---|
| 11 | !! - ! 2010-11 (G. Madec) ice-ocean stress always computed at each ocean time-step |
---|
| 12 | !! - ! 2010-10 (J. Chanut, C. Bricaud, G. Madec) add the surface pressure forcing |
---|
[3294] | 13 | !! 3.4 ! 2011-11 (C. Harris) CICE added as an option |
---|
[3625] | 14 | !! 3.5 ! 2012-11 (A. Coward, G. Madec) Rethink of heat, mass and salt surface fluxes |
---|
[5120] | 15 | !! 3.6 ! 2014-11 (P. Mathiot, C. Harris) add ice shelves melting |
---|
[888] | 16 | !!---------------------------------------------------------------------- |
---|
| 17 | |
---|
| 18 | !!---------------------------------------------------------------------- |
---|
[6060] | 19 | !! sbc_init : read namsbc namelist |
---|
| 20 | !! sbc : surface ocean momentum, heat and freshwater boundary conditions |
---|
[888] | 21 | !!---------------------------------------------------------------------- |
---|
[6060] | 22 | USE oce ! ocean dynamics and tracers |
---|
| 23 | USE dom_oce ! ocean space and time domain |
---|
| 24 | USE phycst ! physical constants |
---|
| 25 | USE sbc_oce ! Surface boundary condition: ocean fields |
---|
| 26 | USE trc_oce ! shared ocean-passive tracers variables |
---|
| 27 | USE sbc_ice ! Surface boundary condition: ice fields |
---|
| 28 | USE sbcdcy ! surface boundary condition: diurnal cycle |
---|
| 29 | USE sbcssm ! surface boundary condition: sea-surface mean variables |
---|
| 30 | USE sbcana ! surface boundary condition: analytical formulation |
---|
| 31 | USE sbcflx ! surface boundary condition: flux formulation |
---|
| 32 | USE sbcblk_clio ! surface boundary condition: bulk formulation : CLIO |
---|
| 33 | USE sbcblk_core ! surface boundary condition: bulk formulation : CORE |
---|
| 34 | USE sbcblk_mfs ! surface boundary condition: bulk formulation : MFS |
---|
| 35 | USE sbcice_if ! surface boundary condition: ice-if sea-ice model |
---|
| 36 | USE sbcice_lim ! surface boundary condition: LIM 3.0 sea-ice model |
---|
| 37 | USE sbcice_lim_2 ! surface boundary condition: LIM 2.0 sea-ice model |
---|
| 38 | USE sbcice_cice ! surface boundary condition: CICE sea-ice model |
---|
| 39 | USE sbccpl ! surface boundary condition: coupled florulation |
---|
| 40 | USE cpl_oasis3 ! OASIS routines for coupling |
---|
| 41 | USE sbcssr ! surface boundary condition: sea surface restoring |
---|
| 42 | USE sbcrnf ! surface boundary condition: runoffs |
---|
| 43 | USE sbcisf ! surface boundary condition: ice shelf |
---|
| 44 | USE sbcfwb ! surface boundary condition: freshwater budget |
---|
| 45 | USE closea ! closed sea |
---|
| 46 | USE icbstp ! Icebergs |
---|
| 47 | USE traqsr ! active tracers: light penetration |
---|
| 48 | USE sbcwave ! Wave module |
---|
| 49 | USE bdy_par ! Require lk_bdy |
---|
| 50 | ! |
---|
| 51 | USE prtctl ! Print control (prt_ctl routine) |
---|
| 52 | USE iom ! IOM library |
---|
| 53 | USE in_out_manager ! I/O manager |
---|
| 54 | USE lib_mpp ! MPP library |
---|
| 55 | USE timing ! Timing |
---|
[888] | 56 | |
---|
| 57 | IMPLICIT NONE |
---|
| 58 | PRIVATE |
---|
| 59 | |
---|
| 60 | PUBLIC sbc ! routine called by step.F90 |
---|
[1725] | 61 | PUBLIC sbc_init ! routine called by opa.F90 |
---|
[888] | 62 | |
---|
| 63 | INTEGER :: nsbc ! type of surface boundary condition (deduced from namsbc informations) |
---|
| 64 | |
---|
| 65 | !!---------------------------------------------------------------------- |
---|
[2715] | 66 | !! NEMO/OPA 4.0 , NEMO-consortium (2011) |
---|
[1146] | 67 | !! $Id$ |
---|
[2715] | 68 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[888] | 69 | !!---------------------------------------------------------------------- |
---|
| 70 | CONTAINS |
---|
| 71 | |
---|
| 72 | SUBROUTINE sbc_init |
---|
| 73 | !!--------------------------------------------------------------------- |
---|
| 74 | !! *** ROUTINE sbc_init *** |
---|
| 75 | !! |
---|
| 76 | !! ** Purpose : Initialisation of the ocean surface boundary computation |
---|
| 77 | !! |
---|
| 78 | !! ** Method : Read the namsbc namelist and set derived parameters |
---|
[3607] | 79 | !! Call init routines for all other SBC modules that have one |
---|
[888] | 80 | !! |
---|
| 81 | !! ** Action : - read namsbc parameters |
---|
| 82 | !! - nsbc: type of sbc |
---|
| 83 | !!---------------------------------------------------------------------- |
---|
[2715] | 84 | INTEGER :: icpt ! local integer |
---|
[1037] | 85 | !! |
---|
[6060] | 86 | NAMELIST/namsbc/ nn_fsbc , ln_ana , ln_flx, ln_blk_clio, ln_blk_core, ln_blk_mfs, & |
---|
| 87 | & ln_cpl , ln_mixcpl, nn_components , nn_limflx , & |
---|
| 88 | & ln_traqsr, ln_dm2dc , & |
---|
| 89 | & nn_ice , nn_ice_embd, & |
---|
| 90 | & ln_rnf , ln_ssr , nn_isf , nn_fwb , ln_apr_dyn, & |
---|
| 91 | & ln_wave , & |
---|
| 92 | & nn_lsm |
---|
[4147] | 93 | INTEGER :: ios |
---|
[5407] | 94 | INTEGER :: ierr, ierr0, ierr1, ierr2, ierr3, jpm |
---|
| 95 | LOGICAL :: ll_purecpl |
---|
[1037] | 96 | !!---------------------------------------------------------------------- |
---|
[6060] | 97 | ! |
---|
[888] | 98 | IF(lwp) THEN |
---|
| 99 | WRITE(numout,*) |
---|
| 100 | WRITE(numout,*) 'sbc_init : surface boundary condition setting' |
---|
| 101 | WRITE(numout,*) '~~~~~~~~ ' |
---|
| 102 | ENDIF |
---|
[6060] | 103 | ! |
---|
[4147] | 104 | REWIND( numnam_ref ) ! Namelist namsbc in reference namelist : Surface boundary |
---|
| 105 | READ ( numnam_ref, namsbc, IOSTAT = ios, ERR = 901) |
---|
[6060] | 106 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc in reference namelist', lwp ) |
---|
| 107 | ! |
---|
[4147] | 108 | REWIND( numnam_cfg ) ! Namelist namsbc in configuration namelist : Parameters of the run |
---|
| 109 | READ ( numnam_cfg, namsbc, IOSTAT = ios, ERR = 902 ) |
---|
[6060] | 110 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc in configuration namelist', lwp ) |
---|
| 111 | IF(lwm) WRITE( numond, namsbc ) |
---|
| 112 | ! |
---|
[2528] | 113 | ! ! overwrite namelist parameter using CPP key information |
---|
| 114 | IF( Agrif_Root() ) THEN ! AGRIF zoom |
---|
| 115 | IF( lk_lim2 ) nn_ice = 2 |
---|
| 116 | IF( lk_lim3 ) nn_ice = 3 |
---|
[3294] | 117 | IF( lk_cice ) nn_ice = 4 |
---|
[1242] | 118 | ENDIF |
---|
[2528] | 119 | IF( cp_cfg == 'gyre' ) THEN ! GYRE configuration |
---|
[888] | 120 | ln_ana = .TRUE. |
---|
| 121 | nn_ice = 0 |
---|
| 122 | ENDIF |
---|
[6060] | 123 | ! |
---|
[2528] | 124 | IF(lwp) THEN ! Control print |
---|
[1218] | 125 | WRITE(numout,*) ' Namelist namsbc (partly overwritten with CPP key setting)' |
---|
[888] | 126 | WRITE(numout,*) ' frequency update of sbc (and ice) nn_fsbc = ', nn_fsbc |
---|
[6060] | 127 | WRITE(numout,*) ' Type of air-sea fluxes : ' |
---|
| 128 | WRITE(numout,*) ' analytical formulation ln_ana = ', ln_ana |
---|
| 129 | WRITE(numout,*) ' flux formulation ln_flx = ', ln_flx |
---|
| 130 | WRITE(numout,*) ' CLIO bulk formulation ln_blk_clio = ', ln_blk_clio |
---|
| 131 | WRITE(numout,*) ' CORE bulk formulation ln_blk_core = ', ln_blk_core |
---|
| 132 | WRITE(numout,*) ' MFS bulk formulation ln_blk_mfs = ', ln_blk_mfs |
---|
| 133 | WRITE(numout,*) ' Type of coupling (Ocean/Ice/Atmosphere) : ' |
---|
| 134 | WRITE(numout,*) ' ocean-atmosphere coupled formulation ln_cpl = ', ln_cpl |
---|
| 135 | WRITE(numout,*) ' forced-coupled mixed formulation ln_mixcpl = ', ln_mixcpl |
---|
| 136 | WRITE(numout,*) ' OASIS coupling (with atm or sas) lk_oasis = ', lk_oasis |
---|
| 137 | WRITE(numout,*) ' components of your executable nn_components = ', nn_components |
---|
| 138 | WRITE(numout,*) ' Multicategory heat flux formulation (LIM3) nn_limflx = ', nn_limflx |
---|
| 139 | WRITE(numout,*) ' Sea-ice : ' |
---|
| 140 | WRITE(numout,*) ' ice management in the sbc (=0/1/2/3) nn_ice = ', nn_ice |
---|
| 141 | WRITE(numout,*) ' ice-ocean embedded/levitating (=0/1/2) nn_ice_embd = ', nn_ice_embd |
---|
[888] | 142 | WRITE(numout,*) ' Misc. options of sbc : ' |
---|
[6060] | 143 | WRITE(numout,*) ' Light penetration in temperature Eq. ln_traqsr = ', ln_traqsr |
---|
| 144 | WRITE(numout,*) ' daily mean to diurnal cycle qsr ln_dm2dc = ', ln_dm2dc |
---|
| 145 | WRITE(numout,*) ' Sea Surface Restoring on SST and/or SSS ln_ssr = ', ln_ssr |
---|
| 146 | WRITE(numout,*) ' FreshWater Budget control (=0/1/2) nn_fwb = ', nn_fwb |
---|
| 147 | WRITE(numout,*) ' Patm gradient added in ocean & ice Eqs. ln_apr_dyn = ', ln_apr_dyn |
---|
| 148 | WRITE(numout,*) ' runoff / runoff mouths ln_rnf = ', ln_rnf |
---|
| 149 | WRITE(numout,*) ' iceshelf formulation nn_isf = ', nn_isf |
---|
| 150 | WRITE(numout,*) ' closed sea (=0/1) (set in namdom) nn_closea = ', nn_closea |
---|
| 151 | WRITE(numout,*) ' nb of iterations if land-sea-mask applied nn_lsm = ', nn_lsm |
---|
| 152 | WRITE(numout,*) ' surface wave ln_wave = ', ln_wave |
---|
[888] | 153 | ENDIF |
---|
[4161] | 154 | ! |
---|
[6060] | 155 | IF(lwp) THEN |
---|
| 156 | WRITE(numout,*) |
---|
| 157 | SELECT CASE ( nn_limflx ) ! LIM3 Multi-category heat flux formulation |
---|
| 158 | CASE ( -1 ) ; WRITE(numout,*) ' LIM3: use per-category fluxes (nn_limflx = -1) ' |
---|
| 159 | CASE ( 0 ) ; WRITE(numout,*) ' LIM3: use average per-category fluxes (nn_limflx = 0) ' |
---|
| 160 | CASE ( 1 ) ; WRITE(numout,*) ' LIM3: use average then redistribute per-category fluxes (nn_limflx = 1) ' |
---|
| 161 | CASE ( 2 ) ; WRITE(numout,*) ' LIM3: Redistribute a single flux over categories (nn_limflx = 2) ' |
---|
| 162 | END SELECT |
---|
| 163 | ENDIF |
---|
| 164 | ! |
---|
| 165 | IF( nn_components /= jp_iam_nemo .AND. .NOT. lk_oasis ) & |
---|
| 166 | & CALL ctl_stop( 'sbc_init : OPA-SAS coupled via OASIS, but key_oasis3 disabled' ) |
---|
| 167 | IF( nn_components == jp_iam_opa .AND. ln_cpl ) & |
---|
| 168 | & CALL ctl_stop( 'sbc_init : OPA-SAS coupled via OASIS, but ln_cpl = T in OPA' ) |
---|
| 169 | IF( nn_components == jp_iam_opa .AND. ln_mixcpl ) & |
---|
| 170 | & CALL ctl_stop( 'sbc_init : OPA-SAS coupled via OASIS, but ln_mixcpl = T in OPA' ) |
---|
| 171 | IF( ln_cpl .AND. .NOT. lk_oasis ) & |
---|
| 172 | & CALL ctl_stop( 'sbc_init : OASIS-coupled atmosphere model, but key_oasis3 disabled' ) |
---|
[5407] | 173 | IF( ln_mixcpl .AND. .NOT. lk_oasis ) & |
---|
| 174 | & CALL ctl_stop( 'the forced-coupled mixed mode (ln_mixcpl) requires the cpp key key_oasis3' ) |
---|
| 175 | IF( ln_mixcpl .AND. .NOT. ln_cpl ) & |
---|
| 176 | & CALL ctl_stop( 'the forced-coupled mixed mode (ln_mixcpl) requires ln_cpl = T' ) |
---|
| 177 | IF( ln_mixcpl .AND. nn_components /= jp_iam_nemo ) & |
---|
| 178 | & CALL ctl_stop( 'the forced-coupled mixed mode (ln_mixcpl) is not yet working with sas-opa coupling via oasis' ) |
---|
| 179 | |
---|
[2715] | 180 | ! ! allocate sbc arrays |
---|
[5836] | 181 | IF( sbc_oce_alloc() /= 0 ) CALL ctl_stop( 'sbc_init : unable to allocate sbc_oce arrays' ) |
---|
[2715] | 182 | |
---|
[2528] | 183 | ! ! Checks: |
---|
[6060] | 184 | IF( nn_isf == 0 ) THEN ! variable initialisation if no ice shelf |
---|
[5836] | 185 | IF( sbc_isf_alloc() /= 0 ) CALL ctl_stop( 'sbc_init : unable to allocate sbc_isf arrays' ) |
---|
[6060] | 186 | fwfisf (:,:) = 0._wp ; fwfisf_b (:,:) = 0._wp |
---|
| 187 | risf_tsc(:,:,:) = 0._wp ; risf_tsc_b(:,:,:) = 0._wp |
---|
| 188 | rdivisf = 0._wp |
---|
[4990] | 189 | END IF |
---|
[6060] | 190 | IF( nn_ice == 0 .AND. nn_components /= jp_iam_opa ) fr_i(:,:) = 0._wp ! no ice in the domain, ice fraction is always zero |
---|
[1037] | 191 | |
---|
[6060] | 192 | sfx(:,:) = 0._wp ! the salt flux due to freezing/melting will be computed (i.e. will be non-zero) |
---|
[3625] | 193 | ! only if sea-ice is present |
---|
[4148] | 194 | |
---|
[6060] | 195 | fmmflx(:,:) = 0._wp ! freezing-melting array initialisation |
---|
[4822] | 196 | |
---|
[6060] | 197 | taum(:,:) = 0._wp ! Initialise taum for use in gls in case of reduced restart |
---|
[3625] | 198 | |
---|
[1218] | 199 | ! ! restartability |
---|
[5407] | 200 | IF( ( nn_ice == 2 .OR. nn_ice ==3 ) .AND. .NOT.( ln_blk_clio .OR. ln_blk_core .OR. ln_cpl ) ) & |
---|
[3294] | 201 | & CALL ctl_stop( 'LIM sea-ice model requires a bulk formulation or coupled configuration' ) |
---|
[5407] | 202 | IF( nn_ice == 4 .AND. .NOT.( ln_blk_core .OR. ln_cpl ) ) & |
---|
| 203 | & CALL ctl_stop( 'CICE sea-ice model requires ln_blk_core or ln_cpl' ) |
---|
[3625] | 204 | IF( nn_ice == 4 .AND. lk_agrif ) & |
---|
| 205 | & CALL ctl_stop( 'CICE sea-ice model not currently available with AGRIF' ) |
---|
| 206 | IF( ( nn_ice == 3 .OR. nn_ice == 4 ) .AND. nn_ice_embd == 0 ) & |
---|
[3740] | 207 | & CALL ctl_stop( 'LIM3 and CICE sea-ice models require nn_ice_embd = 1 or 2' ) |
---|
[4990] | 208 | IF( ( nn_ice /= 3 ) .AND. ( nn_limflx >= 0 ) ) & |
---|
| 209 | & WRITE(numout,*) 'The nn_limflx>=0 option has no effect if sea ice model is not LIM3' |
---|
[5407] | 210 | IF( ( nn_ice == 3 ) .AND. ( ln_cpl ) .AND. ( ( nn_limflx == -1 ) .OR. ( nn_limflx == 1 ) ) ) & |
---|
[4990] | 211 | & CALL ctl_stop( 'The chosen nn_limflx for LIM3 in coupled mode must be 0 or 2' ) |
---|
[5407] | 212 | IF( ( nn_ice == 3 ) .AND. ( .NOT. ln_cpl ) .AND. ( nn_limflx == 2 ) ) & |
---|
[4990] | 213 | & CALL ctl_stop( 'The chosen nn_limflx for LIM3 in forced mode cannot be 2' ) |
---|
| 214 | |
---|
[2528] | 215 | IF( ln_dm2dc ) nday_qsr = -1 ! initialisation flag |
---|
| 216 | |
---|
[5407] | 217 | IF( ln_dm2dc .AND. .NOT.( ln_flx .OR. ln_blk_core ) .AND. nn_components /= jp_iam_opa ) & |
---|
[2528] | 218 | & CALL ctl_stop( 'diurnal cycle into qsr field from daily values requires a flux or core-bulk formulation' ) |
---|
| 219 | |
---|
| 220 | ! ! Choice of the Surface Boudary Condition (set nsbc) |
---|
[5407] | 221 | ll_purecpl = ln_cpl .AND. .NOT. ln_mixcpl |
---|
| 222 | ! |
---|
[888] | 223 | icpt = 0 |
---|
[5407] | 224 | IF( ln_ana ) THEN ; nsbc = jp_ana ; icpt = icpt + 1 ; ENDIF ! analytical formulation |
---|
| 225 | IF( ln_flx ) THEN ; nsbc = jp_flx ; icpt = icpt + 1 ; ENDIF ! flux formulation |
---|
| 226 | IF( ln_blk_clio ) THEN ; nsbc = jp_clio ; icpt = icpt + 1 ; ENDIF ! CLIO bulk formulation |
---|
| 227 | IF( ln_blk_core ) THEN ; nsbc = jp_core ; icpt = icpt + 1 ; ENDIF ! CORE bulk formulation |
---|
| 228 | IF( ln_blk_mfs ) THEN ; nsbc = jp_mfs ; icpt = icpt + 1 ; ENDIF ! MFS bulk formulation |
---|
| 229 | IF( ll_purecpl ) THEN ; nsbc = jp_purecpl ; icpt = icpt + 1 ; ENDIF ! Pure Coupled formulation |
---|
| 230 | IF( cp_cfg == 'gyre') THEN ; nsbc = jp_gyre ; ENDIF ! GYRE analytical formulation |
---|
| 231 | IF( nn_components == jp_iam_opa ) & |
---|
| 232 | & THEN ; nsbc = jp_none ; icpt = icpt + 1 ; ENDIF ! opa coupling via SAS module |
---|
[2528] | 233 | ! |
---|
[5836] | 234 | IF( icpt /= 1 ) CALL ctl_stop( 'sbc_init: choose ONE and only ONE sbc option' ) |
---|
| 235 | ! |
---|
[888] | 236 | IF(lwp) THEN |
---|
| 237 | WRITE(numout,*) |
---|
[6060] | 238 | SELECT CASE( nsbc ) |
---|
| 239 | CASE( jp_gyre ) ; WRITE(numout,*) ' GYRE analytical formulation' |
---|
| 240 | CASE( jp_ana ) ; WRITE(numout,*) ' analytical formulation' |
---|
| 241 | CASE( jp_flx ) ; WRITE(numout,*) ' flux formulation' |
---|
| 242 | CASE( jp_clio ) ; WRITE(numout,*) ' CLIO bulk formulation' |
---|
| 243 | CASE( jp_core ) ; WRITE(numout,*) ' CORE bulk formulation' |
---|
| 244 | CASE( jp_purecpl ) ; WRITE(numout,*) ' pure coupled formulation' |
---|
| 245 | CASE( jp_mfs ) ; WRITE(numout,*) ' MFS Bulk formulation' |
---|
| 246 | CASE( jp_none ) ; WRITE(numout,*) ' OPA coupled to SAS via oasis' |
---|
| 247 | IF( ln_mixcpl ) WRITE(numout,*) ' + forced-coupled mixed formulation' |
---|
| 248 | END SELECT |
---|
[5407] | 249 | IF( nn_components/= jp_iam_nemo ) & |
---|
[6060] | 250 | & WRITE(numout,*) ' + OASIS coupled SAS' |
---|
[888] | 251 | ENDIF |
---|
| 252 | ! |
---|
[5407] | 253 | IF( lk_oasis ) CALL sbc_cpl_init (nn_ice) ! OASIS initialisation. must be done before: (1) first time step |
---|
[5836] | 254 | ! ! (2) the use of nn_fsbc |
---|
[6060] | 255 | ! nn_fsbc initialization if OPA-SAS coupling via OASIS |
---|
| 256 | ! sas model time step has to be declared in OASIS (mandatory) -> nn_fsbc has to be modified accordingly |
---|
| 257 | IF( nn_components /= jp_iam_nemo ) THEN |
---|
| 258 | IF( nn_components == jp_iam_opa ) nn_fsbc = cpl_freq('O_SFLX') / NINT(rdt) |
---|
| 259 | IF( nn_components == jp_iam_sas ) nn_fsbc = cpl_freq('I_SFLX') / NINT(rdt) |
---|
[5407] | 260 | ! |
---|
| 261 | IF(lwp)THEN |
---|
| 262 | WRITE(numout,*) |
---|
| 263 | WRITE(numout,*)" OPA-SAS coupled via OASIS : nn_fsbc re-defined from OASIS namcouple ", nn_fsbc |
---|
| 264 | WRITE(numout,*) |
---|
| 265 | ENDIF |
---|
| 266 | ENDIF |
---|
[6060] | 267 | ! |
---|
[5407] | 268 | IF( MOD( nitend - nit000 + 1, nn_fsbc) /= 0 .OR. & |
---|
| 269 | MOD( nstock , nn_fsbc) /= 0 ) THEN |
---|
| 270 | WRITE(ctmp1,*) 'experiment length (', nitend - nit000 + 1, ') or nstock (', nstock, & |
---|
| 271 | & ' is NOT a multiple of nn_fsbc (', nn_fsbc, ')' |
---|
| 272 | CALL ctl_stop( ctmp1, 'Impossible to properly do model restart' ) |
---|
| 273 | ENDIF |
---|
| 274 | ! |
---|
| 275 | IF( MOD( rday, REAL(nn_fsbc, wp) * rdt ) /= 0 ) & |
---|
| 276 | & CALL ctl_warn( 'nn_fsbc is NOT a multiple of the number of time steps in a day' ) |
---|
| 277 | ! |
---|
| 278 | IF( ln_dm2dc .AND. ( ( NINT(rday) / ( nn_fsbc * NINT(rdt) ) ) < 8 ) ) & |
---|
| 279 | & CALL ctl_warn( 'diurnal cycle for qsr: the sampling of the diurnal cycle is too small...' ) |
---|
[4152] | 280 | ! |
---|
[6060] | 281 | CALL sbc_ssm_init ! Sea-surface mean fields initialisation |
---|
[3764] | 282 | ! |
---|
[6060] | 283 | IF( ln_ssr ) CALL sbc_ssr_init ! Sea-Surface Restoring initialisation |
---|
[5385] | 284 | ! |
---|
[6060] | 285 | CALL sbc_rnf_init ! Runof initialisation |
---|
| 286 | ! |
---|
| 287 | IF( nn_ice == 3 ) CALL sbc_lim_init ! LIM3 initialisation |
---|
| 288 | ! |
---|
| 289 | IF( nn_ice == 4 ) CALL cice_sbc_init( nsbc ) ! CICE initialisation |
---|
| 290 | ! |
---|
[888] | 291 | END SUBROUTINE sbc_init |
---|
| 292 | |
---|
| 293 | |
---|
| 294 | SUBROUTINE sbc( kt ) |
---|
| 295 | !!--------------------------------------------------------------------- |
---|
| 296 | !! *** ROUTINE sbc *** |
---|
| 297 | !! |
---|
| 298 | !! ** Purpose : provide at each time-step the ocean surface boundary |
---|
| 299 | !! condition (momentum, heat and freshwater fluxes) |
---|
| 300 | !! |
---|
| 301 | !! ** Method : blah blah to be written ????????? |
---|
| 302 | !! CAUTION : never mask the surface stress field (tke sbc) |
---|
| 303 | !! |
---|
[2528] | 304 | !! ** Action : - set the ocean surface boundary condition at before and now |
---|
| 305 | !! time step, i.e. |
---|
[3625] | 306 | !! utau_b, vtau_b, qns_b, qsr_b, emp_n, sfx_b, qrp_b, erp_b |
---|
| 307 | !! utau , vtau , qns , qsr , emp , sfx , qrp , erp |
---|
[1037] | 308 | !! - updte the ice fraction : fr_i |
---|
[888] | 309 | !!---------------------------------------------------------------------- |
---|
| 310 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
| 311 | !!--------------------------------------------------------------------- |
---|
[3294] | 312 | ! |
---|
| 313 | IF( nn_timing == 1 ) CALL timing_start('sbc') |
---|
| 314 | ! |
---|
[2528] | 315 | ! ! ---------------------------------------- ! |
---|
| 316 | IF( kt /= nit000 ) THEN ! Swap of forcing fields ! |
---|
| 317 | ! ! ---------------------------------------- ! |
---|
| 318 | utau_b(:,:) = utau(:,:) ! Swap the ocean forcing fields |
---|
| 319 | vtau_b(:,:) = vtau(:,:) ! (except at nit000 where before fields |
---|
| 320 | qns_b (:,:) = qns (:,:) ! are set at the end of the routine) |
---|
[6060] | 321 | emp_b (:,:) = emp (:,:) |
---|
| 322 | sfx_b (:,:) = sfx (:,:) |
---|
[2528] | 323 | ENDIF |
---|
| 324 | ! ! ---------------------------------------- ! |
---|
| 325 | ! ! forcing field computation ! |
---|
| 326 | ! ! ---------------------------------------- ! |
---|
[1482] | 327 | ! |
---|
[6060] | 328 | IF( nn_components /= jp_iam_sas ) CALL sbc_ssm ( kt ) ! ocean sea surface variables (sst_m, sss_m, ssu_m, ssv_m) |
---|
[5407] | 329 | ! ! averaged over nf_sbc time-step |
---|
[6060] | 330 | IF( ln_wave ) CALL sbc_wave( kt ) ! surface waves |
---|
| 331 | |
---|
| 332 | |
---|
[2528] | 333 | !== sbc formulation ==! |
---|
| 334 | |
---|
| 335 | SELECT CASE( nsbc ) ! Compute ocean surface boundary condition |
---|
[3625] | 336 | ! ! (i.e. utau,vtau, qns, qsr, emp, sfx) |
---|
[4990] | 337 | CASE( jp_gyre ) ; CALL sbc_gyre ( kt ) ! analytical formulation : GYRE configuration |
---|
| 338 | CASE( jp_ana ) ; CALL sbc_ana ( kt ) ! analytical formulation : uniform sbc |
---|
| 339 | CASE( jp_flx ) ; CALL sbc_flx ( kt ) ! flux formulation |
---|
| 340 | CASE( jp_clio ) ; CALL sbc_blk_clio( kt ) ! bulk formulation : CLIO for the ocean |
---|
[5407] | 341 | CASE( jp_core ) |
---|
| 342 | IF( nn_components == jp_iam_sas ) & |
---|
| 343 | & CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice ) ! OPA-SAS coupling: SAS receiving fields from OPA |
---|
| 344 | CALL sbc_blk_core( kt ) ! bulk formulation : CORE for the ocean |
---|
| 345 | ! from oce: sea surface variables (sst_m, sss_m, ssu_m, ssv_m) |
---|
| 346 | CASE( jp_purecpl ) ; CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice ) ! pure coupled formulation |
---|
| 347 | ! |
---|
[4990] | 348 | CASE( jp_mfs ) ; CALL sbc_blk_mfs ( kt ) ! bulk formulation : MFS for the ocean |
---|
[5407] | 349 | CASE( jp_none ) |
---|
[6060] | 350 | IF( nn_components == jp_iam_opa ) & |
---|
| 351 | & CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice ) ! OPA-SAS coupling: OPA receiving fields from SAS |
---|
[888] | 352 | END SELECT |
---|
| 353 | |
---|
[5407] | 354 | IF( ln_mixcpl ) CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice ) ! forced-coupled mixed formulation after forcing |
---|
| 355 | |
---|
[6060] | 356 | ! |
---|
[2528] | 357 | ! !== Misc. Options ==! |
---|
[6060] | 358 | ! |
---|
[3632] | 359 | SELECT CASE( nn_ice ) ! Update heat and freshwater fluxes over sea-ice areas |
---|
| 360 | CASE( 1 ) ; CALL sbc_ice_if ( kt ) ! Ice-cover climatology ("Ice-if" model) |
---|
| 361 | CASE( 2 ) ; CALL sbc_ice_lim_2( kt, nsbc ) ! LIM-2 ice model |
---|
| 362 | CASE( 3 ) ; CALL sbc_ice_lim ( kt, nsbc ) ! LIM-3 ice model |
---|
[4205] | 363 | CASE( 4 ) ; CALL sbc_ice_cice ( kt, nsbc ) ! CICE ice model |
---|
[1037] | 364 | END SELECT |
---|
[888] | 365 | |
---|
[3632] | 366 | IF( ln_icebergs ) CALL icb_stp( kt ) ! compute icebergs |
---|
[3609] | 367 | |
---|
[4990] | 368 | IF( nn_isf /= 0 ) CALL sbc_isf( kt ) ! compute iceshelves |
---|
| 369 | |
---|
[3632] | 370 | IF( ln_rnf ) CALL sbc_rnf( kt ) ! add runoffs to fresh water fluxes |
---|
[1061] | 371 | |
---|
[3632] | 372 | IF( ln_ssr ) CALL sbc_ssr( kt ) ! add SST/SSS damping term |
---|
[888] | 373 | |
---|
[3632] | 374 | IF( nn_fwb /= 0 ) CALL sbc_fwb( kt, nn_fwb, nn_fsbc ) ! control the freshwater budget |
---|
[888] | 375 | |
---|
[3632] | 376 | IF( nn_closea == 1 ) CALL sbc_clo( kt ) ! treatment of closed sea in the model domain |
---|
| 377 | ! ! (update freshwater fluxes) |
---|
[2502] | 378 | !RBbug do not understand why see ticket 667 |
---|
[5407] | 379 | !clem: it looks like it is necessary for the north fold (in certain circumstances). Don't know why. |
---|
| 380 | CALL lbc_lnk( emp, 'T', 1. ) |
---|
[2502] | 381 | ! |
---|
[2528] | 382 | IF( kt == nit000 ) THEN ! set the forcing field at nit000 - 1 ! |
---|
| 383 | ! ! ---------------------------------------- ! |
---|
| 384 | IF( ln_rstart .AND. & !* Restart: read in restart file |
---|
| 385 | & iom_varid( numror, 'utau_b', ldstop = .FALSE. ) > 0 ) THEN |
---|
| 386 | IF(lwp) WRITE(numout,*) ' nit000-1 surface forcing fields red in the restart file' |
---|
| 387 | CALL iom_get( numror, jpdom_autoglo, 'utau_b', utau_b ) ! before i-stress (U-point) |
---|
| 388 | CALL iom_get( numror, jpdom_autoglo, 'vtau_b', vtau_b ) ! before j-stress (V-point) |
---|
| 389 | CALL iom_get( numror, jpdom_autoglo, 'qns_b' , qns_b ) ! before non solar heat flux (T-point) |
---|
| 390 | ! The 3D heat content due to qsr forcing is treated in traqsr |
---|
[3625] | 391 | ! CALL iom_get( numror, jpdom_autoglo, 'qsr_b' , qsr_b ) ! before solar heat flux (T-point) |
---|
| 392 | CALL iom_get( numror, jpdom_autoglo, 'emp_b', emp_b ) ! before freshwater flux (T-point) |
---|
| 393 | ! To ensure restart capability with 3.3x/3.4 restart files !! to be removed in v3.6 |
---|
| 394 | IF( iom_varid( numror, 'sfx_b', ldstop = .FALSE. ) > 0 ) THEN |
---|
| 395 | CALL iom_get( numror, jpdom_autoglo, 'sfx_b', sfx_b ) ! before salt flux (T-point) |
---|
| 396 | ELSE |
---|
| 397 | sfx_b (:,:) = sfx(:,:) |
---|
| 398 | ENDIF |
---|
[2528] | 399 | ELSE !* no restart: set from nit000 values |
---|
| 400 | IF(lwp) WRITE(numout,*) ' nit000-1 surface forcing fields set to nit000' |
---|
| 401 | utau_b(:,:) = utau(:,:) |
---|
| 402 | vtau_b(:,:) = vtau(:,:) |
---|
| 403 | qns_b (:,:) = qns (:,:) |
---|
[3625] | 404 | emp_b (:,:) = emp(:,:) |
---|
| 405 | sfx_b (:,:) = sfx(:,:) |
---|
[2528] | 406 | ENDIF |
---|
| 407 | ENDIF |
---|
| 408 | ! ! ---------------------------------------- ! |
---|
| 409 | IF( lrst_oce ) THEN ! Write in the ocean restart file ! |
---|
| 410 | ! ! ---------------------------------------- ! |
---|
| 411 | IF(lwp) WRITE(numout,*) |
---|
| 412 | IF(lwp) WRITE(numout,*) 'sbc : ocean surface forcing fields written in ocean restart file ', & |
---|
| 413 | & 'at it= ', kt,' date= ', ndastp |
---|
| 414 | IF(lwp) WRITE(numout,*) '~~~~' |
---|
| 415 | CALL iom_rstput( kt, nitrst, numrow, 'utau_b' , utau ) |
---|
| 416 | CALL iom_rstput( kt, nitrst, numrow, 'vtau_b' , vtau ) |
---|
| 417 | CALL iom_rstput( kt, nitrst, numrow, 'qns_b' , qns ) |
---|
| 418 | ! The 3D heat content due to qsr forcing is treated in traqsr |
---|
| 419 | ! CALL iom_rstput( kt, nitrst, numrow, 'qsr_b' , qsr ) |
---|
| 420 | CALL iom_rstput( kt, nitrst, numrow, 'emp_b' , emp ) |
---|
[5407] | 421 | CALL iom_rstput( kt, nitrst, numrow, 'sfx_b' , sfx ) |
---|
[2528] | 422 | ENDIF |
---|
| 423 | ! ! ---------------------------------------- ! |
---|
| 424 | ! ! Outputs and control print ! |
---|
| 425 | ! ! ---------------------------------------- ! |
---|
[1482] | 426 | IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN |
---|
[2561] | 427 | CALL iom_put( "empmr" , emp - rnf ) ! upward water flux |
---|
[3625] | 428 | CALL iom_put( "saltflx", sfx ) ! downward salt flux |
---|
| 429 | ! (includes virtual salt flux beneath ice |
---|
| 430 | ! in linear free surface case) |
---|
[4148] | 431 | CALL iom_put( "fmmflx", fmmflx ) ! Freezing-melting water flux |
---|
[2561] | 432 | CALL iom_put( "qt" , qns + qsr ) ! total heat flux |
---|
| 433 | CALL iom_put( "qns" , qns ) ! solar heat flux |
---|
| 434 | CALL iom_put( "qsr" , qsr ) ! solar heat flux |
---|
[5407] | 435 | IF( nn_ice > 0 .OR. nn_components == jp_iam_opa ) CALL iom_put( "ice_cover", fr_i ) ! ice fraction |
---|
[4990] | 436 | CALL iom_put( "taum" , taum ) ! wind stress module |
---|
| 437 | CALL iom_put( "wspd" , wndm ) ! wind speed module over free ocean or leads in presence of sea-ice |
---|
[1482] | 438 | ENDIF |
---|
| 439 | ! |
---|
| 440 | CALL iom_put( "utau", utau ) ! i-wind stress (stress can be updated at |
---|
| 441 | CALL iom_put( "vtau", vtau ) ! j-wind stress each time step in sea-ice) |
---|
| 442 | ! |
---|
[888] | 443 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
[6060] | 444 | CALL prt_ctl(tab2d_1=fr_i , clinfo1=' fr_i - : ', mask1=tmask, ovlap=1 ) |
---|
| 445 | CALL prt_ctl(tab2d_1=(emp-rnf + fwfisf), clinfo1=' emp-rnf - : ', mask1=tmask, ovlap=1 ) |
---|
| 446 | CALL prt_ctl(tab2d_1=(sfx-rnf + fwfisf), clinfo1=' sfx-rnf - : ', mask1=tmask, ovlap=1 ) |
---|
[3294] | 447 | CALL prt_ctl(tab2d_1=qns , clinfo1=' qns - : ', mask1=tmask, ovlap=1 ) |
---|
| 448 | CALL prt_ctl(tab2d_1=qsr , clinfo1=' qsr - : ', mask1=tmask, ovlap=1 ) |
---|
| 449 | CALL prt_ctl(tab3d_1=tmask , clinfo1=' tmask - : ', mask1=tmask, ovlap=1, kdim=jpk ) |
---|
| 450 | CALL prt_ctl(tab3d_1=tsn(:,:,:,jp_tem), clinfo1=' sst - : ', mask1=tmask, ovlap=1, kdim=1 ) |
---|
| 451 | CALL prt_ctl(tab3d_1=tsn(:,:,:,jp_sal), clinfo1=' sss - : ', mask1=tmask, ovlap=1, kdim=1 ) |
---|
| 452 | CALL prt_ctl(tab2d_1=utau , clinfo1=' utau - : ', mask1=umask, & |
---|
| 453 | & tab2d_2=vtau , clinfo2=' vtau - : ', mask2=vmask, ovlap=1 ) |
---|
[888] | 454 | ENDIF |
---|
[3294] | 455 | |
---|
| 456 | IF( kt == nitend ) CALL sbc_final ! Close down surface module if necessary |
---|
[888] | 457 | ! |
---|
[3294] | 458 | IF( nn_timing == 1 ) CALL timing_stop('sbc') |
---|
| 459 | ! |
---|
[888] | 460 | END SUBROUTINE sbc |
---|
| 461 | |
---|
[3764] | 462 | |
---|
[3294] | 463 | SUBROUTINE sbc_final |
---|
| 464 | !!--------------------------------------------------------------------- |
---|
| 465 | !! *** ROUTINE sbc_final *** |
---|
[3764] | 466 | !! |
---|
| 467 | !! ** Purpose : Finalize CICE (if used) |
---|
[3294] | 468 | !!--------------------------------------------------------------------- |
---|
[3764] | 469 | ! |
---|
[3294] | 470 | IF( nn_ice == 4 ) CALL cice_sbc_final |
---|
| 471 | ! |
---|
| 472 | END SUBROUTINE sbc_final |
---|
| 473 | |
---|
[888] | 474 | !!====================================================================== |
---|
| 475 | END MODULE sbcmod |
---|